-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (69 loc) · 2.69 KB
/
crossbrowsers.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
name: Playwright Crossbrowsers Tests
'on':
pull_request:
branches:
- main
workflow_dispatch:
jobs:
Custom_Linux_Grid:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the code
- name: Checkout Code
uses: actions/checkout@v4
# Step 2: Set up Node.js environment
- name: Setup Node.js env
uses: actions/setup-node@v4
with:
node-version: lts/*
# Step 3: Install Yarn (if not installed)
- name: Install Yarn
run: |
npm install -g yarn
# Step 4: Install dependencies using Yarn
- name: Install dependencies
run: |
yarn install
yarn add playwright
yarn add typescript ts-node @types/node
# Step 5: Install Playwright Browsers
- name: Install Playwright Browsers
run: yarn playwright install --with-deps
# Step 6: Compile TypeScript
- name: Compile TypeScript
run: yarn tsc
# Step 7: Ensure Playwright Artifacts exists
- name: Ensure Playwright Artifacts Directory Exists
run: |
mkdir -p test-results/.playwright-artifacts-0/traces
# Step 8: Run Playwright Tests across all browsers in parallel
- name: Run Playwright Tests across all browsers
run: |
echo "Running tests on all browsers: Chromium, Firefox, and WebKit (Edge)"
# Run tests across all browsers in parallel using the `projects` configuration
# The `&` operator runs these commands in parallel, and `wait` ensures that they all finish before continuing
xvfb-run -a yarn playwright test --project=chromium --reporter=html & # Chromium
xvfb-run -a yarn playwright test --project=firefox --reporter=html & # Firefox
xvfb-run -a yarn playwright test --project=webkit --reporter=html & # WebKit (Edge)
wait # Wait for all browsers to finish running
# Step 9: Upload Playwright Reports as Pipeline Artifact
- name: Upload Playwright Report as Pipeline Artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: Playwright_Report
path: playwright-report/
# Step 10: Upload Playwright Report HTML as Pipeline Artifact
- name: Upload Playwright Report HTML as Pipeline Artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: Playwright_Report_HTML
path: playwright-report/index.html
# Step 11: Upload Playwright Test Results (Optional)
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: Playwright_Test_Results
path: test-results/