import { describe, it, expect, beforeAll, afterAll } from 'vitest'; import path from 'path'; import { PlaywrightAutomationAdapter } from 'packages/infrastructure/adapters/automation'; import { StepId } from 'packages/domain/value-objects/StepId'; describe('Workflow – steps 7–9 cars flow', () => { let adapter: PlaywrightAutomationAdapter; const fixtureBaseUrl = `file://${path.resolve(process.cwd(), 'html-dumps')}`; beforeAll(async () => { adapter = new PlaywrightAutomationAdapter({ headless: true, timeout: 5000, baseUrl: fixtureBaseUrl, mode: 'mock', }); await adapter.connect(); }); afterAll(async () => { await adapter.disconnect(); }); it('executes time limits, cars, and add car in sequence', async () => { await adapter.navigateToPage(`${fixtureBaseUrl}/step-07-time-limits.html`); const step7Result = await adapter.executeStep(StepId.create(7), { practice: 10, qualify: 10, race: 20, }); expect(step7Result.success).toBe(true); await adapter.navigateToPage(`${fixtureBaseUrl}/step-08-set-cars.html`); const step8Result = await adapter.executeStep(StepId.create(8), {}); expect(step8Result.success).toBe(true); await adapter.navigateToPage(`${fixtureBaseUrl}/step-09-add-car.html`); const step9Result = await adapter.executeStep(StepId.create(9), { carSearch: 'Porsche 911 GT3 R', }); expect(step9Result.success).toBe(true); }); });