Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/prepublish-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Prepublish test

on:
workflow_dispatch:
inputs:
plugin_ref:
description: 'Plugin branch, tag or commit to test (e.g. refs/pull/64/head); blank uses this workflow commit'
required: false
type: string

permissions:
contents: read

jobs:
browser-tests:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Check out the plugin version under test
uses: actions/checkout@v6
with:
ref: ${{ inputs.plugin_ref || github.sha }}
path: .plugin-under-test
sparse-checkout: siteimprove
persist-credentials: false
- name: Record the plugin commit under test
run: git -C .plugin-under-test rev-parse HEAD
- uses: actions/setup-node@v6
with:
node-version: '24'
cache: npm
- run: npm ci
- run: npx playwright install --with-deps chromium firefox
- run: npm test
env:
SITEIMPROVE_TEST_SCRIPT: ${{ github.workspace }}/.plugin-under-test/siteimprove/admin/js/siteimprove.js
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: prepublish-test-report
path: |
playwright-report/
test-results/browser/
retention-days: 14
50 changes: 50 additions & 0 deletions .github/workflows/prepublish-wordpress.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Prepublish WordPress environment

on:
workflow_dispatch:
inputs:
plugin_ref:
description: 'Plugin branch, tag or commit to test (e.g. refs/pull/64/head); blank uses this workflow commit'
required: false
type: string

permissions:
contents: read

jobs:
wordpress:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Check out the plugin version under test
uses: actions/checkout@v6
with:
ref: ${{ inputs.plugin_ref || github.sha }}
path: .plugin-under-test
sparse-checkout: siteimprove
persist-credentials: false
- name: Record the plugin commit under test
run: git -C .plugin-under-test rev-parse HEAD
- uses: actions/setup-node@v6
with:
node-version: '24'
cache: npm
- run: npm ci
- run: npx playwright install --with-deps chromium firefox
- name: Point WordPress at the selected plugin
run: node -e "require('node:fs').writeFileSync('.wp-env.override.json', JSON.stringify({plugins:['./.plugin-under-test/siteimprove']}))"
- run: npm run env:start
- run: npm run test:wordpress
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: prepublish-wordpress-report
path: |
playwright-wordpress-report/
test-results/wordpress/
retention-days: 14
- run: npm run env:stop
if: ${{ always() }}
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,15 @@ phpcs.xml
#######################

*.un~

# Browser regression tests
node_modules/
playwright-report/
playwright-wordpress-report/
test-results/
.wp-env.override.json
.wp-env-cache/
playwright/.auth/

# Separate plugin checkout used by manual test workflows
.plugin-under-test/
18 changes: 18 additions & 0 deletions .wp-env.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"$schema": "https://schemas.wp.org/trunk/wp-env.json",
"core": null,
"phpVersion": "8.3",
"port": 8888,
"testsEnvironment": false,
"plugins": ["./siteimprove"],
"config": {
"WP_ENVIRONMENT_TYPE": "local",
"WP_DEBUG": true,
"WP_DEBUG_DISPLAY": false,
"SITEIMPROVE_TEST_ENVIRONMENT": true,
"SITEIMPROVE_TEST_MOCK_SERVICE": true
},
"mappings": {
"wp-content/mu-plugins": "./tests/wordpress/support"
}
}
Loading