Skip to content

QA-JV-106 — Brittle selector instead of role-based locator ​

← Back to the rule catalog

Generated from the rule registry. Get the same detail from the CLI with mjolnir explain QA-JV-106.

FieldValue
Severitywarning
Confidencemedium
Tierquarantine
Measured FP rate33% (n=12)
Evidence levelE1
QA impactTest hygiene debt (HYGIENE)
False-positive risk (author estimate)medium
Autofix availableno
Languagesjava
Frameworksjunit, testng
Detection strategyLEXICAL
Introduced inv0.4.0

Why this fails in production ​

XPath paths and structural CSS break on any markup refactor and silently select the wrong element after redesigns.

What gets flagged (real detector output) ​

Brittle selector (xpath= selector).

Example from this rule's own must-fire fixture: tests/fixtures/QA-JV-106/must-fire/InventoryTest.java

The fix ​

Prefer role-based locators (page.getByRole(...)) or data-testid attributes.

Confirmed NOT to fire on the corresponding clean pattern ​

Verified against tests/fixtures/QA-JV-106/must-not-fire/SelectorTest.java — a legitimate, similar-looking pattern this rule correctly leaves alone.

Corpus-measured false-positive risk ​

Real occurrence counts from npm run corpus:audit against actively-maintained OSS repos — reproduce yourself, don't just trust this table (see the false-positive audit):

RepoOccurrences
microsoft-playwright-java4
positive-fixtures2

Released under the MIT License.