codeceptjs 3.7.6-beta.4 → 4.0.0-beta.10.esm-aria

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 (191) hide show
  1. package/README.md +1 -3
  2. package/bin/codecept.js +51 -53
  3. package/bin/test-server.js +14 -3
  4. package/docs/webapi/click.mustache +5 -1
  5. package/lib/actor.js +15 -11
  6. package/lib/ai.js +72 -107
  7. package/lib/assert/empty.js +9 -8
  8. package/lib/assert/equal.js +15 -17
  9. package/lib/assert/error.js +2 -2
  10. package/lib/assert/include.js +9 -11
  11. package/lib/assert/throws.js +1 -1
  12. package/lib/assert/truth.js +8 -5
  13. package/lib/assert.js +18 -18
  14. package/lib/codecept.js +102 -75
  15. package/lib/colorUtils.js +48 -50
  16. package/lib/command/check.js +32 -27
  17. package/lib/command/configMigrate.js +11 -10
  18. package/lib/command/definitions.js +16 -10
  19. package/lib/command/dryRun.js +16 -16
  20. package/lib/command/generate.js +62 -27
  21. package/lib/command/gherkin/init.js +36 -38
  22. package/lib/command/gherkin/snippets.js +14 -14
  23. package/lib/command/gherkin/steps.js +21 -18
  24. package/lib/command/info.js +8 -8
  25. package/lib/command/init.js +36 -29
  26. package/lib/command/interactive.js +11 -10
  27. package/lib/command/list.js +10 -9
  28. package/lib/command/run-multiple/chunk.js +5 -5
  29. package/lib/command/run-multiple/collection.js +5 -5
  30. package/lib/command/run-multiple/run.js +3 -3
  31. package/lib/command/run-multiple.js +16 -13
  32. package/lib/command/run-rerun.js +6 -7
  33. package/lib/command/run-workers.js +24 -9
  34. package/lib/command/run.js +23 -8
  35. package/lib/command/utils.js +20 -18
  36. package/lib/command/workers/runTests.js +197 -114
  37. package/lib/config.js +124 -51
  38. package/lib/container.js +438 -87
  39. package/lib/data/context.js +6 -5
  40. package/lib/data/dataScenarioConfig.js +1 -1
  41. package/lib/data/dataTableArgument.js +1 -1
  42. package/lib/data/table.js +1 -1
  43. package/lib/effects.js +94 -10
  44. package/lib/element/WebElement.js +2 -2
  45. package/lib/els.js +11 -9
  46. package/lib/event.js +11 -10
  47. package/lib/globals.js +141 -0
  48. package/lib/heal.js +12 -12
  49. package/lib/helper/AI.js +11 -11
  50. package/lib/helper/ApiDataFactory.js +50 -19
  51. package/lib/helper/Appium.js +19 -27
  52. package/lib/helper/FileSystem.js +32 -12
  53. package/lib/helper/GraphQL.js +3 -3
  54. package/lib/helper/GraphQLDataFactory.js +4 -4
  55. package/lib/helper/JSONResponse.js +25 -29
  56. package/lib/helper/Mochawesome.js +7 -4
  57. package/lib/helper/Playwright.js +902 -164
  58. package/lib/helper/Puppeteer.js +383 -76
  59. package/lib/helper/REST.js +29 -12
  60. package/lib/helper/WebDriver.js +268 -61
  61. package/lib/helper/clientscripts/PollyWebDriverExt.js +1 -1
  62. package/lib/helper/errors/ConnectionRefused.js +6 -6
  63. package/lib/helper/errors/ElementAssertion.js +11 -16
  64. package/lib/helper/errors/ElementNotFound.js +5 -9
  65. package/lib/helper/errors/RemoteBrowserConnectionRefused.js +5 -5
  66. package/lib/helper/extras/Console.js +11 -11
  67. package/lib/helper/extras/PlaywrightLocator.js +110 -0
  68. package/lib/helper/extras/PlaywrightPropEngine.js +18 -18
  69. package/lib/helper/extras/PlaywrightReactVueLocator.js +18 -9
  70. package/lib/helper/extras/PlaywrightRestartOpts.js +34 -23
  71. package/lib/helper/extras/Popup.js +1 -1
  72. package/lib/helper/extras/React.js +29 -30
  73. package/lib/helper/network/actions.js +29 -44
  74. package/lib/helper/network/utils.js +76 -83
  75. package/lib/helper/scripts/blurElement.js +6 -6
  76. package/lib/helper/scripts/focusElement.js +6 -6
  77. package/lib/helper/scripts/highlightElement.js +9 -9
  78. package/lib/helper/scripts/isElementClickable.js +34 -34
  79. package/lib/helper.js +2 -1
  80. package/lib/history.js +23 -20
  81. package/lib/hooks.js +10 -10
  82. package/lib/html.js +90 -100
  83. package/lib/index.js +48 -21
  84. package/lib/listener/config.js +19 -12
  85. package/lib/listener/emptyRun.js +6 -7
  86. package/lib/listener/enhancedGlobalRetry.js +6 -6
  87. package/lib/listener/exit.js +4 -3
  88. package/lib/listener/globalRetry.js +5 -5
  89. package/lib/listener/globalTimeout.js +30 -14
  90. package/lib/listener/helpers.js +39 -14
  91. package/lib/listener/mocha.js +3 -4
  92. package/lib/listener/result.js +4 -5
  93. package/lib/listener/retryEnhancer.js +3 -3
  94. package/lib/listener/steps.js +8 -7
  95. package/lib/listener/store.js +3 -3
  96. package/lib/locator.js +213 -192
  97. package/lib/mocha/asyncWrapper.js +105 -62
  98. package/lib/mocha/bdd.js +99 -13
  99. package/lib/mocha/cli.js +59 -26
  100. package/lib/mocha/factory.js +78 -19
  101. package/lib/mocha/featureConfig.js +1 -1
  102. package/lib/mocha/gherkin.js +56 -24
  103. package/lib/mocha/hooks.js +12 -3
  104. package/lib/mocha/index.js +13 -4
  105. package/lib/mocha/inject.js +22 -5
  106. package/lib/mocha/scenarioConfig.js +2 -2
  107. package/lib/mocha/suite.js +9 -2
  108. package/lib/mocha/test.js +10 -7
  109. package/lib/mocha/ui.js +28 -18
  110. package/lib/output.js +10 -8
  111. package/lib/parser.js +44 -44
  112. package/lib/pause.js +15 -16
  113. package/lib/plugin/analyze.js +19 -12
  114. package/lib/plugin/auth.js +20 -21
  115. package/lib/plugin/autoDelay.js +12 -8
  116. package/lib/plugin/coverage.js +28 -11
  117. package/lib/plugin/customLocator.js +3 -3
  118. package/lib/plugin/customReporter.js +3 -2
  119. package/lib/plugin/enhancedRetryFailedStep.js +6 -6
  120. package/lib/plugin/heal.js +14 -9
  121. package/lib/plugin/htmlReporter.js +724 -99
  122. package/lib/plugin/pageInfo.js +10 -10
  123. package/lib/plugin/pauseOnFail.js +4 -3
  124. package/lib/plugin/retryFailedStep.js +48 -5
  125. package/lib/plugin/screenshotOnFail.js +75 -37
  126. package/lib/plugin/stepByStepReport.js +14 -14
  127. package/lib/plugin/stepTimeout.js +4 -3
  128. package/lib/plugin/subtitles.js +6 -5
  129. package/lib/recorder.js +33 -14
  130. package/lib/rerun.js +69 -26
  131. package/lib/result.js +4 -4
  132. package/lib/retryCoordinator.js +2 -2
  133. package/lib/secret.js +18 -17
  134. package/lib/session.js +95 -89
  135. package/lib/step/base.js +7 -7
  136. package/lib/step/comment.js +2 -2
  137. package/lib/step/config.js +1 -1
  138. package/lib/step/func.js +3 -3
  139. package/lib/step/helper.js +3 -3
  140. package/lib/step/meta.js +5 -5
  141. package/lib/step/record.js +11 -11
  142. package/lib/step/retry.js +3 -3
  143. package/lib/step/section.js +3 -3
  144. package/lib/step.js +7 -10
  145. package/lib/steps.js +9 -5
  146. package/lib/store.js +1 -1
  147. package/lib/template/heal.js +1 -1
  148. package/lib/template/prompts/generatePageObject.js +31 -0
  149. package/lib/template/prompts/healStep.js +13 -0
  150. package/lib/template/prompts/writeStep.js +9 -0
  151. package/lib/test-server.js +17 -6
  152. package/lib/timeout.js +1 -7
  153. package/lib/transform.js +8 -8
  154. package/lib/translation.js +32 -18
  155. package/lib/utils/mask_data.js +4 -10
  156. package/lib/utils.js +66 -64
  157. package/lib/workerStorage.js +17 -17
  158. package/lib/workers.js +214 -84
  159. package/package.json +41 -37
  160. package/translations/de-DE.js +2 -2
  161. package/translations/fr-FR.js +2 -2
  162. package/translations/index.js +23 -10
  163. package/translations/it-IT.js +2 -2
  164. package/translations/ja-JP.js +2 -2
  165. package/translations/nl-NL.js +2 -2
  166. package/translations/pl-PL.js +2 -2
  167. package/translations/pt-BR.js +2 -2
  168. package/translations/ru-RU.js +2 -2
  169. package/translations/utils.js +4 -3
  170. package/translations/zh-CN.js +2 -2
  171. package/translations/zh-TW.js +2 -2
  172. package/typings/index.d.ts +5 -3
  173. package/typings/promiseBasedTypes.d.ts +4 -0
  174. package/typings/types.d.ts +4 -0
  175. package/lib/helper/Nightmare.js +0 -1486
  176. package/lib/helper/Protractor.js +0 -1840
  177. package/lib/helper/TestCafe.js +0 -1391
  178. package/lib/helper/clientscripts/nightmare.js +0 -213
  179. package/lib/helper/testcafe/testControllerHolder.js +0 -42
  180. package/lib/helper/testcafe/testcafe-utils.js +0 -61
  181. package/lib/plugin/allure.js +0 -15
  182. package/lib/plugin/autoLogin.js +0 -5
  183. package/lib/plugin/commentStep.js +0 -141
  184. package/lib/plugin/eachElement.js +0 -127
  185. package/lib/plugin/fakerTransform.js +0 -49
  186. package/lib/plugin/retryTo.js +0 -16
  187. package/lib/plugin/selenoid.js +0 -364
  188. package/lib/plugin/standardActingHelpers.js +0 -6
  189. package/lib/plugin/tryTo.js +0 -16
  190. package/lib/plugin/wdio.js +0 -247
  191. package/lib/within.js +0 -90
@@ -1,7 +1,7 @@
1
- const { gherkinTranslations } = require('./utils')
1
+ import { gherkinTranslations } from './utils.js'
2
2
  const langCode = 'it'
3
3
 
4
- module.exports = {
4
+ export default {
5
5
  I: 'io',
6
6
  contexts: {
7
7
  ...gherkinTranslations(langCode),
@@ -1,7 +1,7 @@
1
- const { gherkinTranslations } = require('./utils')
1
+ import { gherkinTranslations } from './utils.js'
2
2
  const langCode = 'ja'
3
3
 
4
- module.exports = {
4
+ export default {
5
5
  I: '私は',
6
6
  contexts: {
7
7
  ...gherkinTranslations(langCode),
@@ -1,7 +1,7 @@
1
- const { gherkinTranslations } = require('./utils')
1
+ import { gherkinTranslations } from './utils.js'
2
2
  const langCode = 'nl'
3
3
 
4
- module.exports = {
4
+ export default {
5
5
  I: 'Ik',
6
6
  contexts: {
7
7
  ...gherkinTranslations(langCode),
@@ -1,7 +1,7 @@
1
- const { gherkinTranslations } = require('./utils')
1
+ import { gherkinTranslations } from './utils.js'
2
2
  const langCode = 'pl'
3
3
 
4
- module.exports = {
4
+ export default {
5
5
  I: 'Ja',
6
6
  contexts: {
7
7
  ...gherkinTranslations(langCode),
@@ -1,7 +1,7 @@
1
- const { gherkinTranslations } = require('./utils')
1
+ import { gherkinTranslations } from './utils.js'
2
2
  const langCode = 'pt'
3
3
 
4
- module.exports = {
4
+ export default {
5
5
  I: 'Eu',
6
6
  contexts: {
7
7
  ...gherkinTranslations(langCode),
@@ -1,7 +1,7 @@
1
- const { gherkinTranslations } = require('./utils')
1
+ import { gherkinTranslations } from './utils.js'
2
2
  const langCode = 'ru'
3
3
 
4
- module.exports = {
4
+ export default {
5
5
  I: 'Я',
6
6
  contexts: {
7
7
  ...gherkinTranslations(langCode),
@@ -1,6 +1,7 @@
1
- module.exports.gherkinTranslations = function (langCode) {
2
- const gherkinLanguages = require('@cucumber/gherkin/src/gherkin-languages.json')
3
- const { feature, scenario, scenarioOutline } = gherkinLanguages[langCode]
1
+ import { dialects } from '@cucumber/gherkin'
2
+
3
+ export function gherkinTranslations(langCode) {
4
+ const { feature, scenario, scenarioOutline } = dialects[langCode]
4
5
  return {
5
6
  Feature: feature[0],
6
7
  Scenario: scenario[0],
@@ -1,7 +1,7 @@
1
- const { gherkinTranslations } = require('./utils')
1
+ import { gherkinTranslations } from './utils.js'
2
2
  const langCode = 'zh-CN'
3
3
 
4
- module.exports = {
4
+ export default {
5
5
  I: '我',
6
6
  contexts: {
7
7
  ...gherkinTranslations(langCode),
@@ -1,7 +1,7 @@
1
- const { gherkinTranslations } = require('./utils')
1
+ import { gherkinTranslations } from './utils.js'
2
2
  const langCode = 'zh-TW'
3
3
 
4
- module.exports = {
4
+ export default {
5
5
  I: '我',
6
6
  contexts: {
7
7
  ...gherkinTranslations(langCode),
@@ -518,6 +518,8 @@ declare namespace CodeceptJS {
518
518
  interface HookConfig {
519
519
  retry(retries?: number): HookConfig
520
520
  }
521
+
522
+ function addStep(step: string, fn: Function): Promise<void>
521
523
  }
522
524
 
523
525
  type TryTo = <T>(fn: () => Promise<T> | T) => Promise<T | false>
@@ -540,7 +542,7 @@ declare const within: typeof CodeceptJS.within
540
542
  declare const session: typeof CodeceptJS.session
541
543
  declare const DataTable: typeof CodeceptJS.DataTable
542
544
  declare const DataTableArgument: typeof CodeceptJS.DataTableArgument
543
- declare const codeceptjs: typeof CodeceptJS.index
545
+ declare const codeceptjs: typeof CodeceptJS
544
546
  declare const locate: typeof CodeceptJS.Locator.build
545
547
  declare function inject(): CodeceptJS.SupportObject
546
548
  declare function inject<T extends keyof CodeceptJS.SupportObject>(name: T): CodeceptJS.SupportObject[T]
@@ -634,11 +636,11 @@ declare namespace Mocha {
634
636
  }
635
637
 
636
638
  declare module 'codeceptjs' {
637
- export = codeceptjs
639
+ export default codeceptjs
638
640
  }
639
641
 
640
642
  declare module '@codeceptjs/helper' {
641
- export = CodeceptJS.Helper
643
+ export default CodeceptJS.Helper
642
644
  }
643
645
 
644
646
  declare module 'codeceptjs/effects' {
@@ -2741,6 +2741,7 @@ declare namespace CodeceptJS {
2741
2741
  * May include session cookies, auth tokens, localStorage and (if captured with
2742
2742
  * `grabStorageState({ indexedDB: true })`) IndexedDB data; treat as sensitive and do not commit.
2743
2743
  */
2744
+ // @ts-ignore
2744
2745
  type PlaywrightConfig = {
2745
2746
  url?: string;
2746
2747
  browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
@@ -6140,6 +6141,7 @@ declare namespace CodeceptJS {
6140
6141
  * @property [chrome] - pass additional [Puppeteer run options](https://github.com/puppeteer/puppeteer/blob/main/docs/api/puppeteer.launchoptions.md).
6141
6142
  * @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
6142
6143
  */
6144
+ // @ts-ignore
6143
6145
  type PuppeteerConfig = {
6144
6146
  url: string;
6145
6147
  basicAuth?: any;
@@ -7984,6 +7986,7 @@ declare namespace CodeceptJS {
7984
7986
  * @property [onResponse] - an async function which can update response object.
7985
7987
  * @property [maxUploadFileSize] - set the max content file size in MB when performing api calls.
7986
7988
  */
7989
+ // @ts-ignore
7987
7990
  type RESTConfig = {
7988
7991
  endpoint?: string;
7989
7992
  prettyPrintJson?: boolean;
@@ -9139,6 +9142,7 @@ declare namespace CodeceptJS {
9139
9142
  * @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
9140
9143
  * @property [logLevel = silent] - level of logging verbosity. Default: silent. Options: trace | debug | info | warn | error | silent. More info: https://webdriver.io/docs/configuration/#loglevel
9141
9144
  */
9145
+ // @ts-ignore
9142
9146
  type WebDriverConfig = {
9143
9147
  url: string;
9144
9148
  browser: string;
@@ -2831,6 +2831,7 @@ declare namespace CodeceptJS {
2831
2831
  * May include session cookies, auth tokens, localStorage and (if captured with
2832
2832
  * `grabStorageState({ indexedDB: true })`) IndexedDB data; treat as sensitive and do not commit.
2833
2833
  */
2834
+ // @ts-ignore
2834
2835
  type PlaywrightConfig = {
2835
2836
  url?: string;
2836
2837
  browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
@@ -6381,6 +6382,7 @@ declare namespace CodeceptJS {
6381
6382
  * @property [chrome] - pass additional [Puppeteer run options](https://github.com/puppeteer/puppeteer/blob/main/docs/api/puppeteer.launchoptions.md).
6382
6383
  * @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
6383
6384
  */
6385
+ // @ts-ignore
6384
6386
  type PuppeteerConfig = {
6385
6387
  url: string;
6386
6388
  basicAuth?: any;
@@ -8361,6 +8363,7 @@ declare namespace CodeceptJS {
8361
8363
  * @property [onResponse] - an async function which can update response object.
8362
8364
  * @property [maxUploadFileSize] - set the max content file size in MB when performing api calls.
8363
8365
  */
8366
+ // @ts-ignore
8364
8367
  type RESTConfig = {
8365
8368
  endpoint?: string;
8366
8369
  prettyPrintJson?: boolean;
@@ -9576,6 +9579,7 @@ declare namespace CodeceptJS {
9576
9579
  * @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
9577
9580
  * @property [logLevel = silent] - level of logging verbosity. Default: silent. Options: trace | debug | info | warn | error | silent. More info: https://webdriver.io/docs/configuration/#loglevel
9578
9581
  */
9582
+ // @ts-ignore
9579
9583
  type WebDriverConfig = {
9580
9584
  url: string;
9581
9585
  browser: string;