This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 218
90 lines (74 loc) · 2.71 KB
/
playwright.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
84
85
86
87
88
89
name: Playwright Tests
on:
push:
branches: [ trunk ]
pull_request:
jobs:
PlaywrightE2ETests:
name: Playwright E2E tests - ${{ matrix.config.name }}
timeout-minutes: 60
runs-on: ubuntu-latest
strategy:
matrix:
config: [
{ name: Normal, file: playwright.config.ts, resultPath: test-results },
{ name: Classic, file: playwright.classic-theme.config.ts, resultPath: test-results-classic-theme },
{ name: SideEffects, file: playwright.side-effects.config.ts, resultPath: test-results-side-effects },
]
steps:
- uses: actions/checkout@v3
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: node_modules
key: ${{ runner.os }}-modified-build-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-modified-build-${{ env.cache-name }}-
${{ runner.os }}-modified-build-
${{ runner.os }}-modified-
- name: Setup node version and npm cache
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
- name: Install Node dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: npm ci
- name: Build Assets
run: FORCE_REDUCED_MOTION=true npm run build
- name: blocks.ini setup
run: |
echo -e 'woocommerce_blocks_phase = 3\nwoocommerce_blocks_env = tests' > blocks.ini
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
coverage: none
tools: composer
- name: Composer install
run: composer install
- name: Install Playwright
run: npx playwright install --with-deps
- name: Load wp-env
run: npm run env:start
- name: Run Playwright tests
run: npm run test:e2e -- --config=tests/e2e/${{ matrix.config.file }}
- uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: playwright-report-${{ matrix.config.name }}
path: artifacts/${{ matrix.config.resultPath }}
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`