diff --git a/lib/plugins.ts b/lib/plugins.ts index eca057a61..472cc001f 100644 --- a/lib/plugins.ts +++ b/lib/plugins.ts @@ -30,11 +30,11 @@ export interface ProtractorPlugin { * @throws {*} If this function throws an error, a failed assertion is added to * the test results. * - * @return {Q.Promise=} Can return a promise, in which case protractor will wait + * @return {Promise=} Can return a promise, in which case protractor will wait * for the promise to resolve before continuing. If the promise is * rejected, a failed assertion is added to the test results. */ - setup?: () => q.Promise; + setup?(): void|Promise; /** * This is called before the test have been run but after the test framework has @@ -46,11 +46,11 @@ export interface ProtractorPlugin { * @throws {*} If this function throws an error, a failed assertion is added to * the test results. * - * @return {Q.Promise=} Can return a promise, in which case protractor will wait + * @return {Promise=} Can return a promise, in which case protractor will wait * for the promise to resolve before continuing. If the promise is * rejected, a failed assertion is added to the test results. */ - onPrepare?: () => q.Promise; + onPrepare?(): void|Promise; /** * This is called after the tests have been run, but before the WebDriver @@ -61,11 +61,11 @@ export interface ProtractorPlugin { * @throws {*} If this function throws an error, a failed assertion is added to * the test results. * - * @return {Q.Promise=} Can return a promise, in which case protractor will wait + * @return {Promise=} Can return a promise, in which case protractor will wait * for the promise to resolve before continuing. If the promise is * rejected, a failed assertion is added to the test results. */ - teardown?: () => q.Promise; + teardown?(): void|Promise; /** * Called after the test results have been finalized and any jobs have been @@ -75,11 +75,11 @@ export interface ProtractorPlugin { * * @throws {*} If this function throws an error, it is outputted to the console * - * @return {Q.Promise=} Can return a promise, in which case protractor will wait + * @return {Promise=} Can return a promise, in which case protractor will wait * for the promise to resolve before continuing. If the promise is * rejected, an error is logged to the console. */ - postResults?: () => q.Promise; + postResults?(): void|Promise; /** * Called after each test block (in Jasmine, this means an `it` block) @@ -93,12 +93,12 @@ export interface ProtractorPlugin { * @throws {*} If this function throws an error, a failed assertion is added to * the test results. * - * @return {Q.Promise=} Can return a promise, in which case protractor will wait + * @return {Promise=} Can return a promise, in which case protractor will wait * for the promise to resolve before outputting test results. Protractor * will *not* wait before executing the next test, however. If the promise * is rejected, a failed assertion is added to the test results. */ - postTest?: (passed: boolean, testInfo: any) => q.Promise; + postTest?(passed: boolean, testInfo: any): void|Promise; /** * This is called inside browser.get() directly after the page loads, and before @@ -109,11 +109,11 @@ export interface ProtractorPlugin { * @throws {*} If this function throws an error, a failed assertion is added to * the test results. * - * @return {Q.Promise=} Can return a promise, in which case protractor will wait - * for the promise to resolve before continuing. If the promise is - * rejected, a failed assertion is added to the test results. + * @return {webdriver.promise.Promise=} Can return a promise, in which case + * protractor will wait for the promise to resolve before continuing. If + * the promise is rejected, a failed assertion is added to the test results. */ - onPageLoad?: () => q.Promise; + onPageLoad?(): void|webdriver.promise.Promise; /** * This is called inside browser.get() directly after angular is done @@ -125,11 +125,11 @@ export interface ProtractorPlugin { * @throws {*} If this function throws an error, a failed assertion is added to * the test results. * - * @return {Q.Promise=} Can return a promise, in which case protractor will wait - * for the promise to resolve before continuing. If the promise is - * rejected, a failed assertion is added to the test results. + * @return {webdriver.promise.Promise=} Can return a promise, in which case + * protractor will wait for the promise to resolve before continuing. If + * the promise is rejected, a failed assertion is added to the test results. */ - onPageStable?: () => q.Promise; + onPageStable?(): void|webdriver.promise.Promise; /** * Between every webdriver action, Protractor calls browser.waitForAngular() to @@ -142,33 +142,34 @@ export interface ProtractorPlugin { * @throws {*} If this function throws an error, a failed assertion is added to * the test results. * - * @return {Q.Promise=} Can return a promise, in which case protractor will wait - * for the promise to resolve before continuing. If the promise is - * rejected, a failed assertion is added to the test results, and protractor - * will continue onto the next command. If nothing is returned or something - * other than a promise is returned, protractor will continue onto the next - * command. + * @return {webdriver.promise.Promise=} Can return a promise, in which case + * protractor will wait for the promise to resolve before continuing. If the + * promise is rejected, a failed assertion is added to the test results, and + * protractor will continue onto the next command. If nothing is returned or + * something other than a promise is returned, protractor will continue + * onto the next command. */ - waitForPromise?: () => q.Promise; + waitForPromise?(): webdriver.promise.Promise; /** * Between every webdriver action, Protractor calls browser.waitForAngular() to * make sure that Angular has no outstanding $http or $timeout calls. * You can use waitForCondition() to have Protractor additionally wait for your - * custom condition to be truthy. + * custom condition to be truthy. If specified, this function will be called + * repeatedly until truthy. * * @this {Object} bound to module.exports * * @throws {*} If this function throws an error, a failed assertion is added to * the test results. * - * @return {Q.Promise|boolean} If truthy, Protractor will continue onto - * the next command. If falsy, webdriver will continuously re-run this - * function until it is truthy. If a rejected promise is returned, a failed - * assertion is added to the test results, and protractor will continue onto - * the next command. + * @return {webdriver.promise.Promise|boolean} If truthy, Protractor + * will continue onto the next command. If falsy, webdriver will + * continuously re-run this function until it is truthy. If a rejected promise + * is returned, a failed assertion is added to the test results, and Protractor + * will continue onto the next command. */ - waitForCondition?: () => q.Promise; + waitForCondition?(): webdriver.promise.Promise|boolean; /** * Used to turn off default checks for angular stability @@ -222,7 +223,7 @@ export interface ProtractorPlugin { * * @throws {Error} Throws an error if called after results have been reported */ - addFailure?: (message?: string, info?: {specName?: string, stackTrace?: string}) => void; + addFailure?(message?: string, info?: {specName?: string, stackTrace?: string}): void; /** * Adds a passed assertion to the test's results. Note: this is added by the @@ -235,7 +236,7 @@ export interface ProtractorPlugin { * * @throws {Error} Throws an error if called after results have been reported */ - addSuccess?: (info?: {specName?: string}) => void; + addSuccess?(info?: {specName?: string}): void; /** * Warns the user that something is problematic. Note: this is added by the @@ -247,7 +248,7 @@ export interface ProtractorPlugin { * Defaults to `PLUGIN_NAME + ' Plugin Tests'`. * Defaults to `{}`. */ - addWarning?: (message?: string, info?: {specName?: string}) => void; + addWarning?(message?: string, info?: {specName?: string}): void; } /**