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,6 +1,7 @@
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 14 time of day', () => {
let harness: StepHarness;
@@ -13,22 +14,40 @@ describe('Step 14 time of day', () => {
await harness.dispose();
});
it('executes on Time of Day page in mock wizard', async () => {
it('executes on Time of Day page and applies time-of-day slider from config', async () => {
await harness.navigateToFixtureStep(14);
const page = harness.adapter.getPage();
expect(page).not.toBeNull();
const container = page!
.locator(IRACING_SELECTORS.wizard.stepContainers.timeOfDay)
.first();
expect(await container.count()).toBeGreaterThan(0);
const sidebarTimeOfDay = await page!.textContent(
'#wizard-sidebar-link-set-time-of-day',
);
expect(sidebarTimeOfDay).toContain('Time of Day');
const result = await harness.executeStep(14, {});
const config = { timeOfDay: 800 };
const result = await harness.executeStep(14, config);
expect(result.success).toBe(true);
expect(result.error).toBeUndefined();
const timeSlider = page!
.locator(IRACING_SELECTORS.steps.timeOfDay)
.first();
const sliderExists = await timeSlider.count();
expect(sliderExists).toBeGreaterThan(0);
const valueAttr =
(await timeSlider.getAttribute('data-value')) ??
(await timeSlider.inputValue().catch(() => null));
expect(valueAttr).toBe(String(config.timeOfDay));
const footerText = await page!.textContent('.wizard-footer');
expect(footerText).toMatch(/Weather/i);
});