This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 219
Add E2E tests for Product Collection Block #9825
Merged
imanish003
merged 16 commits into
trunk
from
add/9783-product-collection-end-to-end-testing
Jun 20, 2023
Merged
Add E2E tests for Product Collection Block #9825
imanish003
merged 16 commits into
trunk
from
add/9783-product-collection-end-to-end-testing
Jun 20, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This commit does the following changes: 1. Adjusts the .gitignore file to ignore the test-results and artifacts directories under all subdirectories named 'e2e-pw'. 2. Adds new E2E tests for the Product Collection block, specifically testing: - If the block renders correctly, including validating the number of product images, titles, prices, and 'Add to Cart' buttons. - If the sidebar settings correctly control the number of displayed columns. 3. Implements the 'ProductCollectionPage' class, providing methods to perform actions such as creating a new post, inserting a block, publishing a post, and locating various elements on the page. 4. Adjusts the directory structure for the E2E tests to improve organization and readability.
The release ZIP for this PR is accessible via:
Script Dependencies ReportThere is no changed script dependency between this branch and trunk. This comment was automatically generated by the TypeScript Errors Report
🎉 🎉 This PR does not introduce new TS errors. |
Size Change: +5 B (0%) Total Size: 1.1 MB
ℹ️ View Unchanged
|
This commit updates the E2E tests for the sidebar settings of the Product Collection block. The changes include: 1. Refactoring the test assertions to use property accessors instead of method calls for the `ProductCollectionPage` class. This improves readability and consistency. 2. Updating the `ProductCollectionPage` class to initialize locators for editor and frontend elements separately. This allows easier differentiation between editor and frontend locators. The test file `sidebar-settings.block_theme.spec.ts` has been deleted, as its functionality is now covered by the updated tests in `product-collection.block_theme.spec.ts`.
imanish003
added
skip-changelog
PRs that you don't want to appear in the changelog.
category: tests
block: product collection
Issues related to the Product Collection block
labels
Jun 15, 2023
woocommercebot
requested review from
a team and
roykho
and removed request for
a team
June 15, 2023 11:21
This commit updates the E2E tests for the sidebar settings and order by control of the Product Collection block. The changes include: 1. Refactoring the test assertions and descriptions for improved readability and clarity. 2. Adding a new test case to verify the correct sorting of products by title in descending order. 3. Updating the `ProductCollectionPage` class to include a new method `setOrderBy()` to set the order by value in the order by control. 4. Adding a new method `waitForProductsToLoad()` in the `ProductCollectionPage` class to wait for the products to load in the block. These changes ensure that the sidebar settings and order by control are functioning correctly in the Product Collection block.
This commit updates the E2E tests for the handpicked products filter in the Product Collection block. The changes include: 1. Adding a new test case to verify that products can be filtered based on the selection in the handpicked products option. 2. Adding a new method `addFilter()` to the `ProductCollectionPage` class to select a filter option from the dropdown. 3. Adding a new method `setHandpickedProducts()` to the `ProductCollectionPage` class to set the handpicked products in the block settings. These changes ensure that the handpicked products filter is functioning correctly in the Product Collection block.
Adding assertions to verify the count and presence of on-sale products in the frontend after publishing.
This commit updates the E2E tests for the keyword filter in the Product Collection block. The changes include: 1. Adding assertions to verify that the products are correctly filtered based on the keyword entered. 2. Adding assertions to verify the filtered products in the frontend after publishing. These changes ensure that the keyword filter in the Product Collection block is functioning correctly.
roykho
reviewed
Jun 16, 2023
tests/e2e-pw/tests/product-collection/product-collection.block_theme.spec.ts
Show resolved
Hide resolved
This commit refactors the E2E tests for the Product Collection block to improve test structure and readability. The changes include: 1. Refactoring the test structure using the `test.extend` function to define shared setup and teardown logic. 2. Moving the creation of the `ProductCollectionPage` instance to the shared setup logic. 3. Using the `pageObject` fixture in each test to access the `ProductCollectionPage` instance. 4. Removing duplicate code for creating the `ProductCollectionPage` instance. These changes enhance the maintainability and readability of the E2E tests for the Product Collection block.
roykho
approved these changes
Jun 19, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally and tests are passing. Good job!
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
block: product collection
Issues related to the Product Collection block
skip-changelog
PRs that you don't want to appear in the changelog.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🤖 Generated by Copilot at 7778886
This pull request adds e2e tests for the product collection block using playwright. It creates a new test file
product-collection.block_theme.spec.ts
that checks the block rendering and settings in both the editor and the frontend, and a new page object fileproduct-collection.page.ts
that provides helper methods and locators for the block.Part of #9825
Note: I will be adding more tests for the Product Collection block. This PR only includes few tests. I want to use this PR to receive some early feedback.
Testing
Automated Tests
User Facing Testing
npm run env:start
.npx playwright install
.npx playwright test --config=tests/e2e-pw/playwright.config.ts "./tests/e2e-pw/tests/product-collection"
Note: Also verify that Playwright CI is green.
WooCommerce Visibility
Changelog