-
-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (54 loc) · 1.95 KB
/
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
name: 'E2E Tests'
on: [pull_request]
env:
GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }}
jobs:
tests_e2e_netlify_prepare:
name: Wait for deployment on Netlify
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Retry Netlify Deployment
run: |
retries=5
count=0
until $(curl --output /dev/null --silent --head --fail https://deploy-preview-${{ github.event.pull_request.number }}--eventua11y.netlify.app/); do
((count++))
if [ ${count} -ge ${retries} ]; then
echo "Max retries reached, failing the job."
exit 1
fi
echo "Netlify site not ready, retrying in 60 seconds..."
sleep 60
done
env:
GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }}
tests_e2e_netlify:
needs: tests_e2e_netlify_prepare
name: Run end-to-end tests on Netlify PR preview
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.40.0-jammy
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install dependencies
run: npm ci
- name: Verify network connectivity
run: |
echo "Testing connection to Netlify preview..."
curl -v https://deploy-preview-${{ env.GITHUB_PR_NUMBER }}--eventua11y.netlify.app/
echo "Testing DNS resolution..."
nslookup deploy-preview-${{ env.GITHUB_PR_NUMBER }}--eventua11y.netlify.app
- name: Run tests
env:
PLAYWRIGHT_TEST_BASE_URL: 'https://deploy-preview-${{ env.GITHUB_PR_NUMBER }}--eventua11y.netlify.app/'
DEBUG: 'pw:api,pw:browser*,pw:protocol*'
CI: 'true'
run: |
echo "Starting Playwright tests..."
npx playwright test --project=chromium --retries=5 --reporter=list