Skip to content

chore(e2e): refactor e2e tests to use page object pattern for UI access#8089

Draft
gribnoysup wants to merge 5 commits into
mainfrom
e2e-tests-page-object-pattern
Draft

chore(e2e): refactor e2e tests to use page object pattern for UI access#8089
gribnoysup wants to merge 5 commits into
mainfrom
e2e-tests-page-object-pattern

Conversation

@gribnoysup
Copy link
Copy Markdown
Collaborator

@gribnoysup gribnoysup commented May 19, 2026

🦨

Attempting to refactor e2e tests to page object pattern we discussed using LLM code-generation tools. Not sure if / when I'll be able to come back to it, but wanted to open a PR if people want to take a look. Some personal learnings from this process:

  • The code quality and consistency of changes is really even with the "best" models
  • You really have to be very precise during the planning stage, even then code generation will not always fully follow the plan and will require to pay attention to what's going on, but if there's not enough details it will be completely all over the place during the code changing process
  • Seems very helpful to do everything in the smallest steps possible (I'd say ~300LoC changed is the best for reviewability, but not always possible) so that the changes can be reviewed before proceeding, otherwise the amount of inconsistencies after each step will only get worse and worse
  • Even in this PR that consolidated just a handful of selectors, the usage is a bit all over the place and required to manually follow-up, genuenly not sure if it's in any way improves velocity

Introduces `pages/` directory with `BasePage`, an empty `Pages` interface,
and a `buildPages()` factory wired into `Compass`. No page objects yet;
slots are added by subsequent migration PRs per the cutover conventions
documented in `pages/README.md`.
Adds `helpers/element-commands/` (empty for now), a mapped-type augmentation
of `WebdriverIO.Element` driven by `typeof ElementCommands`, and a
`browser.addCommand(k, fn, true)` registration loop in `Compass.prepare()`.

Ships zero element commands — just the wiring. Generic UI primitives
(clickVisible, hover, setValueVisible, …) migrate out of `helpers/commands/`
and into element commands as part of the Step 7 WDIO v9 revalidation pass.
Removes the cutover-allowlist step from the page-object migration checklist
in pages/README.md to match the decision to skip the PR 0.3 ESLint guard;
hard-cutover + TypeScript errors + PR review are sufficient.
….1a)

Adds `pages/shared/sidebar/sidebar.page.ts` as the first real page object,
folding all connection-list selectors from `helpers/selectors.ts` into the
class as private members. Absorbs `sidebar-connection.ts` and
`select-connections-menu-item.ts`, wires `browser.pages.sidebar` so
helper-command bodies can reach the page object, and migrates every
consuming test and command to use `browser.pages.sidebar.*`.
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