-
Notifications
You must be signed in to change notification settings - Fork 1
feat!: Playwright locator API for full selector support #43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: d8c1d91 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
BREAKING CHANGE: Shadow DOM piercing syntax changes from `>>>` to `>>` (legacy `>>>` still works) - Use page.locator() instead of custom querySelector for element capture - Support all Playwright selector formats: CSS, XPath, text, role - Shadow DOM: use `>>` for chaining (Playwright standard) - Backward compatible: `>>>` auto-converts to `>>` - Add normalizeSelector() for syntax conversion - Update browserFunctions and editor to support both syntaxes - Add elementFinder tests - Document new selector formats in screenshot-reference.md
- Add sync.test.ts with 11 tests for sync() function - Fix gap: throw error when explicit config path doesn't exist - Previously silently returned empty result for missing config - Tests cover: empty config, filter handling, options validation
- Add 6 tests for syncHandler in tools.test.ts - Tests cover: error handling, empty config, filter passthrough, result structure, session key from env, explicit session key priority
- Test that empty jobs array returns empty results without launching browsers - Note: Full error handling tests for batch failures would require browser mocking which is complex
- Add tests for whitespace trimming, double space collapsing - Test empty string, single > (CSS child combinator), mixed >>> and >> - Document that findElement() is tested via CLI integration tests
- Add test that verifies form is filled correctly by actions - Test captures form after type, select_option, and evaluate actions - Compares result to baseline (runs on CI only for font consistency)
- Add screenshotPath tests: very long names, unicode, empty, special chars - Add schema tests: URLs with special chars, IDN domains, fragments, ports - Add performance test: config with 100 screenshots
- Test empty session file returns null - Test truncated/corrupted file returns null - Test random binary garbage returns null - All corrupted files handled gracefully without throwing
- Test class names with special characters (: and [) - Test SVG elements inside shadow DOM - Test deeply nested shadow DOM (host >> host >> element)
- Changed from Promise.all to Promise.allSettled in captureParallel - If one worker's browser fails, other workers' results are still collected - Prevents losing all results when a single batch encounters an error
- Update selector schema description to mention Playwright selector formats - Regenerate docs from updated schema - Increase test timeout for 'fails gracefully with invalid selector' from 60s to 90s (test takes ~40s locally, CI is slower)
Add NOSONAR comments to test code that uses: - Math.random() for generating random test data (not crypto) - /tmp/test as mock output directory (not production code)
99560e0 to
d8c1d91
Compare
|



Summary
Switch from custom
querySelectorimplementation to Playwright's nativepage.locator()API, enabling full Playwright selector format support.Breaking Change
>>(Playwright standard)>>>syntax still works (auto-converted to>>)New Selector Formats Supported
Now supports all Playwright selector types:
.button,#headermy-component >> .innerxpath=//button[@id="submit"]text=Submitrole=button[name="OK"].modal >> role=button[name="Close"]Changes
elementFinder.ts: Usepage.locator()instead of customevaluateHandlebrowserFunctions.ts: Support both>>>and>>syntaxeditor/selector.ts: Support both syntaxes in visual pickernormalizeSelector()function with testsTest plan