Skip to content

Commit 7ee4e61

Browse files
committed
do the thing
1 parent df39fda commit 7ee4e61

2 files changed

Lines changed: 40 additions & 42 deletions

File tree

.github/workflows/ci.yml

Lines changed: 28 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ jobs:
6363
e2e_tests:
6464
runs-on: ubuntu-latest
6565
timeout-minutes: 15
66+
strategy:
67+
fail-fast: false
68+
matrix:
69+
project: [chromium, "Mobile Safari"]
6670
permissions:
6771
contents: read
6872
pull-requests: write
@@ -87,30 +91,30 @@ jobs:
8791
- name: Install Playwright Browsers
8892
run: pnpm playwright install --with-deps
8993

90-
- name: Run e2e tests
94+
- name: Run e2e tests (${{ matrix.project }})
9195
env:
9296
AIRTABLE_PAT: ${{ secrets.AIRTABLE_PAT }}
93-
run: pnpm test:e2e:headless
97+
run: pnpm test:e2e:headless --project='${{ matrix.project }}'
9498

9599
- name: Upload Playwright report
96100
if: failure()
97101
uses: actions/upload-artifact@v4
98102
with:
99-
name: playwright-report
103+
name: playwright-report-${{ matrix.project }}
100104
path: playwright-report/
101105
retention-days: 30
102106

103107
- name: Comment PR with Playwright artifact link
104-
if: always() && github.event_name == 'pull_request'
108+
if: failure() && github.event_name == 'pull_request'
105109
uses: actions/github-script@v7
106110
with:
107111
script: |
108112
const runId = context.runId;
109113
const repo = context.repo;
114+
const project = '${{ matrix.project }}';
110115
const artifactUrl = `https://github.com/${repo.owner}/${repo.repo}/actions/runs/${runId}`;
111-
const identifier = '<!-- playwright-test-status -->';
116+
const identifier = `<!-- playwright-test-status-${project} -->`;
112117
113-
// Find existing comment
114118
const { data: comments } = await github.rest.issues.listComments({
115119
issue_number: context.issue.number,
116120
owner: repo.owner,
@@ -121,46 +125,32 @@ jobs:
121125
comment.body?.includes(identifier)
122126
);
123127
124-
// Determine if tests passed or failed
125-
const testsFailed = '${{ job.status }}' !== 'success';
128+
const comment = `${identifier}
129+
## Playwright Tests Failed (${project})
126130
127-
if (testsFailed) {
128-
const comment = `${identifier}
129-
## ❌ Playwright Tests Failed
131+
Download the test report artifact for details:
130132
131-
The Playwright tests have failed. Please download the test report artifact to see detailed information about the failures:
132-
133-
📊 [View test run and download artifact](${artifactUrl})
133+
[View test run and download artifact](${artifactUrl})
134134
135135
**How to view the report:**
136136
1. Click the link above
137137
2. Scroll to the bottom to the "Artifacts" section
138-
3. Download the \`playwright-report\` artifact
139-
4. Extract the zip file and open \`index.html\` in your browser
140-
141-
The report includes screenshots, videos, and detailed traces of the failed tests.`;
142-
143-
if (existingComment) {
144-
await github.rest.issues.updateComment({
145-
owner: repo.owner,
146-
repo: repo.repo,
147-
comment_id: existingComment.id,
148-
body: comment
149-
});
150-
} else {
151-
await github.rest.issues.createComment({
152-
issue_number: context.issue.number,
153-
owner: repo.owner,
154-
repo: repo.repo,
155-
body: comment
156-
});
157-
}
158-
} else if (existingComment) {
159-
// Tests passed - delete the failure comment
160-
await github.rest.issues.deleteComment({
138+
3. Download the \`playwright-report-${project}\` artifact
139+
4. Extract the zip file and open \`index.html\` in your browser`;
140+
141+
if (existingComment) {
142+
await github.rest.issues.updateComment({
143+
owner: repo.owner,
144+
repo: repo.repo,
145+
comment_id: existingComment.id,
146+
body: comment
147+
});
148+
} else {
149+
await github.rest.issues.createComment({
150+
issue_number: context.issue.number,
161151
owner: repo.owner,
162152
repo: repo.repo,
163-
comment_id: existingComment.id
153+
body: comment
164154
});
165155
}
166156

playwright.config.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@ export default defineConfig({
3232

3333
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
3434
trace: 'on-first-retry',
35-
36-
launchOptions: {
37-
slowMo: process.env.LOCAL_PLAYWRIGHT ? 250 : 0,
38-
},
3935
},
4036

4137
/* Configure projects for major browsers */
@@ -44,6 +40,18 @@ export default defineConfig({
4440
name: 'chromium',
4541
use: {
4642
...devices['Desktop Chrome'],
43+
launchOptions: {
44+
slowMo: process.env.LOCAL_PLAYWRIGHT ? 250 : 0,
45+
},
46+
},
47+
},
48+
{
49+
name: 'Mobile Safari',
50+
use: {
51+
...devices['iPhone 14 Pro'],
52+
launchOptions: {
53+
slowMo: 250,
54+
},
4755
},
4856
},
4957
],

0 commit comments

Comments
 (0)