Fix WordPress Playground tests: update port for multisite, improve test reliability
This commit is contained in:
44
.github/workflows/playground-tests-fix.yml
vendored
Normal file
44
.github/workflows/playground-tests-fix.yml
vendored
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
name: WordPress Playground Tests Fix
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ main, feature/*, bugfix/* ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ main ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
playground-test:
|
||||||
|
name: WordPress Playground Tests
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- 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 WordPress Playground CLI
|
||||||
|
run: npm install -g @wp-playground/cli
|
||||||
|
|
||||||
|
- name: Create plugin zip
|
||||||
|
run: |
|
||||||
|
mkdir -p dist
|
||||||
|
zip -r dist/plugin.zip . -x "node_modules/*" "dist/*" ".git/*"
|
||||||
|
|
||||||
|
- name: Run tests with WordPress Playground
|
||||||
|
run: |
|
||||||
|
# Start WordPress Playground with our blueprint
|
||||||
|
npx @wp-playground/cli server --blueprint playground/blueprint.json --port 8888 --login &
|
||||||
|
|
||||||
|
# Wait for WordPress Playground to be ready
|
||||||
|
echo "Waiting for WordPress Playground to be ready..."
|
||||||
|
timeout 60 bash -c 'until curl -s http://localhost:8888; do sleep 2; done'
|
||||||
|
|
||||||
|
# Run Cypress tests against WordPress Playground
|
||||||
|
npx cypress run --config specPattern=cypress/e2e/playground-single-site.cy.js
|
||||||
6
.github/workflows/playground-tests.yml
vendored
6
.github/workflows/playground-tests.yml
vendored
@@ -102,14 +102,14 @@ jobs:
|
|||||||
- name: Run tests with WordPress Playground
|
- name: Run tests with WordPress Playground
|
||||||
run: |
|
run: |
|
||||||
# Start WordPress Playground with our blueprint
|
# Start WordPress Playground with our blueprint
|
||||||
npx @wp-playground/cli server --blueprint playground/multisite-blueprint.json --port 8889 --login &
|
npx @wp-playground/cli server --blueprint playground/multisite-blueprint.json --port 8888 --login &
|
||||||
|
|
||||||
# Wait for WordPress Playground to be ready
|
# Wait for WordPress Playground to be ready
|
||||||
echo "Waiting for WordPress Playground to be ready..."
|
echo "Waiting for WordPress Playground to be ready..."
|
||||||
timeout 60 bash -c 'until curl -s http://localhost:8889; do sleep 2; done'
|
timeout 60 bash -c 'until curl -s http://localhost:8888; do sleep 2; done'
|
||||||
|
|
||||||
# Run Cypress tests against WordPress Playground
|
# Run Cypress tests against WordPress Playground
|
||||||
npx cypress run --config specPattern=cypress/e2e/playground-multisite.cy.js,baseUrl=http://localhost:8889
|
npx cypress run --config specPattern=cypress/e2e/playground-multisite.cy.js
|
||||||
|
|
||||||
performance-test:
|
performance-test:
|
||||||
name: WordPress Performance Tests
|
name: WordPress Performance Tests
|
||||||
|
|||||||
@@ -11,13 +11,15 @@ describe('WordPress Playground Multisite Tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('Can access the network admin area', () => {
|
it('Can access the network admin area', () => {
|
||||||
// WordPress Playground should auto-login as admin
|
// Visit the network admin dashboard
|
||||||
cy.get('#wpadminbar').should('exist');
|
cy.visit('/wp-admin/network/');
|
||||||
|
|
||||||
|
// Check if we're logged in to the network admin
|
||||||
|
cy.get('body').should('have.class', 'wp-admin');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Plugin is network activated', () => {
|
it('Plugin is network activated', () => {
|
||||||
// Navigate to network plugins page
|
// Navigate to network plugins page
|
||||||
cy.get('#wp-admin-bar-network-admin a').click();
|
|
||||||
cy.visit('/wp-admin/network/plugins.php');
|
cy.visit('/wp-admin/network/plugins.php');
|
||||||
|
|
||||||
// Check if the plugins are active
|
// Check if the plugins are active
|
||||||
|
|||||||
@@ -11,8 +11,11 @@ describe('WordPress Playground Single Site Tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('Can access the admin area', () => {
|
it('Can access the admin area', () => {
|
||||||
// WordPress Playground should auto-login as admin
|
// Visit the admin dashboard
|
||||||
cy.get('#wpadminbar').should('exist');
|
cy.visit('/wp-admin/');
|
||||||
|
|
||||||
|
// Check if we're logged in
|
||||||
|
cy.get('body').should('have.class', 'wp-admin');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Plugin is activated', () => {
|
it('Plugin is activated', () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user