Skip to content

Commit 962ba93

Browse files
DavertMikclaude
andcommitted
Merge branch '3.x' into 4.x
Resolved merge conflicts between 3.x (CommonJS) and 4.x (ESM migration). Accepted 4.x versions for all files to preserve ESM conversion while incorporating changes from 3.x release 3.7.6. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
2 parents 7747f4c + 875a660 commit 962ba93

18 files changed

+610
-2
lines changed

docs/helpers/WebDriver.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1469,6 +1469,21 @@ const webElement = await I.grabWebElement('#button');
14691469
14701470
Returns **[Promise][23]<any>** WebElement of being used Web helper
14711471
1472+
### grabWebElement
1473+
1474+
Grab WebElement for given locator
1475+
Resumes test execution, so **should be used inside an async function with `await`** operator.
1476+
1477+
```js
1478+
const webElement = await I.grabWebElement('#button');
1479+
```
1480+
1481+
#### Parameters
1482+
1483+
* `locator` **([string][18] | [object][17])** element located by CSS|XPath|strict locator.
1484+
1485+
Returns **[Promise][26]<any>** WebElement of being used Web helper
1486+
14721487
### grabWebElements
14731488
14741489
Grab WebElements for given locator

lib/mocha/test.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,14 +154,16 @@ function cloneTest(test) {
154154
function testToFileName(test, { suffix = '', unique = false } = {}) {
155155
let fileName = test.title
156156

157-
if (unique) fileName = `${fileName}_${test?.uid || Math.floor(new Date().getTime() / 1000)}`
158-
if (suffix) fileName = `${fileName}_${suffix}`
159157
// remove tags with empty string (disable for now)
160158
// fileName = fileName.replace(/\@\w+/g, '')
161159
fileName = fileName.slice(0, 100)
162160
if (fileName.indexOf('{') !== -1) {
163161
fileName = fileName.substr(0, fileName.indexOf('{') - 3).trim()
164162
}
163+
164+
// Apply unique suffix AFTER removing data part to ensure uniqueness
165+
if (unique) fileName = `${fileName}_${test?.uid || Math.floor(new Date().getTime())}`
166+
if (suffix) fileName = `${fileName}_${suffix}`
165167
if (test.ctx && test.ctx.test && test.ctx.test.type === 'hook') fileName = clearString(`${test.title}_${test.ctx.test.title}`)
166168
// TODO: add suite title to file name
167169
// if (test.parent && test.parent.title) {
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
exports.config = {
2+
tests: './*_no_test.js',
3+
timeout: 10000,
4+
output: './output',
5+
helpers: {
6+
BDD: {
7+
require: './support/bdd_helper.js',
8+
},
9+
},
10+
// New masking configuration with custom patterns
11+
maskSensitiveData: {
12+
enabled: true,
13+
patterns: [
14+
{
15+
name: 'Email',
16+
regex: /(\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b)/gi,
17+
mask: '[MASKED_EMAIL]',
18+
},
19+
{
20+
name: 'Credit Card',
21+
regex: /\b(?:\d{4}[- ]?){3}\d{4}\b/g,
22+
mask: '[MASKED_CARD]',
23+
},
24+
{
25+
name: 'Phone',
26+
regex: /(\+?1[-.\s]?)?\(?([0-9]{3})\)?[-.\s]?([0-9]{3})[-.\s]?([0-9]{4})/g,
27+
mask: '[MASKED_PHONE]',
28+
},
29+
],
30+
},
31+
gherkin: {
32+
features: './features/masking.feature',
33+
steps: ['./features/step_definitions/my_steps.js', './features/step_definitions/my_other_steps.js'],
34+
},
35+
include: {},
36+
bootstrap: false,
37+
mocha: {},
38+
name: 'sandbox-masking',
39+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
exports.config = {
2+
tests: './*_test.js',
3+
timeout: 10000,
4+
output: './output',
5+
helpers: {
6+
FileSystem: {},
7+
},
8+
gherkin: {
9+
features: './features/*.feature',
10+
steps: './step_definitions/steps.js',
11+
},
12+
include: {},
13+
bootstrap: false,
14+
mocha: {},
15+
name: 'sandbox-bdd',
16+
plugins: {
17+
htmlReporter: {
18+
enabled: true,
19+
output: './output',
20+
reportFileName: 'bdd-report.html',
21+
includeArtifacts: true,
22+
showSteps: true,
23+
showSkipped: true,
24+
showMetadata: true,
25+
showTags: true,
26+
showRetries: true,
27+
exportStats: false,
28+
keepHistory: false,
29+
},
30+
},
31+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
exports.config = {
2+
tests: './*_test.js',
3+
output: './output',
4+
helpers: {
5+
FileSystem: {},
6+
},
7+
include: {},
8+
bootstrap: false,
9+
plugins: {
10+
htmlReporter: {
11+
enabled: true,
12+
output: './output',
13+
reportFileName: 'report.html',
14+
includeArtifacts: true,
15+
showSteps: true,
16+
showSkipped: true,
17+
showMetadata: true,
18+
showTags: true,
19+
showRetries: true,
20+
keepHistory: true,
21+
historyPath: './test-history.json',
22+
maxHistoryEntries: 10,
23+
},
24+
},
25+
mocha: {},
26+
name: 'html-reporter-plugin tests with history',
27+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
const { setHeadlessWhen, setWindowSize } = require('@codeceptjs/configure')
2+
3+
setHeadlessWhen(process.env.HEADLESS)
4+
setWindowSize(1600, 1200)
5+
6+
exports.config = {
7+
tests: './retry_test.js',
8+
output: './output',
9+
helpers: {
10+
FileSystem: {},
11+
},
12+
plugins: {
13+
htmlReporter: {
14+
enabled: true,
15+
output: './output',
16+
reportFileName: 'retry-report.html',
17+
includeArtifacts: true,
18+
showSteps: true,
19+
showRetries: true,
20+
},
21+
retryFailedStep: {
22+
enabled: true,
23+
retries: 2,
24+
},
25+
},
26+
name: 'html-reporter-plugin retry tests',
27+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
exports.config = {
2+
tests: './*_test.js',
3+
output: './output',
4+
helpers: {
5+
FileSystem: {},
6+
},
7+
include: {},
8+
bootstrap: false,
9+
plugins: {
10+
htmlReporter: {
11+
enabled: true,
12+
output: './output',
13+
reportFileName: 'report.html',
14+
includeArtifacts: true,
15+
showSteps: true,
16+
showSkipped: true,
17+
showMetadata: true,
18+
showTags: true,
19+
showRetries: true,
20+
exportStats: true,
21+
exportStatsPath: './test-stats.json',
22+
},
23+
},
24+
mocha: {},
25+
name: 'html-reporter-plugin tests with stats',
26+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
const { setHeadlessWhen, setWindowSize } = require('@codeceptjs/configure')
2+
3+
setHeadlessWhen(process.env.HEADLESS)
4+
setWindowSize(1600, 1200)
5+
6+
exports.config = {
7+
tests: './*_test.js',
8+
output: './output',
9+
helpers: {
10+
FileSystem: {},
11+
},
12+
plugins: {
13+
htmlReporter: {
14+
enabled: true,
15+
output: './output',
16+
reportFileName: 'worker-report.html',
17+
includeArtifacts: true,
18+
showSteps: true,
19+
showSkipped: true,
20+
showMetadata: true,
21+
showTags: true,
22+
showRetries: true,
23+
exportStats: false,
24+
keepHistory: false,
25+
},
26+
},
27+
multiple: {
28+
parallel: {
29+
chunks: 2,
30+
browsers: ['chrome', 'firefox'],
31+
},
32+
},
33+
name: 'html-reporter-plugin worker tests',
34+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
exports.config = {
2+
tests: './*_test.js',
3+
output: './output',
4+
helpers: {
5+
FileSystem: {},
6+
},
7+
include: {},
8+
bootstrap: false,
9+
plugins: {
10+
htmlReporter: {
11+
enabled: true,
12+
output: './output',
13+
reportFileName: 'report.html',
14+
includeArtifacts: true,
15+
showSteps: true,
16+
showSkipped: true,
17+
},
18+
},
19+
mocha: {},
20+
name: 'html-reporter-plugin tests',
21+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
exports.config = {
2+
tests: './*_test.js',
3+
output: './output',
4+
bootstrap: null,
5+
mocha: {},
6+
name: 'only-test',
7+
}

0 commit comments

Comments
 (0)