codeceptjs 3.6.10 → 3.7.0-beta.10

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 (127) hide show
  1. package/README.md +89 -119
  2. package/bin/codecept.js +9 -2
  3. package/docs/webapi/clearCookie.mustache +1 -1
  4. package/lib/actor.js +66 -102
  5. package/lib/ai.js +130 -121
  6. package/lib/assert/empty.js +3 -5
  7. package/lib/assert/equal.js +4 -7
  8. package/lib/assert/include.js +4 -6
  9. package/lib/assert/throws.js +2 -4
  10. package/lib/assert/truth.js +2 -2
  11. package/lib/codecept.js +87 -83
  12. package/lib/command/check.js +186 -0
  13. package/lib/command/configMigrate.js +2 -4
  14. package/lib/command/definitions.js +8 -26
  15. package/lib/command/generate.js +10 -14
  16. package/lib/command/gherkin/snippets.js +10 -8
  17. package/lib/command/gherkin/steps.js +1 -1
  18. package/lib/command/info.js +1 -3
  19. package/lib/command/init.js +8 -12
  20. package/lib/command/interactive.js +2 -2
  21. package/lib/command/list.js +1 -1
  22. package/lib/command/run-multiple.js +12 -35
  23. package/lib/command/run-workers.js +5 -57
  24. package/lib/command/utils.js +5 -6
  25. package/lib/command/workers/runTests.js +68 -232
  26. package/lib/container.js +354 -237
  27. package/lib/data/context.js +10 -13
  28. package/lib/data/dataScenarioConfig.js +8 -8
  29. package/lib/data/dataTableArgument.js +6 -6
  30. package/lib/data/table.js +5 -11
  31. package/lib/effects.js +218 -0
  32. package/lib/els.js +158 -0
  33. package/lib/event.js +19 -17
  34. package/lib/heal.js +88 -80
  35. package/lib/helper/AI.js +2 -1
  36. package/lib/helper/ApiDataFactory.js +3 -6
  37. package/lib/helper/Appium.js +45 -51
  38. package/lib/helper/FileSystem.js +3 -3
  39. package/lib/helper/GraphQLDataFactory.js +3 -3
  40. package/lib/helper/JSONResponse.js +57 -37
  41. package/lib/helper/Nightmare.js +35 -53
  42. package/lib/helper/Playwright.js +211 -252
  43. package/lib/helper/Protractor.js +54 -77
  44. package/lib/helper/Puppeteer.js +139 -232
  45. package/lib/helper/REST.js +5 -17
  46. package/lib/helper/TestCafe.js +21 -44
  47. package/lib/helper/WebDriver.js +131 -169
  48. package/lib/helper/testcafe/testcafe-utils.js +26 -27
  49. package/lib/listener/emptyRun.js +55 -0
  50. package/lib/listener/exit.js +7 -10
  51. package/lib/listener/{retry.js → globalRetry.js} +5 -5
  52. package/lib/listener/globalTimeout.js +165 -0
  53. package/lib/listener/helpers.js +15 -15
  54. package/lib/listener/mocha.js +1 -1
  55. package/lib/listener/result.js +12 -0
  56. package/lib/listener/steps.js +20 -18
  57. package/lib/listener/store.js +20 -0
  58. package/lib/mocha/asyncWrapper.js +216 -0
  59. package/lib/{interfaces → mocha}/bdd.js +3 -3
  60. package/lib/mocha/cli.js +308 -0
  61. package/lib/mocha/factory.js +104 -0
  62. package/lib/{interfaces → mocha}/featureConfig.js +24 -12
  63. package/lib/{interfaces → mocha}/gherkin.js +26 -28
  64. package/lib/mocha/hooks.js +112 -0
  65. package/lib/mocha/index.js +12 -0
  66. package/lib/mocha/inject.js +29 -0
  67. package/lib/{interfaces → mocha}/scenarioConfig.js +21 -6
  68. package/lib/mocha/suite.js +81 -0
  69. package/lib/mocha/test.js +159 -0
  70. package/lib/mocha/types.d.ts +42 -0
  71. package/lib/mocha/ui.js +219 -0
  72. package/lib/output.js +82 -62
  73. package/lib/pause.js +155 -138
  74. package/lib/plugin/analyze.js +349 -0
  75. package/lib/plugin/autoDelay.js +6 -6
  76. package/lib/plugin/autoLogin.js +6 -7
  77. package/lib/plugin/commentStep.js +6 -1
  78. package/lib/plugin/coverage.js +10 -19
  79. package/lib/plugin/customLocator.js +3 -3
  80. package/lib/plugin/customReporter.js +52 -0
  81. package/lib/plugin/eachElement.js +1 -1
  82. package/lib/plugin/fakerTransform.js +1 -1
  83. package/lib/plugin/heal.js +36 -9
  84. package/lib/plugin/pageInfo.js +140 -0
  85. package/lib/plugin/retryFailedStep.js +4 -4
  86. package/lib/plugin/retryTo.js +18 -118
  87. package/lib/plugin/screenshotOnFail.js +17 -49
  88. package/lib/plugin/selenoid.js +15 -35
  89. package/lib/plugin/standardActingHelpers.js +4 -1
  90. package/lib/plugin/stepByStepReport.js +56 -17
  91. package/lib/plugin/stepTimeout.js +5 -12
  92. package/lib/plugin/subtitles.js +4 -4
  93. package/lib/plugin/tryTo.js +17 -107
  94. package/lib/plugin/wdio.js +8 -10
  95. package/lib/recorder.js +146 -125
  96. package/lib/rerun.js +43 -42
  97. package/lib/result.js +161 -0
  98. package/lib/secret.js +1 -1
  99. package/lib/step/base.js +228 -0
  100. package/lib/step/config.js +50 -0
  101. package/lib/step/func.js +46 -0
  102. package/lib/step/helper.js +50 -0
  103. package/lib/step/meta.js +99 -0
  104. package/lib/step/record.js +74 -0
  105. package/lib/step/retry.js +11 -0
  106. package/lib/step/section.js +55 -0
  107. package/lib/step.js +21 -332
  108. package/lib/steps.js +50 -0
  109. package/lib/store.js +10 -2
  110. package/lib/template/heal.js +2 -11
  111. package/lib/timeout.js +66 -0
  112. package/lib/utils.js +317 -216
  113. package/lib/within.js +73 -55
  114. package/lib/workers.js +259 -275
  115. package/package.json +56 -54
  116. package/typings/index.d.ts +175 -186
  117. package/typings/promiseBasedTypes.d.ts +164 -17
  118. package/typings/types.d.ts +284 -115
  119. package/lib/cli.js +0 -256
  120. package/lib/helper/ExpectHelper.js +0 -391
  121. package/lib/helper/SoftExpectHelper.js +0 -381
  122. package/lib/listener/artifacts.js +0 -19
  123. package/lib/listener/timeout.js +0 -109
  124. package/lib/mochaFactory.js +0 -113
  125. package/lib/plugin/debugErrors.js +0 -67
  126. package/lib/scenario.js +0 -224
  127. package/lib/ui.js +0 -236
@@ -608,17 +608,11 @@ declare namespace CodeceptJS {
608
608
  * ```js
609
609
  * // taps outside to hide keyboard per default
610
610
  * I.hideDeviceKeyboard();
611
- * I.hideDeviceKeyboard('tapOutside');
612
- *
613
- * // or by pressing key
614
- * I.hideDeviceKeyboard('pressKey', 'Done');
615
611
  * ```
616
612
  *
617
613
  * Appium: support Android and iOS
618
- * @param [strategy] - Desired strategy to close keyboard (‘tapOutside’ or ‘pressKey’)
619
- * @param [key] - Optional key
620
614
  */
621
- hideDeviceKeyboard(strategy?: 'tapOutside' | 'pressKey', key?: string): Promise<any>;
615
+ hideDeviceKeyboard(): Promise<any>;
622
616
  /**
623
617
  * Send a key event to the device.
624
618
  * List of keys: https://developer.android.com/reference/android/view/KeyEvent.html
@@ -1204,6 +1198,25 @@ declare namespace CodeceptJS {
1204
1198
  *
1205
1199
  * ## Methods
1206
1200
  */
1201
+ // @ts-ignore
1202
+ // @ts-ignore
1203
+ // @ts-ignore
1204
+ // @ts-ignore
1205
+ // @ts-ignore
1206
+ // @ts-ignore
1207
+ // @ts-ignore
1208
+ // @ts-ignore
1209
+ // @ts-ignore
1210
+ // @ts-ignore
1211
+ // @ts-ignore
1212
+ // @ts-ignore
1213
+ // @ts-ignore
1214
+ // @ts-ignore
1215
+ // @ts-ignore
1216
+ // @ts-ignore
1217
+ // @ts-ignore
1218
+ // @ts-ignore
1219
+ // @ts-ignore
1207
1220
  class ExpectHelper {
1208
1221
  expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1209
1222
  expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
@@ -1315,6 +1328,25 @@ declare namespace CodeceptJS {
1315
1328
  *
1316
1329
  * ## Methods
1317
1330
  */
1331
+ // @ts-ignore
1332
+ // @ts-ignore
1333
+ // @ts-ignore
1334
+ // @ts-ignore
1335
+ // @ts-ignore
1336
+ // @ts-ignore
1337
+ // @ts-ignore
1338
+ // @ts-ignore
1339
+ // @ts-ignore
1340
+ // @ts-ignore
1341
+ // @ts-ignore
1342
+ // @ts-ignore
1343
+ // @ts-ignore
1344
+ // @ts-ignore
1345
+ // @ts-ignore
1346
+ // @ts-ignore
1347
+ // @ts-ignore
1348
+ // @ts-ignore
1349
+ // @ts-ignore
1318
1350
  class ExpectHelper {
1319
1351
  expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1320
1352
  expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
@@ -1930,13 +1962,14 @@ declare namespace CodeceptJS {
1930
1962
  */
1931
1963
  seeResponseContainsKeys(keys: any[]): Promise<any>;
1932
1964
  /**
1933
- * Executes a callback function passing in `response` object and chai assertions with `expect`
1965
+ * Executes a callback function passing in `response` object and assert
1934
1966
  * Use it to perform custom checks of response data
1935
1967
  *
1936
1968
  * ```js
1937
- * I.seeResponseValidByCallback(({ data, status, expect }) => {
1938
- * expect(status).to.eql(200);
1939
- * expect(data).keys.to.include(['user', 'company']);
1969
+ * I.seeResponseValidByCallback(({ data, status }) => {
1970
+ * assert.strictEqual(status, 200);
1971
+ * assert('user' in data);
1972
+ * assert('company' in data);
1940
1973
  * });
1941
1974
  * ```
1942
1975
  */
@@ -1986,6 +2019,25 @@ declare namespace CodeceptJS {
1986
2019
  * @property [host = "0.0.0.0"] - Mock server host
1987
2020
  * @property [httpsOpts] - key & cert values are the paths to .key and .crt files
1988
2021
  */
2022
+ // @ts-ignore
2023
+ // @ts-ignore
2024
+ // @ts-ignore
2025
+ // @ts-ignore
2026
+ // @ts-ignore
2027
+ // @ts-ignore
2028
+ // @ts-ignore
2029
+ // @ts-ignore
2030
+ // @ts-ignore
2031
+ // @ts-ignore
2032
+ // @ts-ignore
2033
+ // @ts-ignore
2034
+ // @ts-ignore
2035
+ // @ts-ignore
2036
+ // @ts-ignore
2037
+ // @ts-ignore
2038
+ // @ts-ignore
2039
+ // @ts-ignore
2040
+ // @ts-ignore
1989
2041
  type MockServerConfig = {
1990
2042
  port?: number;
1991
2043
  host?: string;
@@ -2110,6 +2162,25 @@ declare namespace CodeceptJS {
2110
2162
  *
2111
2163
  * ## Methods
2112
2164
  */
2165
+ // @ts-ignore
2166
+ // @ts-ignore
2167
+ // @ts-ignore
2168
+ // @ts-ignore
2169
+ // @ts-ignore
2170
+ // @ts-ignore
2171
+ // @ts-ignore
2172
+ // @ts-ignore
2173
+ // @ts-ignore
2174
+ // @ts-ignore
2175
+ // @ts-ignore
2176
+ // @ts-ignore
2177
+ // @ts-ignore
2178
+ // @ts-ignore
2179
+ // @ts-ignore
2180
+ // @ts-ignore
2181
+ // @ts-ignore
2182
+ // @ts-ignore
2183
+ // @ts-ignore
2113
2184
  class MockServer {
2114
2185
  /**
2115
2186
  * Start the mock server
@@ -2898,7 +2969,7 @@ declare namespace CodeceptJS {
2898
2969
  *
2899
2970
  * ```js
2900
2971
  * I.clearCookie();
2901
- * I.clearCookie('test'); // Playwright currently doesn't support clear a particular cookie name
2972
+ * I.clearCookie('test');
2902
2973
  * ```
2903
2974
  * @param [cookie = null] - (optional, `null` by default) cookie name
2904
2975
  */
@@ -3183,6 +3254,25 @@ declare namespace CodeceptJS {
3183
3254
  * @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).
3184
3255
  * @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).
3185
3256
  */
3257
+ // @ts-ignore
3258
+ // @ts-ignore
3259
+ // @ts-ignore
3260
+ // @ts-ignore
3261
+ // @ts-ignore
3262
+ // @ts-ignore
3263
+ // @ts-ignore
3264
+ // @ts-ignore
3265
+ // @ts-ignore
3266
+ // @ts-ignore
3267
+ // @ts-ignore
3268
+ // @ts-ignore
3269
+ // @ts-ignore
3270
+ // @ts-ignore
3271
+ // @ts-ignore
3272
+ // @ts-ignore
3273
+ // @ts-ignore
3274
+ // @ts-ignore
3275
+ // @ts-ignore
3186
3276
  type PlaywrightConfig = {
3187
3277
  url?: string;
3188
3278
  browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
@@ -4536,7 +4626,7 @@ declare namespace CodeceptJS {
4536
4626
  *
4537
4627
  * ```js
4538
4628
  * I.clearCookie();
4539
- * I.clearCookie('test'); // Playwright currently doesn't support clear a particular cookie name
4629
+ * I.clearCookie('test');
4540
4630
  * ```
4541
4631
  * @param [cookie = null] - (optional, `null` by default) cookie name
4542
4632
  */
@@ -6138,7 +6228,7 @@ declare namespace CodeceptJS {
6138
6228
  *
6139
6229
  * ```js
6140
6230
  * I.clearCookie();
6141
- * I.clearCookie('test'); // Playwright currently doesn't support clear a particular cookie name
6231
+ * I.clearCookie('test');
6142
6232
  * ```
6143
6233
  * @param [cookie = null] - (optional, `null` by default) cookie name
6144
6234
  */
@@ -6559,6 +6649,25 @@ declare namespace CodeceptJS {
6559
6649
  * @property [chrome] - pass additional [Puppeteer run options](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions).
6560
6650
  * @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
6561
6651
  */
6652
+ // @ts-ignore
6653
+ // @ts-ignore
6654
+ // @ts-ignore
6655
+ // @ts-ignore
6656
+ // @ts-ignore
6657
+ // @ts-ignore
6658
+ // @ts-ignore
6659
+ // @ts-ignore
6660
+ // @ts-ignore
6661
+ // @ts-ignore
6662
+ // @ts-ignore
6663
+ // @ts-ignore
6664
+ // @ts-ignore
6665
+ // @ts-ignore
6666
+ // @ts-ignore
6667
+ // @ts-ignore
6668
+ // @ts-ignore
6669
+ // @ts-ignore
6670
+ // @ts-ignore
6562
6671
  type PuppeteerConfig = {
6563
6672
  url: string;
6564
6673
  basicAuth?: any;
@@ -7712,7 +7821,7 @@ declare namespace CodeceptJS {
7712
7821
  *
7713
7822
  * ```js
7714
7823
  * I.clearCookie();
7715
- * I.clearCookie('test'); // Playwright currently doesn't support clear a particular cookie name
7824
+ * I.clearCookie('test');
7716
7825
  * ```
7717
7826
  * @param [cookie = null] - (optional, `null` by default) cookie name
7718
7827
  */
@@ -8365,6 +8474,25 @@ declare namespace CodeceptJS {
8365
8474
  * @property [onResponse] - an async function which can update response object.
8366
8475
  * @property [maxUploadFileSize] - set the max content file size in MB when performing api calls.
8367
8476
  */
8477
+ // @ts-ignore
8478
+ // @ts-ignore
8479
+ // @ts-ignore
8480
+ // @ts-ignore
8481
+ // @ts-ignore
8482
+ // @ts-ignore
8483
+ // @ts-ignore
8484
+ // @ts-ignore
8485
+ // @ts-ignore
8486
+ // @ts-ignore
8487
+ // @ts-ignore
8488
+ // @ts-ignore
8489
+ // @ts-ignore
8490
+ // @ts-ignore
8491
+ // @ts-ignore
8492
+ // @ts-ignore
8493
+ // @ts-ignore
8494
+ // @ts-ignore
8495
+ // @ts-ignore
8368
8496
  type RESTConfig = {
8369
8497
  endpoint?: string;
8370
8498
  prettyPrintJson?: boolean;
@@ -9623,7 +9751,7 @@ declare namespace CodeceptJS {
9623
9751
  *
9624
9752
  * ```js
9625
9753
  * I.clearCookie();
9626
- * I.clearCookie('test'); // Playwright currently doesn't support clear a particular cookie name
9754
+ * I.clearCookie('test');
9627
9755
  * ```
9628
9756
  * @param [cookie = null] - (optional, `null` by default) cookie name
9629
9757
  */
@@ -9753,6 +9881,25 @@ declare namespace CodeceptJS {
9753
9881
  * @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
9754
9882
  * @property [logLevel = silent] - level of logging verbosity. Default: silent. Options: trace | debug | info | warn | error | silent. More info: https://webdriver.io/docs/configuration/#loglevel
9755
9883
  */
9884
+ // @ts-ignore
9885
+ // @ts-ignore
9886
+ // @ts-ignore
9887
+ // @ts-ignore
9888
+ // @ts-ignore
9889
+ // @ts-ignore
9890
+ // @ts-ignore
9891
+ // @ts-ignore
9892
+ // @ts-ignore
9893
+ // @ts-ignore
9894
+ // @ts-ignore
9895
+ // @ts-ignore
9896
+ // @ts-ignore
9897
+ // @ts-ignore
9898
+ // @ts-ignore
9899
+ // @ts-ignore
9900
+ // @ts-ignore
9901
+ // @ts-ignore
9902
+ // @ts-ignore
9756
9903
  type WebDriverConfig = {
9757
9904
  url: string;
9758
9905
  browser: string;
@@ -11023,7 +11170,7 @@ declare namespace CodeceptJS {
11023
11170
  *
11024
11171
  * ```js
11025
11172
  * I.clearCookie();
11026
- * I.clearCookie('test'); // Playwright currently doesn't support clear a particular cookie name
11173
+ * I.clearCookie('test');
11027
11174
  * ```
11028
11175
  * @param [cookie = null] - (optional, `null` by default) cookie name
11029
11176
  */