feat: decouple selectors from root seelctors#7
Merged
sergeyshmakov merged 3 commits intomainfrom Mar 21, 2026
Merged
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ca33bc547e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
2 issues found across 13 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/decorators/selectorBy.ts">
<violation number="1" location="src/decorators/selectorBy.ts:5">
P2: Exact duplicate of `isLocatorLike` from `rootSelectors.ts`. Consider extracting it into `../protocol` (or a shared internal module) so a future change to the duck-type check doesn't need to be synchronized across two files.</violation>
<violation number="2" location="src/decorators/selectorBy.ts:24">
P1: Reading `instance.locator` here can trigger a `@Selector*`-decorated accessor of the same name, which re-enters `resolveLocator()` → `tryHostLocatorRoot()` → `instance.locator` → infinite recursion (stack overflow). Use property-descriptor inspection (e.g., `Object.getOwnPropertyDescriptor` walking the prototype chain) to detect a plain data/value property without invoking getters, and skip or fall through when the property is an accessor (getter).</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
|
🎉 This PR is included in version 1.4.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
Summary by cubic
Decoupled child selector decorators from root selectors so classes without
@RootSelectorresolve frompageor a fragment’slocator. Expanded helper APIs and updated docs/skill; switched lists to@ListSelectorwith prefixeddata-testidvalues and added a rawLocatorlist accessor.LOCATOR_SYMBOL→this.locator(fragment) →page.locator("body");locatorwins overpage; throws if none found.pagecan use@Selector*; fixtures accept page-only hosts; added example tests for raw list locators.readonly locatorhost nested@Selector*underthis.locator.@ListSelector("CartItem_")withdata-testid="CartItem_${id}"; added rawLocatoraccessor (CartItemRows).PageObjectgainswaitPropAbsence()andexpect({ message });ListPageObjectaddsgetAll(),last(),filterByTestId(),getItemByIdMask().skills/playwright-page-object/SKILL.mdupdated to cover page-only hosts, fragments, and adoption path; requirements set to Node>=20,@playwright/test >=1.35.0, and TypeScript>=5.0.Written for commit 1463ecf. Summary will update on new commits.