-
Notifications
You must be signed in to change notification settings - Fork 1
173 lines (157 loc) · 5.9 KB
/
Copy pathe2e-tests.yml
File metadata and controls
173 lines (157 loc) · 5.9 KB
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
name: E2E Tests
# The triggers below implement the minimum required by the QA automation standard:
# - Smoke tests on every pull request
# - Full regression suite on workflow_dispatch (pre-release)
on:
pull_request:
workflow_dispatch:
inputs:
TEST_SUITE:
description: 'Test suite to run'
required: true
default: 'critical'
type: choice
options:
- smoke
- critical
- regression
- test
XRAY_TEST_EXEC_KEY:
description: 'Xray test execution key (optional)'
required: false
default: ''
TARGET:
description: 'Target environment (wpenv = local wp-env, kinsta = Kinsta tst)'
required: false
default: 'wpenv'
type: choice
options:
- wpenv
- kinsta
jobs:
build:
name: Build plugin zip
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
coverage: none
tools: composer
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
registry-url: https://npm.pkg.github.com
scope: '@inpsyde'
# Runs `npm run e2e:build-zip` (composer install + asset build for each
# module + rsync + zip) — the same command used for local E2E setup, so
# CI and local always package the plugin the same way.
- name: Build plugin zip
run: npm ci && npm run e2e:build-zip
env:
NODE_AUTH_TOKEN: ${{ secrets.DEPLOYBOT_PACKAGES_READ_ACCESS_TOKEN }}
COMPOSER_AUTH: ${{ secrets.PACKAGIST_AUTH_JSON }}
- uses: actions/upload-artifact@v4
with:
name: paypal-point-of-sale
path: tests/qa/resources/files/paypal-point-of-sale.zip
retention-days: 1
smoke:
name: Smoke Tests
needs: build
if: github.event_name == 'pull_request'
uses: inpsyde/reusable-workflows/.github/workflows/test-playwright.yml@main
with:
PLAYWRIGHT_SCRIPT: e2e:smoke:ci
PLAYWRIGHT_ARTIFACT_PATH: |
playwright-report/
test-results/
PLAYWRIGHT_ARTIFACT_INCLUDE_HIDDEN_FILES: true
PLAYWRIGHT_ARTIFACT_NAME: e2e-smoke-report
PLAYWRIGHT_ARTIFACT_RETENTION_DAYS: 14
NODE_VERSION: 22
PLAYWRIGHT_BROWSER_ARGS: 'chromium --with-deps'
COMPOSER_DEPS_INSTALL: false
PRE_SCRIPT: |
mkdir -p tests/qa/resources/files storage-states
gh run download ${{ github.run_id }} -n "paypal-point-of-sale" -D tests/qa/resources/files/
npx wp-env run cli wp rewrite structure '/%postname%/' --hard
npx wp-env run cli wp plugin activate woocommerce
secrets:
ENV_FILE_DATA: ${{ secrets.QA_ENV_FILE }}
NPM_REGISTRY_TOKEN: ${{ secrets.DEPLOYBOT_PACKAGES_READ_ACCESS_TOKEN }}
COMPOSER_AUTH_JSON: ${{ secrets.PACKAGIST_AUTH_JSON }}
GITHUB_USER_EMAIL: ${{ secrets.DEPLOYBOT_EMAIL }}
GITHUB_USER_NAME: ${{ secrets.DEPLOYBOT_USER }}
GITHUB_USER_SSH_KEY: ${{ secrets.DEPLOYBOT_SSH_PRIVATE_KEY }}
e2e:
name: Run Playwright E2E Tests
needs: build
if: github.event_name == 'workflow_dispatch' && inputs.TARGET != 'kinsta'
uses: inpsyde/reusable-workflows/.github/workflows/test-playwright.yml@main
with:
PLAYWRIGHT_SCRIPT: e2e:${{ inputs.TEST_SUITE }}:ci
PLAYWRIGHT_ARTIFACT_PATH: |
playwright-report/
test-results/
PLAYWRIGHT_ARTIFACT_INCLUDE_HIDDEN_FILES: true
PLAYWRIGHT_ARTIFACT_NAME: e2e-report
PLAYWRIGHT_ARTIFACT_RETENTION_DAYS: 30
NODE_VERSION: 22
PLAYWRIGHT_BROWSER_ARGS: 'chromium --with-deps'
COMPOSER_DEPS_INSTALL: false
XRAY_TEST_EXEC_KEY: ${{ inputs.XRAY_TEST_EXEC_KEY }}
PRE_SCRIPT: |
mkdir -p tests/qa/resources/files storage-states
gh run download ${{ github.run_id }} -n "paypal-point-of-sale" -D tests/qa/resources/files/
npx wp-env run cli wp rewrite structure '/%postname%/' --hard
npx wp-env run cli wp plugin activate woocommerce
secrets:
ENV_FILE_DATA: ${{ secrets.QA_ENV_FILE }}
NPM_REGISTRY_TOKEN: ${{ secrets.DEPLOYBOT_PACKAGES_READ_ACCESS_TOKEN }}
COMPOSER_AUTH_JSON: ${{ secrets.PACKAGIST_AUTH_JSON }}
GITHUB_USER_EMAIL: ${{ secrets.DEPLOYBOT_EMAIL }}
GITHUB_USER_NAME: ${{ secrets.DEPLOYBOT_USER }}
GITHUB_USER_SSH_KEY: ${{ secrets.DEPLOYBOT_SSH_PRIVATE_KEY }}
e2e-kinsta:
name: Run Playwright E2E Tests (Kinsta tst)
needs: build
if: github.event_name == 'workflow_dispatch' && inputs.TARGET == 'kinsta'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
registry-url: https://npm.pkg.github.com
scope: '@inpsyde'
- name: Install npm dependencies
run: npm ci --ignore-scripts
env:
NODE_AUTH_TOKEN: ${{ secrets.DEPLOYBOT_PACKAGES_READ_ACCESS_TOKEN }}
- name: Install Playwright browsers
run: npx playwright install chromium --with-deps
- name: Set up SSH key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.QA_KINSTA_SSH_KEY }}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-keyscan -H -p ${{ secrets.QA_KINSTA_SSH_PORT }} \
${{ secrets.QA_KINSTA_SSH_HOST }} >> ~/.ssh/known_hosts
- name: Download plugin zip
uses: actions/download-artifact@v4
with:
name: paypal-point-of-sale
path: tests/qa/resources/files/
- name: Write .env.ci
run: echo "${{ secrets.QA_KINSTA_ENV_FILE }}" > .env.ci
- name: Create storage-states directory
run: mkdir -p storage-states
- name: Run Playwright tests
run: npm run e2e:${{ inputs.TEST_SUITE }}:ci
env:
XRAY_TEST_EXEC_KEY: ${{ inputs.XRAY_TEST_EXEC_KEY }}
E2E_CONFIRM_RESET: 'true'