-
Notifications
You must be signed in to change notification settings - Fork 8
119 lines (104 loc) · 4 KB
/
playwright.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: Playwright Test
on:
deployment_status:
env:
HUSKY: 0
jobs:
Run:
name: Shard ${{ matrix.shardIndex }}
if: github.event.deployment_status.state == 'success' && github.event.deployment_status.environment == 'Preview'
timeout-minutes: 60
runs-on: ubuntu-latest
env:
SHARD_INDEX: ${{ matrix.shardIndex }}
SHARD_TOTAL: 3
strategy:
fail-fast: false
matrix:
shardIndex:
- 1
- 2
- 3
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.node-version'
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright tests
run: npx playwright test --shard=$SHARD_INDEX/$SHARD_TOTAL
env:
PLAYWRIGHT_TEST_BASE_URL: ${{ github.event.deployment_status.target_url }}
PLAYWRIGHT_PRODUCT_NAME_INSTOCK: ${{ vars.PLAYWRIGHT_PRODUCT_NAME_INSTOCK }}
PLAYWRIGHT_PRODUCT_SIZE_INSTOCK: ${{ vars.PLAYWRIGHT_PRODUCT_SIZE_INSTOCK }}
PLAYWRIGHT_PRODUCT_COLOR_INSTOCK: ${{ vars.PLAYWRIGHT_PRODUCT_COLOR_INSTOCK }}
PLAYWRIGHT_COLLECTION_NAME: ${{ vars.PLAYWRIGHT_COLLECTION_NAME }}
PLAYWRIGHT_PRODUCT_NAME_OUTOFSTOCK: ${{ vars.PLAYWRIGHT_PRODUCT_NAME_OUTOFSTOCK }}
PLAYWRIGHT_PRODUCT_SIZE_OUTOFSTOCK: ${{ vars.PLAYWRIGHT_PRODUCT_SIZE_OUTOFSTOCK }}
PLAYWRIGHT_PRODUCT_COLOR_OUTOFSTOCK: ${{ vars.PLAYWRIGHT_PRODUCT_COLOR_OUTOFSTOCK }}
PLAYWRIGHT_BRAND_NAME: ${{ vars.PLAYWRIGHT_BRAND_NAME }}
PLAYWRIGHT_USER_EMAIL: ${{ vars.PLAYWRIGHT_USER_EMAIL }}
PLAYWRIGHT_USER_PASSWORD: ${{ vars.PLAYWRIGHT_USER_PASSWORD }}
- name: Move Playwright report
if: ${{ success() || failure() }}
shell: bash
run: |
mkdir blob-reports
mv blob-report blob-reports/blob-report-$SHARD_INDEX
- name: Upload artifact
uses: actions/upload-artifact@v4
if: ${{ success() || failure() }}
with:
name: blob-report-${{ matrix.shardIndex }}
path: blob-reports
retention-days: 1
report:
name: Report
if: ${{ vars.PLAYWRIGHT_S3_URL != '' && (success() || failure()) }}
runs-on: ubuntu-latest
needs:
- Run
env:
HTML_REPORT_URL_PATH: reports/${{ github.sha }}/${{ github.run_attempt }}
steps:
- name: Download results
uses: actions/download-artifact@v4
with:
path: blob-reports
pattern: blob-report-*
merge-multiple: true
- name: Merge reports
shell: bash
run: |
mv ./blob-reports/**/*.zip ./blob-reports
npx playwright merge-reports --reporter html ./blob-reports
mkdir -p ./playwright-report-upload/$HTML_REPORT_URL_PATH
mv ./playwright-report/* ./playwright-report-upload/$HTML_REPORT_URL_PATH
- name: Upload to S3
run: |
aws s3 sync ./playwright-report-upload s3://$S3_BUCKET
env:
S3_BUCKET: ${{ vars.PLAYWRIGHT_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.PLAYWRIGHT_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.PLAYWRIGHT_AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ vars.PLAYWRIGHT_S3_REGION }}
- name: Add link to summary
env:
REPORT_URL: ${{ vars.PLAYWRIGHT_S3_URL }}${{ env.HTML_REPORT_URL_PATH }}/index.html
shell: bash
run: |
echo "[Playwright Report]($REPORT_URL)" >> $GITHUB_STEP_SUMMARY
- name: Post status
if: ${{ success() || failure() }}
uses: guibranco/[email protected]
with:
authToken: ${{ secrets.GITHUB_TOKEN }}
context: Playwright Report
state: ${{ needs.Run.result }}
sha: ${{ github.sha }}
target_url: ${{ vars.PLAYWRIGHT_S3_URL }}${{ env.HTML_REPORT_URL_PATH }}/index.html