-
Notifications
You must be signed in to change notification settings - Fork 19
74 lines (67 loc) · 2.29 KB
/
pr-e2e-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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: Run E2E tests on PR
on:
pull_request:
jobs:
run:
timeout-minutes: 60
name: Run E2E Tests WP Version ${{matrix.wpImage}}
runs-on: ubuntu-latest
strategy:
fail-fast: false # Disable fail-fast so all jobs run even if one fails.
matrix:
include:
# Latest WP release version with latest WC version.
- wpImage: "wordpress:latest"
wcVersion: ""
# Latest WP 6.1 with PHP 8.0 to ensure PHP 8.0.0 compatability.
- wpImage: "wordpress:6.1-php8.0"
wcVersion: ""
# Minimum supported WordPress, PHP and WC Versions
- wpImage: "wordpress:5-php7.4"
wcVersion: "5.6.0"
steps:
# Checkout repo.
- uses: actions/checkout@v3
with:
# Use the commit that triggered the workflow.
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/setup-node@v3 # Install node version 16.
with:
node-version: 16
# Install all composer dependencies for the plugin.
- name: Install Composer dependencies
uses: php-actions/composer@v6
with:
dev: no
php_version: 7.4
# Install and build Block release.
- name: Build block release versions.
run: |
npm ci
npm run build
# Install NPM packages for tests.
- name: Install NPM packages.
working-directory: tests/e2e
run: npm ci
# Start the docker container for the test suite.
- name: Start docker container.
working-directory: tests/e2e
env:
WP_IMAGE: ${{matrix.wpImage}}
WC_VERSION: ${{matrix.wcVersion}}
NGROK_AUTH: ${{ secrets.NGROK_AUTH }}
run: npm run docker:up
# Install Chromium with Playwright.
- name: Install Chromium browser with Playwright
working-directory: tests/e2e
run: npx playwright install chromium
# Run E2E tests.
- name: Run E2E Tests with Playwright.
working-directory: tests/e2e
env:
CI: 1
KLARNA_API_USERNAME: ${{ secrets.KLARNA_API_USERNAME }}
KLARNA_API_PASSWORD: ${{ secrets.KLARNA_API_PASSWORD }}
WC_VERSION: ${{matrix.wcVersion}}
NGROK_AUTH: ${{ secrets.NGROK_AUTH }}
run: npx playwright test