Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
164 changes: 116 additions & 48 deletions lib/plugin/htmlReporter.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
"@pollyjs/core": "6.0.6",
"@types/chai": "5.2.2",
"@types/inquirer": "9.0.9",
"@types/node": "^24.6.0",
"@types/node": "^24.6.2",
"@wdio/sauce-service": "9.12.5",
"@wdio/selenium-standalone-service": "8.15.0",
"@wdio/utils": "9.19.2",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const { setHeadlessWhen, setWindowSize } = require('@codeceptjs/configure')

setHeadlessWhen(process.env.HEADLESS)
setWindowSize(1600, 1200)

exports.config = {
tests: './retry_test.js',
output: './output',
helpers: {
FileSystem: {},
},
plugins: {
htmlReporter: {
enabled: true,
output: './output',
reportFileName: 'retry-report.html',
includeArtifacts: true,
showSteps: true,
showRetries: true,
},
retryFailedStep: {
enabled: true,
retries: 2,
},
},
name: 'html-reporter-plugin retry tests',
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const { setHeadlessWhen, setWindowSize } = require('@codeceptjs/configure')

setHeadlessWhen(process.env.HEADLESS)
setWindowSize(1600, 1200)

exports.config = {
tests: './*_test.js',
output: './output',
helpers: {
FileSystem: {},
},
plugins: {
htmlReporter: {
enabled: true,
output: './output',
reportFileName: 'worker-report.html',
includeArtifacts: true,
showSteps: true,
showSkipped: true,
showMetadata: true,
showTags: true,
showRetries: true,
exportStats: false,
keepHistory: false,
},
},
multiple: {
parallel: {
chunks: 2,
browsers: ['chrome', 'firefox'],
},
},
name: 'html-reporter-plugin worker tests',
}
42 changes: 42 additions & 0 deletions test/data/sandbox/configs/html-reporter-plugin/edge-cases_test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
Feature('HTML Reporter Edge Cases')

Scenario('test with special characters <>&"\'', ({ I }) => {
I.amInPath('.')
I.seeFile('package.json')
})

Scenario('test with very long name that should be handled properly without breaking the layout or causing any rendering issues in the HTML report', ({ I }) => {
I.amInPath('.')
I.seeFile('codecept.conf.js')
})

Scenario('test with unicode characters 测试 🎉 ñoño', ({ I }) => {
I.amInPath('.')
I.seeFile('package.json')
})

Scenario('@tag1 @tag2 @critical test with multiple tags', ({ I }) => {
I.amInPath('.')
I.seeFile('codecept.conf.js')
})

Scenario('test with metadata', ({ I }) => {
I.amInPath('.')
I.seeFile('package.json')
}).tag('@smoke').tag('@regression')

Scenario('test that takes longer to execute', async ({ I }) => {
I.amInPath('.')
await new Promise(resolve => setTimeout(resolve, 500))
I.seeFile('package.json')
})

Scenario('test with nested error', ({ I }) => {
I.amInPath('.')
try {
throw new Error('Nested error with <html> tags & special chars')
} catch (e) {
// This will fail
I.seeFile('non-existent-file-with-error.txt')
}
})
23 changes: 23 additions & 0 deletions test/data/sandbox/configs/html-reporter-plugin/retry_test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Feature('HTML Reporter Retry Test')

let attemptCounter = 0

Scenario('test that fails first time then passes', ({ I }) => {
attemptCounter++
I.amInPath('.')
if (attemptCounter === 1) {
I.seeFile('this-file-does-not-exist.txt') // Will fail first time
} else {
I.seeFile('package.json') // Will pass on retry
}
})

Scenario('test that always fails even with retries', ({ I }) => {
I.amInPath('.')
I.seeFile('this-will-never-exist.txt')
})

Scenario('test that passes without retries', ({ I }) => {
I.amInPath('.')
I.seeFile('codecept.conf.js')
})
Loading