Skip to content

This repository is for doing hands-on practice for the Playwright Framework

Notifications You must be signed in to change notification settings

rishavjeet/woo-automation

Repository files navigation

WordPress WooCommerce E2E Testing with Playwright

This repository contains a set of end-to-end (E2E) test scripts designed to automate various processes in WordPress. The tests are written using the wp-e2e-utils-playwright framework functions, providing a powerful and flexible solution for testing WordPress websites.

E2E test scenarios

The test scripts in this repository cover the following areas:

  • Product Management

    • Create a simple product.
    • Add product categories and tags.
    • Upload product images.
    • Set pricing and inventory.
    • Publish and verify product visibility.
  • Coupon Management

    • Create different types of coupons (percentage, fixed amount).
    • Apply coupons during checkout.
    • Verify discount calculations.
  • User Management

    • Create a customer user.
    • Customer places an order.
    • Admin/Store manager reviews the order.

Visual Test Scenarios

  • Employee Admin Dashboard

    • An employee logs into the admin dashboard
  • Search Employee Feature

    • Login as an Admin to the dashboard.
    • Search for the employee.
    • Show the search list.
  • Add Employee Feature

    • Login as an admin
    • Add a new Employee by adding the reqired data.
    • Test the UI of the new Employee details page.
  • Assign Supervisor to the Employee

    • Create a new Employee.
    • Edit the details and then assign the supervisor to it.

Exclusive Features

  • wp-e2e-utils-playwright Framework: The tests are written using the wp-e2e-utils-playwright framework functions, which streamline the process of automating interactions with a WordPress site. This framework helps interact with the WordPress admin panel, as well as simulating user behavior on the frontend.

  • Test Data Cleanup: Each test script includes a data cleanup feature to ensure that the site storage is not overpopulated with test data. After each test execution, the relevant test data (e.g., products, users, coupons) is removed, maintaining a clean environment for subsequent tests.

Table of Contents

Installation

To get started, follow the steps below to set up the testing environment.

  1. Clone the repository:
git clone https://github.com/rishavjeet/test-automation-hands-on.git
  1. Install the dependencies:

This project uses npm to manage dependencies. Make sure you have Node.js and npm installed. Then, run the following command to install the required packages:

npm install
  1. Install the dependencies:

Create a .env file in the root directory of the project. You will need to add your WordPress admin credentials and other relevant environment configurations.

WP_USERNAME=
WP_PASSWORD=
WP_BASE_URL=

Prerequisites

Before running the test scripts, ensure that you have the following:

  • Node.js (version 14 or later)
  • npm (Node Package Manager)
  • Playwright (installed automatically through npm)
  • WordPress site setup for testing (local or staging environment)

Running the Tests

Once the environment is set up, you can run the test scripts using Playwright’s test runner.

  1. Run all tests:
npx playwright test
  1. Run a specific test script:
npx playwright test path/to/test-script.spec.js

Replace path/to/test-script.spec.js with the path to the specific test script you want to run

About

This repository is for doing hands-on practice for the Playwright Framework

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published