config.d.ts 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609
  1. import { PluginConfig } from './plugins';
  2. export interface Config {
  3. [key: string]: any;
  4. /**
  5. * The location of the standalone Selenium Server jar file, relative
  6. * to the location of webdriver-manager. If no other method of starting
  7. * Selenium Server is found, this will default to
  8. * node_modules/protractor/node_modules/webdriver-manager/selenium/<jar file>
  9. */
  10. seleniumServerJar?: string;
  11. /**
  12. * The timeout milliseconds waiting for a local standalone Selenium Server to start.
  13. *
  14. * default: 30000ms
  15. */
  16. seleniumServerStartTimeout?: number;
  17. /**
  18. * Can be an object which will be passed to the SeleniumServer class as args.
  19. * See a full list of options at
  20. * https://github.com/SeleniumHQ/selenium/blob/master/javascript/node/selenium-webdriver/remote/index.js
  21. * If you specify `args` or `port` in this object, it will overwrite the
  22. * values set via the deprecated config values `seleniumPort` and
  23. * `seleniumArgs`.
  24. */
  25. localSeleniumStandaloneOpts?: {
  26. /**
  27. * The port to start the Selenium Server on, or null if the server should
  28. * find its own unused port.
  29. */
  30. port?: any;
  31. /**
  32. * Additional command line options to pass to selenium. For example,
  33. * if you need to change the browser timeout, use
  34. * seleniumArgs: ['-browserTimeout=60']
  35. */
  36. args?: any;
  37. /**
  38. * Additional command line jvm options to pass to selenium. For example,
  39. * if you need to change the browser driver, use
  40. * jvmArgs: ['-Dwebdriver.ie.driver=IEDriverServer_Win32_2.53.1.exe']
  41. */
  42. jvmArgs?: string[];
  43. };
  44. /**
  45. * ChromeDriver location is used to help find the chromedriver binary. This will be passed to the
  46. * Selenium jar as the system property webdriver.chrome.driver. If the value is not set when
  47. * launching locally, it will use the default values downloaded from webdriver-manager.
  48. *
  49. * example:
  50. * chromeDriver: './node_modules/webdriver-manager/selenium/chromedriver_2.20'
  51. */
  52. chromeDriver?: string;
  53. /**
  54. * geckoDriver location is used to help find the gecko binary. This will be passed to the Selenium
  55. * jar as the system property webdriver.gecko.driver. If the value is not set when launching
  56. * locally, it will use the default values downloaded from webdriver-manager.
  57. */
  58. geckoDriver?: string;
  59. /**
  60. * The address of a running Selenium Server. If specified, Protractor will
  61. * connect to an already running instance of Selenium. This usually looks like
  62. * seleniumAddress: 'http://localhost:4444/wd/hub'
  63. */
  64. seleniumAddress?: string;
  65. /**
  66. * The selenium session id allows Protractor to attach to an existing selenium
  67. * browser session. The selenium session is maintained after the test has
  68. * completed. Ignored if seleniumAddress is null.
  69. */
  70. seleniumSessionId?: string;
  71. /**
  72. * The address of a proxy server to use for communicating to Sauce Labs rest APIs via the
  73. * saucelabs node module. For example, the Sauce Labs Proxy can be setup with: sauceProxy:
  74. * 'http://localhost:3128'
  75. */
  76. sauceProxy?: string;
  77. /**
  78. * The proxy address that browser traffic will go through which is tied to the browser session.
  79. */
  80. webDriverProxy?: string;
  81. /**
  82. * If specified, connect to webdriver through a proxy that manages client-side
  83. * synchronization. Blocking Proxy is an experimental feature and may change
  84. * without notice.
  85. */
  86. useBlockingProxy?: boolean;
  87. /**
  88. * If specified, Protractor will connect to the Blocking Proxy at the given
  89. * url instead of starting it's own.
  90. */
  91. blockingProxyUrl?: string;
  92. /**
  93. * If the sauceUser and sauceKey are specified, seleniumServerJar will be
  94. * ignored. The tests will be run remotely using Sauce Labs.
  95. */
  96. sauceUser?: string;
  97. /**
  98. * If the sauceUser and sauceKey are specified, seleniumServerJar will be
  99. * ignored. The tests will be run remotely using Sauce Labs.
  100. */
  101. sauceKey?: string;
  102. /**
  103. * Use sauceAgent if you need custom HTTP agent to connect to saucelabs.com.
  104. * This is needed if your computer is behind a corporate proxy.
  105. *
  106. * To match sauce agent implementation, use
  107. * [HttpProxyAgent](https://github.com/TooTallNate/node-http-proxy-agent)
  108. * to generate the agent or use webDriverProxy as an alternative. If a
  109. * webDriverProxy is provided, the sauceAgent will be overridden.
  110. */
  111. sauceAgent?: any;
  112. /**
  113. * Use sauceBuild if you want to group test capabilites by a build ID
  114. */
  115. sauceBuild?: string;
  116. /**
  117. * If true, Protractor will use http:// protocol instead of https:// to
  118. * connect to Sauce Labs defined by sauceSeleniumAddress.
  119. *
  120. * default: false
  121. */
  122. sauceSeleniumUseHttp?: boolean;
  123. /**
  124. * Use sauceSeleniumAddress if you need to customize the URL Protractor
  125. * uses to connect to sauce labs (for example, if you are tunneling selenium
  126. * traffic through a sauce connect tunnel). Default is
  127. * ondemand.saucelabs.com:80/wd/hub
  128. */
  129. sauceSeleniumAddress?: string;
  130. /**
  131. * If testobjectUser and testobjectKey are specified, kobitonUser, kobitonKey, browserstackUser,
  132. * browserStackKey and seleniumServerJar will be ignored. The tests will be run remotely using
  133. * TestObject.
  134. */
  135. testobjectUser?: string;
  136. /**
  137. * If testobjectUser and testobjectKey are specified, kobitonUser, kobitonKey, browserStackUser,
  138. * browserStackKey and seleniumServerJar will be ignored. The tests will be run remotely using
  139. * TestObject.
  140. */
  141. testobjectKey?: string;
  142. /**
  143. * If kobitonUser and kobitonKey are specified, testobjectUser, testojbectKey, browserstackUser,
  144. * browserStackKey and seleniumServerJar will be ignored. The tests will be run remotely using
  145. * TestObject.
  146. */
  147. kobitonUser?: string;
  148. /**
  149. * If kobitonUser and kobitonKey are specified, testobjectUser, testojbectKey, browserStackUser,
  150. * browserStackKey and seleniumServerJar will be ignored. The tests will be run remotely using
  151. * TestObject.
  152. */
  153. kobitonKey?: string;
  154. /**
  155. * If browserstackUser and browserstackKey are specified, seleniumServerJar
  156. * will be ignored. The tests will be run remotely using BrowserStack.
  157. */
  158. browserstackUser?: string;
  159. /**
  160. * If browserstackUser and browserstackKey are specified, seleniumServerJar
  161. * will be ignored. The tests will be run remotely using BrowserStack.
  162. */
  163. browserstackKey?: string;
  164. /**
  165. * Proxy server to be used for connecting to BrowserStack APIs
  166. * e.g. "http://proxy.example.com:1234".
  167. * This should be used when you are behind a proxy server.
  168. */
  169. browserstackProxy?: string;
  170. /**
  171. * If true, Protractor will connect directly to the browser Drivers
  172. * at the locations specified by chromeDriver and firefoxPath. Only Chrome
  173. * and Firefox are supported for direct connect.
  174. *
  175. * default: false
  176. */
  177. directConnect?: boolean;
  178. /**
  179. * Path to the firefox application binary. If null, will attempt to find
  180. * firefox in the default locations.
  181. */
  182. firefoxPath?: string;
  183. /**
  184. * Use default globals: 'protractor', 'browser', '$', '$$', 'element', 'by'.
  185. * These also exist as properties of the protractor namespace:
  186. * 'protractor.browser', 'protractor.$', 'protractor.$$',
  187. * 'protractor.element', 'protractor.by', and 'protractor.By'.
  188. *
  189. * When no globals is set to true, the only available global variable will be
  190. * 'protractor'.
  191. */
  192. noGlobals?: boolean;
  193. /**
  194. * Required. Spec patterns are relative to the location of this config.
  195. *
  196. * Example:
  197. * specs: [
  198. * 'spec/*_spec.js'
  199. * ]
  200. */
  201. specs?: Array<string>;
  202. /**
  203. * Patterns to exclude specs.
  204. */
  205. exclude?: Array<string> | string;
  206. /**
  207. * Alternatively, suites may be used. When run without a command line
  208. * parameter, all suites will run. If run with --suite=smoke or
  209. * --suite=smoke,full only the patterns matched by the specified suites will
  210. * run.
  211. *
  212. * Example:
  213. * suites: {
  214. * smoke: 'spec/smoketests/*.js',
  215. * full: 'spec/*.js'
  216. * }
  217. */
  218. suites?: any;
  219. /**
  220. * If you would like protractor to use a specific suite by default instead of
  221. * all suites, you can put that in the config file as well.
  222. */
  223. suite?: string;
  224. /**
  225. * Protractor can launch your tests on one or more browsers. If you are
  226. * testing on a single browser, use the capabilities option. If you are
  227. * testing on multiple browsers, use the multiCapabilities array.
  228. *
  229. * For a list of available capabilities, see
  230. * https://github.com/SeleniumHQ/selenium/wiki/DesiredCapabilities
  231. * In addition, you may specify count, shardTestFiles, and maxInstances.
  232. *
  233. * Example:
  234. * capabilities: {
  235. * browserName: 'chrome',
  236. * name: 'Unnamed Job',
  237. * logName: 'Chrome - English',
  238. * count: 1,
  239. * shardTestFiles: false,
  240. * maxInstances: 1,
  241. * specs: ['spec/chromeOnlySpec.js'],
  242. * exclude: ['spec/doNotRunInChromeSpec.js'],
  243. * seleniumAddress: 'http://localhost:4444/wd/hub'
  244. * }
  245. */
  246. capabilities?: {
  247. [key: string]: any;
  248. browserName?: string;
  249. /**
  250. * Name of the process executing this capability. Not used directly by
  251. * protractor or the browser, but instead pass directly to third parties
  252. * like BrowserStack and SauceLabs as the name of the job running this
  253. * test
  254. */
  255. name?: string;
  256. /**
  257. * User defined name for the capability that will display in the results
  258. * log. Defaults to the browser name
  259. */
  260. logName?: string;
  261. /**
  262. * Number of times to run this set of capabilities (in parallel, unless
  263. * limited by maxSessions). Default is 1.
  264. */
  265. count?: number;
  266. /**
  267. * If this is set to be true, specs will be sharded by file (i.e. all
  268. * files to be run by this set of capabilities will run in parallel).
  269. * Default is false.
  270. */
  271. shardTestFiles?: boolean;
  272. /**
  273. * Maximum number of browser instances that can run in parallel for this
  274. * set of capabilities. This is only needed if shardTestFiles is true.
  275. * Default is 1.
  276. */
  277. maxInstances?: number;
  278. /**
  279. * Additional spec files to be run on this capability only.
  280. */
  281. specs?: string[];
  282. /**
  283. * Spec files to be excluded on this capability only.
  284. */
  285. exclude?: string[];
  286. /**
  287. * Optional: override global seleniumAddress on this capability only.
  288. */
  289. seleniumAddress?: string;
  290. };
  291. /**
  292. * If you would like to run more than one instance of WebDriver on the same
  293. * tests, use multiCapabilities, which takes an array of capabilities.
  294. * If this is specified, capabilities will be ignored.
  295. */
  296. multiCapabilities?: Array<any>;
  297. /**
  298. * If you need to resolve multiCapabilities asynchronously (i.e. wait for
  299. * server/proxy, set firefox profile, etc), you can specify a function here
  300. * which will return either `multiCapabilities` or a promise to
  301. * `multiCapabilities`.
  302. *
  303. * If this returns a promise, it is resolved immediately after
  304. * `beforeLaunch` is run, and before any driver is set up. If this is
  305. * specified, both capabilities and multiCapabilities will be ignored.
  306. */
  307. getMultiCapabilities?: any;
  308. /**
  309. * Maximum number of total browser sessions to run. Tests are queued in
  310. * sequence if number of browser sessions is limited by this parameter.
  311. * Use a number less than 1 to denote unlimited. Default is unlimited.
  312. */
  313. maxSessions?: number;
  314. /**
  315. * Whether or not to buffer output when running tests on multiple browsers
  316. * in parallel. By default, when running multiple browser sessions, the
  317. * results are buffered and not logged until the test run finishes. If true,
  318. * when running multiple sessions in parallel results will be logged when
  319. * each test finishes.
  320. */
  321. verboseMultiSessions?: boolean;
  322. /**
  323. * A base URL for your application under test. Calls to protractor.get()
  324. * with relative paths will be resolved against this URL (via url.resolve)
  325. */
  326. baseUrl?: string;
  327. /**
  328. * A CSS Selector for a DOM element within your Angular application.
  329. * Protractor will attempt to automatically find your application, but it is
  330. * necessary to set rootElement in certain cases.
  331. *
  332. * In Angular 1, Protractor will use the element your app bootstrapped to by
  333. * default. If that doesn't work, it will then search for hooks in `body` or
  334. * `ng-app` elements (details here: https://git.io/v1b2r).
  335. *
  336. * In later versions of Angular, Protractor will try to hook into all angular
  337. * apps on the page. Use rootElement to limit the scope of which apps
  338. * Protractor waits for and searches within.
  339. */
  340. rootElement?: string;
  341. /**
  342. * The timeout in milliseconds for each script run on the browser. This
  343. * should be longer than the maximum time your application needs to
  344. * stabilize between tasks.
  345. */
  346. allScriptsTimeout?: number;
  347. /**
  348. * How long to wait for a page to load.
  349. */
  350. getPageTimeout?: number;
  351. /**
  352. * A callback function called once configs are read but before any
  353. * environment setup. This will only run once, and before onPrepare.
  354. *
  355. * You can specify a file containing code to run by setting beforeLaunch to
  356. * the filename string.
  357. *
  358. * At this point, global variable 'protractor' object will NOT be set up,
  359. * and globals from the test framework will NOT be available. The main
  360. * purpose of this function should be to bring up test dependencies.
  361. */
  362. beforeLaunch?: () => void;
  363. /**
  364. * A callback function called once protractor is ready and available, and
  365. * before the specs are executed. If multiple capabilities are being run,
  366. * this will run once per capability.
  367. *
  368. * You can specify a file containing code to run by setting onPrepare to
  369. * the filename string. onPrepare can optionally return a promise, which
  370. * Protractor will wait for before continuing execution. This can be used if
  371. * the preparation involves any asynchronous calls, e.g. interacting with
  372. * the browser. Otherwise Protractor cannot guarantee order of execution
  373. * and may start the tests before preparation finishes.
  374. *
  375. * At this point, global variable 'protractor' object will be set up, and
  376. * globals from the test framework will be available. For example, if you
  377. * are using Jasmine, you can add a reporter with:
  378. *
  379. * jasmine.getEnv().addReporter(new jasmine.JUnitXmlReporter(
  380. * 'outputdir/', true, true));
  381. *
  382. * If you need access back to the current configuration object,
  383. * use a pattern like the following:
  384. *
  385. * return browser.getProcessedConfig().then(function(config) {
  386. * // config.capabilities is the CURRENT capability being run, if
  387. * // you are using multiCapabilities.
  388. * console.log('Executing capability', config.capabilities);
  389. * });
  390. */
  391. onPrepare?: () => void;
  392. /**
  393. * A callback function called once tests are finished. onComplete can
  394. * optionally return a promise, which Protractor will wait for before
  395. * shutting down webdriver.
  396. *
  397. * At this point, tests will be done but global objects will still be
  398. * available.
  399. */
  400. onComplete?: () => void;
  401. /**
  402. * A callback function called once the tests have finished running and
  403. * the WebDriver instance has been shut down. It is passed the exit code
  404. * (0 if the tests passed). This is called once per capability.
  405. */
  406. onCleanUp?: (exitCode: number) => void;
  407. /**
  408. * A callback function called once all tests have finished running and
  409. * the WebDriver instance has been shut down. It is passed the exit code
  410. * (0 if the tests passed). afterLaunch must return a promise if you want
  411. * asynchronous code to be executed before the program exits.
  412. * This is called only once before the program exits (after onCleanUp).
  413. */
  414. afterLaunch?: (exitCode: number) => void;
  415. /**
  416. * The params object will be passed directly to the Protractor instance,
  417. * and can be accessed from your test as browser.params. It is an arbitrary
  418. * object and can contain anything you may need in your test.
  419. * This can be changed via the command line as:
  420. * --params.login.user "Joe"
  421. *
  422. * Example:
  423. * params: {
  424. * login: {
  425. * user: 'Jane',
  426. * password: '1234'
  427. * }
  428. * }
  429. */
  430. params?: any;
  431. /**
  432. * If set, protractor will save the test output in json format at this path.
  433. * The path is relative to the location of this config.
  434. */
  435. resultJsonOutputFile?: any;
  436. /**
  437. * If true, protractor will restart the browser between each test. Default
  438. * value is false.
  439. *
  440. * CAUTION: This will cause your tests to slow down drastically.
  441. */
  442. restartBrowserBetweenTests?: boolean;
  443. /**
  444. * Protractor will track outstanding $timeouts by default, and report them
  445. * in the error message if Protractor fails to synchronize with Angular in
  446. * time. In order to do this Protractor needs to decorate $timeout.
  447. *
  448. * CAUTION: If your app decorates $timeout, you must turn on this flag. This
  449. * is false by default.
  450. */
  451. untrackOutstandingTimeouts?: boolean;
  452. /**
  453. * If set, Protractor will ignore uncaught exceptions instead of exiting
  454. * without an error code. The exceptions will still be logged as warnings.
  455. */
  456. ignoreUncaughtExceptions?: boolean;
  457. /**
  458. * If set, will create a log file in the given directory with a readable log of
  459. * the webdriver commands it executes.
  460. *
  461. * This is an experimental feature. Enabling this will also turn on Blocking Proxy
  462. * synchronization, which is also experimental.
  463. */
  464. webDriverLogDir?: string;
  465. /**
  466. * If set, Protractor will pause the specified amount of time (in milliseconds)
  467. * before interactions with browser elements (ie, sending keys, clicking). It will
  468. * also highlight the element it's about to interact with.
  469. *
  470. * This is an experimental feature. Enabling this will also turn on Blocking Proxy
  471. * synchronization, which is also experimental.
  472. */
  473. highlightDelay?: number;
  474. /**
  475. * Protractor log level
  476. *
  477. * default: INFO
  478. */
  479. logLevel?: 'ERROR' | 'WARN' | 'INFO' | 'DEBUG';
  480. /**
  481. * Test framework to use. This may be one of: jasmine, mocha or custom.
  482. * Default value is 'jasmine'
  483. *
  484. * When the framework is set to "custom" you'll need to additionally
  485. * set frameworkPath with the path relative to the config file or absolute:
  486. *
  487. * framework: 'custom',
  488. * frameworkPath: './frameworks/my_custom_jasmine.js',
  489. *
  490. * See github.com/angular/protractor/blob/master/lib/frameworks/README.md
  491. * to comply with the interface details of your custom implementation.
  492. *
  493. * Jasmine is fully supported as test and assertion frameworks.
  494. * Mocha has limited support. You will need to include your
  495. * own assertion framework (such as Chai) if working with Mocha.
  496. */
  497. framework?: string;
  498. /**
  499. * Options to be passed to jasmine.
  500. *
  501. * See https://github.com/jasmine/jasmine-npm/blob/master/lib/jasmine.js
  502. * for the exact options available.
  503. */
  504. jasmineNodeOpts?: {
  505. [key: string]: any;
  506. /**
  507. * If true, print colors to the terminal.
  508. */
  509. showColors?: boolean;
  510. /**
  511. * Default time to wait in ms before a test fails.
  512. */
  513. defaultTimeoutInterval?: number;
  514. /**
  515. * Function called to print jasmine results.
  516. */
  517. print?: () => void;
  518. /**
  519. * If set, only execute specs whose names match the pattern, which is
  520. * internally compiled to a RegExp.
  521. */
  522. grep?: string;
  523. /**
  524. * Inverts 'grep' matches
  525. */
  526. invertGrep?: boolean;
  527. /**
  528. * If true, run specs in semi-random order
  529. */
  530. random?: boolean;
  531. /**
  532. * Set the randomization seed if randomization is turned on
  533. */
  534. seed?: string;
  535. };
  536. /**
  537. * Options to be passed to Mocha.
  538. *
  539. * See the full list at http://mochajs.org/
  540. */
  541. mochaOpts?: {
  542. [key: string]: any;
  543. ui?: string;
  544. reporter?: string;
  545. };
  546. /**
  547. * See docs/plugins.md
  548. */
  549. plugins?: PluginConfig[];
  550. /**
  551. * Turns off source map support. Stops protractor from registering global
  552. * variable `source-map-support`. Defaults to `false`
  553. */
  554. skipSourceMapSupport?: boolean;
  555. /**
  556. * Turns off WebDriver's environment variables overrides to ignore any
  557. * environment variable and to only use the configuration in this file.
  558. * Defaults to `false`
  559. */
  560. disableEnvironmentOverrides?: boolean;
  561. /**
  562. * Tells Protractor to interpret any angular apps it comes across as hybrid
  563. * angular1/angular2 apps (i.e. apps using ngUpgrade)
  564. * Defaults to `false`
  565. *
  566. * @type {boolean}
  567. */
  568. ng12Hybrid?: boolean;
  569. /**
  570. * Protractor will exit with an error if it sees any command line flags it doesn't
  571. * recognize. Set disableChecks true to disable this check.
  572. */
  573. disableChecks?: boolean;
  574. /**
  575. * Enable/disable the WebDriver Control Flow.
  576. *
  577. * WebDriverJS (and by extention, Protractor) uses a Control Flow to manage the order in which
  578. * commands are executed and promises are resolved (see docs/control-flow.md for details).
  579. * However, as syntax like `async`/`await` are being introduced, WebDriverJS has decided to
  580. * deprecate the control flow, and have users manage the asynchronous activity themselves
  581. * (details here: https://github.com/SeleniumHQ/selenium/issues/2969).
  582. *
  583. * At the moment, the WebDriver Control Flow is still enabled by default. You can disable it by
  584. * setting the environment variable `SELENIUM_PROMISE_MANAGER` to `0`. In a webdriver release in
  585. * Q4 2017, the Control Flow will be disabled by default, but you will be able to re-enable it by
  586. * setting `SELENIUM_PROMISE_MANAGER` to `1`. At a later point, the control flow will be removed
  587. * for good.
  588. *
  589. * If you don't like managing environment variables, you can set this option in your config file,
  590. * and Protractor will handle enabling/disabling the control flow for you. Setting this option
  591. * is higher priority than the `SELENIUM_PROMISE_MANAGER` environment variable.
  592. *
  593. * @type {boolean=}
  594. */
  595. SELENIUM_PROMISE_MANAGER?: boolean;
  596. seleniumArgs?: any[];
  597. jvmArgs?: string[];
  598. configDir?: string;
  599. troubleshoot?: boolean;
  600. seleniumPort?: number;
  601. mockSelenium?: boolean;
  602. v8Debug?: any;
  603. nodeDebug?: boolean;
  604. debuggerServerPort?: number;
  605. frameworkPath?: string;
  606. elementExplorer?: any;
  607. debug?: boolean;
  608. unknownFlags_?: string[];
  609. }