Fixtures in Trezor Suite E2E Tests

SkillWeb & browsing

Guides your agent in writing Playwright test fixtures with proper scope, dependency injection, and teardown for shared test setup.

Available today. Use it from your connected AI after setup.

Add ahel to your AI once: Claude, ChatGPT, Cursor, Claude Code or Codex. Then ask it to use this.

Then ask your AI: use the Fixtures in Trezor Suite E2E Tests skill

About this skill

Playwright fixture architecture in Suite E2E tests: scope, dependency injection, mocks lifecycle. Use whenever tests need shared setup, teardown or reusable resources.

What this skill tells your AI

The instructions your AI receives, as published by trezor/trezor-suite in suite/e2e/skills/fixtures/SKILL.md and read by ahel’s review.

When to use: Whenever tests need shared setup, teardown, reusable resources, or configurable context. Fixtures are Playwright's killer feature — prefer them over hooks in every situation where both could work. Prerequisites: locators for locator strategies and Understanding of Playwright test framework basics.

Decision Guide for New Fixtures

I need a new fixture in suite/e2e.

├── Is it a domain-specific page wrapper (Dashboard, Settings, Trading)?
│   └── YES → Add to TestFixtures in fixtures.ts
│       └── Depends on: page, device, other page objects
│       └── Scope: test (default)
│
├── Is it an expensive resource safe to share across all tests?
│   └── YES → Add to WorkerFixtures
│       └── Scope: worker
│       └── Cannot depend on page/context
│
├── Is it core environment setup (emulator, device, page)?
│   └── YES → Modify suiteBaseFixture.ts
│       └── Option fixtures for configuration
│       └── Auto fixtures for auto-run behavior
│
└── Is it adding methods to page object?
    └── YES → Modify enhancePage.ts
        └── Use module augmentation (declare module '@playwright/test')
        └── Applied automatically to all pages
        └── Note: Any additions should be considered carefully for not polluting the global Page interface

Anti-Patterns to Avoid

❌ Anti-Pattern 1: Fixture Without Teardown for Resources

// BAD: Creates mock, never stops it
tradingMock: async ({ page }, use) => {
    const mock = new TradingMock(page);
    await use(mock);
    // Missing: await mock.stop();
},

❌ Anti-Pattern 2: Not Declaring Fixture in Test Signature

// BAD: Fixture created but test doesn't use it
test('example', async ({ page }) => {
    // dashboardPage is never requested, fixture doesn't run
    const dash = new DashboardPage(page, ...);  // Manual creation is wrong
});

Exception: Test needs to initialize page object manually for some reason (second tab, manual start).

❌ Anti-Pattern 3: Worker Fixture Depending on Page

// BAD: Worker fixture cannot access page
wcSignClient: [
    async ({ page }, use) => {  // ❌ page is test-scoped
        const client = new WalletConnectSignClient();
        await client.init();
        await use(client);
    },
    { scope: 'worker' },
],

Signals

GitHub stars
1k
Forks
383
Last commit
Sep 2026
Advanced
Catalog kind
skill
Key
fixtures-trezor
Source
github.com/trezor/trezor-suite