E2E Test Utils: Add new openPreviewPage utility #21678
Labels
Needs Dev
Ready for, and needs developer efforts
[Tool] E2E Test Utils
/packages/e2e-test-utils
[Type] Task
Issues or PRs that have been broken down into an individual action to take
Previously: #21467 (comment)
Context:
In end-to-end tests, it can often be useful to make assertions against the actual front-end content display of a published or previewed post.
This already occurs in two tests:
packages/e2e-tests/specs/editor/various/preview.test.js
packages/e2e-tests/specs/editor/plugins/block-context.test.js
Task:
openPreviewPage
utility in@wordpress/e2e-test-utils
Implementation Notes:
The utility may or may not make sense to port directly from these implementations.
Notably, managing an extra preview page tab adds some additional overhead in managing tabs, especially "bring to front" and "close" clean-up tasks. These are not particularly difficult to implement using Puppeteer APIs, but they must be known to be performed, and as such introduce a risk for human error. A good utility may seek to try to remove the need for these considerations.
For example, one of the following may be an improvement:
page.evaluate
, which has the advantage of: The utility can manage clean-up tasks after the evaluation has completed.The text was updated successfully, but these errors were encountered: