runner.d.ts 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /// <reference types="node" />
  2. /// <reference types="q" />
  3. import { EventEmitter } from 'events';
  4. import * as q from 'q';
  5. import { promise as wdpromise } from 'selenium-webdriver';
  6. import { ProtractorBrowser } from './browser';
  7. import { Config } from './config';
  8. import { DriverProvider } from './driverProviders';
  9. import { Plugins } from './plugins';
  10. export declare class Runner extends EventEmitter {
  11. config_: Config;
  12. preparer_: any;
  13. driverprovider_: DriverProvider;
  14. o: any;
  15. plugins_: Plugins;
  16. restartPromise: q.Promise<any>;
  17. frameworkUsesAfterEach: boolean;
  18. ready_?: wdpromise.Promise<void>;
  19. constructor(config: Config);
  20. /**
  21. * Registrar for testPreparers - executed right before tests run.
  22. * @public
  23. * @param {string/Fn} filenameOrFn
  24. */
  25. setTestPreparer(filenameOrFn: string | Function): void;
  26. /**
  27. * Executor of testPreparer
  28. * @public
  29. * @param {string[]=} An optional list of command line arguments the framework will accept.
  30. * @return {q.Promise} A promise that will resolve when the test preparers
  31. * are finished.
  32. */
  33. runTestPreparer(extraFlags?: string[]): q.Promise<any>;
  34. /**
  35. * Called after each test finishes.
  36. *
  37. * Responsible for `restartBrowserBetweenTests`
  38. *
  39. * @public
  40. * @return {q.Promise} A promise that will resolve when the work here is done
  41. */
  42. afterEach(): q.Promise<void>;
  43. /**
  44. * Grab driver provider based on type
  45. * @private
  46. *
  47. * Priority
  48. * 1) if directConnect is true, use that
  49. * 2) if seleniumAddress is given, use that
  50. * 3) if a Sauce Labs account is given, use that
  51. * 4) if a seleniumServerJar is specified, use that
  52. * 5) try to find the seleniumServerJar in protractor/selenium
  53. */
  54. loadDriverProvider_(config: Config): void;
  55. /**
  56. * Responsible for cleaning up test run and exiting the process.
  57. * @private
  58. * @param {int} Standard unix exit code
  59. */
  60. exit_: (exitCode: number) => any;
  61. /**
  62. * Getter for the Runner config object
  63. * @public
  64. * @return {Object} config
  65. */
  66. getConfig(): Config;
  67. /**
  68. * Get the control flow used by this runner.
  69. * @return {Object} WebDriver control flow.
  70. */
  71. controlFlow(): any;
  72. /**
  73. * Sets up convenience globals for test specs
  74. * @private
  75. */
  76. setupGlobals_(browser_: ProtractorBrowser): void;
  77. /**
  78. * Create a new driver from a driverProvider. Then set up a
  79. * new protractor instance using this driver.
  80. * This is used to set up the initial protractor instances and any
  81. * future ones.
  82. *
  83. * @param {Plugin} plugins The plugin functions
  84. * @param {ProtractorBrowser=} parentBrowser The browser which spawned this one
  85. *
  86. * @return {Protractor} a protractor instance.
  87. * @public
  88. */
  89. createBrowser(plugins: any, parentBrowser?: ProtractorBrowser): any;
  90. /**
  91. * Final cleanup on exiting the runner.
  92. *
  93. * @return {q.Promise} A promise which resolves on finish.
  94. * @private
  95. */
  96. shutdown_(): q.Promise<void>;
  97. /**
  98. * The primary workhorse interface. Kicks off the test running process.
  99. *
  100. * @return {q.Promise} A promise which resolves to the exit code of the tests.
  101. * @public
  102. */
  103. run(): q.Promise<any>;
  104. }