Dependency Audit
The Dependency Audit is the core analysis engine of the Architecture module. It scans your test codebase for structural weaknesses and quantifies them with actionable metrics.
Page Object Coverage
The audit calculates what percentage of your application's pages and components are abstracted behind Page Object classes:
Page Object Coverage: 72%
├── With PO: 18 pages (login, dashboard, cart, ...)
├── Without PO: 7 pages (settings, profile, admin/*, ...)
└── Inline only: 3 pages (tests use raw selectors, no abstraction)Tests without Page Objects are harder to maintain — a single UI change can break dozens of tests.
Target Coverage
Aim for at least 85% Page Object coverage. The remaining 15% can be simple utility pages or one-off tests where abstraction adds no value.
Selector Quality
The audit flags fragile selectors that are likely to break on minor DOM changes:
| Selector Pattern | Risk Level | Recommendation |
|---|---|---|
.container > div:nth-child(3) | Critical | Use getByRole or getByTestId |
#auto-generated-id-7f3a | Critical | Replace with stable data-testid |
.btn.primary.large | Warning | Prefer getByRole('button', { name }) |
[data-testid="submit-btn"] | Safe | Stable, explicit test identifier |
getByRole('button', { name: 'Submit' }) | Safe | Semantic, resilient to DOM changes |
Selector Quality Score: 64/100
Critical selectors: 12 (in 8 files)
Warning selectors: 23 (in 14 files)
Safe selectors: 89 (in 31 files)nth-child Selectors
nth-child selectors are the most common cause of flaky tests. A single new element in the DOM shifts all indices, breaking every test that relies on positional selection.
Code Duplication
The audit detects repeated code patterns across your test files:
- Duplicated setup blocks — identical
beforeEachlogic in multiple files - Repeated selector strings — the same CSS selector hardcoded in several places
- Copy-pasted assertion chains — identical assertion sequences that should be helper functions
Each duplicate cluster is shown with the affected files and a suggested extraction target (helper function, fixture, or Page Object method).
Structural Metrics
A summary table of project-level metrics:
| Metric | Value | Benchmark |
|---|---|---|
| Total test files | 47 | — |
| Average test length | 34 lines | < 50 lines recommended |
| Fixture usage ratio | 61% | > 70% recommended |
| Max import depth | 4 levels | < 5 recommended |
| Orphan helpers | 3 files | 0 is ideal |
Orphan Helpers
Orphan helpers are utility files that exist in the test directory but are not imported by any test. They may be dead code or missing integrations.
Running the Audit
- Open Architecture > Dependency Audit
- Click Start Scan — the analysis typically completes in 5-15 seconds
- Review the results organized by category (Coverage, Selectors, Duplication, Metrics)
- Click any finding to see affected files and generate an AI fix
