wip
This commit is contained in:
@@ -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 15 – weather', () => {
|
||||
let harness: StepHarness;
|
||||
@@ -13,7 +14,7 @@ describe('Step 15 – weather', () => {
|
||||
await harness.dispose();
|
||||
});
|
||||
|
||||
it('executes on Weather page in mock wizard', async () => {
|
||||
it('executes on Weather page in mock wizard and applies weather config from JSON-backed controls', async () => {
|
||||
await harness.navigateToFixtureStep(15);
|
||||
|
||||
const page = harness.adapter.getPage();
|
||||
@@ -27,9 +28,44 @@ describe('Step 15 – weather', () => {
|
||||
const bodyText = await page!.textContent('body');
|
||||
expect(bodyText).toMatch(/Weather Mode|Event weather/i);
|
||||
|
||||
const result = await harness.executeStep(15, { timeOfDay: 800 });
|
||||
const config = {
|
||||
weatherType: '2',
|
||||
temperature: 650,
|
||||
};
|
||||
|
||||
const result = await harness.executeStep(15, config);
|
||||
|
||||
expect(result.success).toBe(true);
|
||||
expect(result.error).toBeUndefined();
|
||||
|
||||
const weatherSelect = page!
|
||||
.locator(IRACING_SELECTORS.steps.weatherType)
|
||||
.first();
|
||||
const weatherSelectCount = await weatherSelect.count();
|
||||
|
||||
if (weatherSelectCount > 0) {
|
||||
const selectedWeatherValue =
|
||||
(await weatherSelect.getAttribute('value')) ??
|
||||
(await weatherSelect.textContent().catch(() => null));
|
||||
expect(
|
||||
(selectedWeatherValue ?? '').toLowerCase(),
|
||||
).toMatch(/static|forecast|timeline|2/);
|
||||
} else {
|
||||
const radioGroup = page!.locator('[role="radiogroup"] input[type="radio"]').first();
|
||||
const radioCount = await radioGroup.count();
|
||||
expect(radioCount).toBeGreaterThan(0);
|
||||
}
|
||||
|
||||
const tempSlider = page!
|
||||
.locator(IRACING_SELECTORS.steps.temperature)
|
||||
.first();
|
||||
const tempExists = await tempSlider.count();
|
||||
|
||||
if (tempExists > 0) {
|
||||
const tempValue =
|
||||
(await tempSlider.getAttribute('data-value')) ??
|
||||
(await tempSlider.inputValue().catch(() => null));
|
||||
expect(tempValue).toBe(String(config.temperature));
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user