diff --git a/lib/command/definitions.js b/lib/command/definitions.js index 8a4a9bbca..20f0be26c 100644 --- a/lib/command/definitions.js +++ b/lib/command/definitions.js @@ -38,6 +38,46 @@ interface ILocator { ios?: string; } +declare class Helper { + /** Abstract method to provide required config options */ + static _config(): any; + /** Abstract method to validate config */ + _validateConfig(config: T): T; + /** Sets config for current test */ + _setConfig(opts: any): void; + /** Hook executed before all tests */ + _init(): void + /** Hook executed before each test. */ + _before(): void + /** Hook executed after each test */ + _after(): void + /** + * Hook provides a test details + * Executed in the very beginning of a test + */ + _test(test): void + /** Hook executed after each passed test */ + _passed(test: () => void): void + /** Hook executed after each failed test */ + _failed(test: () => void): void + /** Hook executed before each step */ + _beforeStep(step: () => void): void + /** Hook executed after each step */ + _afterStep(step: () => void): void + /** Hook executed before each suite */ + _beforeSuite(suite: () => void): void + /** Hook executed after each suite */ + _afterSuite(suite: () => void): void + /** Hook executed after all tests are executed */ + _finishTest(suite: () => void): void + /**Access another configured helper: `this.helpers['AnotherHelper']` */ + get helpers(): any + /** Print debug message to console (outputs only in debug mode) */ + debug(msg: string): void + + debugSection(section: string, msg: string): void +} + declare class Locator implements ILocator { xpath?: string; css?: string; @@ -64,8 +104,12 @@ declare class Locator implements ILocator { declare function actor(customSteps?: {}): CodeceptJS.{{I}}; declare function Feature(title: string, opts?: {}): FeatureConfig; -declare function Scenario(title: string, callback: ICodeceptCallback): ScenarioConfig; -declare function Scenario(title: string, opts: {}, callback: ICodeceptCallback): ScenarioConfig; +declare const Scenario: { + (title: string, callback: ICodeceptCallback): ScenarioConfig; + (title: string, opts: {}, callback: ICodeceptCallback): ScenarioConfig; + only(title: string, callback: ICodeceptCallback): ScenarioConfig; + only(title: string, opts: {}, callback: ICodeceptCallback): ScenarioConfig; +} declare function xScenario(title: string, callback: ICodeceptCallback): ScenarioConfig; declare function xScenario(title: string, opts: {}, callback: ICodeceptCallback): ScenarioConfig; declare function Data(data: any): any;