woocommerce/plugins/woocommerce-blocks/tests/e2e-pw
Manish Menaria bd892c4781 Add E2E tests for 'Inherit query from template' control in Product Collection block (https://github.com/woocommerce/woocommerce-blocks/pull/10174)
Key updates:

1. Additional CSS class to Inherit Query Control: A CSS class named `wc-block-product-collection__inherit-query-control` has been added to the ToggleControl component. This provides a precise target for E2E tests and potential custom styles.

2. E2E tests for 'Inherit query from template' control: Numerous scenarios have been covered to ensure the control's correct behavior. These scenarios include verifying visibility under different circumstances and checking its functionality in a Product Catalog template.

3. E2E test code enhancements: The E2E test code now exports the `SELECTORS` object to assist in locating different elements during the tests. This includes the new 'Inherit query from template' control. The `setShowOnlyProductsOnSale()` function has been refactored to improve readability and provide more granular control over its operations.

4. Test scenario for 'Show only products on sale': The existing E2E test for this functionality has been extended to check that it retains its state when the 'Inherit query from template' control is toggled.

These changes increase the robustness of our E2E tests, providing better coverage for the 'Inherit query from template' control in the Product Collection block.
2023-07-14 10:52:19 +05:30
..
bin Add e2e tests for attributes count (https://github.com/woocommerce/woocommerce-blocks/pull/9500) 2023-06-01 07:14:50 -07:00
playwright-utils Add FrontendUtils class (https://github.com/woocommerce/woocommerce-blocks/pull/10033) 2023-06-30 09:08:14 +02:00
test-data/data WIP: Add Playwright setup (https://github.com/woocommerce/woocommerce-blocks/pull/9034) 2023-04-17 19:01:41 +07:00
tests Add E2E tests for 'Inherit query from template' control in Product Collection block (https://github.com/woocommerce/woocommerce-blocks/pull/10174) 2023-07-14 10:52:19 +05:30
types Enable blockified templates (https://github.com/woocommerce/woocommerce-blocks/pull/9551) 2023-06-01 11:51:59 +00:00
utils Add FrontendUtils class (https://github.com/woocommerce/woocommerce-blocks/pull/10033) 2023-06-30 09:08:14 +02:00
README.md WIP: Add Playwright setup (https://github.com/woocommerce/woocommerce-blocks/pull/9034) 2023-04-17 19:01:41 +07:00
block-theme.setup.ts Improve the E2E testing process with Playwright (https://github.com/woocommerce/woocommerce-blocks/pull/9148) 2023-05-05 11:03:36 +00:00
classic-theme.setup.ts Improve the E2E testing process with Playwright (https://github.com/woocommerce/woocommerce-blocks/pull/9148) 2023-05-05 11:03:36 +00:00
global-setup.ts Add Cart/Checkout/Order-Received Templates (https://github.com/woocommerce/woocommerce-blocks/pull/9301) 2023-06-29 14:41:22 +01:00
global-teardown.ts WIP: Add Playwright setup (https://github.com/woocommerce/woocommerce-blocks/pull/9034) 2023-04-17 19:01:41 +07:00
playwright.config.ts Blockified Single Product Template: add product-classes via `wc_get_product_class` (https://github.com/woocommerce/woocommerce-blocks/pull/9697) 2023-06-02 14:16:20 +00:00
tsconfig.json Improve the E2E testing process with Playwright (https://github.com/woocommerce/woocommerce-blocks/pull/9148) 2023-05-05 11:03:36 +00:00

README.md

WooCommerce Blocks Playwright End to End Tests

This is the documentation for the new E2E testing setup based on Playwright and wp-env. Over time, these playwright E2E tests should replace the current Puppeteer E2E tests.

Table of contents

Pre-requisites

Note, that if you are on Mac and you install docker through other methods such as homebrew, for example, your steps to set it up might be different. The commands listed in steps below may also vary.

If you are using Windows, we recommend using Windows Subsystem for Linux (WSL) for running E2E tests. Follow the WSL Setup Instructions first before proceeding with the steps below.

Introduction

End-to-end tests are powered by Playwright. The test site is spun up using wp-env (recommended), but we will continue to support e2e-environment in the meantime.

Running tests for the first time

nvm use
npm install
npm run env:start
npm run test:e2e-pw

To run the test again, re-create the environment to start with a fresh state

npm run env:restart
npm run test:e2e-pw

Other ways of running tests

Headless mode:

npm run test:e2e-pw

Interactive UI mode:

npm run test:e2e-pw -- --ui

Headed mode:

npm run test:e2e-pw -- --headed

Debug mode:

npm run test:e2e-pw -- --debug

Running a single test:

npm run test:e2e-pw ./tests/e2e-pw/tests/example.spec.ts

To see all options, run the following command:

npx playwright test --help