Skip to content

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:

text
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

MetricDescriptionIdeal
Fan-outNumber of imports per test file2-5
Fan-inNumber of files that import a given helperHigher = more reuse
OrphansFiles with zero incoming importsShould be 0 for helpers
Hub filesFiles imported by >50% of testsWorth extracting into fixtures

Fixture Usage

The analysis tracks how Playwright fixtures are used across the project:

text
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:

  1. Click the Generate Fix button on any Issue Card
  2. The AI analyzes the affected file(s) and produces a diff
  3. Review the diff in the side-by-side viewer
  4. Click Apply to write the change or Dismiss to skip

Fix Types

Fix TypeExample
Extract HelperMove repeated login() sequence into a shared function
Create Page ObjectGenerate a PO class from inline selectors in a spec
Replace SelectorSwap nth-child for getByTestId or getByRole
Remove Dead CodeDelete 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.

Local-first QA orchestration.