with one click
writing-browser-app-e2e-tests
// Write a Playwright e2e test in the browser-app-e2e-tests package. Use when this capability is needed.
// Write a Playwright e2e test in the browser-app-e2e-tests package. Use when this capability is needed.
[HINT] Download the complete skill directory including SKILL.md and all related files
| name | writing-browser-app-e2e-tests |
| description | Write a Playwright e2e test in the browser-app-e2e-tests package. Use when this capability is needed. |
| metadata | {"author":"superegodev"} |
When you need to write a Playwright e2e test for browser-app package.
packages/tests/browser-app-e2e-tests/src/scenarios- +
snake-cased-short-description + .test.tsFor assertions, ONLY use visual comparisons of screenshots via
VisualEvaluator.expectToSee. DO NOT use other assertions.
Tests are structured as multi-step scenarios in which the simulated user tries to reach a specific goal. Each test starts from the empty state of the application, so the first steps of the scenarios should be about configuring and creating everything needed for the later steps.
The Boutique section of the app contains ready-made "packs" of collection categories, collections, and apps, that can be installed to create a useful starting point.
Technically, a test is a sequence of Playwright test steps. Each step has two
sections (visually separated by // $SectionName comments):
VisualEvaluator.expectToSee exactly once, which:
Additional requirements:
00. Go to Homepage.00. $title must go before
01. $otherTitle.00.png for step
00. $title.Run the test with
yarn workspace @superego/browser-app-e2e-tests test:playwright.
When the test runs the first time there are no "golden reference snapshots" yet, so the test will fail.
However, the run generates the yet-to-be-evaluated snapshots in the
packages/tests/browser-app-e2e-tests/src/scenarios/$TEST_FILE_NAME-snapshots
directory.
One by one, visually review the snapshots and ensure they match the corresponding described expectation.
Reusable test logic is shared code that makes scenarios simpler and more reliable by extracting common selectors and interactions into locators, actions, and routines.
When writing a new locator, action, or routine:
The packages/tests/browser-app-e2e-tests/src/locators directory contains
reusable locator builders.
Guidelines:
Locators (or small grouped locator objects) and scope within
containers when possible.boutiquePackCard, installPackButton).The packages/tests/browser-app-e2e-tests/src/actions directory contains
reusable functions that each perform a small single action shared across
multiple tests.
Guidelines:
clickInstallPackButton), not generic helpers.The packages/tests/browser-app-e2e-tests/src/routines directory contains
reusable functions that compose multiple actions into a single higher-level
interaction. A routine performs a specific goal (e.g., "installing a pack",
"filling-in a form") by calling actions in sequence and handling any expected
intermediate UI transitions (waiting for navigation, toasts, modals, etc.).
Check existing routines for examples.
Guidelines:
After writing a test, check other tests and see if there are duplicated locators, actions, or routines. If there are, suggest a refactor to the user.
Converted and distributed by TomeVault — claim your Tome and manage your conversions.