test: regression coverage for broker-protection root scoping and element-hiding selectors - #2997
Draft
cursor[bot] wants to merge 1 commit into
Draft
cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
Contributor
[Beta] Generated file diffTime updated: Mon, 31 Aug 2026 08:12:08 GMT AndroidFile has changed AppleFile has changed Chrome-mv3File has changed FirefoxFile has changed IntegrationFile has changed WindowsFile has changed |
This branch has not been deployed
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.
Asana Task/Github Issue: Weekly test-coverage automation
Description
Adds targeted unit tests for two recent injected-feature changes that had integration coverage but no fast unit-level regression guards:
selectRootElement(fix(broker-protection): preserve matched CAPTCHA context #2976) — scopes CAPTCHA actions to the profile row that best matches user data. Wrong scoping would solve the wrong captcha on multi-record pages.querySelectorFor(Element hiding: Improve performance by taking advantage of browser selector indexing #2977) — only wraps comma-separated selector lists in:is()so single selectors stay indexable. Re-wrapping singles would regress the performance fix.Extracted selector helpers into
element-hiding-selectors.jsso they can be unit-tested without pulling in the full feature module.Risky behavior now covered
PirErrorinstead of silently using the wrong root:is()wrappingTest files added/updated
injected/unit-test/select-root-element.spec.js(new)injected/unit-test/element-hiding-selectors.spec.js(new)injected/src/features/element-hiding-selectors.js(extracted, no behavior change)scripts/check-strict-core.js(register new module)Why these tests materially reduce regression risk
selectRootElementis shared by CAPTCHA and click actions; integration tests are slow and don't exhaust scoring edge casesquerySelectorForis a one-line perf optimization easy to undo during refactors; unit tests lock the single-vs-list contractTesting Steps
cd injected && npm run test-unit -- --filter="selectRootElement|element-hiding selector"(8 specs, 0 failures)npm run tsc && npm run tsc-strict-coreChecklist