Skip to content

Commit

Permalink
ci(jenkins): provide playwright report on failed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonGolms committed Apr 21, 2023
1 parent d8ce6d3 commit 3556970
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
28 changes: 17 additions & 11 deletions Jenkinsfile
Expand Up @@ -251,19 +251,25 @@ def stageAnalyzeCode(def context) {
}

def stageTest(def context) {
container('playwright') {
stage('Test Components') {
withEnv([
'VITE_AZURE_ACTIVE_DIRECTORY_CLIENT_ID=11111111-2222-3333-4444-555555555dev',
// IMPORTANT: A valid Azure AD Tenant ID for testing purposes is required.
'VITE_AZURE_ACTIVE_DIRECTORY_TENANT_ID=common',
]) {
sh(
label: 'Test React Components',
script: 'npm run test',
)
try {
container('playwright') {
stage('Test Components') {
withEnv([
'VITE_AZURE_ACTIVE_DIRECTORY_CLIENT_ID=11111111-2222-3333-4444-555555555dev',
// IMPORTANT: A valid Azure AD Tenant ID for testing purposes is required.
'VITE_AZURE_ACTIVE_DIRECTORY_TENANT_ID=common',
]) {
sh(
label: 'Test React Components',
script: 'npm run test',
)
}
}
}
} catch (Exception exception) {
zip zipFile: "${context.jobName}-${context.tagversion}-playwright-report.zip", archive: true, glob: 'playwright-report/**,test-results/**'
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"
throw exception
}
}

Expand Down
4 changes: 3 additions & 1 deletion playwright-ct.config.ts
Expand Up @@ -35,7 +35,9 @@ export default defineConfig({
],

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

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

0 comments on commit 3556970

Please sign in to comment.