1- # # .github/workflows/playwright-daily.yml
2- # # Runs Playwright test shards every day at **11 : 42 AM IST** (06 : 12 UTC)
3- # # plus anytime you trigger it manually from the Actions tab.
4-
5- # name: Run Playwright tests
6-
7- # on:
8- # push: # runs on every push
9- # pull_request: # runs on new PRs or PR updates
10- # schedule:
11- # - cron: '30 3 * * 1-5'
12- # workflow_dispatch:
13-
14- # jobs:
15- # run-tests:
16- # name: Run Playwright shards
17- # runs-on: ubuntu-latest
18-
19- # strategy:
20- # fail-fast: false
21- # matrix:
22- # shardIndex: [1,2,3,4,5]
23- # shardTotal: [5]
24-
25- # steps:
26- # - uses: actions/checkout@v4
27-
28- # - name: Setup Node.js 18.x
29- # uses: actions/setup-node@v3
30- # with:
31- # node-version: '18'
32- # - name: Create .env file
33- # run: |
34- # echo "USERNAME=${{ secrets.USERNAME }}" >> .env
35- # echo "PASSWORD=${{ secrets.PASSWORD }}" >> .env
36- # echo "PASSWORD=${{ secrets.PASSWORD }}" >> .env
37- # echo "NEW_PASSWORD=${{ secrets.NEW_PASSWORD }}" >> .env
38- # echo "FIRST_NAME=${{ secrets.FIRST_NAME }}" >> .env
39- # echo "STREET_NAME=${{ secrets.STREET_NAME }}" >> .env
40- # echo "CITY=${{ secrets.CITY }}" >> .env
41- # echo "STATE=${{ secrets.STATE }}" >> .env
42- # echo "COUNTRY=${{ secrets.COUNTRY }}" >> .env
43- # echo "ZIP_CODE=${{ secrets.ZIP_CODE }}" >> .env
44-
45- # - name: Cache npm dependencies
46- # uses: actions/cache@v3
47- # with:
48- # path: ~/.npm
49- # key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
50- # restore-keys: |
51- # ${{ runner.os }}-node-
52-
53- # - name: Install deps + browsers
54- # run: |
55- # npm ci
56- # npx playwright install --with-deps
57-
58- # - name: Run shard ${{ matrix.shardIndex }}
59- # run: npx playwright test --project=chromium --reporter=blob --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
60-
61- # - name: Upload blob report
62- # if: ${{ !cancelled() }}
63- # uses: actions/upload-artifact@v4
64- # with:
65- # name: blob-report-${{ matrix.shardIndex }}
66- # path: ./blob-report
67- # retention-days: 1
68-
69- # merge-reports:
70- # name: Merge Reports
71- # needs: run-tests
72- # if: always() # run even if some shards fail
73- # runs-on: ubuntu-latest
74-
75- # steps:
76- # - uses: actions/checkout@v4
77-
78- # - name: Setup Node.js 18.x
79- # uses: actions/setup-node@v3
80- # with:
81- # node-version: '18'
82-
83- # - name: Cache npm dependencies
84- # uses: actions/cache@v3
85- # with:
86- # path: ~/.npm
87- # key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
88- # restore-keys: |
89- # ${{ runner.os }}-node-
90-
91- # - name: Install deps + browsers
92- # run: |
93- # npm ci
94- # npx playwright install --with-deps
95-
96- # - name: Download all blob reports
97- # uses: actions/download-artifact@v4
98- # with:
99- # path: ./all-blob-reports
100- # pattern: blob-report-*
101- # merge-multiple: true
102-
103- # - name: Merge HTML & JSON reports
104- # run: npx playwright merge-reports --config=playwright.config.js ./all-blob-reports
105-
106- # - name: Upload combined report
107- # uses: actions/upload-artifact@v4
108- # with:
109- # name: Playwright Test Report
110- # path: ./playwright-report
111- # retention-days: 14
112-
113- # - name: Send TestDino report
114- # run: |
115- # npx --yes tdpw ./playwright-report \
116- # --token="${{ secrets.TESTDINO_TOKEN }}" \
117- # --upload-html \
118- # --verbose
119-
120-
1211name : Run Playwright tests
1222
1233on :
1244 push :
1255 pull_request :
6+ schedule :
7+ - cron : ' 30 3 * * *' # 9:00 AM IST everyday # 11:00 AM IST
1268 workflow_dispatch :
1279
12810jobs :
12911 run-tests :
130- name : Run shard ${{ matrix.shardIndex }}/5
12+ name : Run Playwright tests ${{ matrix.shardIndex }}/5
13113 runs-on : ubuntu-latest
13214
13315 strategy :
@@ -137,16 +19,13 @@ jobs:
13719 shardTotal : [5]
13820
13921 steps :
140- - name : Checkout repo
141- uses : actions/checkout@v4
22+ - uses : actions/checkout@v4
14223
143- # ✅ Required Node version
14424 - name : Setup Node.js 20.x
145- uses : actions/setup-node@v4
25+ uses : actions/setup-node@v3
14626 with :
147- node-version : ' 20 '
27+ node-version : " 20 "
14828
149- # ✅ Required env variables for tests
15029 - name : Create .env file
15130 run : |
15231 echo "USERNAME=${{ secrets.USERNAME }}" >> .env
15938 echo "COUNTRY=${{ secrets.COUNTRY }}" >> .env
16039 echo "ZIP_CODE=${{ secrets.ZIP_CODE }}" >> .env
16140
162- # ✅ Cache npm dependencies
16341 - name : Cache npm dependencies
16442 uses : actions/cache@v3
16543 with :
@@ -168,27 +46,69 @@ jobs:
16846 restore-keys : |
16947 ${{ runner.os }}-node-
17048
171- # ✅ Install dependencies + TestDino (.tgz) + Playwright browsers
172- - name : Install dependencies & browsers
49+ - name : Install dependencies
17350 run : |
174- npm install
175- npm install --save-dev @testdino/playwright@latest
176- npx playwright install --with-deps chromium webkit firefox
51+ npm ci
52+ npx playwright install --with-deps
17753
178- # ✅ Run Playwright shard with TestDino
179- - name : Run Playwright shard with TestDino
180- env :
181- TESTDINO_TOKEN : ${{ secrets.TESTDINO_TOKEN }}
54+ - name : Run Playwright Tests
18255 run : |
18356 npx playwright test \
184- --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} \
185- --grep="@chromium|@firefox|@webkit|@android|@ios|@api" \
186-
187- # ✅ Upload blob report (needed for merge)
57+ --grep="@chromium|@firefox|@webkit|@api|@andriod|@ios" \
58+ --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
59+
18860 - name : Upload blob report
18961 if : ${{ !cancelled() }}
19062 uses : actions/upload-artifact@v4
19163 with :
19264 name : blob-report-${{ matrix.shardIndex }}
19365 path : ./blob-report
194- retention-days : 1
66+ retention-days : 1
67+
68+ merge-reports :
69+ name : Merge Reports
70+ needs : run-tests
71+ if : always()
72+ runs-on : ubuntu-latest
73+
74+ steps :
75+ - uses : actions/checkout@v4
76+
77+ - name : Setup Node.js 20.x
78+ uses : actions/setup-node@v3
79+ with :
80+ node-version : " 20"
81+
82+ - name : Install dependencies
83+ run : |
84+ npm ci
85+ npx playwright install --with-deps
86+
87+ - name : Download all blob reports
88+ uses : actions/download-artifact@v4
89+ with :
90+ path : ./all-blob-reports
91+ pattern : blob-report-*
92+ merge-multiple : true
93+
94+ - name : Merge HTML & JSON reports
95+ run : |
96+ npx playwright merge-reports \
97+ --config=playwright.config.js \
98+ ./all-blob-reports
99+
100+ - name : Upload combined Playwright report
101+ uses : actions/upload-artifact@v4
102+ with :
103+ name : Playwright Test Report
104+ path : ./playwright-report
105+ retention-days : 14
106+
107+ - name : Upload report to TestDino
108+ env :
109+ TESTDINO_TOKEN : ${{ secrets.TESTDINO_TOKEN }}
110+ run : |
111+ npx tdpw upload ./playwright-report \
112+ --upload-traces \
113+ --upload-html \
114+ --token="$TESTDINO_TOKEN"
0 commit comments