Files
metabuilder/packages/ui_home/playwright
copilot-swe-agent[bot] d63df61958 refactor: scope tests to correct functional packages
- Moved auth tests: packages/auth → packages/ui_auth
- Moved CRUD tests: packages/crud → packages/user_manager
- Moved package tests: packages/package_tests → packages/package_manager
- Moved pagination tests: packages/pagination → packages/data_table
- Merged navigation tests into packages/ui_home (navigation belongs to home page)
- Removed standalone test packages (crud, auth, package_tests, navigation, pagination)
- Tests now properly belong to the functional packages they test
- Updated TEST_STORY_CONVERSION.md with final package mapping
- api_tests and smoke_tests remain as cross-cutting integration test packages

Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
2026-01-16 19:28:20 +00:00
..

Playwright Tests for ui_home Package

This folder contains declarative Playwright test definitions for the ui_home package, following MetaBuilder's data-driven architecture.

Structure

  • tests.json - Main test suite with JSON-defined E2E tests
  • metadata.json - Test suite metadata and coverage information

Test Coverage

The test suite validates:

  • Home page loads successfully (HTTP 200)
  • Hero section with title and CTAs
  • Six Levels of Power feature cards
  • Navigation bar with Sign In/Admin buttons
  • About MetaBuilder section
  • Contact form with all fields
  • No critical console errors
  • Anchor link navigation

Running Tests

From Package Test Definition

# Generate .spec.ts from tests.json (future implementation)
npm run test:generate -- --package ui_home

# Run generated tests
npm run test:e2e -- --grep @ui_home

Run Existing E2E Tests

cd /path/to/metabuilder
npm run test:e2e -- e2e/smoke.spec.ts

Test Schema

Tests follow the playwright.schema.json schema:

  • Declarative steps: All test actions defined in JSON
  • Selector strategies: Support for CSS, role-based, text, and test-id selectors
  • Assertions: Playwright expect matchers as data
  • Fixtures: Reusable test data
  • Tags: Filter tests by categories (@smoke, @critical, etc.)

Example Test

{
  "name": "should display hero section with title and CTAs",
  "tags": ["@smoke", "@ui"],
  "steps": [
    {
      "action": "navigate",
      "url": "/"
    },
    {
      "action": "expect",
      "selector": ".hero-title",
      "assertion": {
        "matcher": "toBeVisible"
      }
    }
  ]
}

Meta Architecture Benefits

  • Data-driven: Tests are configuration, not code
  • Package-scoped: Each package owns its test definitions
  • Schema-validated: Tests conform to JSON schema
  • Auto-discoverable: Test loader can find all playwright/tests.json files
  • Maintainable: Update tests without touching TypeScript

Future Enhancements

  1. Test Generator: Convert tests.json.spec.ts automatically
  2. Visual Testing: Add screenshot comparison tests
  3. Performance: Add lighthouse/performance assertions
  4. Accessibility: WCAG/aria validation tests
  5. Cross-browser: Multi-browser test matrix from single JSON