44 lines
1.4 KiB
TypeScript
44 lines
1.4 KiB
TypeScript
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('Step 7 – time limits', () => {
|
||
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 on Time Limits page and navigates to Cars', async () => {
|
||
await adapter.navigateToPage(`${fixtureBaseUrl}/step-07-time-limits.html`);
|
||
const page = adapter.getPage();
|
||
expect(page).not.toBeNull();
|
||
|
||
const stepIndicatorBefore = await page!.textContent('[data-indicator]');
|
||
expect(stepIndicatorBefore).toContain('Time Limits');
|
||
|
||
const result = await adapter.executeStep(StepId.create(7), {
|
||
practice: 10,
|
||
qualify: 10,
|
||
race: 20,
|
||
});
|
||
|
||
expect(result.success).toBe(true);
|
||
expect(result.error).toBeUndefined();
|
||
|
||
const stepIndicatorAfter = await page!.textContent('[data-indicator]');
|
||
expect(stepIndicatorAfter).toContain('Set Cars');
|
||
});
|
||
}); |