End-to-end testing suite for BackWPUp plugin using Playwright and Cucumber.
- Node.js - Make sure you have Node.js installed
- BackWPUp Plugin Files - You need zip files of BackWPUp for testing:
- Free Version:
new_release_free.zip(latest),previous_stable_free.zip(stable) - Pro Version:
new_release_pro.zip(latest),previous_stable_pro.zip(stable) - Place these files in the
./pluginfolder in the root
- Free Version:
- Test Helper Plugin - Install the BackWPUp E2E Test Helper on your test site
- WordPress Test Site - A WordPress site with admin credentials for testing
- Clone this repository
- Run
npm installto install dependencies - Run
npx playwright installto download browser engines - Copy
config/wp.config.sample.tstoconfig/wp.config.tsand update with your test site details
Update the configuration file config/wp.config.ts with:
WP_BASE_URL- Your test site URLWP_USERNAME&WP_PASSWORD- WordPress admin credentials- Additional SSH/Docker settings if needed
Use the comprehensive test runner script for advanced options:
# Run all tests
./run-tests.sh all
# Run tests on different environments
./run-tests.sh -e staging playwright
./run-tests.sh -e production cucumber
# Run with debugging
./run-tests.sh -d -u playwright
# Run smoke tests only
./run-tests.sh --smoke all
# Clean results and run regression tests
./run-tests.sh -c --regression all# Run tests headless
npm run test:e2e
# Run tests with browser visible
npm run test:e2e:headed
# Debug tests step by step
npm run test:e2e:debug# Run Cucumber BDD tests
npm run test:cucumber
# Run Cucumber tests with browser visible
npm run test:cucumber:headed# Generate reference images
npm run test:backstop:reference
# Run visual regression tests
npm run test:backstop
# Approve new screenshots
npm run test:backstop:approveUse npm run test:e2e:debug to control and view each test step interactively.
You can also run npm run test:e2e:headed to view tests being executed in the browser.
├── config/ # Configuration files
├── plugin/ # BackWPUp plugin zip files
├── src/
│ ├── common/ # Common utilities and page objects
│ │ ├── sections/ # Plugin sections (jobs, settings, etc.)
│ │ └── selectors.ts # Element selectors
│ ├── features/ # Cucumber feature files
│ ├── specs/ # Playwright test specifications
│ └── support/ # Cucumber step definitions and hooks
├── utils/ # Utility functions and helpers
├── test-results/ # Test results and reports
└── backstop_data/ # Visual regression data
Tests are organized in src/specs/ following the plugin structure:
src/specs/admin/jobs/- Job management testssrc/specs/admin/settings/- Settings testssrc/specs/admin/logs/- Log management tests
BDD scenarios are in src/features/ with step definitions in src/support/steps/.
After test runs, Playwright generates HTML reports with videos and screenshots of failed tests.
GPL-3.0
The project includes a Docker setup for a complete WordPress testing environment:
# Start WordPress environment
npm run docker:up
# Stop WordPress environment
npm run docker:down
# View WordPress logs
npm run docker:logsWordPress will be available at http://localhost:8080 with:
- Username:
admin - Password:
password
The MySQL database is accessible on port 3306 with:
- Database:
wordpress - Username:
wordpress - Password:
wordpress
Place your BackWPUp plugin files in the plugin/ directory to have them available in the WordPress environment.
The project includes comprehensive tests for BackWPUp plugin installation, activation, and deletion scenarios.
Available test scenarios:
- Install and Activate - Tests plugin installation and activation flow
- Delete After Install - Tests plugin deletion immediately after installation
- Delete After Activate - Tests plugin deletion after activation
- Delete After First Backup - Tests plugin deletion after creating a backup
# Interactive plugin test runner
./run-plugin-tests.sh
# Run specific test types
npm run test:plugin:playwright # Playwright tests only
npm run test:plugin:cucumber # Cucumber tests only
npm run test:plugin-lifecycle # Interactive runner
# Run with specific options
npx playwright test src/specs/plugin-lifecycle.spec.ts --headed
npx cucumber-js src/features/plugin-lifecycle.feature --tags "@smoke"Each scenario runs against:
- ✅ BackWPUp Free (new_release_free.zip)
- ✅ BackWPUp Pro (new_release_pro.zip)
Tags available:
@smoke- Quick essential tests@regression- Comprehensive test coverage@free- Free version specific tests@pro- Pro version specific tests