Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Commit 3556970

Browse files
committed
ci(jenkins): provide playwright report on failed tests
1 parent d8ce6d3 commit 3556970

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

Jenkinsfile

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -251,19 +251,25 @@ def stageAnalyzeCode(def context) {
251251
}
252252

253253
def stageTest(def context) {
254-
container('playwright') {
255-
stage('Test Components') {
256-
withEnv([
257-
'VITE_AZURE_ACTIVE_DIRECTORY_CLIENT_ID=11111111-2222-3333-4444-555555555dev',
258-
// IMPORTANT: A valid Azure AD Tenant ID for testing purposes is required.
259-
'VITE_AZURE_ACTIVE_DIRECTORY_TENANT_ID=common',
260-
]) {
261-
sh(
262-
label: 'Test React Components',
263-
script: 'npm run test',
264-
)
254+
try {
255+
container('playwright') {
256+
stage('Test Components') {
257+
withEnv([
258+
'VITE_AZURE_ACTIVE_DIRECTORY_CLIENT_ID=11111111-2222-3333-4444-555555555dev',
259+
// IMPORTANT: A valid Azure AD Tenant ID for testing purposes is required.
260+
'VITE_AZURE_ACTIVE_DIRECTORY_TENANT_ID=common',
261+
]) {
262+
sh(
263+
label: 'Test React Components',
264+
script: 'npm run test',
265+
)
266+
}
265267
}
266268
}
269+
} catch (Exception exception) {
270+
zip zipFile: "${context.jobName}-${context.tagversion}-playwright-report.zip", archive: true, glob: 'playwright-report/**,test-results/**'
271+
echo "\033[31mERROR: The test runs have failed.\033[0m\n\nFor a detailed analysis, download and extract the artifact and view it with: \033[34mnpx --yes @playwright/test show-report\033[0m"
272+
throw exception
267273
}
268274
}
269275

playwright-ct.config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ export default defineConfig({
3535
],
3636

3737
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
38-
reporter: process.env.CI ? [["junit", { outputFile: "build/test-results/test/component-test-results.xml" }]] : "list",
38+
reporter: process.env.CI
39+
? [["html"], ["junit", { outputFile: "build/test-results/test/acceptance-junit.xml" }]]
40+
: "list",
3941

4042
/**
4143
* Retry on CI only - Test that passes on a second retry is 'flaky'

0 commit comments

Comments
 (0)