feat(e2e): teach the porting workflow object-model design + a11y locators#73209
Open
stephenliang wants to merge 1 commit into
Open
feat(e2e): teach the porting workflow object-model design + a11y locators#73209stephenliang wants to merge 1 commit into
stephenliang wants to merge 1 commit into
Conversation
…tors Improvements distilled from porting platform/global_edition/region_select. - Scout now plans the OBJECT MODEL rather than a single POM: a `pageObjects` array (one per page/route) plus `sharedChrome` (global UI that belongs on a shared base class). Replaces the singular `targetPom`, which biased Generate toward one scenario-shaped POM. New STEP 4b frames this as test design. - Generator: page objects EXPOSE readonly Locators and own interactions; the SPEC does the assertions (no single-assertion POM wrappers). A scenario spanning pages is coordinated in the spec, never modeled as an XyzPage; global chrome lives once on a shared base; filenames are kebab-case. - Generator: drive locator choice from the accessibility tree (browser_snapshot) — prefer getByRole/getByLabel by accessible name; CSS only when there is no accessible name or the name is the text under test. - Reviewer: enforce the above (object model, assert-in-spec, a11y-first) as review findings. The gitignored playwright-best-practices skill (skill-lock installed) is unchanged; these conventions live in the agent defs, which carry their own copy. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Improves the agentic Cucumber→Playwright porting workflow (
.claude/), distilling lessons from portingplatform/global_edition/region_select. The first pass produced a single scenario-shaped POM with assertions buried in it and CSS locators; these changes make the workflow design a proper object model, assert in the spec, and locate by accessibility role/name — so less hand-rework per port. No application or runtime code changes; only the porting agents + workflow.Object-model design (Scout — the keystone)
Scout now plans the object model instead of a single POM:
targetPomwith apageObjectsarray (one per page/route, each withextends, kebab-casepath,reused) andsharedChrome(global UI that belongs once on a shared base class).This is the shape the workflow now aims for:
classDiagram BasePage <|-- SignInPage BasePage <|-- LegacyBlocklyLab LegacyBlocklyLab <|-- ArtistLab class BasePage { global chrome (locale switcher, header) } class SignInPage { page-specific } class LegacyBlocklyLab { lab-wide } class ArtistLab { one route }A scenario spanning pages is coordinated in the spec, never modeled as an
XyzPage.Generator conventions
readonlyLocators and own interactions; the spec performs the assertions on those locators. No single-assertion POM wrappers (expectXVisible()); a reused composite assertion lives in the spec file.browser_snapshot) — prefergetByRole/getByLabelby accessible name; CSS only when there is no accessible name, or the name is the text under test (e.g. a tab whose label localizes).sign-in.ts,artist-lab.ts), never PascalCase.Reviewer enforcement
The reviewer's BEST PRACTICES dimension now flags: scenario-as-page (BLOCKING), single-assertion POM wrappers, locators constructed in the spec from
page, and undocumented CSS where an accessible name exists.Links
Testing story
node --checkon the workflow script; the pre-commit lint hook passes on all three files.region_selectport that motivated them — its spec is green under the 5×/all-browser stress gate and follows exactly this shape (BasePage → SignInPage / LegacyBlocklyLab → ArtistLab; locators exposed; assertions in the spec; role/name locators).playwright-best-practicesskill (skill-lock installed) is intentionally unchanged; the conventions live in the agent defs, which carry their own copy.