codeceptjs 3.7.6-beta.1 → 3.7.6-beta.3

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.
@@ -103,12 +103,12 @@ module.exports = function (config) {
103
103
  // Method 1: Check retryNum property (most reliable)
104
104
  if (test.retryNum && test.retryNum > 0) {
105
105
  testRetryAttempts.set(testId, test.retryNum)
106
- output.print(`HTML Reporter: Retry count detected (retryNum) for ${test.title}, attempts: ${test.retryNum}`)
106
+ output.debug(`HTML Reporter: Retry count detected (retryNum) for ${test.title}, attempts: ${test.retryNum}`)
107
107
  }
108
108
  // Method 2: Check currentRetry property
109
109
  else if (test.currentRetry && test.currentRetry > 0) {
110
110
  testRetryAttempts.set(testId, test.currentRetry)
111
- output.print(`HTML Reporter: Retry count detected (currentRetry) for ${test.title}, attempts: ${test.currentRetry}`)
111
+ output.debug(`HTML Reporter: Retry count detected (currentRetry) for ${test.title}, attempts: ${test.currentRetry}`)
112
112
  }
113
113
  // Method 3: Check if this is a retried test
114
114
  else if (test.retriedTest && test.retriedTest()) {
@@ -119,12 +119,12 @@ module.exports = function (config) {
119
119
  } else {
120
120
  testRetryAttempts.set(originalTestId, testRetryAttempts.get(originalTestId) + 1)
121
121
  }
122
- output.print(`HTML Reporter: Retry detected (retriedTest) for ${originalTest.title}, attempts: ${testRetryAttempts.get(originalTestId)}`)
122
+ output.debug(`HTML Reporter: Retry detected (retriedTest) for ${originalTest.title}, attempts: ${testRetryAttempts.get(originalTestId)}`)
123
123
  }
124
124
  // Method 4: Check if test has been seen before (indicating a retry)
125
125
  else if (reportData.tests.some(t => t.id === testId)) {
126
126
  testRetryAttempts.set(testId, 1) // First retry detected
127
- output.print(`HTML Reporter: Retry detected (duplicate test) for ${test.title}, attempts: 1`)
127
+ output.debug(`HTML Reporter: Retry detected (duplicate test) for ${test.title}, attempts: 1`)
128
128
  }
129
129
  }
130
130
  })
@@ -196,20 +196,20 @@ module.exports = function (config) {
196
196
  if (test.retryNum && test.retryNum > 0) {
197
197
  retryAttempts = test.retryNum
198
198
  testRetryAttempts.set(testId, retryAttempts)
199
- output.print(`HTML Reporter: Late retry detection (retryNum) for ${test.title}, attempts: ${retryAttempts}`)
199
+ output.debug(`HTML Reporter: Late retry detection (retryNum) for ${test.title}, attempts: ${retryAttempts}`)
200
200
  } else if (test.currentRetry && test.currentRetry > 0) {
201
201
  retryAttempts = test.currentRetry
202
202
  testRetryAttempts.set(testId, retryAttempts)
203
- output.print(`HTML Reporter: Late retry detection (currentRetry) for ${test.title}, attempts: ${retryAttempts}`)
203
+ output.debug(`HTML Reporter: Late retry detection (currentRetry) for ${test.title}, attempts: ${retryAttempts}`)
204
204
  } else if (test._retries && test._retries > 0) {
205
205
  retryAttempts = test._retries
206
206
  testRetryAttempts.set(testId, retryAttempts)
207
- output.print(`HTML Reporter: Late retry detection (_retries) for ${test.title}, attempts: ${retryAttempts}`)
207
+ output.debug(`HTML Reporter: Late retry detection (_retries) for ${test.title}, attempts: ${retryAttempts}`)
208
208
  }
209
209
  }
210
210
 
211
211
  // Debug logging
212
- output.print(`HTML Reporter: Test finished - ${test.title}, State: ${test.state}, Retries: ${retryAttempts}`)
212
+ output.debug(`HTML Reporter: Test finished - ${test.title}, State: ${test.state}, Retries: ${retryAttempts}`)
213
213
 
214
214
  // Detect if this is a BDD/Gherkin test
215
215
  const isBddTest = isBddGherkinTest(test, currentSuite)
@@ -222,7 +222,7 @@ module.exports = function (config) {
222
222
  const currentlyFailed = test.state === 'failed'
223
223
 
224
224
  // Debug artifacts collection (but don't process them yet - screenshots may not be ready)
225
- output.print(`HTML Reporter: Test ${test.title} artifacts at test.finished: ${JSON.stringify(test.artifacts)}`)
225
+ output.debug(`HTML Reporter: Test ${test.title} artifacts at test.finished: ${JSON.stringify(test.artifacts)}`)
226
226
 
227
227
  const testData = {
228
228
  ...test,
@@ -244,11 +244,11 @@ module.exports = function (config) {
244
244
  if (existingTestIndex >= 0) {
245
245
  // Update existing test with final result (including failed state)
246
246
  reportData.tests[existingTestIndex] = testData
247
- output.print(`HTML Reporter: Updated existing test - ${test.title}, Final state: ${test.state}`)
247
+ output.debug(`HTML Reporter: Updated existing test - ${test.title}, Final state: ${test.state}`)
248
248
  } else {
249
249
  // Add new test
250
250
  reportData.tests.push(testData)
251
- output.print(`HTML Reporter: Added new test - ${test.title}, State: ${test.state}`)
251
+ output.debug(`HTML Reporter: Added new test - ${test.title}, State: ${test.state}`)
252
252
  }
253
253
 
254
254
  // Track retry information - only add if there were actual retries AND the test failed at some point
@@ -262,7 +262,7 @@ module.exports = function (config) {
262
262
  if (retryAttempts === 0 && existingRetryIndex >= 0) {
263
263
  retryAttempts = reportData.retries[existingRetryIndex].attempts + 1
264
264
  testRetryAttempts.set(testId, retryAttempts)
265
- output.print(`HTML Reporter: Incremented retry count for duplicate test ${test.title}, attempts: ${retryAttempts}`)
265
+ output.debug(`HTML Reporter: Incremented retry count for duplicate test ${test.title}, attempts: ${retryAttempts}`)
266
266
  }
267
267
 
268
268
  // Remove existing retry info for this test and add updated one
@@ -274,7 +274,7 @@ module.exports = function (config) {
274
274
  finalState: test.state,
275
275
  duration: test.duration || 0,
276
276
  })
277
- output.print(`HTML Reporter: Added retry info for ${test.title}, attempts: ${retryAttempts}, state: ${test.state}`)
277
+ output.debug(`HTML Reporter: Added retry info for ${test.title}, attempts: ${retryAttempts}, state: ${test.state}`)
278
278
  }
279
279
 
280
280
  // Fallback: If this test already exists and either failed before or is failing now, it's a retry
@@ -288,7 +288,7 @@ module.exports = function (config) {
288
288
  finalState: test.state,
289
289
  duration: test.duration || 0,
290
290
  })
291
- output.print(`HTML Reporter: Fallback retry detection for failed test ${test.title}, attempts: ${fallbackAttempts}`)
291
+ output.debug(`HTML Reporter: Fallback retry detection for failed test ${test.title}, attempts: ${fallbackAttempts}`)
292
292
  }
293
293
  })
294
294
 
@@ -298,40 +298,40 @@ module.exports = function (config) {
298
298
  reportData.duration = reportData.endTime - reportData.startTime
299
299
 
300
300
  // Process artifacts now that all async tasks (including screenshots) are complete
301
- output.print(`HTML Reporter: Processing artifacts for ${reportData.tests.length} tests after all async tasks complete`)
301
+ output.debug(`HTML Reporter: Processing artifacts for ${reportData.tests.length} tests after all async tasks complete`)
302
302
 
303
303
  reportData.tests.forEach(test => {
304
304
  const originalArtifacts = test.artifacts
305
305
  let collectedArtifacts = []
306
306
 
307
- output.print(`HTML Reporter: Processing test "${test.title}" (ID: ${test.id})`)
308
- output.print(`HTML Reporter: Test ${test.title} final artifacts: ${JSON.stringify(originalArtifacts)}`)
307
+ output.debug(`HTML Reporter: Processing test "${test.title}" (ID: ${test.id})`)
308
+ output.debug(`HTML Reporter: Test ${test.title} final artifacts: ${JSON.stringify(originalArtifacts)}`)
309
309
 
310
310
  if (originalArtifacts) {
311
311
  if (Array.isArray(originalArtifacts)) {
312
312
  collectedArtifacts = originalArtifacts
313
- output.print(`HTML Reporter: Using array artifacts: ${collectedArtifacts.length} items`)
313
+ output.debug(`HTML Reporter: Using array artifacts: ${collectedArtifacts.length} items`)
314
314
  } else if (typeof originalArtifacts === 'object') {
315
315
  // Convert object properties to array (screenshotOnFail plugin format)
316
316
  collectedArtifacts = Object.values(originalArtifacts).filter(artifact => artifact)
317
- output.print(`HTML Reporter: Converted artifacts object to array: ${collectedArtifacts.length} items`)
318
- output.print(`HTML Reporter: Converted artifacts: ${JSON.stringify(collectedArtifacts)}`)
317
+ output.debug(`HTML Reporter: Converted artifacts object to array: ${collectedArtifacts.length} items`)
318
+ output.debug(`HTML Reporter: Converted artifacts: ${JSON.stringify(collectedArtifacts)}`)
319
319
  }
320
320
  }
321
321
 
322
322
  // Only use filesystem fallback if no artifacts found from screenshotOnFail plugin
323
323
  if (collectedArtifacts.length === 0 && test.state === 'failed') {
324
- output.print(`HTML Reporter: No artifacts from plugin, trying filesystem for test "${test.title}"`)
324
+ output.debug(`HTML Reporter: No artifacts from plugin, trying filesystem for test "${test.title}"`)
325
325
  collectedArtifacts = collectScreenshotsFromFilesystem(test, test.id)
326
- output.print(`HTML Reporter: Collected ${collectedArtifacts.length} screenshots from filesystem for failed test "${test.title}"`)
326
+ output.debug(`HTML Reporter: Collected ${collectedArtifacts.length} screenshots from filesystem for failed test "${test.title}"`)
327
327
  if (collectedArtifacts.length > 0) {
328
- output.print(`HTML Reporter: Filesystem screenshots for "${test.title}": ${JSON.stringify(collectedArtifacts)}`)
328
+ output.debug(`HTML Reporter: Filesystem screenshots for "${test.title}": ${JSON.stringify(collectedArtifacts)}`)
329
329
  }
330
330
  }
331
331
 
332
332
  // Update test with processed artifacts
333
333
  test.artifacts = collectedArtifacts
334
- output.print(`HTML Reporter: Final artifacts for "${test.title}": ${JSON.stringify(test.artifacts)}`)
334
+ output.debug(`HTML Reporter: Final artifacts for "${test.title}": ${JSON.stringify(test.artifacts)}`)
335
335
  })
336
336
 
337
337
  // Calculate stats from our collected test data instead of using result.stats
@@ -384,19 +384,19 @@ module.exports = function (config) {
384
384
  }
385
385
 
386
386
  // Debug logging for final stats
387
- output.print(`HTML Reporter: Calculated stats - Tests: ${reportData.stats.tests}, Passes: ${reportData.stats.passes}, Failures: ${reportData.stats.failures}`)
388
- output.print(`HTML Reporter: Collected ${reportData.tests.length} tests in reportData`)
389
- output.print(`HTML Reporter: Failures array has ${reportData.failures.length} items`)
390
- output.print(`HTML Reporter: Retries array has ${reportData.retries.length} items`)
391
- output.print(`HTML Reporter: testRetryAttempts Map size: ${testRetryAttempts.size}`)
387
+ output.debug(`HTML Reporter: Calculated stats - Tests: ${reportData.stats.tests}, Passes: ${reportData.stats.passes}, Failures: ${reportData.stats.failures}`)
388
+ output.debug(`HTML Reporter: Collected ${reportData.tests.length} tests in reportData`)
389
+ output.debug(`HTML Reporter: Failures array has ${reportData.failures.length} items`)
390
+ output.debug(`HTML Reporter: Retries array has ${reportData.retries.length} items`)
391
+ output.debug(`HTML Reporter: testRetryAttempts Map size: ${testRetryAttempts.size}`)
392
392
 
393
393
  // Log retry attempts map contents
394
394
  for (const [testId, attempts] of testRetryAttempts.entries()) {
395
- output.print(`HTML Reporter: testRetryAttempts - ${testId}: ${attempts} attempts`)
395
+ output.debug(`HTML Reporter: testRetryAttempts - ${testId}: ${attempts} attempts`)
396
396
  }
397
397
 
398
398
  reportData.tests.forEach(test => {
399
- output.print(`HTML Reporter: Test in reportData - ${test.title}, State: ${test.state}, Retries: ${test.retryAttempts}`)
399
+ output.debug(`HTML Reporter: Test in reportData - ${test.title}, State: ${test.state}, Retries: ${test.retryAttempts}`)
400
400
  })
401
401
 
402
402
  // Check if running with workers
package/lib/result.js CHANGED
@@ -3,22 +3,21 @@ const path = require('path')
3
3
  const { serializeTest } = require('./mocha/test')
4
4
 
5
5
  /**
6
- * Result of the test run
7
- *
8
- * @typedef {Object} Stats
9
- * @property {number} passes
10
- * @property {number} failures
11
- * @property {number} tests
12
- * @property {number} pending
13
- * @property {number} failedHooks
14
- * @property {Date} start
15
- * @property {Date} end
16
- * @property {number} duration
6
+ * @typedef {Object} Stats Statistics for a test result.
7
+ * @property {number} passes Number of passed tests.
8
+ * @property {number} failures Number of failed tests.
9
+ * @property {number} tests Total number of tests.
10
+ * @property {number} pending Number of pending tests.
11
+ * @property {number} failedHooks Number of failed hooks.
12
+ * @property {Date} start Start time of the test run.
13
+ * @property {Date} end End time of the test run.
14
+ * @property {number} duration Duration of the test run, in milliseconds.
15
+ */
16
+
17
+ /**
18
+ * Result of a test run. Will be emitted for example in "event.all.result" events.
17
19
  */
18
20
  class Result {
19
- /**
20
- * Create Result of the test run
21
- */
22
21
  constructor() {
23
22
  this._startTime = new Date()
24
23
  this._endTime = null
@@ -27,6 +26,9 @@ class Result {
27
26
  this.start()
28
27
  }
29
28
 
29
+ /**
30
+ * Resets all collected stats, tests, and failure reports.
31
+ */
30
32
  reset() {
31
33
  this._stats = {
32
34
  passes: 0,
@@ -39,43 +41,85 @@ class Result {
39
41
  duration: 0,
40
42
  }
41
43
 
42
- /** @type {CodeceptJS.Test[]} */
44
+ /**
45
+ * @type {CodeceptJS.Test[]}
46
+ * @private
47
+ */
43
48
  this._tests = []
44
49
 
45
- /** @type {String[]} */
50
+ /**
51
+ * @type {string[][]}
52
+ * @private
53
+ */
46
54
  this._failures = []
47
55
  }
48
56
 
57
+ /**
58
+ * Sets the start time to the current time.
59
+ */
49
60
  start() {
50
61
  this._startTime = new Date()
51
62
  }
52
63
 
64
+ /**
65
+ * Sets the end time to the current time.
66
+ */
53
67
  finish() {
54
68
  this._endTime = new Date()
55
69
  }
56
70
 
71
+ /**
72
+ * Whether this result contains any failed tests.
73
+ *
74
+ * @type {boolean}
75
+ * @readonly
76
+ */
57
77
  get hasFailed() {
58
78
  return this._stats.failures > 0
59
79
  }
60
80
 
81
+ /**
82
+ * All collected tests.
83
+ *
84
+ * @type {CodeceptJS.Test[]}
85
+ * @readonly
86
+ */
61
87
  get tests() {
62
88
  return this._tests
63
89
  }
64
90
 
91
+ /**
92
+ * The failure reports (array of strings per failed test).
93
+ *
94
+ * @type {string[][]}
95
+ * @readonly
96
+ */
65
97
  get failures() {
66
98
  return this._failures.filter(f => f && (!Array.isArray(f) || f.length > 0))
67
99
  }
68
100
 
101
+ /**
102
+ * The test statistics.
103
+ *
104
+ * @type {Stats}
105
+ * @readonly
106
+ */
69
107
  get stats() {
70
108
  return this._stats
71
109
  }
72
110
 
111
+ /**
112
+ * The start time of the test run.
113
+ *
114
+ * @type {Date}
115
+ * @readonly
116
+ */
73
117
  get startTime() {
74
118
  return this._startTime
75
119
  }
76
120
 
77
121
  /**
78
- * Add test to result
122
+ * Adds a test to this result.
79
123
  *
80
124
  * @param {CodeceptJS.Test} test
81
125
  */
@@ -90,34 +134,67 @@ class Result {
90
134
  }
91
135
 
92
136
  /**
93
- * Add failures to result
137
+ * Adds failure reports to this result.
94
138
  *
95
- * @param {String[]} newFailures
139
+ * @param {string[][]} newFailures
96
140
  */
97
141
  addFailures(newFailures) {
98
142
  this._failures.push(...newFailures)
99
143
  }
100
144
 
145
+ /**
146
+ * Whether this result contains any failed tests.
147
+ *
148
+ * @type {boolean}
149
+ * @readonly
150
+ */
101
151
  get hasFailures() {
102
152
  return this.stats.failures > 0
103
153
  }
104
154
 
155
+ /**
156
+ * The duration of the test run, in milliseconds.
157
+ *
158
+ * @type {number}
159
+ * @readonly
160
+ */
105
161
  get duration() {
106
162
  return this._endTime ? +this._endTime - +this._startTime : 0
107
163
  }
108
164
 
165
+ /**
166
+ * All failed tests.
167
+ *
168
+ * @type {CodeceptJS.Test[]}
169
+ * readonly
170
+ */
109
171
  get failedTests() {
110
172
  return this._tests.filter(test => test.state === 'failed')
111
173
  }
112
174
 
175
+ /**
176
+ * All passed tests.
177
+ *
178
+ * @type {CodeceptJS.Test[]}
179
+ * @readonly
180
+ */
113
181
  get passedTests() {
114
182
  return this._tests.filter(test => test.state === 'passed')
115
183
  }
116
184
 
185
+ /**
186
+ * All skipped tests.
187
+ *
188
+ * @type {CodeceptJS.Test[]}
189
+ * @readonly
190
+ */
117
191
  get skippedTests() {
118
192
  return this._tests.filter(test => test.state === 'skipped' || test.state === 'pending')
119
193
  }
120
194
 
195
+ /**
196
+ * @returns {object} The JSON representation of this result.
197
+ */
121
198
  simplify() {
122
199
  return {
123
200
  hasFailed: this.hasFailed,
@@ -129,9 +206,9 @@ class Result {
129
206
  }
130
207
 
131
208
  /**
132
- * Save result to json file
209
+ * Saves this result to a JSON file.
133
210
  *
134
- * @param {string} fileName
211
+ * @param {string} [fileName] Path to the JSON file, relative to `output_dir`. Defaults to "result.json".
135
212
  */
136
213
  save(fileName) {
137
214
  if (!fileName) fileName = 'result.json'
@@ -139,9 +216,9 @@ class Result {
139
216
  }
140
217
 
141
218
  /**
142
- * Add stats to result
219
+ * Adds stats to this result.
143
220
  *
144
- * @param {object} newStats
221
+ * @param {Partial<Stats>} [newStats]
145
222
  */
146
223
  addStats(newStats = {}) {
147
224
  this._stats.passes += newStats.passes || 0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeceptjs",
3
- "version": "3.7.6-beta.1",
3
+ "version": "3.7.6-beta.3",
4
4
  "description": "Supercharged End 2 End Testing Framework for NodeJS",
5
5
  "keywords": [
6
6
  "acceptance",
@@ -96,7 +96,7 @@
96
96
  "cross-spawn": "7.0.6",
97
97
  "css-to-xpath": "0.1.0",
98
98
  "csstoxpath": "1.6.0",
99
- "envinfo": "7.14.0",
99
+ "envinfo": "7.15.0",
100
100
  "escape-string-regexp": "4.0.0",
101
101
  "figures": "3.2.0",
102
102
  "fn-args": "4.0.0",
@@ -138,7 +138,7 @@
138
138
  "@pollyjs/core": "6.0.6",
139
139
  "@types/chai": "5.2.2",
140
140
  "@types/inquirer": "9.0.9",
141
- "@types/node": "24.5.2",
141
+ "@types/node": "^24.6.0",
142
142
  "@wdio/sauce-service": "9.12.5",
143
143
  "@wdio/selenium-standalone-service": "8.15.0",
144
144
  "@wdio/utils": "9.19.2",
@@ -147,11 +147,11 @@
147
147
  "chai-as-promised": "7.1.2",
148
148
  "chai-subset": "1.6.0",
149
149
  "documentation": "14.0.3",
150
- "electron": "38.1.2",
150
+ "electron": "38.2.0",
151
151
  "eslint": "^9.36.0",
152
152
  "eslint-plugin-import": "2.32.0",
153
153
  "eslint-plugin-mocha": "11.1.0",
154
- "expect": "30.1.2",
154
+ "expect": "30.2.0",
155
155
  "express": "^5.1.0",
156
156
  "globals": "16.4.0",
157
157
  "graphql": "16.11.0",
@@ -97,7 +97,7 @@ declare namespace CodeceptJS {
97
97
  * tests: 'tests/**.test.ts'
98
98
  * ```
99
99
  */
100
- tests: string
100
+ tests: string | string[]
101
101
  /**
102
102
  * Where to store failure screenshots, artifacts, etc
103
103
  *
@@ -520,17 +520,16 @@ declare namespace CodeceptJS {
520
520
  }
521
521
  }
522
522
 
523
- type TryTo = <T>(fn: () => Promise<T> | T) => Promise<T | false>;
524
- type HopeThat = <T>(fn: () => Promise<T> | T) => Promise<T | false>;
525
- type RetryTo = <T>(fn: () => Promise<T> | T, retries?: number) => Promise<T>;
526
-
523
+ type TryTo = <T>(fn: () => Promise<T> | T) => Promise<T | false>
524
+ type HopeThat = <T>(fn: () => Promise<T> | T) => Promise<T | false>
525
+ type RetryTo = <T>(fn: () => Promise<T> | T, retries?: number) => Promise<T>
527
526
 
528
527
  // Globals
529
528
  declare const codecept_dir: string
530
529
  declare const output_dir: string
531
- declare const tryTo: TryTo;
532
- declare const retryTo: RetryTo;
533
- declare const hopeThat: HopeThat;
530
+ declare const tryTo: TryTo
531
+ declare const retryTo: RetryTo
532
+ declare const hopeThat: HopeThat
534
533
 
535
534
  declare const actor: CodeceptJS.actor
536
535
  declare const codecept_actor: CodeceptJS.actor
@@ -643,7 +642,7 @@ declare module '@codeceptjs/helper' {
643
642
  }
644
643
 
645
644
  declare module 'codeceptjs/effects' {
646
- export const tryTo: TryTo;
647
- export const retryTo: RetryTo;
648
- export const hopeThat: HopeThat;
645
+ export const tryTo: TryTo
646
+ export const retryTo: RetryTo
647
+ export const hopeThat: HopeThat
649
648
  }
@@ -2733,10 +2733,14 @@ declare namespace CodeceptJS {
2733
2733
  * @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
2734
2734
  * @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).
2735
2735
  * @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).
2736
- * @property [customLocatorStrategies] - custom locator strategies. An object with keys as strategy names and values as JavaScript functions. Example: `{ byRole: (selector, root) => { return root.querySelector(\`[role="\${selector}\"]\`) } }`
2736
+ * @property [customLocatorStrategies] - custom locator strategies. An object with keys as strategy names and values as JavaScript functions. Example: `{ byRole: (selector, root) => { return root.querySelector(`[role="${selector}"]`) } }`
2737
+ * @property [storageState] - Playwright storage state (path to JSON file or object)
2738
+ * passed directly to `browser.newContext`.
2739
+ * If a Scenario is declared with a `cookies` option (e.g. `Scenario('name', { cookies: [...] }, fn)`),
2740
+ * those cookies are used instead and the configured `storageState` is ignored (no merge).
2741
+ * May include session cookies, auth tokens, localStorage and (if captured with
2742
+ * `grabStorageState({ indexedDB: true })`) IndexedDB data; treat as sensitive and do not commit.
2737
2743
  */
2738
- // @ts-ignore
2739
- // @ts-ignore
2740
2744
  type PlaywrightConfig = {
2741
2745
  url?: string;
2742
2746
  browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
@@ -2775,6 +2779,7 @@ declare namespace CodeceptJS {
2775
2779
  recordHar?: any;
2776
2780
  testIdAttribute?: string;
2777
2781
  customLocatorStrategies?: any;
2782
+ storageState?: string | any;
2778
2783
  };
2779
2784
  /**
2780
2785
  * Uses [Playwright](https://github.com/microsoft/playwright) library to run tests inside:
@@ -3686,7 +3691,7 @@ declare namespace CodeceptJS {
3686
3691
  */
3687
3692
  pressKeyUp(key: string): Promise<any>;
3688
3693
  /**
3689
- * _Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([GoogleChrome/Puppeteer#1313](https://github.com/GoogleChrome/puppeteer/issues/1313)).
3694
+ * _Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([puppeteer/puppeteer#1313](https://github.com/puppeteer/puppeteer/issues/1313)).
3690
3695
  *
3691
3696
  * Presses a key in the browser (on a focused element).
3692
3697
  *
@@ -4085,6 +4090,27 @@ declare namespace CodeceptJS {
4085
4090
  * @param [name = null] - cookie name.
4086
4091
  */
4087
4092
  grabCookie(name?: string): Promise<any>;
4093
+ /**
4094
+ * Grab the current storage state (cookies, localStorage, etc.) via Playwright's `browserContext.storageState()`.
4095
+ * Returns the raw object that Playwright provides.
4096
+ *
4097
+ * Security: The returned object can contain authentication tokens, session cookies
4098
+ * and (when `indexedDB: true` is used) data that may include user PII. Treat it as a secret.
4099
+ * Avoid committing it to source control and prefer storing it in a protected secrets store / CI artifact vault.
4100
+ * @param [options.indexedDB] - set to true to include IndexedDB in snapshot (Playwright >=1.51)
4101
+ *
4102
+ * ```js
4103
+ * // basic usage
4104
+ * const state = await I.grabStorageState();
4105
+ * require('fs').writeFileSync('authState.json', JSON.stringify(state));
4106
+ *
4107
+ * // include IndexedDB when using Firebase Auth, etc.
4108
+ * const stateWithIDB = await I.grabStorageState({ indexedDB: true });
4109
+ * ```
4110
+ */
4111
+ grabStorageState(options?: {
4112
+ indexedDB?: boolean;
4113
+ }): Promise<any>;
4088
4114
  /**
4089
4115
  * Clears a cookie by name,
4090
4116
  * if none provided clears all cookies.
@@ -4515,7 +4541,7 @@ declare namespace CodeceptJS {
4515
4541
  /**
4516
4542
  * Waits for navigation to finish. By default, it takes configured `waitForNavigation` option.
4517
4543
  *
4518
- * See [Playwright's reference](https://playwright.dev/docs/api/class-page?_highlight=waitfornavi#pagewaitfornavigationoptions)
4544
+ * See [Playwright's reference](https://playwright.dev/docs/api/class-page#page-wait-for-navigation)
4519
4545
  */
4520
4546
  waitForNavigation(options: any): Promise<any>;
4521
4547
  /**
@@ -6103,7 +6129,7 @@ declare namespace CodeceptJS {
6103
6129
  * @property [keepBrowserState = false] - keep browser state between tests when `restart` is set to false.
6104
6130
  * @property [keepCookies = false] - keep cookies between tests when `restart` is set to false.
6105
6131
  * @property [waitForAction = 100] - how long to wait after click, doubleClick or PressKey actions in ms. Default: 100.
6106
- * @property [waitForNavigation = load] - when to consider navigation succeeded. Possible options: `load`, `domcontentloaded`, `networkidle0`, `networkidle2`. See [Puppeteer API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagewaitfornavigationoptions). Array values are accepted as well.
6132
+ * @property [waitForNavigation = load] - when to consider navigation succeeded. Possible options: `load`, `domcontentloaded`, `networkidle0`, `networkidle2`. See [Puppeteer API](https://github.com/puppeteer/puppeteer/blob/main/docs/api/puppeteer.waitforoptions.md). Array values are accepted as well.
6107
6133
  * @property [pressKeyDelay = 10] - delay between key presses in ms. Used when calling Puppeteers page.type(...) in fillField/appendField
6108
6134
  * @property [getPageTimeout = 30000] - config option to set maximum navigation time in milliseconds. If the timeout is set to 0, then timeout will be disabled.
6109
6135
  * @property [waitForTimeout = 1000] - default wait* timeout in ms.
@@ -6111,11 +6137,9 @@ declare namespace CodeceptJS {
6111
6137
  * @property [userAgent] - user-agent string.
6112
6138
  * @property [manualStart = false] - do not start browser before a test, start it manually inside a helper with `this.helpers["Puppeteer"]._startBrowser()`.
6113
6139
  * @property [browser = chrome] - can be changed to `firefox` when using [puppeteer-firefox](https://codecept.io/helpers/Puppeteer-firefox).
6114
- * @property [chrome] - pass additional [Puppeteer run options](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions).
6140
+ * @property [chrome] - pass additional [Puppeteer run options](https://github.com/puppeteer/puppeteer/blob/main/docs/api/puppeteer.launchoptions.md).
6115
6141
  * @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
6116
6142
  */
6117
- // @ts-ignore
6118
- // @ts-ignore
6119
6143
  type PuppeteerConfig = {
6120
6144
  url: string;
6121
6145
  basicAuth?: any;
@@ -6129,7 +6153,7 @@ declare namespace CodeceptJS {
6129
6153
  keepBrowserState?: boolean;
6130
6154
  keepCookies?: boolean;
6131
6155
  waitForAction?: number;
6132
- waitForNavigation?: string;
6156
+ waitForNavigation?: string | string[];
6133
6157
  pressKeyDelay?: number;
6134
6158
  getPageTimeout?: number;
6135
6159
  waitForTimeout?: number;
@@ -6141,7 +6165,7 @@ declare namespace CodeceptJS {
6141
6165
  highlightElement?: boolean;
6142
6166
  };
6143
6167
  /**
6144
- * Uses [Google Chrome's Puppeteer](https://github.com/GoogleChrome/puppeteer) library to run tests inside headless Chrome.
6168
+ * Uses [Google Chrome's Puppeteer](https://github.com/puppeteer/puppeteer) library to run tests inside headless Chrome.
6145
6169
  * Browser control is executed via DevTools Protocol (instead of Selenium).
6146
6170
  * This helper works with a browser out of the box with no additional tools required to install.
6147
6171
  *
@@ -6883,7 +6907,7 @@ declare namespace CodeceptJS {
6883
6907
  */
6884
6908
  pressKeyUp(key: string): Promise<any>;
6885
6909
  /**
6886
- * _Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([GoogleChrome/puppeteer#1313](https://github.com/GoogleChrome/puppeteer/issues/1313)).
6910
+ * _Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([puppeteer/puppeteer#1313](https://github.com/puppeteer/puppeteer/issues/1313)).
6887
6911
  *
6888
6912
  * Presses a key in the browser (on a focused element).
6889
6913
  *
@@ -7731,7 +7755,7 @@ declare namespace CodeceptJS {
7731
7755
  /**
7732
7756
  * Waits for navigation to finish. By default, takes configured `waitForNavigation` option.
7733
7757
  *
7734
- * See [Puppeteer's reference](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagewaitfornavigationoptions)
7758
+ * See [Puppeteer's reference](https://github.com/puppeteer/puppeteer/blob/main/docs/api/puppeteer.page.waitfornavigation.md)
7735
7759
  */
7736
7760
  waitForNavigation(opts: any): Promise<any>;
7737
7761
  /**
@@ -7960,8 +7984,6 @@ declare namespace CodeceptJS {
7960
7984
  * @property [onResponse] - an async function which can update response object.
7961
7985
  * @property [maxUploadFileSize] - set the max content file size in MB when performing api calls.
7962
7986
  */
7963
- // @ts-ignore
7964
- // @ts-ignore
7965
7987
  type RESTConfig = {
7966
7988
  endpoint?: string;
7967
7989
  prettyPrintJson?: boolean;
@@ -9117,8 +9139,6 @@ declare namespace CodeceptJS {
9117
9139
  * @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
9118
9140
  * @property [logLevel = silent] - level of logging verbosity. Default: silent. Options: trace | debug | info | warn | error | silent. More info: https://webdriver.io/docs/configuration/#loglevel
9119
9141
  */
9120
- // @ts-ignore
9121
- // @ts-ignore
9122
9142
  type WebDriverConfig = {
9123
9143
  url: string;
9124
9144
  browser: string;