codeceptjs 4.2.2 → 4.2.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 (74) hide show
  1. package/README.md +4 -4
  2. package/docs/ai.md +1 -1
  3. package/docs/alternative-browsers.md +4 -4
  4. package/docs/api.md +13 -13
  5. package/docs/assertions.md +6 -6
  6. package/docs/best.md +1 -1
  7. package/docs/bootstrap.md +1 -1
  8. package/docs/data.md +8 -8
  9. package/docs/element-selection.md +27 -4
  10. package/docs/helpers/ApiDataFactory.md +2 -2
  11. package/docs/helpers/Appium.md +56 -56
  12. package/docs/helpers/Decision.md +1 -1
  13. package/docs/helpers/Detox.md +1 -1
  14. package/docs/helpers/ExpectHelper.md +1 -1
  15. package/docs/helpers/FileSystem.md +1 -1
  16. package/docs/helpers/GraphQL.md +1 -1
  17. package/docs/helpers/GraphQLDataFactory.md +2 -2
  18. package/docs/helpers/JSONResponse.md +1 -1
  19. package/docs/helpers/Kitesurf.md +65 -65
  20. package/docs/helpers/Lightpanda.md +65 -65
  21. package/docs/helpers/MockRequest.md +1 -1
  22. package/docs/helpers/Moli.md +65 -65
  23. package/docs/helpers/Obscura.md +65 -65
  24. package/docs/helpers/Playwright.md +127 -127
  25. package/docs/helpers/Puppeteer.md +88 -88
  26. package/docs/helpers/REST.md +1 -1
  27. package/docs/helpers/WebDriver.md +87 -87
  28. package/docs/installation.md +1 -1
  29. package/docs/locators.md +5 -7
  30. package/docs/migration-4.md +7 -3
  31. package/docs/mobile.md +2 -2
  32. package/docs/parallel.md +1 -1
  33. package/docs/playwright.md +5 -5
  34. package/docs/plugins/aiTrace.md +1 -1
  35. package/docs/plugins/autoDelay.md +1 -1
  36. package/docs/plugins/customLocator.md +1 -1
  37. package/docs/plugins/customReporter.md +1 -1
  38. package/docs/plugins/junitReporter.md +2 -2
  39. package/docs/plugins/pageInfo.md +1 -1
  40. package/docs/plugins/pauseOnFail.md +1 -1
  41. package/docs/plugins/retryFailedStep.md +1 -1
  42. package/docs/plugins/screenshotOnFail.md +1 -1
  43. package/docs/plugins/stepTimeout.md +1 -1
  44. package/docs/plugins.md +10 -10
  45. package/docs/puppeteer.md +4 -4
  46. package/docs/retry.md +1 -1
  47. package/docs/timeouts.md +7 -7
  48. package/docs/webdriver.md +8 -8
  49. package/lib/actor.js +20 -2
  50. package/lib/aria.js +1 -0
  51. package/lib/codecept.js +1 -1
  52. package/lib/data/context.js +24 -0
  53. package/lib/element/WebElement.js +5 -5
  54. package/lib/helper/ApiDataFactory.js +1 -1
  55. package/lib/helper/Appium.js +2 -2
  56. package/lib/helper/GraphQLDataFactory.js +1 -1
  57. package/lib/helper/Playwright.js +22 -12
  58. package/lib/helper/Puppeteer.js +5 -11
  59. package/lib/mocha/asyncWrapper.js +14 -3
  60. package/lib/mocha/test.js +1 -0
  61. package/lib/plugin/auth.js +3 -0
  62. package/lib/plugin/junitReporter.js +21 -12
  63. package/lib/recorder.js +22 -3
  64. package/lib/step/base.js +8 -1
  65. package/lib/step/func.js +1 -1
  66. package/lib/step/helper.js +1 -1
  67. package/lib/step/record.js +22 -17
  68. package/lib/step/retry.js +13 -6
  69. package/lib/utils/typescript.js +86 -12
  70. package/lib/workers.js +15 -0
  71. package/package.json +2 -1
  72. package/typings/index.d.ts +12 -0
  73. package/typings/promiseBasedTypes.d.ts +696 -351
  74. package/typings/types.d.ts +485 -352
package/lib/workers.js CHANGED
@@ -104,9 +104,22 @@ const createWorker = (workerObject, isPoolMode = false, skipTests = []) => {
104
104
  })
105
105
 
106
106
  WorkerStorage.addWorker(worker)
107
+ worker.runOutputDir = workerObject.runOutputDir
107
108
  return worker
108
109
  }
109
110
 
111
+ const tagWithRun = (message, runOutputDir) => {
112
+ if (!message.event || !message.data || typeof message.data !== 'object') return
113
+ const runName = path.basename(runOutputDir)
114
+ const tag = obj => {
115
+ if (!obj || typeof obj !== 'object' || obj.outputDir) return
116
+ obj.outputDir = runOutputDir
117
+ if (obj.uid) obj.uid = `${obj.uid}@${runName}`
118
+ }
119
+ tag(message.data)
120
+ if (Array.isArray(message.data.tests)) message.data.tests.forEach(tag)
121
+ }
122
+
110
123
  const simplifyObject = object => {
111
124
  return Object.keys(object)
112
125
  .filter(k => k.indexOf('_') !== 0)
@@ -169,6 +182,7 @@ const createWorkerObjects = (testGroups, config, testRoot, options, selectedRuns
169
182
  workerObj.addTests(tests)
170
183
  workerObj.setTestRoot(testRoot)
171
184
  workerObj.addOptions(options)
185
+ workerObj.runOutputDir = path.resolve(testRoot, finalConfig.output)
172
186
  testWorkerArray.push(workerObj)
173
187
  })
174
188
  workers.push(...testWorkerArray)
@@ -659,6 +673,7 @@ class Workers extends EventEmitter {
659
673
 
660
674
  worker.on('message', message => {
661
675
  lastActivity = Date.now() // Update activity timestamp
676
+ if (worker.runOutputDir) tagWithRun(message, worker.runOutputDir)
662
677
 
663
678
  // Track current test
664
679
  if (message.event === event.test.started && message.data) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeceptjs",
3
- "version": "4.2.2",
3
+ "version": "4.2.4",
4
4
  "type": "module",
5
5
  "description": "Supercharged End 2 End Testing Framework for NodeJS",
6
6
  "keywords": [
@@ -97,6 +97,7 @@
97
97
  "@cucumber/cucumber-expressions": "18",
98
98
  "@cucumber/gherkin": "38.0.0",
99
99
  "@cucumber/messages": "32.3.1",
100
+ "@jridgewell/trace-mapping": "^0.3.31",
100
101
  "@modelcontextprotocol/sdk": "^1.26.0",
101
102
  "@xmldom/xmldom": "^0.9.12",
102
103
  "acorn": "8.15.0",
@@ -527,6 +527,18 @@ declare namespace CodeceptJS {
527
527
 
528
528
  type StringOrSecret = string | CodeceptJS.Secret
529
529
 
530
+ interface StepPromise extends Promise<any> {
531
+ stepConfig(config: CodeceptJS.StepConfig): this
532
+ timeout(seconds: number): this
533
+ retry(retry: number | object): this
534
+ }
535
+
536
+ interface ElementStepPromise extends StepPromise {
537
+ first(): this
538
+ last(): this
539
+ at(position: number): this
540
+ }
541
+
530
542
  interface GherkinCallback {
531
543
  (test: Test): void | Promise<void>
532
544
  }