Skip to content

feat(e2e): teach the porting workflow object-model design + a11y locators#73209

Open
stephenliang wants to merge 1 commit into
stagingfrom
playwright-port-workflow-pom-design
Open

feat(e2e): teach the porting workflow object-model design + a11y locators#73209
stephenliang wants to merge 1 commit into
stagingfrom
playwright-port-workflow-pom-design

Conversation

@stephenliang

Copy link
Copy Markdown
Member

Improves the agentic Cucumber→Playwright porting workflow (.claude/), distilling lessons from porting platform/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:

  • Replaced the singular targetPom with a pageObjects array (one per page/route, each with extends, kebab-case path, reused) and sharedChrome (global UI that belongs once on a shared base class).
  • New STEP 4b — Design the object model, framing structure explicitly as test design.

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
  }
Loading

A scenario spanning pages is coordinated in the spec, never modeled as an XyzPage.

Generator conventions

  • POM encapsulation: page objects expose readonly Locators 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.
  • Accessibility-first locators: drive locator choice from the a11y 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 (e.g. a tab whose label localizes).
  • kebab-case filenames (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

  • Jira:

Testing story

  • node --check on the workflow script; the pre-commit lint hook passes on all three files.
  • These are agent/workflow prompts (no runtime suite applies). The conventions were validated empirically by the region_select port 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).
  • The gitignored playwright-best-practices skill (skill-lock installed) is intentionally unchanged; the conventions live in the agent defs, which carry their own copy.

…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>
@stephenliang stephenliang marked this pull request as ready for review June 12, 2026 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant