Skip to content

Commit 6eac07b

Browse files
authored
Run E2E tests on locally-running webserver (#305)
* Run E2E tests on locally-running webserver This helps reduce CI times by running E2E tests in parallel with deployment. * Fix pipeline * Fix * Fix name of pipeline
1 parent 4524c70 commit 6eac07b

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

.github/workflows/deploy.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111

1212
jobs:
1313
deploy:
14+
name: Deploy to Cloudflare Pages
1415
outputs:
1516
deployment-url: ${{ steps.deploy.outputs.deployment-url }}
1617
permissions:
@@ -94,7 +95,6 @@ jobs:
9495
e2e:
9596
name: Run Playwright tests
9697
if: github.event_name == 'pull_request'
97-
needs: deploy
9898
runs-on: ubuntu-latest
9999
permissions:
100100
contents: read
@@ -110,12 +110,6 @@ jobs:
110110
with:
111111
node-version: lts/*
112112
cache: 'yarn'
113-
- name: Validate deployment URL
114-
run: |
115-
if [ -z "${{ needs.deploy.outputs.deployment-url }}" ]; then
116-
echo "::error::deployment-url output is empty"
117-
exit 1
118-
fi
119113
- name: Restore Yarn Cache
120114
uses: actions/cache@v4
121115
with:
@@ -128,8 +122,6 @@ jobs:
128122
- name: Install Playwright dependencies
129123
run: npx playwright install --with-deps
130124
- run: yarn test:e2e --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
131-
env:
132-
PLAYWRIGHT_BASE_URL: ${{ needs.deploy.outputs.deployment-url }}
133125
- name: Upload blob report to GitHub Actions Artifacts
134126
if: ${{ !cancelled() }}
135127
uses: actions/upload-artifact@v4
@@ -163,7 +155,7 @@ jobs:
163155

164156
merge-reports:
165157
name: Merge Playwright Reports
166-
if: ${{ github.event_name == 'pull_request' && !cancelled() }}
158+
if: ${{ github.event_name == 'pull_request' && !failure() && !cancelled() }}
167159
needs: [e2e]
168160
runs-on: ubuntu-latest
169161
permissions:

playwright.config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,9 @@ export default defineConfig({
2222
use: { browserName: 'webkit' },
2323
},
2424
],
25+
webServer: {
26+
command: 'yarn run dev',
27+
url: 'http://localhost:3000',
28+
reuseExistingServer: !process.env.CI,
29+
},
2530
});

0 commit comments

Comments
 (0)