-
Notifications
You must be signed in to change notification settings - Fork 219
E2E tests for Product Archive Template and Legacy Block #5748
Conversation
Size Change: 0 B Total Size: 817 kB ℹ️ View Unchanged
|
I first got the following error, I solved this locally by upgrading the After that, there was 1 failing test but I haven't had a chance to look into why as of yet. All other tests seemed to pass though 👍🏻 |
* Add function to wait for Gutenberg canvas * Add alternative ids
e276591
to
b90736c
Compare
Also: * refactors the function to add a custom paragraph for later. * updates obsolete snapshot
fad1760
to
c269f64
Compare
…t-archive # Conflicts: # tests/e2e/specs/backend/site-editing-templates.test.js # tests/e2e/utils.js
async function addCustomParagraph( | ||
templateSlug, | ||
customText = CUSTOMIZED_STRING | ||
) { |
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.
Should we update the name to better reflect that this would visit a template edit view, add a paragraph and save it? visitTemplateAndAddParagraph
maybe? Currently when I saw it just by name I thought it just adds it to the current context.
I feel like if action/flow helpers reflect the flow it's easier to read through the tests
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.
Yea, good point!
Renamed to `visitTemplateAndAddCustomParagraph`
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.
👌
@@ -25,6 +26,7 @@ import { elementExists, getTextContent } from './page-utils'; | |||
* @typedef {{ addedBy: string, hasActions: boolean, templateTitle: string }} TemplateTableItem | |||
*/ | |||
|
|||
export const BASE_URL = config.get( 'url' ); | |||
export const DEFAULT_TIMEOUT = 30000; |
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.
When debugging got stung by having default timeout here and not in config file, had this one override what I've passed via command line and test timeouted for me even though I've disabled timeouts.
For the future I'd consider tapping into config/env values for that but it's just for consideration
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.
This DEFAULT_TIMEOUT
is actually not a jest/puppeteer timeout configuration. This timeout is used in specific functions like waiting for canvas and a few others. This won't override a test case timeout or lack thereof.
Also: * Refactors the function to add a custom paragraph * Add front-end test for archive template * Use WordPress data to guarantee block presence * Use WordPress data instead of selectors to match blocks
This PR adds E2E tests for the Product Archive Template, and refactors a few things used in the Single Product Template which are useful for other Template tests.
Specifically regarding #5657, it covers the following test cases:
Closes #5657
Note that, as opposed to #5722, where I opted not to test the functionality of both the template and the block (I tested only the template-related functionality, see discussion there), here I also tested the frontend part for the block itself, due to the fact that the test was fairly simply and straightforward to write.
Testing
Automated Tests
Manual Testing
How to test the changes in this Pull Request:
npm i
when you pull, as there is a requirement for the neweste2e-test-utils
.npm run test:e2e -- -i "tests/e2e/specs/backend/site-editing-templates.test.js"
andnpm run test:e2e -- -i "tests/e2e/specs/frontend/legacy-template-blocks.test.js"
.User Facing Testing
These are steps for user testing (where "user" is someone interacting with this change that is not editing any code).