Files
gridpilot.gg/tests/e2e/steps/step-03-race-information.e2e.test.ts
2025-12-16 11:09:13 +01:00

61 lines
2.0 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import type { StepHarness } from '../support/StepHarness';
import { createStepHarness } from '../support/StepHarness';
import { IRACING_SELECTORS } from 'core/automation/infrastructure//automation/dom/IRacingSelectors';
describe('Step 3 race information', () => {
let harness: StepHarness;
beforeEach(async () => {
harness = await createStepHarness();
});
afterEach(async () => {
await harness.dispose();
});
it('fills race information on Race Information page and persists values in form fields', async () => {
await harness.navigateToFixtureStep(3);
const page = harness.adapter.getPage();
expect(page).not.toBeNull();
const sidebarRaceInfo = await page!
.locator(IRACING_SELECTORS.wizard.sidebarLinks.raceInformation)
.first()
.innerText();
expect(sidebarRaceInfo).toMatch(/Race Information/i);
const config = {
sessionName: 'GridPilot E2E Session',
password: 'secret',
description: 'Step 3 race information E2E',
};
const result = await harness.executeStep(3, config);
expect(result.success).toBe(true);
expect(result.error).toBeUndefined();
const sessionNameInput = page!
.locator(IRACING_SELECTORS.steps.sessionName)
.first();
const passwordInput = page!
.locator(IRACING_SELECTORS.steps.password)
.first();
const descriptionInput = page!
.locator(IRACING_SELECTORS.steps.description)
.first();
const sessionNameValue = await sessionNameInput.inputValue();
const passwordValue = await passwordInput.inputValue();
const descriptionValue = await descriptionInput.inputValue();
expect(sessionNameValue).toBe(config.sessionName);
expect(passwordValue).toBe(config.password);
expect(descriptionValue).toBe(config.description);
const footerText = await page!.textContent('.wizard-footer');
expect(footerText).toMatch(/Server Details|Admins/i);
});
});