|
1 | | -# TestAutomation-Hands-on |
2 | | -This repository is for doing hands-on practice for the Playwright Framework |
| 1 | +# WordPress WooCommerce E2E Testing with Playwright |
| 2 | + |
| 3 | +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. |
| 4 | + |
| 5 | +The test scripts in this repository cover the following areas: |
| 6 | + |
| 7 | +- **Product Management** |
| 8 | + - Create a simple product. |
| 9 | + - Add product categories and tags. |
| 10 | + - Upload product images. |
| 11 | + - Set pricing and inventory. |
| 12 | + - Publish and verify product visibility. |
| 13 | + |
| 14 | +- **Coupon Management** |
| 15 | + - Create different types of coupons (percentage, fixed amount). |
| 16 | + - Apply coupons during checkout. |
| 17 | + - Verify discount calculations. |
| 18 | + |
| 19 | +- **User Management** |
| 20 | + - Create a customer user. |
| 21 | + - Customer places an order. |
| 22 | + - Admin/Store manager reviews the order. |
| 23 | + |
| 24 | +### Exclusive Features |
| 25 | + |
| 26 | +- **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. |
| 27 | + |
| 28 | +- **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. |
| 29 | + |
| 30 | +## Table of Contents |
| 31 | + |
| 32 | +- [Installation](#installation) |
| 33 | +- [Prerequisites](#prerequisites) |
| 34 | +- [Running the Tests](#running-the-tests) |
| 35 | + |
| 36 | +## Installation |
| 37 | + |
| 38 | +To get started, follow the steps below to set up the testing environment. |
| 39 | + |
| 40 | +1. **Clone the repository**: |
| 41 | + |
| 42 | +```bash |
| 43 | +git clone https://github.com/rishavjeet/test-automation-hands-on.git |
| 44 | +``` |
| 45 | +2. **Install the dependencies**: |
| 46 | + |
| 47 | +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: |
| 48 | + |
| 49 | +```bash |
| 50 | +npm install |
| 51 | +``` |
| 52 | +2. **Install the dependencies**: |
| 53 | + |
| 54 | +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. |
| 55 | + |
| 56 | +```bash |
| 57 | +WP_USERNAME= |
| 58 | +WP_PASSWORD= |
| 59 | +WP_BASE_URL= |
| 60 | +``` |
| 61 | + |
| 62 | +## Prerequisites |
| 63 | + |
| 64 | +Before running the test scripts, ensure that you have the following: |
| 65 | + |
| 66 | +- `Node.js` (version 14 or later) |
| 67 | +- `npm` (Node Package Manager) |
| 68 | +- Playwright (installed automatically through npm) |
| 69 | +- WordPress site setup for testing (local or staging environment) |
| 70 | + |
| 71 | +## Running the Tests |
| 72 | + |
| 73 | +Once the environment is set up, you can run the test scripts using Playwright’s test runner. |
| 74 | + |
| 75 | +1. Run all tests: |
| 76 | + |
| 77 | +```bash |
| 78 | +npx playwright test |
| 79 | +``` |
| 80 | +2. Run a specific test script: |
| 81 | + |
| 82 | +```bash |
| 83 | +npx playwright test path/to/test-script.spec.js |
| 84 | +``` |
| 85 | +*Replace `path/to/test-script.spec.js` with the path to the specific test script you want to run* |
0 commit comments