Refactor infra tests, clean E2E step suites, and fix TS in tests
This commit is contained in:
44
tests/e2e/steps/step-07-time-limits.e2e.test.ts
Normal file
44
tests/e2e/steps/step-07-time-limits.e2e.test.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
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');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user