-
Notifications
You must be signed in to change notification settings - Fork 43
85 lines (79 loc) · 3.17 KB
/
e2e-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: E2E Tests
on:
workflow_call:
inputs:
skipNxCache:
type: boolean
default: false
required: false
description: Skip the nx cache
secrets:
NX_CLOUD_ACCESS_TOKEN:
required: false
description: Token to use Nx Cloud token
env:
NX_PARALLEL: ${{ vars.NX_PARALLEL }}
NX_TASK_TARGET_CONFIGURATION: ci
NX_SKIP_NX_CACHE: ${{ inputs.skipNxCache }}
YARN_ENABLE_HARDENED_MODE: 0
E2E_REPORT: e2e-report
permissions:
contents: write # Needed to create a commit in case of visual testing failure
issues: write # Needed to add a comment to a pull request
pull-requests: write # Needed to add a comment to a pull request
jobs:
e2e-tests:
runs-on: ubuntu-24.04
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: ./tools/github-actions/download-build-output
- uses: ./tools/github-actions/setup
- run: yarn playwright install
- name: Run e2e tests
run: |
npx --yes http-server apps/showcase/dist/browser -p 8080 -s &
npx --yes wait-on $PLAYWRIGHT_TARGET_URL -t 5000
yarn test-e2e
shell: bash
env:
PLAYWRIGHT_TARGET_URL: http://127.0.0.1:8080
- name: Publish tests reports
if: failure()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: ${{ env.E2E_REPORT }}
path: |
apps/chrome-devtools/playwright-reports
apps/showcase/playwright-reports
apps/showcase/test-results
e2e-screenshots:
runs-on: ubuntu-24.04
# To work correctly this workflow must be run only on pull_request trigger and not coming from a fork
if: ${{ failure() && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name }}
permissions:
contents: write
issues: write
pull-requests: write
needs: [e2e-tests]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
with:
name: ${{ env.E2E_REPORT }}
# Needed because the least common ancestor of all the paths will be used as the root directory of the artifact
# https://github.com/actions/upload-artifact?tab=readme-ov-file#upload-using-multiple-paths-and-exclusions
path: 'apps'
- name: Update e2e screenshots
id: update-e2e-screenshots
uses: ./tools/github-actions/update-e2e-screenshots
with:
visualTestingReportPath: apps/showcase/playwright-reports/visual-testing/report.json
- uses: ./tools/github-actions/setup
if: ${{ steps.update-e2e-screenshots.outputs.screenshots != '0' }}
- name: Create branch for e2e screenshots
if: ${{ steps.update-e2e-screenshots.outputs.screenshots != '0' }}
uses: ./tools/github-actions/create-branch-e2e-screenshots
with:
screenshotsPattern: apps/showcase/e2e-playwright/sanity/screenshots/**