Files
gridpilot.gg/tests/e2e/steps/step-07-time-limits.e2e.test.ts

44 lines
1.4 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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');
});
});