Skip to content

QA-PW-123 — Hardcoded environment URL in spec ​

← Back to the rule catalog

Generated from the rule registry. Get the same detail from the CLI with mjolnir explain QA-PW-123.

FieldValue
Severitywarning
Confidencehigh
Tierquarantine
Measured FP rate46% (n=11)
Evidence levelE2
QA impactTest hygiene debt (HYGIENE)
False-positive risk (author estimate)low
Autofix availableno
Languagestypescript, javascript
Frameworksplaywright
Detection strategyLEXICAL
Introduced inv0.3.0

Why this fails in production ​

Specs pointing at absolute URLs break when environments change and can hit production by accident.

What gets flagged (real detector output) ​

Hardcoded URL: `goto("https://prod.example.com/dashboard"`.

Example from this rule's own must-fire fixture: tests/fixtures/QA-PW-123/must-fire/hardcoded.spec.ts

The fix ​

Use relative paths with baseURL from playwright.config, or an env variable.

Confirmed NOT to fire on the corresponding clean pattern ​

Verified against tests/fixtures/QA-PW-123/must-not-fire/clean.spec.ts — 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
cypress-io-kitchensink6
nextauthjs-next-auth2
playwright-community-eslint-plugin-playwright9
positive-fixtures8
puppeteer-puppeteer3
vitest-dev-vitest1

Released under the MIT License.