This commit is contained in:
2025-12-01 17:27:56 +01:00
parent e7ada8aa23
commit 98a09a3f2b
41 changed files with 2341 additions and 1525 deletions

View File

@@ -20,10 +20,11 @@ describe('Step 3 race information', () => {
const page = harness.adapter.getPage();
expect(page).not.toBeNull();
const sidebarRaceInfo = await page!.textContent(
'#wizard-sidebar-link-set-session-information',
);
expect(sidebarRaceInfo).toContain('Race Information');
const sidebarRaceInfo = await page!
.locator(IRACING_SELECTORS.wizard.sidebarLinks.raceInformation)
.first()
.innerText();
expect(sidebarRaceInfo).toMatch(/Race Information/i);
const config = {
sessionName: 'GridPilot E2E Session',

View File

@@ -20,10 +20,16 @@ describe('Step 4 server details', () => {
const page = harness.adapter.getPage();
expect(page).not.toBeNull();
const sidebarServerDetails = await page!.textContent(
'#wizard-sidebar-link-set-server-details',
);
expect(sidebarServerDetails).toContain('Server Details');
const sidebarServerDetails = await page!
.locator(IRACING_SELECTORS.wizard.sidebarLinks.serverDetails)
.first()
.innerText();
expect(sidebarServerDetails).toMatch(/Server Details/i);
const serverDetailsContainer = page!
.locator(IRACING_SELECTORS.wizard.stepContainers.serverDetails)
.first();
expect(await serverDetailsContainer.count()).toBeGreaterThan(0);
const config = {
region: 'US-East-OH',

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 5 set admins', () => {
let harness: StepHarness;
@@ -18,11 +19,17 @@ describe('Step 5 set admins', () => {
const page = harness.adapter.getPage();
expect(page).not.toBeNull();
const sidebarAdmins = await page!.textContent(
'#wizard-sidebar-link-set-admins',
);
expect(sidebarAdmins).toContain('Admins');
const sidebarAdmins = await page!
.locator(IRACING_SELECTORS.wizard.sidebarLinks.admins)
.first()
.innerText();
expect(sidebarAdmins).toMatch(/Admins/i);
const adminsContainer = page!
.locator(IRACING_SELECTORS.wizard.stepContainers.admins)
.first();
expect(await adminsContainer.count()).toBeGreaterThan(0);
const bodyText = await page!.textContent('body');
expect(bodyText).toContain('Add an Admin');

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 6 admins', () => {
let harness: StepHarness;
@@ -18,8 +19,16 @@ describe('Step 6 admins', () => {
const page = harness.adapter.getPage();
expect(page).not.toBeNull();
const sidebarAdmins = await page!.textContent('#wizard-sidebar-link-set-admins');
expect(sidebarAdmins).toContain('Admins');
const sidebarAdmins = await page!
.locator(IRACING_SELECTORS.wizard.sidebarLinks.admins)
.first()
.innerText();
expect(sidebarAdmins).toMatch(/Admins/i);
const adminsContainer = page!
.locator(IRACING_SELECTORS.wizard.stepContainers.admins)
.first();
expect(await adminsContainer.count()).toBeGreaterThan(0);
const result = await harness.executeStep(6, {
adminSearch: 'Marc',
@@ -42,6 +51,11 @@ describe('Step 6 admins', () => {
const page = harness.adapter.getPage();
expect(page).not.toBeNull();
const adminsContainer = page!
.locator(IRACING_SELECTORS.wizard.stepContainers.admins)
.first();
expect(await adminsContainer.count()).toBeGreaterThan(0);
const header = await page!.textContent('#set-admins .card-header');
expect(header).toContain('Set Admins');

View File

@@ -17,23 +17,23 @@ describe('Step 8 cars', () => {
describe('alignment', () => {
it('executes on Cars page in mock wizard and exposes Add Car UI', async () => {
await harness.navigateToFixtureStep(8);
const page = harness.adapter.getPage();
expect(page).not.toBeNull();
const carsContainer = page!
.locator(IRACING_SELECTORS.wizard.stepContainers.cars)
.first();
expect(await carsContainer.count()).toBeGreaterThan(0);
const addCarButton = page!
.locator(IRACING_SELECTORS.steps.addCarButton)
.first();
const addCarText = await addCarButton.innerText();
expect(addCarText.toLowerCase()).toContain('add a car');
const result = await harness.executeStep(8, {});
const result = await harness.executeStepWithFixtureMismatch(8, {});
expect(result.success).toBe(true);
expect(result.error).toBeUndefined();
});
@@ -45,7 +45,7 @@ describe('Step 8 cars', () => {
await harness.adapter.getPage()?.waitForLoadState('domcontentloaded');
await expect(async () => {
await harness.executeStep(8, {});
await harness.executeStepWithFixtureMismatch(8, {});
}).rejects.toThrow(/Step 8 FAILED validation/i);
});
@@ -54,7 +54,7 @@ describe('Step 8 cars', () => {
await harness.adapter.getPage()?.waitForLoadState('domcontentloaded');
await expect(async () => {
await harness.executeStep(8, {});
await harness.executeStepWithFixtureMismatch(8, {});
}).rejects.toThrow(/Step 8 FAILED validation/i);
});
@@ -62,7 +62,7 @@ describe('Step 8 cars', () => {
await harness.navigateToFixtureStep(8);
await harness.adapter.getPage()?.waitForLoadState('domcontentloaded');
const result = await harness.executeStep(8, {});
const result = await harness.executeStepWithFixtureMismatch(8, {});
expect(result.success).toBe(true);
});

View File

@@ -21,7 +21,7 @@ describe('Step 9 add car', () => {
const page = harness.adapter.getPage();
expect(page).not.toBeNull();
const result = await harness.executeStep(9, {
const result = await harness.executeStepWithFixtureMismatch(9, {
carSearch: 'Acura ARX-06',
});
@@ -45,7 +45,7 @@ describe('Step 9 add car', () => {
await harness.adapter.getPage()?.waitForLoadState('domcontentloaded');
await expect(async () => {
await harness.executeStep(9, {
await harness.executeStepWithFixtureMismatch(9, {
carSearch: 'Mazda MX-5',
});
}).rejects.toThrow(/Step 9 FAILED validation/i);
@@ -56,7 +56,7 @@ describe('Step 9 add car', () => {
await harness.adapter.getPage()?.waitForLoadState('domcontentloaded');
await expect(async () => {
await harness.executeStep(9, {
await harness.executeStepWithFixtureMismatch(9, {
carSearch: 'Porsche 911',
});
}).rejects.toThrow(/Step 9 FAILED validation/i);
@@ -67,7 +67,7 @@ describe('Step 9 add car', () => {
await harness.adapter.getPage()?.waitForLoadState('domcontentloaded');
await expect(async () => {
await harness.executeStep(9, {
await harness.executeStepWithFixtureMismatch(9, {
carSearch: 'Ferrari 488',
});
}).rejects.toThrow(/Step 9 FAILED validation/i);
@@ -77,7 +77,7 @@ describe('Step 9 add car', () => {
await harness.navigateToFixtureStep(8);
await harness.adapter.getPage()?.waitForLoadState('domcontentloaded');
const result = await harness.executeStep(9, {
const result = await harness.executeStepWithFixtureMismatch(9, {
carSearch: 'Acura ARX-06',
});
@@ -102,7 +102,7 @@ describe('Step 9 add car', () => {
let errorMessage = '';
try {
await harness.executeStep(9, {
await harness.executeStepWithFixtureMismatch(9, {
carSearch: 'BMW M4',
});
} catch (error) {
@@ -129,7 +129,7 @@ describe('Step 9 add car', () => {
let validationError = false;
try {
await harness.executeStep(9, {
await harness.executeStepWithFixtureMismatch(9, {
carSearch: 'Audi R8',
});
} catch {
@@ -145,7 +145,7 @@ describe('Step 9 add car', () => {
await harness.adapter.getPage()?.waitForLoadState('domcontentloaded');
await expect(async () => {
await harness.executeStep(9, {
await harness.executeStepWithFixtureMismatch(9, {
carSearch: 'McLaren 720S',
});
}).rejects.toThrow();

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 13 track options', () => {
let harness: StepHarness;
@@ -19,10 +20,16 @@ describe('Step 13 track options', () => {
const page = harness.adapter.getPage();
expect(page).not.toBeNull();
const sidebarTrackOptions = await page!.textContent(
'#wizard-sidebar-link-set-track-options',
);
expect(sidebarTrackOptions).toContain('Track Options');
const sidebarTrackOptions = await page!
.locator(IRACING_SELECTORS.wizard.sidebarLinks.trackOptions)
.first()
.innerText();
expect(sidebarTrackOptions).toMatch(/Track Options/i);
const trackOptionsContainer = page!
.locator(IRACING_SELECTORS.wizard.stepContainers.trackOptions)
.first();
expect(await trackOptionsContainer.count()).toBeGreaterThan(0);
const bodyText = await page!.textContent('body');
expect(bodyText).toContain('Create Starting Grid');