This commit is contained in:
2025-11-30 23:00:48 +01:00
parent 4b8c70978f
commit 645f537895
41 changed files with 738 additions and 1631 deletions

View File

@@ -1,7 +1,8 @@
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import type { StepHarness } from '../support/StepHarness';
import { createStepHarness } from '../support/StepHarness';
import { IRACING_SELECTORS } from 'packages/infrastructure/adapters/automation/dom/IRacingSelectors';
describe('Step 7 time limits', () => {
let harness: StepHarness;
@@ -13,24 +14,36 @@ describe('Step 7 time limits', () => {
await harness.dispose();
});
it('executes on Time Limits page and navigates to Cars', async () => {
it('executes on Time Limits page, applies sliders, and navigates to Cars', async () => {
await harness.navigateToFixtureStep(7);
const page = harness.adapter.getPage();
expect(page).not.toBeNull();
const stepIndicatorBefore = await page!.textContent('[data-indicator]');
expect(stepIndicatorBefore).toContain('Time Limits');
const timeLimitContainer = page!
.locator(IRACING_SELECTORS.wizard.stepContainers.timeLimit)
.first();
expect(await timeLimitContainer.count()).toBeGreaterThan(0);
const result = await harness.executeStep(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');
const raceSlider = page!
.locator(IRACING_SELECTORS.steps.race)
.first();
const raceSliderExists = await raceSlider.count();
expect(raceSliderExists).toBeGreaterThan(0);
const raceValueAttr =
(await raceSlider.getAttribute('data-value')) ??
(await raceSlider.inputValue().catch(() => null));
expect(raceValueAttr).toBe('20');
const footerText = await page!.textContent('.wizard-footer');
expect(footerText).toMatch(/Cars/i);
});
});