Skip to content

Commit 773c38b

Browse files
committed
Added Azure DevOps pipeline
1 parent 53dace2 commit 773c38b

File tree

2 files changed

+47
-1
lines changed

2 files changed

+47
-1
lines changed

azdo/pipelines/playwright.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: $(date:yyyy).$(date:MM).$(date:dd)$(rev:.r)
2+
trigger:
3+
- none
4+
5+
pool:
6+
vmImage: ubuntu-latest
7+
8+
steps:
9+
- task: NodeTool@0
10+
inputs:
11+
versionSpec: '18'
12+
displayName: 'Install Node.js'
13+
14+
- script: npm ci
15+
displayName: 'npm ci'
16+
- script: npx playwright install --with-deps
17+
displayName: 'Install Playwright browsers'
18+
- script: npx playwright test
19+
displayName: 'Run Playwright tests'
20+
env:
21+
CI: 'true'
22+
- task: PublishTestResults@2
23+
displayName: 'Publish Test Results'
24+
inputs:
25+
searchFolder: '$(System.DefaultWorkingDirectory)'
26+
testResultsFormat: 'JUnit'
27+
testResultsFiles: '**/test-results/e2e-junit-results.xml'
28+
mergeTestResults: true
29+
failTaskOnFailedTests: true
30+
testRunTitle: 'My End-To-End Tests'
31+
condition: succeededOrFailed()
32+
- task: PublishPipelineArtifact@1
33+
displayName: 'Publish Test Report as Artifact'
34+
inputs:
35+
targetPath: '$(System.DefaultWorkingDirectory)/test-results'
36+
artifact: playwright-report
37+
publishLocation: 'pipeline'
38+
condition: succeededOrFailed()

playwright.config.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,15 @@ export default defineConfig({
2222
/* Opt out of parallel tests on CI. */
2323
workers: process.env.CI ? 1 : undefined,
2424
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
25-
reporter: process.env.CI ? 'blob' : 'html',
25+
// reporter: process.env.CI ? 'blob' : 'html',
26+
reporter: process.env.CI ?
27+
[
28+
['html', { open: 'never' }],
29+
['junit', { outputFile: 'test-results/e2e-junit-results.xml' }]
30+
] :
31+
[
32+
['html', { open: 'never' }]
33+
],
2634
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
2735
use: {
2836
/* Base URL to use in actions like `await page.goto('/')`. */

0 commit comments

Comments
 (0)