page-objects
Skill268 starsChanged 9 days agoMITView on GitHub
Use when creating a page object or component under pages/**, adding locators or action methods to one, or registering it as a fixture. Not for choosing a selector or the exploration workflow (see `selectors`) or for fixture internals (see `fixtures`).
In this repository35 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- ai-native-workflowSkill
- api-testingSkill
- common-tasksSkill
- configSkill
- data-strategySkill
- debuggingSkill
- enumsSkill
- fixturesSkill
- helpersSkill
- playwright-cliSkill
- pr-reviewerSkill
- refactor-valuesSkill
- selectorsSkill
- skill-creatorSkill
- test-standardsSkill
- type-safetySkill
- ai-native-workflowSkill
- api-testingSkill
- common-tasksSkill
- configSkill
- data-strategySkill
- debuggingSkill
- enumsSkill
- fixturesSkill
- helpersSkill
- page-objectsSkill
- playwright-cliSkill
- pr-reviewerSkill
- refactor-valuesSkill
- selectorsSkill
- skill-creatorSkill
- test-standardsSkill
- type-safetySkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 0 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 30
Every new page object is registered in fixtures/pom/page-object-fixture.ts.
- Very specific: line 34
Run ls pages/ to resolve {area}.
- Very specific: line 37
Write the class from references/class-pattern.md: locators in priority order (selectors), feedback locators, action methods with explicit …
- Very specific: line 40
Run npm run lint; write or update the spec per test-standards and run it.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Page Objects
Critical
- Explore the live page with
playwright-clibefore writing any locator (selectors). If the app is unreachable, stop and say so; never ship placeholder locators. - Locators are
getaccessors returningLocator. The constructor isconstructor(private readonly page: Page). Imports come from@playwright/test, never fromfixtures/pom/test-options.ts. JSDoc is Forbidden on locator getters and on any method returning a
Locator. JSDoc with@paramand@returnsis required on every action and verification method.// CORRECT get submitButton(): Locator { return this.page.getByRole('button', { name: 'Submit' }); } // WRONG /** The submit button. */ get submitButton(): Locator { return this.page.getByRole('button', { name: 'Submit' }); }- A page object for a form or CRUD screen has three groups: interactive locators, feedback locators (success, error, field validation), action methods. Feedback locators are not optional;
selectorslists what to capture. - Strings inside
getByText(...)come fromenums/{area}/*(Messages.LOGIN_ERROR), never literals. - Action methods do not assert; a verification method named
xxxAndVerify()may callexpect. Waits arepage.waitForResponse(...)or web-first assertions, neverpage.waitForTimeout(...). - A fragment shared by several pages (header, modal, sidebar) is a component in
pages/components/, held asreadonly nav: NavigationComponentand created in the constructor. - Every new page object is registered in
fixtures/pom/page-object-fixture.ts; tests receive it from the fixture (fixtures).
Procedure
- Run
ls pages/to resolve{area}. File:pages/{area}/<name>.page.ts, orpages/components/<name>.component.tsfor a fragment. - Explore the page with
playwright-cliperselectors; record each element's role, accessible name, label or test id, and the exact text of every feedback message. - A message or route that has no enum member yet is added per
enumsbefore the class is written. - Write the class from
references/class-pattern.md: locators in priority order (selectors), feedback locators, action methods with explicit return types and JSDoc. - A fragment used by more than one page becomes a component per
references/components.md. - Register: import the class, add it to
FrameworkFixtures, add the fixture body, each shaped like theappPageentries infixtures/pom/page-object-fixture.ts. NomergeTestschange. - Run
npm run lint; write or update the spec pertest-standardsand run it.
References
references/class-pattern.md: the full class with the three groups, one action method and one verification method.references/components.md: a component, its composition into a page, when to split a large page object.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

