49 lines
1.6 KiB
TypeScript
49 lines
1.6 KiB
TypeScript
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;
|
||
|
||
beforeEach(async () => {
|
||
harness = await createStepHarness();
|
||
});
|
||
|
||
afterEach(async () => {
|
||
await harness.dispose();
|
||
});
|
||
|
||
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 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 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);
|
||
});
|
||
}); |