codeceptjs 4.0.0-beta.2 → 4.0.0-beta.4

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 (152) hide show
  1. package/README.md +2 -2
  2. package/bin/codecept.js +84 -81
  3. package/lib/actor.js +13 -13
  4. package/lib/ai.js +10 -13
  5. package/lib/assert/empty.js +20 -21
  6. package/lib/assert/equal.js +37 -39
  7. package/lib/assert/error.js +14 -14
  8. package/lib/assert/include.js +46 -47
  9. package/lib/assert/throws.js +13 -11
  10. package/lib/assert/truth.js +19 -22
  11. package/lib/assert.js +4 -2
  12. package/lib/cli.js +56 -49
  13. package/lib/codecept.js +145 -155
  14. package/lib/colorUtils.js +3 -3
  15. package/lib/command/configMigrate.js +58 -52
  16. package/lib/command/definitions.js +88 -89
  17. package/lib/command/dryRun.js +79 -81
  18. package/lib/command/generate.js +197 -188
  19. package/lib/command/gherkin/init.js +27 -16
  20. package/lib/command/gherkin/snippets.js +21 -21
  21. package/lib/command/gherkin/steps.js +8 -8
  22. package/lib/command/info.js +40 -38
  23. package/lib/command/init.js +290 -288
  24. package/lib/command/interactive.js +32 -32
  25. package/lib/command/list.js +26 -26
  26. package/lib/command/run-multiple/chunk.js +5 -5
  27. package/lib/command/run-multiple/collection.js +3 -3
  28. package/lib/command/run-multiple/run.js +6 -2
  29. package/lib/command/run-multiple.js +113 -93
  30. package/lib/command/run-rerun.js +20 -25
  31. package/lib/command/run-workers.js +64 -66
  32. package/lib/command/run.js +26 -29
  33. package/lib/command/utils.js +80 -65
  34. package/lib/command/workers/runTests.js +11 -12
  35. package/lib/config.js +10 -9
  36. package/lib/container.js +40 -48
  37. package/lib/data/context.js +60 -59
  38. package/lib/data/dataScenarioConfig.js +47 -47
  39. package/lib/data/dataTableArgument.js +29 -29
  40. package/lib/data/table.js +26 -20
  41. package/lib/event.js +163 -167
  42. package/lib/heal.js +14 -18
  43. package/lib/helper/AI.js +130 -41
  44. package/lib/helper/ApiDataFactory.js +74 -70
  45. package/lib/helper/Appium.js +416 -388
  46. package/lib/helper/ExpectHelper.js +40 -48
  47. package/lib/helper/FileSystem.js +80 -79
  48. package/lib/helper/GraphQL.js +44 -43
  49. package/lib/helper/GraphQLDataFactory.js +51 -51
  50. package/lib/helper/JSONResponse.js +65 -62
  51. package/lib/helper/Mochawesome.js +28 -28
  52. package/lib/helper/Nightmare.js +664 -571
  53. package/lib/helper/Playwright.js +1367 -1222
  54. package/lib/helper/Protractor.js +663 -635
  55. package/lib/helper/Puppeteer.js +1232 -1132
  56. package/lib/helper/REST.js +183 -68
  57. package/lib/helper/SoftExpectHelper.js +2 -2
  58. package/lib/helper/TestCafe.js +490 -486
  59. package/lib/helper/WebDriver.js +1246 -1297
  60. package/lib/helper/clientscripts/PollyWebDriverExt.js +1 -1
  61. package/lib/helper/errors/ConnectionRefused.js +1 -1
  62. package/lib/helper/errors/ElementAssertion.js +2 -2
  63. package/lib/helper/errors/ElementNotFound.js +2 -2
  64. package/lib/helper/errors/RemoteBrowserConnectionRefused.js +1 -1
  65. package/lib/helper/extras/Console.js +1 -1
  66. package/lib/helper/extras/PlaywrightPropEngine.js +4 -4
  67. package/lib/helper/extras/PlaywrightReactVueLocator.js +1 -1
  68. package/lib/helper/extras/PlaywrightRestartOpts.js +21 -18
  69. package/lib/helper/extras/Popup.js +1 -1
  70. package/lib/helper/extras/React.js +3 -3
  71. package/lib/helper/network/actions.js +14 -7
  72. package/lib/helper/network/utils.js +4 -3
  73. package/lib/helper/scripts/blurElement.js +1 -1
  74. package/lib/helper/scripts/focusElement.js +1 -1
  75. package/lib/helper/scripts/highlightElement.js +1 -1
  76. package/lib/helper/scripts/isElementClickable.js +1 -1
  77. package/lib/helper/testcafe/testControllerHolder.js +1 -1
  78. package/lib/helper/testcafe/testcafe-utils.js +7 -8
  79. package/lib/helper.js +1 -3
  80. package/lib/history.js +6 -5
  81. package/lib/hooks.js +6 -6
  82. package/lib/html.js +7 -7
  83. package/lib/index.js +25 -41
  84. package/lib/interfaces/bdd.js +47 -64
  85. package/lib/interfaces/featureConfig.js +19 -19
  86. package/lib/interfaces/gherkin.js +124 -118
  87. package/lib/interfaces/scenarioConfig.js +29 -29
  88. package/lib/listener/artifacts.js +9 -9
  89. package/lib/listener/config.js +24 -24
  90. package/lib/listener/exit.js +12 -12
  91. package/lib/listener/helpers.js +42 -42
  92. package/lib/listener/mocha.js +11 -11
  93. package/lib/listener/retry.js +32 -30
  94. package/lib/listener/steps.js +50 -53
  95. package/lib/listener/timeout.js +54 -54
  96. package/lib/locator.js +7 -11
  97. package/lib/mochaFactory.js +18 -15
  98. package/lib/output.js +19 -15
  99. package/lib/parser.js +15 -12
  100. package/lib/pause.js +45 -38
  101. package/lib/plugin/allure.js +15 -15
  102. package/lib/plugin/autoDelay.js +29 -37
  103. package/lib/plugin/autoLogin.js +70 -65
  104. package/lib/plugin/commentStep.js +18 -18
  105. package/lib/plugin/coverage.js +112 -67
  106. package/lib/plugin/customLocator.js +21 -20
  107. package/lib/plugin/debugErrors.js +24 -24
  108. package/lib/plugin/eachElement.js +38 -38
  109. package/lib/plugin/fakerTransform.js +6 -6
  110. package/lib/plugin/heal.js +67 -108
  111. package/lib/plugin/pauseOnFail.js +11 -11
  112. package/lib/plugin/retryFailedStep.js +32 -39
  113. package/lib/plugin/retryTo.js +46 -40
  114. package/lib/plugin/screenshotOnFail.js +109 -87
  115. package/lib/plugin/selenoid.js +131 -118
  116. package/lib/plugin/standardActingHelpers.js +2 -8
  117. package/lib/plugin/stepByStepReport.js +110 -91
  118. package/lib/plugin/stepTimeout.js +24 -23
  119. package/lib/plugin/subtitles.js +34 -35
  120. package/lib/plugin/tryTo.js +40 -30
  121. package/lib/plugin/wdio.js +78 -75
  122. package/lib/recorder.js +14 -17
  123. package/lib/rerun.js +11 -10
  124. package/lib/scenario.js +25 -23
  125. package/lib/secret.js +4 -3
  126. package/lib/session.js +10 -10
  127. package/lib/step.js +12 -9
  128. package/lib/store.js +2 -3
  129. package/lib/transform.js +1 -1
  130. package/lib/translation.js +7 -8
  131. package/lib/ui.js +12 -14
  132. package/lib/utils.js +70 -72
  133. package/lib/within.js +10 -10
  134. package/lib/workerStorage.js +27 -25
  135. package/lib/workers.js +29 -33
  136. package/package.json +67 -68
  137. package/translations/de-DE.js +2 -1
  138. package/translations/fr-FR.js +2 -2
  139. package/translations/index.js +9 -13
  140. package/translations/it-IT.js +1 -1
  141. package/translations/ja-JP.js +1 -1
  142. package/translations/pl-PL.js +1 -1
  143. package/translations/pt-BR.js +1 -1
  144. package/translations/ru-RU.js +1 -1
  145. package/translations/zh-CN.js +1 -1
  146. package/translations/zh-TW.js +1 -1
  147. package/typings/index.d.ts +423 -65
  148. package/typings/promiseBasedTypes.d.ts +41 -172
  149. package/typings/types.d.ts +43 -178
  150. package/lib/dirname.js +0 -5
  151. package/lib/helper/Expect.js +0 -425
  152. package/lib/helper/MockServer.js +0 -223
@@ -113,7 +113,7 @@ declare namespace CodeceptJS {
113
113
  *
114
114
  * module.exports = new Factory()
115
115
  * // no need to set id, it will be set by REST API
116
- * .attr('author', () => faker.name.findName())
116
+ * .attr('author', () => faker.person.findName())
117
117
  * .attr('title', () => faker.lorem.sentence())
118
118
  * .attr('body', () => faker.lorem.paragraph());
119
119
  * ```
@@ -354,6 +354,17 @@ declare namespace CodeceptJS {
354
354
  * ```
355
355
  */
356
356
  runOnAndroid(caps: any, fn: any): Promise<any>;
357
+ /**
358
+ * Execute code only in Web mode.
359
+ *
360
+ * ```js
361
+ * I.runInWeb(() => {
362
+ * I.waitForElement('#data');
363
+ * I.seeInCurrentUrl('/data');
364
+ * });
365
+ * ```
366
+ */
367
+ runInWeb(): Promise<any>;
357
368
  /**
358
369
  * Returns app installation status.
359
370
  *
@@ -651,6 +662,19 @@ declare namespace CodeceptJS {
651
662
  * Shortcut for `makeTouchAction`
652
663
  */
653
664
  tap(locator: any): Promise<void>;
665
+ /**
666
+ * Perform a swipe on the screen or an element.
667
+ *
668
+ * ```js
669
+ * let locator = "#io.selendroid.testapp:id/LinearLayout1";
670
+ * I.swipe(locator, 800, 1200, 1000);
671
+ * ```
672
+ *
673
+ * [See complete reference](http://webdriver.io/api/mobile/swipe.html)
674
+ * @param [speed = 1000] - (optional), 1000 by default
675
+ * @returns Appium: support Android and iOS
676
+ */
677
+ swipe(locator: CodeceptJS.LocatorOrString, xoffset: number, yoffset: number, speed?: number): Promise<void>;
654
678
  /**
655
679
  * Perform a swipe on the screen.
656
680
  *
@@ -1180,10 +1204,6 @@ declare namespace CodeceptJS {
1180
1204
  *
1181
1205
  * ## Methods
1182
1206
  */
1183
- // @ts-ignore
1184
- // @ts-ignore
1185
- // @ts-ignore
1186
- // @ts-ignore
1187
1207
  class ExpectHelper {
1188
1208
  expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1189
1209
  expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
@@ -1295,10 +1315,6 @@ declare namespace CodeceptJS {
1295
1315
  *
1296
1316
  * ## Methods
1297
1317
  */
1298
- // @ts-ignore
1299
- // @ts-ignore
1300
- // @ts-ignore
1301
- // @ts-ignore
1302
1318
  class ExpectHelper {
1303
1319
  expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1304
1320
  expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
@@ -1637,7 +1653,7 @@ declare namespace CodeceptJS {
1637
1653
  * input: { ...buildObj },
1638
1654
  * }))
1639
1655
  * // 'attr'-id can be left out depending on the GraphQl resolvers
1640
- * .attr('name', () => faker.name.findName())
1656
+ * .attr('name', () => faker.person.findName())
1641
1657
  * .attr('email', () => faker.interact.email())
1642
1658
  * ```
1643
1659
  * For more options see [rosie documentation](https://github.com/rosiejs/rosie).
@@ -1970,10 +1986,6 @@ declare namespace CodeceptJS {
1970
1986
  * @property [host = "0.0.0.0"] - Mock server host
1971
1987
  * @property [httpsOpts] - key & cert values are the paths to .key and .crt files
1972
1988
  */
1973
- // @ts-ignore
1974
- // @ts-ignore
1975
- // @ts-ignore
1976
- // @ts-ignore
1977
1989
  type MockServerConfig = {
1978
1990
  port?: number;
1979
1991
  host?: string;
@@ -2098,10 +2110,6 @@ declare namespace CodeceptJS {
2098
2110
  *
2099
2111
  * ## Methods
2100
2112
  */
2101
- // @ts-ignore
2102
- // @ts-ignore
2103
- // @ts-ignore
2104
- // @ts-ignore
2105
2113
  class MockServer {
2106
2114
  /**
2107
2115
  * Start the mock server
@@ -3175,10 +3183,6 @@ declare namespace CodeceptJS {
3175
3183
  * @property [recordHar] - record HAR and will be saved to `output/har`. See more of [HAR options](https://playwright.dev/docs/api/class-browser#browser-new-context-option-record-har).
3176
3184
  * @property [testIdAttribute = data-testid] - locate elements based on the testIdAttribute. See more of [locate by test id](https://playwright.dev/docs/locators#locate-by-test-id).
3177
3185
  */
3178
- // @ts-ignore
3179
- // @ts-ignore
3180
- // @ts-ignore
3181
- // @ts-ignore
3182
3186
  type PlaywrightConfig = {
3183
3187
  url?: string;
3184
3188
  browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
@@ -6555,10 +6559,6 @@ declare namespace CodeceptJS {
6555
6559
  * @property [chrome] - pass additional [Puppeteer run options](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions).
6556
6560
  * @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
6557
6561
  */
6558
- // @ts-ignore
6559
- // @ts-ignore
6560
- // @ts-ignore
6561
- // @ts-ignore
6562
6562
  type PuppeteerConfig = {
6563
6563
  url: string;
6564
6564
  basicAuth?: any;
@@ -8365,10 +8365,6 @@ declare namespace CodeceptJS {
8365
8365
  * @property [onResponse] - an async function which can update response object.
8366
8366
  * @property [maxUploadFileSize] - set the max content file size in MB when performing api calls.
8367
8367
  */
8368
- // @ts-ignore
8369
- // @ts-ignore
8370
- // @ts-ignore
8371
- // @ts-ignore
8372
8368
  type RESTConfig = {
8373
8369
  endpoint?: string;
8374
8370
  prettyPrintJson?: boolean;
@@ -8549,6 +8545,17 @@ declare namespace CodeceptJS {
8549
8545
  * @returns response
8550
8546
  */
8551
8547
  sendDeleteRequest(url: any, headers?: any): Promise<any>;
8548
+ /**
8549
+ * Sends DELETE request to API with payload.
8550
+ *
8551
+ * ```js
8552
+ * I.sendDeleteRequestWithPayload('/api/users/1', { author: 'john' });
8553
+ * ```
8554
+ * @param [payload = {}] - the payload to be sent. By default it is sent as an empty object
8555
+ * @param [headers = {}] - the headers object to be sent. By default, it is sent as an empty object
8556
+ * @returns response
8557
+ */
8558
+ sendDeleteRequestWithPayload(url: any, payload?: any, headers?: any): Promise<any>;
8552
8559
  }
8553
8560
  /**
8554
8561
  * SoftAssertHelper is a utility class for performing soft assertions.
@@ -9745,12 +9752,7 @@ declare namespace CodeceptJS {
9745
9752
  * @property [timeouts] - [WebDriver timeouts](http://webdriver.io/docs/timeouts.html) defined as hash.
9746
9753
  * @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
9747
9754
  * @property [logLevel = silent] - level of logging verbosity. Default: silent. Options: trace | debug | info | warn | error | silent. More info: https://webdriver.io/docs/configuration/#loglevel
9748
- * @property [devtoolsProtocol = false] - enable devtools protocol. Default: false. More info: https://webdriver.io/docs/automationProtocols/#devtools-protocol.
9749
9755
  */
9750
- // @ts-ignore
9751
- // @ts-ignore
9752
- // @ts-ignore
9753
- // @ts-ignore
9754
9756
  type WebDriverConfig = {
9755
9757
  url: string;
9756
9758
  browser: string;
@@ -9773,7 +9775,6 @@ declare namespace CodeceptJS {
9773
9775
  timeouts?: any;
9774
9776
  highlightElement?: boolean;
9775
9777
  logLevel?: string;
9776
- devtoolsProtocol?: boolean;
9777
9778
  };
9778
9779
  /**
9779
9780
  * WebDriver helper which wraps [webdriverio](http://webdriver.io/) library to
@@ -9879,7 +9880,6 @@ declare namespace CodeceptJS {
9879
9880
  * WebDriver : {
9880
9881
  * url: "http://localhost",
9881
9882
  * browser: "chrome",
9882
- * devtoolsProtocol: true,
9883
9883
  * desiredCapabilities: {
9884
9884
  * chromeOptions: {
9885
9885
  * args: [ "--headless", "--disable-gpu", "--no-sandbox" ]
@@ -11569,33 +11569,6 @@ declare namespace CodeceptJS {
11569
11569
  * @returns scroll position
11570
11570
  */
11571
11571
  grabPageScrollPosition(): Promise<PageScrollPosition>;
11572
- /**
11573
- * This method is **deprecated**.
11574
- *
11575
- *
11576
- * Set the current geo location
11577
- *
11578
- *
11579
- * ```js
11580
- * I.setGeoLocation(121.21, 11.56);
11581
- * I.setGeoLocation(121.21, 11.56, 10);
11582
- * ```
11583
- * @param latitude - to set.
11584
- * @param longitude - to set
11585
- * @param [altitude] - (optional, null by default) to set
11586
- */
11587
- setGeoLocation(latitude: number, longitude: number, altitude?: number): Promise<any>;
11588
- /**
11589
- * This method is **deprecated**.
11590
- *
11591
- * Return the current geo location
11592
- * Resumes test execution, so **should be used inside async function with `await`** operator.
11593
- *
11594
- * ```js
11595
- * let geoLocation = await I.grabGeoLocation();
11596
- * ```
11597
- */
11598
- grabGeoLocation(): Promise<{ latitude: number; longitude: number; altitude: number; }>;
11599
11572
  /**
11600
11573
  * Grab the width, height, location of given locator.
11601
11574
  * Provide `width` or `height`as second param to get your desired prop.
@@ -11622,119 +11595,15 @@ declare namespace CodeceptJS {
11622
11595
  /**
11623
11596
  * Placeholder for ~ locator only test case write once run on both Appium and WebDriver.
11624
11597
  */
11625
- runOnAndroid(caps: any, fn: any): Promise<any>;
11598
+ runOnIOS(caps: any, fn: any): Promise<any>;
11626
11599
  /**
11627
11600
  * Placeholder for ~ locator only test case write once run on both Appium and WebDriver.
11628
11601
  */
11629
- runInWeb(): Promise<any>;
11630
- /**
11631
- * _Note:_ Only works when devtoolsProtocol is enabled.
11632
- *
11633
- * Resets all recorded network requests.
11634
- *
11635
- * ```js
11636
- * I.flushNetworkTraffics();
11637
- * ```
11638
- */
11639
- flushNetworkTraffics(): Promise<any>;
11640
- /**
11641
- * _Note:_ Only works when devtoolsProtocol is enabled.
11642
- *
11643
- * Stops recording of network traffic. Recorded traffic is not flashed.
11644
- *
11645
- * ```js
11646
- * I.stopRecordingTraffic();
11647
- * ```
11648
- */
11649
- stopRecordingTraffic(): Promise<any>;
11650
- /**
11651
- * _Note:_ Only works when devtoolsProtocol is enabled.
11652
- *
11653
- * Starts recording the network traffics.
11654
- * This also resets recorded network requests.
11655
- *
11656
- * ```js
11657
- * I.startRecordingTraffic();
11658
- * ```
11659
- */
11660
- startRecordingTraffic(): Promise<any>;
11661
- /**
11662
- * _Note:_ Only works when devtoolsProtocol is enabled.
11663
- *
11664
- * Grab the recording network traffics
11665
- *
11666
- * ```js
11667
- * const traffics = await I.grabRecordedNetworkTraffics();
11668
- * expect(traffics[0].url).to.equal('https://reqres.in/api/comments/1');
11669
- * expect(traffics[0].response.status).to.equal(200);
11670
- * expect(traffics[0].response.body).to.contain({ name: 'this was mocked' });
11671
- * ```
11672
- */
11673
- grabRecordedNetworkTraffics(): Promise<any>;
11674
- /**
11675
- * _Note:_ Only works when devtoolsProtocol is enabled.
11676
- *
11677
- * Verifies that a certain request is part of network traffic.
11678
- *
11679
- * ```js
11680
- * // checking the request url contains certain query strings
11681
- * I.amOnPage('https://openai.com/blog/chatgpt');
11682
- * I.startRecordingTraffic();
11683
- * await I.seeTraffic({
11684
- * name: 'sentry event',
11685
- * url: 'https://images.openai.com/blob/cf717bdb-0c8c-428a-b82b-3c3add87a600',
11686
- * parameters: {
11687
- * width: '1919',
11688
- * height: '1138',
11689
- * },
11690
- * });
11691
- * ```
11692
- *
11693
- * ```js
11694
- * // checking the request url contains certain post data
11695
- * I.amOnPage('https://openai.com/blog/chatgpt');
11696
- * I.startRecordingTraffic();
11697
- * await I.seeTraffic({
11698
- * name: 'event',
11699
- * url: 'https://cloudflareinsights.com/cdn-cgi/rum',
11700
- * requestPostData: {
11701
- * st: 2,
11702
- * },
11703
- * });
11704
- * ```
11705
- * @param opts - options when checking the traffic network.
11706
- * @param opts.name - A name of that request. Can be any value. Only relevant to have a more meaningful error message in case of fail.
11707
- * @param opts.url - Expected URL of request in network traffic
11708
- * @param [opts.parameters] - Expected parameters of that request in network traffic
11709
- * @param [opts.requestPostData] - Expected that request contains post data in network traffic
11710
- * @param [opts.timeout] - Timeout to wait for request in seconds. Default is 10 seconds.
11711
- */
11712
- seeTraffic(opts: {
11713
- name: string;
11714
- url: string;
11715
- parameters?: any;
11716
- requestPostData?: any;
11717
- timeout?: number;
11718
- }): Promise<any>;
11602
+ runOnAndroid(caps: any, fn: any): Promise<any>;
11719
11603
  /**
11720
- * _Note:_ Only works when devtoolsProtocol is enabled.
11721
- *
11722
- * Verifies that a certain request is not part of network traffic.
11723
- *
11724
- * Examples:
11725
- *
11726
- * ```js
11727
- * I.dontSeeTraffic({ name: 'Unexpected API Call', url: 'https://api.example.com' });
11728
- * I.dontSeeTraffic({ name: 'Unexpected API Call of "user" endpoint', url: /api.example.com.*user/ });
11729
- * ```
11730
- * @param opts - options when checking the traffic network.
11731
- * @param opts.name - A name of that request. Can be any value. Only relevant to have a more meaningful error message in case of fail.
11732
- * @param opts.url - Expected URL of request in network traffic. Can be a string or a regular expression.
11604
+ * Placeholder for ~ locator only test case write once run on both Appium and WebDriver.
11733
11605
  */
11734
- dontSeeTraffic(opts: {
11735
- name: string;
11736
- url: string | RegExp;
11737
- }): Promise<any>;
11606
+ runInWeb(): Promise<any>;
11738
11607
  }
11739
11608
  }
11740
11609
 
@@ -113,7 +113,7 @@ declare namespace CodeceptJS {
113
113
  *
114
114
  * module.exports = new Factory()
115
115
  * // no need to set id, it will be set by REST API
116
- * .attr('author', () => faker.name.findName())
116
+ * .attr('author', () => faker.person.findName())
117
117
  * .attr('title', () => faker.lorem.sentence())
118
118
  * .attr('body', () => faker.lorem.paragraph());
119
119
  * ```
@@ -354,6 +354,17 @@ declare namespace CodeceptJS {
354
354
  * ```
355
355
  */
356
356
  runOnAndroid(caps: any, fn: any): void;
357
+ /**
358
+ * Execute code only in Web mode.
359
+ *
360
+ * ```js
361
+ * I.runInWeb(() => {
362
+ * I.waitForElement('#data');
363
+ * I.seeInCurrentUrl('/data');
364
+ * });
365
+ * ```
366
+ */
367
+ runInWeb(): void;
357
368
  /**
358
369
  * Returns app installation status.
359
370
  *
@@ -651,6 +662,19 @@ declare namespace CodeceptJS {
651
662
  * Shortcut for `makeTouchAction`
652
663
  */
653
664
  tap(locator: any): Promise<void>;
665
+ /**
666
+ * Perform a swipe on the screen or an element.
667
+ *
668
+ * ```js
669
+ * let locator = "#io.selendroid.testapp:id/LinearLayout1";
670
+ * I.swipe(locator, 800, 1200, 1000);
671
+ * ```
672
+ *
673
+ * [See complete reference](http://webdriver.io/api/mobile/swipe.html)
674
+ * @param [speed = 1000] - (optional), 1000 by default
675
+ * @returns Appium: support Android and iOS
676
+ */
677
+ swipe(locator: CodeceptJS.LocatorOrString, xoffset: number, yoffset: number, speed?: number): Promise<void>;
654
678
  /**
655
679
  * Perform a swipe on the screen.
656
680
  *
@@ -1204,10 +1228,6 @@ declare namespace CodeceptJS {
1204
1228
  *
1205
1229
  * ## Methods
1206
1230
  */
1207
- // @ts-ignore
1208
- // @ts-ignore
1209
- // @ts-ignore
1210
- // @ts-ignore
1211
1231
  class ExpectHelper {
1212
1232
  expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1213
1233
  expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
@@ -1319,10 +1339,6 @@ declare namespace CodeceptJS {
1319
1339
  *
1320
1340
  * ## Methods
1321
1341
  */
1322
- // @ts-ignore
1323
- // @ts-ignore
1324
- // @ts-ignore
1325
- // @ts-ignore
1326
1342
  class ExpectHelper {
1327
1343
  expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1328
1344
  expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
@@ -1664,7 +1680,7 @@ declare namespace CodeceptJS {
1664
1680
  * input: { ...buildObj },
1665
1681
  * }))
1666
1682
  * // 'attr'-id can be left out depending on the GraphQl resolvers
1667
- * .attr('name', () => faker.name.findName())
1683
+ * .attr('name', () => faker.person.findName())
1668
1684
  * .attr('email', () => faker.interact.email())
1669
1685
  * ```
1670
1686
  * For more options see [rosie documentation](https://github.com/rosiejs/rosie).
@@ -1997,10 +2013,6 @@ declare namespace CodeceptJS {
1997
2013
  * @property [host = "0.0.0.0"] - Mock server host
1998
2014
  * @property [httpsOpts] - key & cert values are the paths to .key and .crt files
1999
2015
  */
2000
- // @ts-ignore
2001
- // @ts-ignore
2002
- // @ts-ignore
2003
- // @ts-ignore
2004
2016
  type MockServerConfig = {
2005
2017
  port?: number;
2006
2018
  host?: string;
@@ -2125,10 +2137,6 @@ declare namespace CodeceptJS {
2125
2137
  *
2126
2138
  * ## Methods
2127
2139
  */
2128
- // @ts-ignore
2129
- // @ts-ignore
2130
- // @ts-ignore
2131
- // @ts-ignore
2132
2140
  class MockServer {
2133
2141
  /**
2134
2142
  * Start the mock server
@@ -3268,10 +3276,6 @@ declare namespace CodeceptJS {
3268
3276
  * @property [recordHar] - record HAR and will be saved to `output/har`. See more of [HAR options](https://playwright.dev/docs/api/class-browser#browser-new-context-option-record-har).
3269
3277
  * @property [testIdAttribute = data-testid] - locate elements based on the testIdAttribute. See more of [locate by test id](https://playwright.dev/docs/locators#locate-by-test-id).
3270
3278
  */
3271
- // @ts-ignore
3272
- // @ts-ignore
3273
- // @ts-ignore
3274
- // @ts-ignore
3275
3279
  type PlaywrightConfig = {
3276
3280
  url?: string;
3277
3281
  browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
@@ -6799,10 +6803,6 @@ declare namespace CodeceptJS {
6799
6803
  * @property [chrome] - pass additional [Puppeteer run options](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions).
6800
6804
  * @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
6801
6805
  */
6802
- // @ts-ignore
6803
- // @ts-ignore
6804
- // @ts-ignore
6805
- // @ts-ignore
6806
6806
  type PuppeteerConfig = {
6807
6807
  url: string;
6808
6808
  basicAuth?: any;
@@ -8745,10 +8745,6 @@ declare namespace CodeceptJS {
8745
8745
  * @property [onResponse] - an async function which can update response object.
8746
8746
  * @property [maxUploadFileSize] - set the max content file size in MB when performing api calls.
8747
8747
  */
8748
- // @ts-ignore
8749
- // @ts-ignore
8750
- // @ts-ignore
8751
- // @ts-ignore
8752
8748
  type RESTConfig = {
8753
8749
  endpoint?: string;
8754
8750
  prettyPrintJson?: boolean;
@@ -8929,6 +8925,17 @@ declare namespace CodeceptJS {
8929
8925
  * @returns response
8930
8926
  */
8931
8927
  sendDeleteRequest(url: any, headers?: any): Promise<any>;
8928
+ /**
8929
+ * Sends DELETE request to API with payload.
8930
+ *
8931
+ * ```js
8932
+ * I.sendDeleteRequestWithPayload('/api/users/1', { author: 'john' });
8933
+ * ```
8934
+ * @param [payload = {}] - the payload to be sent. By default it is sent as an empty object
8935
+ * @param [headers = {}] - the headers object to be sent. By default, it is sent as an empty object
8936
+ * @returns response
8937
+ */
8938
+ sendDeleteRequestWithPayload(url: any, payload?: any, headers?: any): Promise<any>;
8932
8939
  }
8933
8940
  /**
8934
8941
  * SoftAssertHelper is a utility class for performing soft assertions.
@@ -10185,12 +10192,7 @@ declare namespace CodeceptJS {
10185
10192
  * @property [timeouts] - [WebDriver timeouts](http://webdriver.io/docs/timeouts.html) defined as hash.
10186
10193
  * @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
10187
10194
  * @property [logLevel = silent] - level of logging verbosity. Default: silent. Options: trace | debug | info | warn | error | silent. More info: https://webdriver.io/docs/configuration/#loglevel
10188
- * @property [devtoolsProtocol = false] - enable devtools protocol. Default: false. More info: https://webdriver.io/docs/automationProtocols/#devtools-protocol.
10189
10195
  */
10190
- // @ts-ignore
10191
- // @ts-ignore
10192
- // @ts-ignore
10193
- // @ts-ignore
10194
10196
  type WebDriverConfig = {
10195
10197
  url: string;
10196
10198
  browser: string;
@@ -10213,7 +10215,6 @@ declare namespace CodeceptJS {
10213
10215
  timeouts?: any;
10214
10216
  highlightElement?: boolean;
10215
10217
  logLevel?: string;
10216
- devtoolsProtocol?: boolean;
10217
10218
  };
10218
10219
  /**
10219
10220
  * WebDriver helper which wraps [webdriverio](http://webdriver.io/) library to
@@ -10319,7 +10320,6 @@ declare namespace CodeceptJS {
10319
10320
  * WebDriver : {
10320
10321
  * url: "http://localhost",
10321
10322
  * browser: "chrome",
10322
- * devtoolsProtocol: true,
10323
10323
  * desiredCapabilities: {
10324
10324
  * chromeOptions: {
10325
10325
  * args: [ "--headless", "--disable-gpu", "--no-sandbox" ]
@@ -12123,34 +12123,6 @@ declare namespace CodeceptJS {
12123
12123
  * @returns scroll position
12124
12124
  */
12125
12125
  grabPageScrollPosition(): Promise<PageScrollPosition>;
12126
- /**
12127
- * This method is **deprecated**.
12128
- *
12129
- *
12130
- * Set the current geo location
12131
- *
12132
- *
12133
- * ```js
12134
- * I.setGeoLocation(121.21, 11.56);
12135
- * I.setGeoLocation(121.21, 11.56, 10);
12136
- * ```
12137
- * @param latitude - to set.
12138
- * @param longitude - to set
12139
- * @param [altitude] - (optional, null by default) to set
12140
- * @returns automatically synchronized promise through #recorder
12141
- */
12142
- setGeoLocation(latitude: number, longitude: number, altitude?: number): void;
12143
- /**
12144
- * This method is **deprecated**.
12145
- *
12146
- * Return the current geo location
12147
- * Resumes test execution, so **should be used inside async function with `await`** operator.
12148
- *
12149
- * ```js
12150
- * let geoLocation = await I.grabGeoLocation();
12151
- * ```
12152
- */
12153
- grabGeoLocation(): Promise<{ latitude: number; longitude: number; altitude: number; }>;
12154
12126
  /**
12155
12127
  * Grab the width, height, location of given locator.
12156
12128
  * Provide `width` or `height`as second param to get your desired prop.
@@ -12177,123 +12149,15 @@ declare namespace CodeceptJS {
12177
12149
  /**
12178
12150
  * Placeholder for ~ locator only test case write once run on both Appium and WebDriver.
12179
12151
  */
12180
- runOnAndroid(caps: any, fn: any): void;
12152
+ runOnIOS(caps: any, fn: any): void;
12181
12153
  /**
12182
12154
  * Placeholder for ~ locator only test case write once run on both Appium and WebDriver.
12183
12155
  */
12184
- runInWeb(): void;
12185
- /**
12186
- * _Note:_ Only works when devtoolsProtocol is enabled.
12187
- *
12188
- * Resets all recorded network requests.
12189
- *
12190
- * ```js
12191
- * I.flushNetworkTraffics();
12192
- * ```
12193
- */
12194
- flushNetworkTraffics(): void;
12195
- /**
12196
- * _Note:_ Only works when devtoolsProtocol is enabled.
12197
- *
12198
- * Stops recording of network traffic. Recorded traffic is not flashed.
12199
- *
12200
- * ```js
12201
- * I.stopRecordingTraffic();
12202
- * ```
12203
- */
12204
- stopRecordingTraffic(): void;
12205
- /**
12206
- * _Note:_ Only works when devtoolsProtocol is enabled.
12207
- *
12208
- * Starts recording the network traffics.
12209
- * This also resets recorded network requests.
12210
- *
12211
- * ```js
12212
- * I.startRecordingTraffic();
12213
- * ```
12214
- * @returns automatically synchronized promise through #recorder
12215
- */
12216
- startRecordingTraffic(): void;
12217
- /**
12218
- * _Note:_ Only works when devtoolsProtocol is enabled.
12219
- *
12220
- * Grab the recording network traffics
12221
- *
12222
- * ```js
12223
- * const traffics = await I.grabRecordedNetworkTraffics();
12224
- * expect(traffics[0].url).to.equal('https://reqres.in/api/comments/1');
12225
- * expect(traffics[0].response.status).to.equal(200);
12226
- * expect(traffics[0].response.body).to.contain({ name: 'this was mocked' });
12227
- * ```
12228
- * @returns recorded network traffics
12229
- */
12230
- grabRecordedNetworkTraffics(): any[];
12231
- /**
12232
- * _Note:_ Only works when devtoolsProtocol is enabled.
12233
- *
12234
- * Verifies that a certain request is part of network traffic.
12235
- *
12236
- * ```js
12237
- * // checking the request url contains certain query strings
12238
- * I.amOnPage('https://openai.com/blog/chatgpt');
12239
- * I.startRecordingTraffic();
12240
- * await I.seeTraffic({
12241
- * name: 'sentry event',
12242
- * url: 'https://images.openai.com/blob/cf717bdb-0c8c-428a-b82b-3c3add87a600',
12243
- * parameters: {
12244
- * width: '1919',
12245
- * height: '1138',
12246
- * },
12247
- * });
12248
- * ```
12249
- *
12250
- * ```js
12251
- * // checking the request url contains certain post data
12252
- * I.amOnPage('https://openai.com/blog/chatgpt');
12253
- * I.startRecordingTraffic();
12254
- * await I.seeTraffic({
12255
- * name: 'event',
12256
- * url: 'https://cloudflareinsights.com/cdn-cgi/rum',
12257
- * requestPostData: {
12258
- * st: 2,
12259
- * },
12260
- * });
12261
- * ```
12262
- * @param opts - options when checking the traffic network.
12263
- * @param opts.name - A name of that request. Can be any value. Only relevant to have a more meaningful error message in case of fail.
12264
- * @param opts.url - Expected URL of request in network traffic
12265
- * @param [opts.parameters] - Expected parameters of that request in network traffic
12266
- * @param [opts.requestPostData] - Expected that request contains post data in network traffic
12267
- * @param [opts.timeout] - Timeout to wait for request in seconds. Default is 10 seconds.
12268
- * @returns automatically synchronized promise through #recorder
12269
- */
12270
- seeTraffic(opts: {
12271
- name: string;
12272
- url: string;
12273
- parameters?: any;
12274
- requestPostData?: any;
12275
- timeout?: number;
12276
- }): void;
12156
+ runOnAndroid(caps: any, fn: any): void;
12277
12157
  /**
12278
- * _Note:_ Only works when devtoolsProtocol is enabled.
12279
- *
12280
- * Verifies that a certain request is not part of network traffic.
12281
- *
12282
- * Examples:
12283
- *
12284
- * ```js
12285
- * I.dontSeeTraffic({ name: 'Unexpected API Call', url: 'https://api.example.com' });
12286
- * I.dontSeeTraffic({ name: 'Unexpected API Call of "user" endpoint', url: /api.example.com.*user/ });
12287
- * ```
12288
- * @param opts - options when checking the traffic network.
12289
- * @param opts.name - A name of that request. Can be any value. Only relevant to have a more meaningful error message in case of fail.
12290
- * @param opts.url - Expected URL of request in network traffic. Can be a string or a regular expression.
12291
- * @returns automatically synchronized promise through #recorder
12158
+ * Placeholder for ~ locator only test case write once run on both Appium and WebDriver.
12292
12159
  */
12293
- dontSeeTraffic(opts: {
12294
- name: string;
12295
- url: string | RegExp;
12296
- }): void;
12160
+ runInWeb(): void;
12297
12161
  }
12298
12162
  interface ActorStatic {
12299
12163
  /**
@@ -12686,7 +12550,7 @@ declare namespace CodeceptJS {
12686
12550
  inside(locator: CodeceptJS.LocatorOrString): Locator;
12687
12551
  after(locator: CodeceptJS.LocatorOrString): Locator;
12688
12552
  before(locator: CodeceptJS.LocatorOrString): Locator;
12689
- static build(locator: CodeceptJS.LocatorOrString): Locator;
12553
+ static build(locator?: CodeceptJS.LocatorOrString): Locator;
12690
12554
  /**
12691
12555
  * Filters to modify locators
12692
12556
  */
@@ -12741,6 +12605,7 @@ declare namespace CodeceptJS {
12741
12605
  function skipped(test: Mocha.Test): void;
12742
12606
  }
12743
12607
  namespace scenario {
12608
+ function started(test: Mocha.Test): void;
12744
12609
  function passed(test: Mocha.Test): void;
12745
12610
  function failed(test: Mocha.Test): void;
12746
12611
  }
package/lib/dirname.js DELETED
@@ -1,5 +0,0 @@
1
- import { fileURLToPath } from 'url';
2
- import { dirname } from 'path';
3
-
4
- const __filename = fileURLToPath(import.meta.url);
5
- export const __dirname = dirname(__filename);