11name : Progress Planner Playwright Tests
22
33env :
4- WORDPRESS_URL : http://localhost:8080
5- WORDPRESS_ADMIN_USER : admin
6- WORDPRESS_ADMIN_PASSWORD : password
7- WORDPRESS_ADMIN_EMAIL :
[email protected] 8- WORDPRESS_TABLE_PREFIX : wp_
9- WORDPRESS_DB_USER : wpuser
10- WORDPRESS_DB_PASSWORD : wppass
11- WORDPRESS_DB_NAME : wordpress
12- WORDPRESS_DB_PORT : 3307 # So it can run locally (hopefully).
134 PRPL_TEST_TOKEN : 0220a2de67fc29094281088395939f58
145 YOAST_TOKEN : ${{ secrets.YOAST_TOKEN }}
156
2314 pull_request :
2415
2516jobs :
17+ # Main E2E tests using WP Playground (fast, no Docker)
2618 e2e-tests :
2719 runs-on : ubuntu-latest
2820
21+ steps :
22+ - name : Checkout code
23+ uses : actions/checkout@v4
24+
25+ - name : Setup Node.js
26+ uses : actions/setup-node@v4
27+ with :
28+ node-version : 20
29+ cache : ' npm'
30+
31+ - name : Install dependencies
32+ run : npm ci
33+
34+ - name : Install Playwright browsers
35+ run : npx playwright install --with-deps chromium
36+
37+ - name : Run Playwright Tests
38+ run : npm run test:e2e
39+ env :
40+ PLAYGROUND : ' true'
41+
42+ - name : Upload Playwright Report
43+ if : always()
44+ uses : actions/upload-artifact@v4
45+ with :
46+ name : playwright-report
47+ path : playwright-report/
48+
49+ - name : Upload failure screenshots
50+ if : failure()
51+ uses : actions/upload-artifact@v4
52+ with :
53+ name : playwright-screenshots
54+ path : |
55+ login-failed.png
56+ test-results/
57+
58+ # Yoast Premium tests require Docker (for Composer/premium plugin installation)
59+ # Runs in parallel with e2e-tests - Docker spins up while Playground tests run
60+ yoast-premium-tests :
61+ runs-on : ubuntu-latest
62+
2963 services :
3064 mysql :
3165 image : mariadb:10.6
3266 env :
3367 MYSQL_ROOT_PASSWORD : root
34- MYSQL_DATABASE : ${{ env.WORDPRESS_DB_NAME }}
35- MYSQL_USER : ${{ env.WORDPRESS_DB_USER }}
36- MYSQL_PASSWORD : ${{ env.WORDPRESS_DB_PASSWORD }}
68+ MYSQL_DATABASE : wordpress
69+ MYSQL_USER : wpuser
70+ MYSQL_PASSWORD : wppass
3771 ports :
38- - 3307:3306 # GitHub Actions doesn't support environment variables in the ports section.
72+ - 3307:3306
3973 wordpress :
4074 image : wordpress:latest
4175 env :
4276 WORDPRESS_DB_HOST : mysql
43- WORDPRESS_DB_USER : ${{ env.WORDPRESS_DB_USER }}
44- WORDPRESS_DB_PASSWORD : ${{ env.WORDPRESS_DB_PASSWORD }}
45- WORDPRESS_DB_NAME : ${{ env.WORDPRESS_DB_NAME }}
46- WORDPRESS_DB_PORT : ${{ env.WORDPRESS_DB_PORT }}
47- WORDPRESS_TABLE_PREFIX : ${{ env.WORDPRESS_TABLE_PREFIX }}
77+ WORDPRESS_DB_USER : wpuser
78+ WORDPRESS_DB_PASSWORD : wppass
79+ WORDPRESS_DB_NAME : wordpress
4880 WORDPRESS_DEBUG : 1
49- WORDPRESS_URL : ${{ env.WORDPRESS_URL }}
50- WORDPRESS_ADMIN_USER : ${{ env.WORDPRESS_ADMIN_USER }}
51- WORDPRESS_ADMIN_PASSWORD : ${{ env.WORDPRESS_ADMIN_PASSWORD }}
52- WORDPRESS_ADMIN_EMAIL : ${{ env.WORDPRESS_ADMIN_EMAIL }}
53- PRPL_TEST_TOKEN : ${{ env.PRPL_TEST_TOKEN }}
5481 ports :
5582 - 8080:80
5683 options : >-
@@ -61,27 +88,31 @@ jobs:
6188
6289 steps :
6390 - name : Checkout code
64- uses : actions/checkout@v3
91+ uses : actions/checkout@v4
6592
66- - name : Install Node.js & Playwright
67- uses : actions/setup-node@v3
93+ - name : Setup Node.js
94+ uses : actions/setup-node@v4
6895 with :
69- node-version : 18
70- - run : npm install -D @playwright/test
71- - run : npx playwright install --with-deps
96+ node-version : 20
97+ cache : ' npm'
98+
99+ - name : Install dependencies
100+ run : npm ci
101+
102+ - name : Install Playwright browsers
103+ run : npx playwright install --with-deps chromium
72104
73105 - name : Complete WordPress installation
74106 run : |
75- echo "Installing WordPress at: $WORDPRESS_URL"
76- curl --silent -X POST "$WORDPRESS_URL/wp-admin/install.php?step=2" \
107+ curl --silent -X POST "http://localhost:8080/wp-admin/install.php?step=2" \
77108 -d "weblog_title=My%20WordPress%20Site" \
78- -d "user_name=$WORDPRESS_ADMIN_USER " \
79- -d "admin_password=$WORDPRESS_ADMIN_PASSWORD " \
80- -d "admin_password2=$WORDPRESS_ADMIN_PASSWORD " \
81- -d "admin_email=$WORDPRESS_ADMIN_EMAIL " \
109+ -d "user_name=admin " \
110+ -d "admin_password=password " \
111+ -d "admin_password2=password " \
112+ -d "admin_email=[email protected] " \ 82113 -d "public=1"
83114
84- - name : Install and activate plugin
115+ - name : Setup WordPress with plugins
85116 run : |
86117 WP_CONTAINER=$(docker ps -qf "name=wordpress")
87118
@@ -90,79 +121,56 @@ jobs:
90121 docker exec $WP_CONTAINER chmod +x wp-cli.phar
91122 docker exec $WP_CONTAINER mv wp-cli.phar /usr/local/bin/wp
92123
93- # Create the plugins directory in the WordPress container
94- docker exec $WP_CONTAINER mkdir -p /var/www/html/wp-content/plugins
95-
96- # Copy plugin files to WordPress plugins directory
124+ # Copy and activate Progress Planner
97125 docker cp . $WP_CONTAINER:/var/www/html/wp-content/plugins/progress-planner
98-
99- # Activate the plugin using WP-CLI
100126 docker exec $WP_CONTAINER wp plugin activate progress-planner --allow-root
101127
102- # Enable debug mode
103- docker exec $WP_CONTAINER wp option update prpl_debug true --allow-root
104-
105- # Insert test token
128+ # Set test token
106129 docker exec $WP_CONTAINER wp option update progress_planner_test_token $PRPL_TEST_TOKEN --allow-root
107130
108- # Install Yoast SEO
131+ # Install and activate Yoast SEO (free)
109132 docker exec $WP_CONTAINER wp plugin install wordpress-seo --activate --allow-root
110133
111- - name : Run Playwright Tests
112- run : npx playwright test tests/e2e/
113-
114- # Begin Yoast SEO Premium tests
115- - name : Install PHP & Composer on host
134+ - name : Install PHP & Composer
116135 run : |
117136 sudo apt-get update
118137 sudo apt-get install -y git curl unzip php-cli php-curl php-mbstring php-xml php-zip
119138 curl -sS https://getcomposer.org/installer | php
120139 sudo mv composer.phar /usr/local/bin/composer
121140
122- - name : Install plugin dependencies (Composer)
141+ - name : Install Yoast SEO Premium
123142 run : |
143+ WP_CONTAINER=$(docker ps -qf "name=wordpress")
144+
145+ # Configure Composer for Yoast
124146 composer config -g http-basic.my.yoast.com token $YOAST_TOKEN
125147 composer config repositories.my-yoast composer https://my.yoast.com/packages/
126148 composer config --no-plugins allow-plugins.composer/installers true
127- composer install --working-dir=./
149+ composer install
128150
129- - name : Require Yoast SEO Premium & copy files
130- run : |
131- WP_CONTAINER=$(docker ps -qf "name=wordpress")
151+ # Install and copy Yoast Premium
132152 composer require yoast/wordpress-seo-premium
133153 composer dump-autoload --working-dir=./wp-content/plugins/wordpress-seo-premium
134154 docker cp ./wp-content/plugins/wordpress-seo-premium $WP_CONTAINER:/var/www/html/wp-content/plugins/wordpress-seo-premium
135155
136- - name : Activate Yoast SEO Premium
137- run : |
138- WP_CONTAINER=$(docker ps -qf "name=wordpress")
156+ # Activate and configure
139157 docker exec $WP_CONTAINER wp plugin activate wordpress-seo-premium --allow-root
140158
141- - name : Update Yoast Premium settings
142- run : |
143- WP_CONTAINER=$(docker ps -qf "name=wordpress")
144- # Get current option value
159+ # Disable redirect after install
145160 CURRENT_OPTION=$(docker exec $WP_CONTAINER wp option get wpseo_premium --format=json --allow-root)
146- # Update the option with should_redirect_after_install set to false
147161 UPDATED_OPTION=$(echo $CURRENT_OPTION | jq '.should_redirect_after_install = false')
148- # Save the updated option
149162 docker exec $WP_CONTAINER wp option update wpseo_premium "$UPDATED_OPTION" --format=json --allow-root
150163
151- - name : Run Yoast Focus Element Test Again
152- run : npx playwright test tests/e2e/yoast-focus-element.spec.js
153- # End Yoast SEO Premium tests
164+ - name : Run Yoast Integration Tests
165+ run : npx playwright test --project=parallel --grep="Yoast"
166+ env :
167+ WORDPRESS_URL : http://localhost:8080
168+ WORDPRESS_ADMIN_USER : admin
169+ WORDPRESS_ADMIN_PASSWORD : password
154170
155- - name : Upload Playwright Report
171+ - name : Upload Yoast Test Report
156172 if : always()
157173 uses : actions/upload-artifact@v4
158174 with :
159- name : playwright-report
175+ name : yoast- playwright-report
160176 path : playwright-report/
161-
162- - name : Upload Playwright screenshots as artifacts
163- if : failure()
164- uses : actions/upload-artifact@v4
165- with :
166- name : playwright-screenshots
167- path : |
168- onboarding-failed.png # Specify the path of the screenshot you want to upload
0 commit comments