Component Analysis
Component Analysis provides a structural map of your test project — how files relate to each other through imports, which fixtures are shared, and where AI-generated fixes can improve maintainability.
Import Graph
The import graph visualizes how your test files, Page Objects, helpers, and fixtures connect:
tests/
login.spec.ts
└── imports: pages/LoginPage.ts
└── imports: fixtures/auth.fixture.ts
cart.spec.ts
└── imports: pages/CartPage.ts
└── imports: pages/ProductPage.ts
└── imports: helpers/test-data.ts
checkout.spec.ts
└── imports: pages/CartPage.ts (shared with cart.spec.ts)
└── imports: pages/CheckoutPage.ts
└── imports: fixtures/auth.fixture.ts (shared with login.spec.ts)Circular Dependencies
The graph highlights circular imports in red. Circular dependencies between test files and helpers can cause unpredictable load order and hard-to-debug failures.
Graph Metrics
| Metric | Description | Ideal |
|---|---|---|
| Fan-out | Number of imports per test file | 2-5 |
| Fan-in | Number of files that import a given helper | Higher = more reuse |
| Orphans | Files with zero incoming imports | Should be 0 for helpers |
| Hub files | Files imported by >50% of tests | Worth extracting into fixtures |
Fixture Usage
The analysis tracks how Playwright fixtures are used across the project:
Fixture Usage: 61% of tests use at least one custom fixture
auth.fixture.ts — used by 28 tests (60%)
database.fixture.ts — used by 12 tests (26%)
api-mock.fixture.ts — used by 8 tests (17%)
Not using fixtures — 18 tests (39%)Tests that do not use fixtures often contain duplicated setup logic. The audit flags these and suggests fixture extraction.
What Counts as a Fixture
xyva detects both Playwright's test.extend() fixtures and custom helper classes instantiated in beforeEach. Both are tracked in the usage analysis.
AI-Powered Fix Generation
For each issue found during analysis — unused imports, duplicated setup, fragile selectors — you can generate an AI fix:
- Click the Generate Fix button on any Issue Card
- The AI analyzes the affected file(s) and produces a diff
- Review the diff in the side-by-side viewer
- Click Apply to write the change or Dismiss to skip
Fix Types
| Fix Type | Example |
|---|---|
| Extract Helper | Move repeated login() sequence into a shared function |
| Create Page Object | Generate a PO class from inline selectors in a spec |
| Replace Selector | Swap nth-child for getByTestId or getByRole |
| Remove Dead Code | Delete unused imports or unreachable helper functions |
Generated Code Review
AI fixes follow your project's existing patterns (informed by the Vault), but they should always be reviewed. The AI may not account for edge cases specific to your application logic.
Vault Integration
Every Component Analysis scan feeds results into the Architecture Vault. Over time, the Vault builds a model of your project's structural patterns:
- Which naming conventions you use for Page Objects
- How fixtures are typically organized
- What selector strategy is dominant
This accumulated knowledge makes each subsequent AI fix more accurate and consistent with your codebase style.
