Refactor infra tests, clean E2E step suites, and fix TS in tests

This commit is contained in:
2025-11-30 10:58:49 +01:00
parent af14526ae2
commit f8a1fbeb50
43 changed files with 883 additions and 2159 deletions

View File

@@ -0,0 +1,43 @@
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 79 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);
});
});