This commit is contained in:
2025-11-30 17:37:03 +01:00
parent 65f74e124a
commit 4b8c70978f
6 changed files with 283 additions and 20 deletions

View File

@@ -1,28 +1,35 @@
import { describe, it, expect, beforeAll, afterAll } from 'vitest';
import path from 'path';
import { PlaywrightAutomationAdapter } from 'packages/infrastructure/adapters/automation';
import { PlaywrightAutomationAdapter, FixtureServer } from 'packages/infrastructure/adapters/automation';
import { StepId } from 'packages/domain/value-objects/StepId';
describe('Workflow steps 79 cars flow', () => {
describe('Workflow steps 79 cars flow (fixture-backed)', () => {
let adapter: PlaywrightAutomationAdapter;
const fixtureBaseUrl = `file://${path.resolve(process.cwd(), 'html-dumps')}`;
let server: FixtureServer;
let baseUrl: string;
beforeAll(async () => {
adapter = new PlaywrightAutomationAdapter({
headless: true,
timeout: 5000,
baseUrl: fixtureBaseUrl,
mode: 'mock',
});
server = new FixtureServer();
const info = await server.start();
baseUrl = info.url;
adapter = new PlaywrightAutomationAdapter(
{
headless: true,
timeout: 5000,
baseUrl,
mode: 'mock',
}
);
await adapter.connect();
});
afterAll(async () => {
await adapter.disconnect();
await server.stop();
});
it('executes time limits, cars, and add car in sequence', async () => {
await adapter.navigateToPage(`${fixtureBaseUrl}/step-07-time-limits.html`);
it('executes time limits, cars, and add car in sequence using fixtures', async () => {
await adapter.navigateToPage(server.getFixtureUrl(7));
const step7Result = await adapter.executeStep(StepId.create(7), {
practice: 10,
qualify: 10,
@@ -30,11 +37,11 @@ describe('Workflow steps 79 cars flow', () => {
});
expect(step7Result.success).toBe(true);
await adapter.navigateToPage(`${fixtureBaseUrl}/step-08-set-cars.html`);
await adapter.navigateToPage(server.getFixtureUrl(8));
const step8Result = await adapter.executeStep(StepId.create(8), {});
expect(step8Result.success).toBe(true);
await adapter.navigateToPage(`${fixtureBaseUrl}/step-09-add-car.html`);
await adapter.navigateToPage(server.getFixtureUrl(9));
const step9Result = await adapter.executeStep(StepId.create(9), {
carSearch: 'Porsche 911 GT3 R',
});