Skip to content

Miraeld/bwu-e2e

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BackWPUp E2E Tests

End-to-end testing suite for BackWPUp plugin using Playwright and Cucumber.

Requirements

  • 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 ./plugin folder in the root
  • Test Helper Plugin - Install the BackWPUp E2E Test Helper on your test site
  • WordPress Test Site - A WordPress site with admin credentials for testing

Installation

  1. Clone this repository
  2. Run npm install to install dependencies
  3. Run npx playwright install to download browser engines
  4. Copy config/wp.config.sample.ts to config/wp.config.ts and update with your test site details

Configuration

Update the configuration file config/wp.config.ts with:

  • WP_BASE_URL - Your test site URL
  • WP_USERNAME & WP_PASSWORD - WordPress admin credentials
  • Additional SSH/Docker settings if needed

Running Tests

Enhanced Test Runner

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

Individual Test Types

Playwright Tests

# 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

Cucumber Tests

# Run Cucumber BDD tests
npm run test:cucumber

# Run Cucumber tests with browser visible
npm run test:cucumber:headed

Visual Regression Tests

# Generate reference images
npm run test:backstop:reference

# Run visual regression tests
npm run test:backstop

# Approve new screenshots
npm run test:backstop:approve

Debugging Tests

Use 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.

Project Structure

├── 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

Writing Tests

Test Organization

Tests are organized in src/specs/ following the plugin structure:

  • src/specs/admin/jobs/ - Job management tests
  • src/specs/admin/settings/ - Settings tests
  • src/specs/admin/logs/ - Log management tests

Cucumber Features

BDD scenarios are in src/features/ with step definitions in src/support/steps/.

Reporting

After test runs, Playwright generates HTML reports with videos and screenshots of failed tests.

License

GPL-3.0

Docker Environment

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:logs

WordPress 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.

Plugin Lifecycle Tests

The project includes comprehensive tests for BackWPUp plugin installation, activation, and deletion scenarios.

Test Scenarios

Available test scenarios:

  1. Install and Activate - Tests plugin installation and activation flow
  2. Delete After Install - Tests plugin deletion immediately after installation
  3. Delete After Activate - Tests plugin deletion after activation
  4. Delete After First Backup - Tests plugin deletion after creating a backup

Running Plugin Tests

# 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"

Test Coverage

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published