codeceptjs 3.5.4-beta.1 → 3.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/CHANGELOG.md +368 -0
  2. package/README.md +0 -2
  3. package/docs/build/Appium.js +48 -7
  4. package/docs/build/GraphQL.js +25 -0
  5. package/docs/build/Nightmare.js +15 -6
  6. package/docs/build/Playwright.js +436 -197
  7. package/docs/build/Protractor.js +17 -8
  8. package/docs/build/Puppeteer.js +37 -20
  9. package/docs/build/TestCafe.js +19 -10
  10. package/docs/build/WebDriver.js +45 -37
  11. package/docs/changelog.md +375 -0
  12. package/docs/community-helpers.md +8 -4
  13. package/docs/examples.md +8 -2
  14. package/docs/helpers/Appium.md +39 -2
  15. package/docs/helpers/GraphQL.md +21 -0
  16. package/docs/helpers/Nightmare.md +1260 -0
  17. package/docs/helpers/Playwright.md +223 -119
  18. package/docs/helpers/Protractor.md +1711 -0
  19. package/docs/helpers/Puppeteer.md +31 -29
  20. package/docs/helpers/TestCafe.md +18 -17
  21. package/docs/helpers/WebDriver.md +34 -32
  22. package/docs/playwright.md +24 -1
  23. package/docs/webapi/dontSeeInField.mustache +1 -1
  24. package/docs/webapi/executeAsyncScript.mustache +2 -0
  25. package/docs/webapi/executeScript.mustache +2 -0
  26. package/docs/webapi/seeInField.mustache +1 -1
  27. package/docs/wiki/Books-&-Posts.md +0 -0
  28. package/docs/wiki/Community-Helpers-&-Plugins.md +8 -4
  29. package/docs/wiki/Converting-Playwright-to-Istanbul-Coverage.md +46 -14
  30. package/docs/wiki/Examples.md +8 -2
  31. package/docs/wiki/Google-Summer-of-Code-(GSoC)-2020.md +0 -0
  32. package/docs/wiki/Home.md +0 -0
  33. package/docs/wiki/Migration-to-Appium-v2---CodeceptJS.md +83 -0
  34. package/docs/wiki/Release-Process.md +0 -0
  35. package/docs/wiki/Roadmap.md +0 -0
  36. package/docs/wiki/Tests.md +0 -0
  37. package/docs/wiki/Upgrading-to-CodeceptJS-3.md +0 -0
  38. package/docs/wiki/Videos.md +0 -0
  39. package/lib/codecept.js +1 -0
  40. package/lib/command/definitions.js +2 -7
  41. package/lib/command/init.js +40 -4
  42. package/lib/command/run-multiple/collection.js +17 -5
  43. package/lib/command/run-workers.js +4 -0
  44. package/lib/command/run.js +6 -0
  45. package/lib/helper/Appium.js +46 -5
  46. package/lib/helper/GraphQL.js +25 -0
  47. package/lib/helper/Nightmare.js +1415 -0
  48. package/lib/helper/Playwright.js +336 -62
  49. package/lib/helper/Protractor.js +1837 -0
  50. package/lib/helper/Puppeteer.js +31 -18
  51. package/lib/helper/TestCafe.js +15 -8
  52. package/lib/helper/WebDriver.js +39 -35
  53. package/lib/helper/clientscripts/nightmare.js +213 -0
  54. package/lib/helper/errors/ElementNotFound.js +2 -1
  55. package/lib/helper/scripts/highlightElement.js +1 -1
  56. package/lib/interfaces/bdd.js +1 -1
  57. package/lib/mochaFactory.js +2 -1
  58. package/lib/pause.js +6 -4
  59. package/lib/plugin/heal.js +2 -3
  60. package/lib/plugin/selenoid.js +6 -1
  61. package/lib/step.js +27 -10
  62. package/lib/utils.js +4 -0
  63. package/lib/workers.js +3 -1
  64. package/package.json +87 -87
  65. package/typings/promiseBasedTypes.d.ts +163 -126
  66. package/typings/types.d.ts +183 -144
  67. package/docs/build/Polly.js +0 -42
  68. package/docs/build/SeleniumWebdriver.js +0 -76
@@ -841,7 +841,7 @@ declare namespace CodeceptJS {
841
841
  * @param value - value to check.
842
842
  * ⚠️ returns a _promise_ which is synchronized internally by recorder
843
843
  */
844
- dontSeeInField(field: CodeceptJS.LocatorOrString, value: string): void;
844
+ dontSeeInField(field: CodeceptJS.LocatorOrString, value: CodeceptJS.StringOrSecret): void;
845
845
  /**
846
846
  * Opposite to `see`. Checks that a text is not present on a page.
847
847
  * Use context parameter to narrow down the search.
@@ -1022,7 +1022,7 @@ declare namespace CodeceptJS {
1022
1022
  * @param value - value to check.
1023
1023
  * ⚠️ returns a _promise_ which is synchronized internally by recorder
1024
1024
  */
1025
- seeInField(field: CodeceptJS.LocatorOrString, value: string): void;
1025
+ seeInField(field: CodeceptJS.LocatorOrString, value: CodeceptJS.StringOrSecret): void;
1026
1026
  /**
1027
1027
  * Checks that a page contains a visible text.
1028
1028
  * Use context parameter to narrow down the search.
@@ -1298,6 +1298,21 @@ declare namespace CodeceptJS {
1298
1298
  * @returns Promise<any>
1299
1299
  */
1300
1300
  sendMutation(mutation: string, variables?: any, options?: any, headers?: any): any;
1301
+ /**
1302
+ * Sets request headers for all requests of this test
1303
+ * @param headers - headers list
1304
+ */
1305
+ haveRequestHeaders(headers: any): void;
1306
+ /**
1307
+ * Adds a header for Bearer authentication
1308
+ *
1309
+ * ```js
1310
+ * // we use secret function to hide token from logs
1311
+ * I.amBearerAuthenticated(secret('heregoestoken'))
1312
+ * ```
1313
+ * @param accessToken - Bearer access token
1314
+ */
1315
+ amBearerAuthenticated(accessToken: string | CodeceptJS.Secret): void;
1301
1316
  }
1302
1317
  /**
1303
1318
  * Helper for managing remote data using GraphQL queries.
@@ -2060,12 +2075,14 @@ declare namespace CodeceptJS {
2060
2075
  * ```
2061
2076
  * @param fn - function to be executed in browser context.
2062
2077
  * @param args - to be passed to function.
2078
+ * @returns script return value
2079
+ *
2063
2080
  * ⚠️ returns a _promise_ which is synchronized internally by recorder
2064
2081
  *
2065
2082
  *
2066
2083
  * Wrapper for synchronous [evaluate](https://github.com/segmentio/nightmare#evaluatefn-arg1-arg2)
2067
2084
  */
2068
- executeScript(fn: string | ((...params: any[]) => any), ...args: any[]): void;
2085
+ executeScript(fn: string | ((...params: any[]) => any), ...args: any[]): Promise<any>;
2069
2086
  /**
2070
2087
  * Executes async script on page.
2071
2088
  * Provided function should execute a passed callback (as first argument) to signal it is finished.
@@ -2089,13 +2106,15 @@ declare namespace CodeceptJS {
2089
2106
  * ```
2090
2107
  * @param fn - function to be executed in browser context.
2091
2108
  * @param args - to be passed to function.
2109
+ * @returns script return value
2110
+ *
2092
2111
  * ⚠️ returns a _promise_ which is synchronized internally by recorder
2093
2112
  *
2094
2113
  *
2095
2114
  * Wrapper for asynchronous [evaluate](https://github.com/segmentio/nightmare#evaluatefn-arg1-arg2).
2096
2115
  * Unlike NightmareJS implementation calling `done` will return its first argument.
2097
2116
  */
2098
- executeAsyncScript(fn: string | ((...params: any[]) => any), ...args: any[]): void;
2117
+ executeAsyncScript(fn: string | ((...params: any[]) => any), ...args: any[]): Promise<any>;
2099
2118
  /**
2100
2119
  * Resize the current window to provided width and height.
2101
2120
  * First parameter can be set to `maximize`.
@@ -2195,7 +2214,7 @@ declare namespace CodeceptJS {
2195
2214
  * @param value - value to check.
2196
2215
  * ⚠️ returns a _promise_ which is synchronized internally by recorder
2197
2216
  */
2198
- seeInField(field: CodeceptJS.LocatorOrString, value: string): void;
2217
+ seeInField(field: CodeceptJS.LocatorOrString, value: CodeceptJS.StringOrSecret): void;
2199
2218
  /**
2200
2219
  * Checks that value of input field or textarea doesn't equal to given value
2201
2220
  * Opposite to `seeInField`.
@@ -2208,7 +2227,7 @@ declare namespace CodeceptJS {
2208
2227
  * @param value - value to check.
2209
2228
  * ⚠️ returns a _promise_ which is synchronized internally by recorder
2210
2229
  */
2211
- dontSeeInField(field: CodeceptJS.LocatorOrString, value: string): void;
2230
+ dontSeeInField(field: CodeceptJS.LocatorOrString, value: CodeceptJS.StringOrSecret): void;
2212
2231
  /**
2213
2232
  * Sends [input event](http://electron.atom.io/docs/api/web-contents/#webcontentssendinputeventevent) on a page.
2214
2233
  * Can submit special keys like 'Enter', 'Backspace', etc
@@ -2742,7 +2761,7 @@ declare namespace CodeceptJS {
2742
2761
  * @property [keepBrowserState = false] - keep browser state between tests when `restart` is set to 'session'.
2743
2762
  * @property [keepCookies = false] - keep cookies between tests when `restart` is set to 'session'.
2744
2763
  * @property [waitForAction] - how long to wait after click, doubleClick or PressKey actions in ms. Default: 100.
2745
- * @property [waitForNavigation] - When to consider navigation succeeded. Possible options: `load`, `domcontentloaded`, `networkidle`. Choose one of those options is possible. See [Playwright API](https://playwright.dev/docs/api/class-page#page-wait-for-navigation).
2764
+ * @property [waitForNavigation] - When to consider navigation succeeded. Possible options: `load`, `domcontentloaded`, `commit`. Choose one of those options is possible. See [Playwright API](https://playwright.dev/docs/api/class-page#page-wait-for-url).
2746
2765
  * @property [pressKeyDelay = 10] - Delay between key presses in ms. Used when calling Playwrights page.type(...) in fillField/appendField
2747
2766
  * @property [getPageTimeout] - config option to set maximum navigation time in milliseconds.
2748
2767
  * @property [waitForTimeout] - default wait* timeout in ms. Default: 1000.
@@ -2759,7 +2778,7 @@ declare namespace CodeceptJS {
2759
2778
  * @property [ignoreLog] - An array with console message types that are not logged to debug log. Default value is `['warning', 'log']`. E.g. you can set `[]` to log all messages. See all possible [values](https://playwright.dev/docs/api/class-consolemessage#console-message-type).
2760
2779
  * @property [ignoreHTTPSErrors] - Allows access to untrustworthy pages, e.g. to a page with an expired certificate. Default value is `false`
2761
2780
  * @property [bypassCSP] - bypass Content Security Policy or CSP
2762
- * @property [highlightElement] - highlight the interacting elements
2781
+ * @property [highlightElement] - highlight the interacting elements. Default: false
2763
2782
  */
2764
2783
  type PlaywrightConfig = {
2765
2784
  url?: string;
@@ -2778,7 +2797,7 @@ declare namespace CodeceptJS {
2778
2797
  keepBrowserState?: boolean;
2779
2798
  keepCookies?: boolean;
2780
2799
  waitForAction?: number;
2781
- waitForNavigation?: 'load' | 'domcontentloaded' | 'networkidle';
2800
+ waitForNavigation?: 'load' | 'domcontentloaded' | 'commit';
2782
2801
  pressKeyDelay?: number;
2783
2802
  getPageTimeout?: number;
2784
2803
  waitForTimeout?: number;
@@ -2907,6 +2926,7 @@ declare namespace CodeceptJS {
2907
2926
  * url: "http://localhost",
2908
2927
  * show: true // headless mode not supported for extensions
2909
2928
  * chromium: {
2929
+ * // Note: due to this would launch persistent context, so to avoid the error when running tests with run-workers a timestamp would be appended to the defined folder name. For instance: playwright-tmp_1692715649511
2910
2930
  * userDataDir: '/tmp/playwright-tmp', // necessary to launch the browser in normal mode instead of incognito,
2911
2931
  * args: [
2912
2932
  * `--disable-extensions-except=${pathToExtension}`,
@@ -3309,7 +3329,16 @@ declare namespace CodeceptJS {
3309
3329
  */
3310
3330
  _locate(): void;
3311
3331
  /**
3312
- * Find a checkbox by providing human readable text:
3332
+ * Get the first element by different locator types, including strict locator
3333
+ * Should be used in custom helpers:
3334
+ *
3335
+ * ```js
3336
+ * const element = await this.helpers['Playwright']._locateElement({name: 'password'});
3337
+ * ```
3338
+ */
3339
+ _locateElement(): void;
3340
+ /**
3341
+ * Find a checkbox by providing human-readable text:
3313
3342
  * NOTE: Assumes the checkable element exists
3314
3343
  *
3315
3344
  * ```js
@@ -3318,7 +3347,7 @@ declare namespace CodeceptJS {
3318
3347
  */
3319
3348
  _locateCheckable(): void;
3320
3349
  /**
3321
- * Find a clickable element by providing human readable text:
3350
+ * Find a clickable element by providing human-readable text:
3322
3351
  *
3323
3352
  * ```js
3324
3353
  * this.helpers['Playwright']._locateClickable('Next page').then // ...
@@ -3326,7 +3355,7 @@ declare namespace CodeceptJS {
3326
3355
  */
3327
3356
  _locateClickable(): void;
3328
3357
  /**
3329
- * Find field elements by providing human readable text:
3358
+ * Find field elements by providing human-readable text:
3330
3359
  *
3331
3360
  * ```js
3332
3361
  * this.helpers['Playwright']._locateFields('Your email').then // ...
@@ -3811,7 +3840,7 @@ declare namespace CodeceptJS {
3811
3840
  * @param value - value to check.
3812
3841
  * ⚠️ returns a _promise_ which is synchronized internally by recorder
3813
3842
  */
3814
- seeInField(field: CodeceptJS.LocatorOrString, value: string): void;
3843
+ seeInField(field: CodeceptJS.LocatorOrString, value: CodeceptJS.StringOrSecret): void;
3815
3844
  /**
3816
3845
  * Checks that value of input field or textarea doesn't equal to given value
3817
3846
  * Opposite to `seeInField`.
@@ -3824,7 +3853,7 @@ declare namespace CodeceptJS {
3824
3853
  * @param value - value to check.
3825
3854
  * ⚠️ returns a _promise_ which is synchronized internally by recorder
3826
3855
  */
3827
- dontSeeInField(field: CodeceptJS.LocatorOrString, value: string): void;
3856
+ dontSeeInField(field: CodeceptJS.LocatorOrString, value: CodeceptJS.StringOrSecret): void;
3828
3857
  /**
3829
3858
  * Attaches a file to element located by label, name, CSS or XPath
3830
3859
  * Path to file is relative current codecept directory (where codecept.conf.ts or codecept.conf.js is located).
@@ -4516,11 +4545,18 @@ declare namespace CodeceptJS {
4516
4545
  */
4517
4546
  waitForFunction(fn: string | ((...params: any[]) => any), argsOrSec?: any[] | number, sec?: number): void;
4518
4547
  /**
4519
- * Waits for navigation to finish. By default takes configured `waitForNavigation` option.
4548
+ * Waits for navigation to finish. By default, it takes configured `waitForNavigation` option.
4520
4549
  *
4521
4550
  * See [Playwright's reference](https://playwright.dev/docs/api/class-page?_highlight=waitfornavi#pagewaitfornavigationoptions)
4522
4551
  */
4523
4552
  waitForNavigation(options: any): void;
4553
+ /**
4554
+ * Waits for page navigates to a new URL or reloads. By default, it takes configured `waitForNavigation` option.
4555
+ *
4556
+ * See [Playwright's reference](https://playwright.dev/docs/api/class-page#page-wait-for-url)
4557
+ * @param url - A glob pattern, regex pattern or predicate receiving URL to match while waiting for the navigation. Note that if the parameter is a string without wildcard characters, the method will wait for navigation to URL that is exactly equal to the string.
4558
+ */
4559
+ waitForURL(url: string | RegExp, options: any): void;
4524
4560
  /**
4525
4561
  * Waits for an element to become not attached to the DOM on a page (by default waits for 1sec).
4526
4562
  * Element can be located by CSS or XPath.
@@ -4603,20 +4639,27 @@ declare namespace CodeceptJS {
4603
4639
  */
4604
4640
  stopMockingRoute(url?: string | RegExp, handler?: (...params: any[]) => any): void;
4605
4641
  /**
4606
- * Starts recording of network traffic.
4642
+ * Starts recording the network traffics.
4607
4643
  * This also resets recorded network requests.
4608
4644
  *
4609
4645
  * ```js
4610
4646
  * I.startRecordingTraffic();
4611
4647
  * ```
4612
4648
  */
4613
- startRecordingTraffic(): Promise<void>;
4649
+ startRecordingTraffic(): void;
4614
4650
  /**
4615
4651
  * Grab the recording network traffics
4652
+ *
4653
+ * ```js
4654
+ * const traffics = await I.grabRecordedNetworkTraffics();
4655
+ * expect(traffics[0].url).to.equal('https://reqres.in/api/comments/1');
4656
+ * expect(traffics[0].response.status).to.equal(200);
4657
+ * expect(traffics[0].response.body).to.contain({ name: 'this was mocked' });
4658
+ * ```
4616
4659
  */
4617
- grabRecordedNetworkTraffics(): any[];
4660
+ grabRecordedNetworkTraffics(): Promise<any[]>;
4618
4661
  /**
4619
- * Blocks traffic for URL.
4662
+ * Blocks traffic of a given URL or a list of URLs.
4620
4663
  *
4621
4664
  * Examples:
4622
4665
  *
@@ -4626,9 +4669,13 @@ declare namespace CodeceptJS {
4626
4669
  * I.blockTraffic('http://example.com/**');
4627
4670
  * I.blockTraffic(/\.css$/);
4628
4671
  * ```
4629
- * @param url - URL to block . URL can contain * for wildcards. Example: https://www.example.com** to block all traffic for that domain. Regexp are also supported.
4672
+ *
4673
+ * ```js
4674
+ * I.blockTraffic(['http://example.com/css/style.css', 'http://example.com/css/*.css']);
4675
+ * ```
4676
+ * @param urls - URL or a list of URLs to block . URL can contain * for wildcards. Example: https://www.example.com** to block all traffic for that domain. Regexp are also supported.
4630
4677
  */
4631
- blockTraffic(url: any): void;
4678
+ blockTraffic(urls: string | any[] | RegExp): void;
4632
4679
  /**
4633
4680
  * Mocks traffic for URL(s).
4634
4681
  * This is a powerful feature to manipulate network traffic. Can be used e.g. to stabilize your tests, speed up your tests or as a last resort to make some test scenarios even possible.
@@ -4729,42 +4776,84 @@ declare namespace CodeceptJS {
4729
4776
  name: string;
4730
4777
  url: string | RegExp;
4731
4778
  }): void;
4732
- }
4733
- /**
4734
- * This helper works the same as MockRequest helper. It has been included for backwards compatibility
4735
- * reasons. So use MockRequest helper instead of this.
4736
- *
4737
- * Please refer to MockRequest helper documentation for details.
4738
- *
4739
- * ### Installations
4740
- *
4741
- * Requires [Polly.js](https://netflix.github.io/pollyjs/#/) library by Netflix installed
4742
- *
4743
- * ```
4744
- * npm i @pollyjs/core @pollyjs/adapter-puppeteer --save-dev
4745
- * ```
4746
- *
4747
- * Requires Puppeteer helper or WebDriver helper enabled
4748
- *
4749
- * ### Configuration
4750
- *
4751
- * Just enable helper in config file:
4752
- *
4753
- * ```js
4754
- * helpers: {
4755
- * Puppeteer: {
4756
- * // regular Puppeteer config here
4757
- * },
4758
- * Polly: {}
4759
- * }
4760
- * ```
4761
- * The same can be done when using WebDriver helper..
4762
- *
4763
- * ### Usage
4764
- *
4765
- * Use `I.mockRequest` to intercept and mock requests.
4766
- */
4767
- class Polly {
4779
+ /**
4780
+ * Starts recording of websocket messages.
4781
+ * This also resets recorded websocket messages.
4782
+ *
4783
+ * ```js
4784
+ * await I.startRecordingWebSocketMessages();
4785
+ * ```
4786
+ */
4787
+ startRecordingWebSocketMessages(): void;
4788
+ /**
4789
+ * Stops recording WS messages. Recorded WS messages is not flashed.
4790
+ *
4791
+ * ```js
4792
+ * await I.stopRecordingWebSocketMessages();
4793
+ * ```
4794
+ */
4795
+ stopRecordingWebSocketMessages(): void;
4796
+ /**
4797
+ * Grab the recording WS messages
4798
+ */
4799
+ grabWebSocketMessages(): any[];
4800
+ /**
4801
+ * Resets all recorded WS messages.
4802
+ */
4803
+ flushWebSocketMessages(): void;
4804
+ /**
4805
+ * Return a performance metric from the chrome cdp session.
4806
+ * Note: Chrome-only
4807
+ *
4808
+ * Examples:
4809
+ *
4810
+ * ```js
4811
+ * const metrics = await I.grabMetrics();
4812
+ *
4813
+ * // returned metrics
4814
+ *
4815
+ * [
4816
+ * { name: 'Timestamp', value: 1584904.203473 },
4817
+ * { name: 'AudioHandlers', value: 0 },
4818
+ * { name: 'AudioWorkletProcessors', value: 0 },
4819
+ * { name: 'Documents', value: 22 },
4820
+ * { name: 'Frames', value: 10 },
4821
+ * { name: 'JSEventListeners', value: 366 },
4822
+ * { name: 'LayoutObjects', value: 1240 },
4823
+ * { name: 'MediaKeySessions', value: 0 },
4824
+ * { name: 'MediaKeys', value: 0 },
4825
+ * { name: 'Nodes', value: 4505 },
4826
+ * { name: 'Resources', value: 141 },
4827
+ * { name: 'ContextLifecycleStateObservers', value: 34 },
4828
+ * { name: 'V8PerContextDatas', value: 4 },
4829
+ * { name: 'WorkerGlobalScopes', value: 0 },
4830
+ * { name: 'UACSSResources', value: 0 },
4831
+ * { name: 'RTCPeerConnections', value: 0 },
4832
+ * { name: 'ResourceFetchers', value: 22 },
4833
+ * { name: 'AdSubframes', value: 0 },
4834
+ * { name: 'DetachedScriptStates', value: 2 },
4835
+ * { name: 'ArrayBufferContents', value: 1 },
4836
+ * { name: 'LayoutCount', value: 0 },
4837
+ * { name: 'RecalcStyleCount', value: 0 },
4838
+ * { name: 'LayoutDuration', value: 0 },
4839
+ * { name: 'RecalcStyleDuration', value: 0 },
4840
+ * { name: 'DevToolsCommandDuration', value: 0.000013 },
4841
+ * { name: 'ScriptDuration', value: 0 },
4842
+ * { name: 'V8CompileDuration', value: 0 },
4843
+ * { name: 'TaskDuration', value: 0.000014 },
4844
+ * { name: 'TaskOtherDuration', value: 0.000001 },
4845
+ * { name: 'ThreadTime', value: 0.000046 },
4846
+ * { name: 'ProcessTime', value: 0.616852 },
4847
+ * { name: 'JSHeapUsedSize', value: 19004908 },
4848
+ * { name: 'JSHeapTotalSize', value: 26820608 },
4849
+ * { name: 'FirstMeaningfulPaint', value: 0 },
4850
+ * { name: 'DomContentLoaded', value: 1584903.690491 },
4851
+ * { name: 'NavigationStart', value: 1584902.841845 }
4852
+ * ]
4853
+ *
4854
+ * ```
4855
+ */
4856
+ grabMetrics(): Promise<object[]>;
4768
4857
  }
4769
4858
  /**
4770
4859
  * Protractor helper is based on [Protractor library](http://www.protractortest.org) and used for testing web applications.
@@ -5153,7 +5242,7 @@ declare namespace CodeceptJS {
5153
5242
  * @param value - value to check.
5154
5243
  * ⚠️ returns a _promise_ which is synchronized internally by recorder
5155
5244
  */
5156
- seeInField(field: CodeceptJS.LocatorOrString, value: string): void;
5245
+ seeInField(field: CodeceptJS.LocatorOrString, value: CodeceptJS.StringOrSecret): void;
5157
5246
  /**
5158
5247
  * Checks that value of input field or textarea doesn't equal to given value
5159
5248
  * Opposite to `seeInField`.
@@ -5166,7 +5255,7 @@ declare namespace CodeceptJS {
5166
5255
  * @param value - value to check.
5167
5256
  * ⚠️ returns a _promise_ which is synchronized internally by recorder
5168
5257
  */
5169
- dontSeeInField(field: CodeceptJS.LocatorOrString, value: string): void;
5258
+ dontSeeInField(field: CodeceptJS.LocatorOrString, value: CodeceptJS.StringOrSecret): void;
5170
5259
  /**
5171
5260
  * Appends text to a input field or textarea.
5172
5261
  * Field is located by name, label, CSS or XPath
@@ -5563,9 +5652,11 @@ declare namespace CodeceptJS {
5563
5652
  * ```
5564
5653
  * @param fn - function to be executed in browser context.
5565
5654
  * @param args - to be passed to function.
5655
+ * @returns script return value
5656
+ *
5566
5657
  * ⚠️ returns a _promise_ which is synchronized internally by recorder
5567
5658
  */
5568
- executeScript(fn: string | ((...params: any[]) => any), ...args: any[]): void;
5659
+ executeScript(fn: string | ((...params: any[]) => any), ...args: any[]): Promise<any>;
5569
5660
  /**
5570
5661
  * Executes async script on page.
5571
5662
  * Provided function should execute a passed callback (as first argument) to signal it is finished.
@@ -5589,9 +5680,11 @@ declare namespace CodeceptJS {
5589
5680
  * ```
5590
5681
  * @param fn - function to be executed in browser context.
5591
5682
  * @param args - to be passed to function.
5683
+ * @returns script return value
5684
+ *
5592
5685
  * ⚠️ returns a _promise_ which is synchronized internally by recorder
5593
5686
  */
5594
- executeAsyncScript(fn: string | ((...params: any[]) => any), ...args: any[]): void;
5687
+ executeAsyncScript(fn: string | ((...params: any[]) => any), ...args: any[]): Promise<any>;
5595
5688
  /**
5596
5689
  * Checks that current url contains a provided fragment.
5597
5690
  *
@@ -6111,7 +6204,7 @@ declare namespace CodeceptJS {
6111
6204
  * @property [manualStart = false] - do not start browser before a test, start it manually inside a helper with `this.helpers["Puppeteer"]._startBrowser()`.
6112
6205
  * @property [browser = chrome] - can be changed to `firefox` when using [puppeteer-firefox](https://codecept.io/helpers/Puppeteer-firefox).
6113
6206
  * @property [chrome] - pass additional [Puppeteer run options](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions).
6114
- * @property [highlightElement] - highlight the interacting elements
6207
+ * @property [highlightElement] - highlight the interacting elements. Default: false
6115
6208
  */
6116
6209
  type PuppeteerConfig = {
6117
6210
  url: string;
@@ -7037,7 +7130,7 @@ declare namespace CodeceptJS {
7037
7130
  * @param value - value to check.
7038
7131
  * ⚠️ returns a _promise_ which is synchronized internally by recorder
7039
7132
  */
7040
- seeInField(field: CodeceptJS.LocatorOrString, value: string): void;
7133
+ seeInField(field: CodeceptJS.LocatorOrString, value: CodeceptJS.StringOrSecret): void;
7041
7134
  /**
7042
7135
  * Checks that value of input field or textarea doesn't equal to given value
7043
7136
  * Opposite to `seeInField`.
@@ -7050,7 +7143,7 @@ declare namespace CodeceptJS {
7050
7143
  * @param value - value to check.
7051
7144
  * ⚠️ returns a _promise_ which is synchronized internally by recorder
7052
7145
  */
7053
- dontSeeInField(field: CodeceptJS.LocatorOrString, value: string): void;
7146
+ dontSeeInField(field: CodeceptJS.LocatorOrString, value: CodeceptJS.StringOrSecret): void;
7054
7147
  /**
7055
7148
  * Attaches a file to element located by label, name, CSS or XPath
7056
7149
  * Path to file is relative current codecept directory (where codecept.conf.ts or codecept.conf.js is located).
@@ -7361,12 +7454,14 @@ declare namespace CodeceptJS {
7361
7454
  * ```
7362
7455
  * @param fn - function to be executed in browser context.
7363
7456
  * @param args - to be passed to function.
7457
+ * @returns script return value
7458
+ *
7364
7459
  * ⚠️ returns a _promise_ which is synchronized internally by recorder
7365
7460
  *
7366
7461
  *
7367
7462
  * If a function returns a Promise It will wait for it resolution.
7368
7463
  */
7369
- executeScript(fn: string | ((...params: any[]) => any), ...args: any[]): void;
7464
+ executeScript(fn: string | ((...params: any[]) => any), ...args: any[]): Promise<any>;
7370
7465
  /**
7371
7466
  * Executes async script on page.
7372
7467
  * Provided function should execute a passed callback (as first argument) to signal it is finished.
@@ -7390,12 +7485,14 @@ declare namespace CodeceptJS {
7390
7485
  * ```
7391
7486
  * @param fn - function to be executed in browser context.
7392
7487
  * @param args - to be passed to function.
7488
+ * @returns script return value
7489
+ *
7393
7490
  * ⚠️ returns a _promise_ which is synchronized internally by recorder
7394
7491
  *
7395
7492
  *
7396
7493
  * Asynchronous scripts can also be executed with `executeScript` if a function returns a Promise.
7397
7494
  */
7398
- executeAsyncScript(fn: string | ((...params: any[]) => any), ...args: any[]): void;
7495
+ executeAsyncScript(fn: string | ((...params: any[]) => any), ...args: any[]): Promise<any>;
7399
7496
  /**
7400
7497
  * Retrieves all texts from an element located by CSS or XPath and returns it to test.
7401
7498
  * Resumes test execution, so **should be used inside async with `await`** operator.
@@ -8012,72 +8109,6 @@ declare namespace CodeceptJS {
8012
8109
  */
8013
8110
  sendDeleteRequest(url: any, headers?: any): Promise<any>;
8014
8111
  }
8015
- /**
8016
- * SeleniumWebdriver helper is based on the official [Selenium Webdriver JS](https://www.npmjs.com/package/selenium-webdriver)
8017
- * library. It implements common web api methods (amOnPage, click, see).
8018
- *
8019
- * ## Backends
8020
- *
8021
- * ### Selenium Installation
8022
- *
8023
- * 1. Download [Selenium Server](http://docs.seleniumhq.org/download/)
8024
- * 2. For Chrome browser install [ChromeDriver](https://sites.google.com/a/chromium.org/chromedriver/getting-started), for Firefox browser install [GeckoDriver](https://github.com/mozilla/geckodriver).
8025
- * 3. Launch the server: `java -jar selenium-server-standalone-3.xx.xxx.jar`. To locate Chromedriver binary use `-Dwebdriver.chrome.driver=./chromedriver` option. For Geckodriver use `-Dwebdriver.gecko.driver=`.
8026
- *
8027
- *
8028
- * ### PhantomJS Installation
8029
- *
8030
- * PhantomJS is a headless alternative to Selenium Server that implements [the WebDriver protocol](https://code.google.com/p/selenium/wiki/JsonWireProtocol).
8031
- * It allows you to run Selenium tests on a server without a GUI installed.
8032
- *
8033
- * 1. Download [PhantomJS](http://phantomjs.org/download.html)
8034
- * 2. Run PhantomJS in WebDriver mode: `phantomjs --webdriver=4444`
8035
- *
8036
- * ## Configuration
8037
- *
8038
- * This helper should be configured in codecept.json or codecept.conf.js
8039
- *
8040
- * * `url` - base url of website to be tested
8041
- * * `browser` - browser in which perform testing
8042
- * * `driver` - which protractor driver to use (local, direct, session, hosted, sauce, browserstack). By default set to 'hosted' which requires selenium server to be started.
8043
- * * `restart` - restart browser between tests (default: true).
8044
- * * `smartWait`: (optional) **enables SmartWait**; wait for additional milliseconds for element to appear. Enable for 5 secs: "smartWait": 5000
8045
- * * `disableScreenshots` (optional, default: false) - don't save screenshot on failure
8046
- * * `uniqueScreenshotNames` (optional, default: false) - option to prevent screenshot override if you have scenarios with the same name in different suites
8047
- * * `keepBrowserState` (optional, default: false) - keep browser state between tests when `restart` set to false.
8048
- * * `keepCookies` (optional, default: false) - keep cookies between tests when `restart` set to false.*
8049
- * * `seleniumAddress` - Selenium address to connect (default: http://localhost:4444/wd/hub)
8050
- * * `waitForTimeout`: (optional) sets default wait time in _ms_ for all `wait*` functions. 1000 by default;
8051
- * * `scriptTimeout`: (optional) sets default timeout for scripts in `executeAsync`. 1000 by default.
8052
- * * `windowSize`: (optional) default window size. Set to `maximize` or a dimension in the format `640x480`.
8053
- * * `manualStart` (optional, default: false) - do not start browser before a test, start it manually inside a helper with `this.helpers["WebDriverIO"]._startBrowser()`
8054
- * * `capabilities`: {} - list of [Desired Capabilities](https://github.com/SeleniumHQ/selenium/wiki/DesiredCapabilities)
8055
- *
8056
- * Example:
8057
- *
8058
- * ```json
8059
- * {
8060
- * "helpers": {
8061
- * "SeleniumWebdriver" : {
8062
- * "url": "http://localhost",
8063
- * "browser": "chrome",
8064
- * "smartWait": 5000,
8065
- * "restart": false
8066
- * }
8067
- * }
8068
- * }
8069
- * ```
8070
- *
8071
- * ## Access From Helpers
8072
- *
8073
- * Receive a WebDriverIO client from a custom helper by accessing `browser` property:
8074
- *
8075
- * ```js
8076
- * this.helpers['SeleniumWebdriver'].browser
8077
- * ```
8078
- */
8079
- class SeleniumWebdriver {
8080
- }
8081
8112
  /**
8082
8113
  * Client Functions
8083
8114
  */
@@ -8626,7 +8657,7 @@ declare namespace CodeceptJS {
8626
8657
  * @param value - value to check.
8627
8658
  * ⚠️ returns a _promise_ which is synchronized internally by recorder
8628
8659
  */
8629
- seeInField(field: CodeceptJS.LocatorOrString, value: string): void;
8660
+ seeInField(field: CodeceptJS.LocatorOrString, value: CodeceptJS.StringOrSecret): void;
8630
8661
  /**
8631
8662
  * Checks that value of input field or textarea doesn't equal to given value
8632
8663
  * Opposite to `seeInField`.
@@ -8639,7 +8670,7 @@ declare namespace CodeceptJS {
8639
8670
  * @param value - value to check.
8640
8671
  * ⚠️ returns a _promise_ which is synchronized internally by recorder
8641
8672
  */
8642
- dontSeeInField(field: CodeceptJS.LocatorOrString, value: string): void;
8673
+ dontSeeInField(field: CodeceptJS.LocatorOrString, value: CodeceptJS.StringOrSecret): void;
8643
8674
  /**
8644
8675
  * Checks that text is equal to provided one.
8645
8676
  *
@@ -8729,12 +8760,14 @@ declare namespace CodeceptJS {
8729
8760
  * ```
8730
8761
  * @param fn - function to be executed in browser context.
8731
8762
  * @param args - to be passed to function.
8763
+ * @returns script return value
8764
+ *
8732
8765
  * ⚠️ returns a _promise_ which is synchronized internally by recorder
8733
8766
  *
8734
8767
  *
8735
8768
  * If a function returns a Promise It will wait for its resolution.
8736
8769
  */
8737
- executeScript(fn: string | ((...params: any[]) => any), ...args: any[]): void;
8770
+ executeScript(fn: string | ((...params: any[]) => any), ...args: any[]): Promise<any>;
8738
8771
  /**
8739
8772
  * Retrieves all texts from an element located by CSS or XPath and returns it to test.
8740
8773
  * Resumes test execution, so **should be used inside async with `await`** operator.
@@ -9086,7 +9119,7 @@ declare namespace CodeceptJS {
9086
9119
  * @property [desiredCapabilities] - Selenium's [desired capabilities](https://github.com/SeleniumHQ/selenium/wiki/DesiredCapabilities).
9087
9120
  * @property [manualStart = false] - do not start browser before a test, start it manually inside a helper with `this.helpers["WebDriver"]._startBrowser()`.
9088
9121
  * @property [timeouts] - [WebDriver timeouts](http://webdriver.io/docs/timeouts.html) defined as hash.
9089
- * @property [highlightElement] - highlight the interacting elements
9122
+ * @property [highlightElement] - highlight the interacting elements. Default: false
9090
9123
  */
9091
9124
  type WebDriverConfig = {
9092
9125
  url: string;
@@ -9989,7 +10022,7 @@ declare namespace CodeceptJS {
9989
10022
  * @param value - value to check.
9990
10023
  * ⚠️ returns a _promise_ which is synchronized internally by recorder
9991
10024
  */
9992
- seeInField(field: CodeceptJS.LocatorOrString, value: string): void;
10025
+ seeInField(field: CodeceptJS.LocatorOrString, value: CodeceptJS.StringOrSecret): void;
9993
10026
  /**
9994
10027
  * Checks that value of input field or textarea doesn't equal to given value
9995
10028
  * Opposite to `seeInField`.
@@ -10002,7 +10035,7 @@ declare namespace CodeceptJS {
10002
10035
  * @param value - value to check.
10003
10036
  * ⚠️ returns a _promise_ which is synchronized internally by recorder
10004
10037
  */
10005
- dontSeeInField(field: CodeceptJS.LocatorOrString, value: string): void;
10038
+ dontSeeInField(field: CodeceptJS.LocatorOrString, value: CodeceptJS.StringOrSecret): void;
10006
10039
  /**
10007
10040
  * Verifies that the specified checkbox is checked.
10008
10041
  *
@@ -10257,13 +10290,15 @@ declare namespace CodeceptJS {
10257
10290
  * ```
10258
10291
  * @param fn - function to be executed in browser context.
10259
10292
  * @param args - to be passed to function.
10293
+ * @returns script return value
10294
+ *
10260
10295
  * ⚠️ returns a _promise_ which is synchronized internally by recorder
10261
10296
  *
10262
10297
  *
10263
10298
  *
10264
10299
  * Wraps [execute](http://webdriver.io/api/protocol/execute.html) command.
10265
10300
  */
10266
- executeScript(fn: string | ((...params: any[]) => any), ...args: any[]): void;
10301
+ executeScript(fn: string | ((...params: any[]) => any), ...args: any[]): Promise<any>;
10267
10302
  /**
10268
10303
  * Executes async script on page.
10269
10304
  * Provided function should execute a passed callback (as first argument) to signal it is finished.
@@ -10287,9 +10322,11 @@ declare namespace CodeceptJS {
10287
10322
  * ```
10288
10323
  * @param fn - function to be executed in browser context.
10289
10324
  * @param args - to be passed to function.
10325
+ * @returns script return value
10326
+ *
10290
10327
  * ⚠️ returns a _promise_ which is synchronized internally by recorder
10291
10328
  */
10292
- executeAsyncScript(fn: string | ((...params: any[]) => any), ...args: any[]): void;
10329
+ executeAsyncScript(fn: string | ((...params: any[]) => any), ...args: any[]): Promise<any>;
10293
10330
  /**
10294
10331
  * Scroll element into viewport.
10295
10332
  *
@@ -11056,7 +11093,7 @@ declare namespace CodeceptJS {
11056
11093
  /**
11057
11094
  * Run a specific test or all loaded tests.
11058
11095
  */
11059
- run(test?: string): void;
11096
+ run(test?: string): Promise<void>;
11060
11097
  }
11061
11098
  /**
11062
11099
  * Current configuration
@@ -11430,7 +11467,9 @@ declare namespace CodeceptJS {
11430
11467
  /**
11431
11468
  * Pauses test execution and starts interactive shell
11432
11469
  */
11433
- function pause(): void;
11470
+ function pause(passedObject?: {
11471
+ [key: string]: any;
11472
+ }): void;
11434
11473
  /**
11435
11474
  * Singleton object to record all test steps as promises and run them in chain.
11436
11475
  */
@@ -12059,11 +12098,11 @@ declare namespace CodeceptJS {
12059
12098
  /**
12060
12099
  * Hook executed before each test.
12061
12100
  */
12062
- protected _before(): void;
12101
+ protected _before(test?: Mocha.Test): void;
12063
12102
  /**
12064
12103
  * Hook executed after each test
12065
12104
  */
12066
- protected _after(): void;
12105
+ protected _after(test?: Mocha.Test): void;
12067
12106
  /**
12068
12107
  * Hook executed after each passed test
12069
12108
  */