-
Notifications
You must be signed in to change notification settings - Fork 1
176 lines (146 loc) · 5.66 KB
/
playwright.yml
File metadata and controls
176 lines (146 loc) · 5.66 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
174
175
176
name: Progress Planner Playwright Tests
env:
PRPL_TEST_TOKEN: 0220a2de67fc29094281088395939f58
YOAST_TOKEN: ${{ secrets.YOAST_TOKEN }}
on:
push:
branches:
- main
- develop
- 'release/[0-9]+.[0-9]+*'
- 'hotfix/[0-9]+.[0-9]+*'
pull_request:
jobs:
# Main E2E tests using WP Playground (fast, no Docker)
e2e-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Install Playwright browsers
run: npx playwright install --with-deps chromium
- name: Run Playwright Tests
run: npm run test:e2e
env:
PLAYGROUND: 'true'
- name: Upload Playwright Report
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: playwright-report/
- name: Upload failure screenshots
if: failure()
uses: actions/upload-artifact@v4
with:
name: playwright-screenshots
path: |
login-failed.png
test-results/
# Yoast Premium tests require Docker (for Composer/premium plugin installation)
# Runs in parallel with e2e-tests - Docker spins up while Playground tests run
yoast-premium-tests:
runs-on: ubuntu-latest
services:
mysql:
image: mariadb:10.6
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: wordpress
MYSQL_USER: wpuser
MYSQL_PASSWORD: wppass
ports:
- 3307:3306
wordpress:
image: wordpress:latest
env:
WORDPRESS_DB_HOST: mysql
WORDPRESS_DB_USER: wpuser
WORDPRESS_DB_PASSWORD: wppass
WORDPRESS_DB_NAME: wordpress
WORDPRESS_DEBUG: 1
ports:
- 8080:80
options: >-
--health-cmd="curl --silent --fail http://localhost:8080/wp-login.php || exit 0"
--health-interval=10s
--health-timeout=5s
--health-retries=5
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Install Playwright browsers
run: npx playwright install --with-deps chromium
- name: Complete WordPress installation
run: |
curl --silent -X POST "http://localhost:8080/wp-admin/install.php?step=2" \
-d "weblog_title=My%20WordPress%20Site" \
-d "user_name=admin" \
-d "admin_password=password" \
-d "admin_password2=password" \
-d "admin_email=admin@example.com" \
-d "public=1"
- name: Setup WordPress with plugins
run: |
WP_CONTAINER=$(docker ps -qf "name=wordpress")
# Install WP-CLI
docker exec $WP_CONTAINER curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
docker exec $WP_CONTAINER chmod +x wp-cli.phar
docker exec $WP_CONTAINER mv wp-cli.phar /usr/local/bin/wp
# Copy and activate Progress Planner
docker cp . $WP_CONTAINER:/var/www/html/wp-content/plugins/progress-planner
docker exec $WP_CONTAINER wp plugin activate progress-planner --allow-root
# Set test token
docker exec $WP_CONTAINER wp option update progress_planner_test_token $PRPL_TEST_TOKEN --allow-root
# Install and activate Yoast SEO (free)
docker exec $WP_CONTAINER wp plugin install wordpress-seo --activate --allow-root
- name: Install PHP & Composer
run: |
sudo apt-get update
sudo apt-get install -y git curl unzip php-cli php-curl php-mbstring php-xml php-zip
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
- name: Install Yoast SEO Premium
run: |
WP_CONTAINER=$(docker ps -qf "name=wordpress")
# Configure Composer for Yoast
composer config -g http-basic.my.yoast.com token $YOAST_TOKEN
composer config repositories.my-yoast composer https://my.yoast.com/packages/
composer config --no-plugins allow-plugins.composer/installers true
composer install
# Install and copy Yoast Premium
composer require yoast/wordpress-seo-premium
composer dump-autoload --working-dir=./wp-content/plugins/wordpress-seo-premium
docker cp ./wp-content/plugins/wordpress-seo-premium $WP_CONTAINER:/var/www/html/wp-content/plugins/wordpress-seo-premium
# Activate and configure
docker exec $WP_CONTAINER wp plugin activate wordpress-seo-premium --allow-root
# Disable redirect after install
CURRENT_OPTION=$(docker exec $WP_CONTAINER wp option get wpseo_premium --format=json --allow-root)
UPDATED_OPTION=$(echo $CURRENT_OPTION | jq '.should_redirect_after_install = false')
docker exec $WP_CONTAINER wp option update wpseo_premium "$UPDATED_OPTION" --format=json --allow-root
- name: Run Yoast Integration Tests
run: npx playwright test --project=parallel --grep="Yoast"
env:
WORDPRESS_URL: http://localhost:8080
WORDPRESS_ADMIN_USER: admin
WORDPRESS_ADMIN_PASSWORD: password
- name: Upload Yoast Test Report
if: always()
uses: actions/upload-artifact@v4
with:
name: yoast-playwright-report
path: playwright-report/