Skip to content

QA-PY-101 — Sync/async Playwright API mix ​

← Back to the rule catalog

Generated from the rule registry. Get the same detail from the CLI with mjolnir explain QA-PY-101.

FieldValue
Severitywarning
Confidencehigh
Tierextended
Measured FP rate0% (n=10)
Evidence levelE2
QA impactFlaky-test risk (FLAKY-RISK)
False-positive risk (author estimate)low
Autofix availableno
Languagespython
Frameworkspytest-playwright, playwright
Detection strategyLEXICAL (regex heuristic)
Introduced inv0.3.8

Why this fails in production ​

Calling the synchronous Playwright API from an async function blocks the event loop and hangs the run; the two APIs cannot be mixed.

What gets flagged (real detector output) ​

Async test `test_login` in a file importing playwright.sync_api.

Example from this rule's own must-fire fixture: tests/fixtures/QA-PY-101/must-fire/test_auth.py

The fix ​

Use pytest-playwright's injected page fixture with plain (non-async) tests, or import from playwright.async_api consistently.

Confirmed NOT to fire on the corresponding clean pattern ​

Verified against tests/fixtures/QA-PY-101/must-not-fire/test_auth.py — 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
positive-fixtures4

Released under the MIT License.