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

@@ -14,21 +14,28 @@ describe('Step 9 add car', () => {
});
describe('happy path', () => {
it('executes on Add Car modal from Cars step', async () => {
await harness.navigateToFixtureStep(9);
it('adds a real car using the JSON-backed car list on Cars page', async () => {
await harness.navigateToFixtureStep(8);
await harness.adapter.getPage()?.waitForLoadState('domcontentloaded');
const page = harness.adapter.getPage();
expect(page).not.toBeNull();
const modalTitleBefore = await page!.textContent('[data-indicator="add-car"]');
expect(modalTitleBefore).toContain('Add a Car');
const result = await harness.executeStep(9, {
carSearch: 'Porsche 911 GT3 R',
carSearch: 'Acura ARX-06',
});
expect(result.success).toBe(true);
expect(result.error).toBeUndefined();
const carsTable = page!
.locator('#select-car-set-cars table.table.table-striped')
.first();
expect(await carsTable.count()).toBeGreaterThan(0);
const acuraCell = carsTable.locator('tbody tr td >> text=Acura ARX-06 GTP');
expect(await acuraCell.count()).toBeGreaterThan(0);
});
});
@@ -52,7 +59,7 @@ describe('Step 9 add car', () => {
await harness.executeStep(9, {
carSearch: 'Porsche 911',
});
}).rejects.toThrow(/Expected cars step/i);
}).rejects.toThrow(/Step 9 FAILED validation/i);
});
it('detects when Track container is present instead of Cars page', async () => {
@@ -63,7 +70,7 @@ describe('Step 9 add car', () => {
await harness.executeStep(9, {
carSearch: 'Ferrari 488',
});
}).rejects.toThrow(/3 steps ahead|Track page/i);
}).rejects.toThrow(/Step 9 FAILED validation/i);
});
it('passes validation when on Cars page', async () => {
@@ -71,10 +78,22 @@ describe('Step 9 add car', () => {
await harness.adapter.getPage()?.waitForLoadState('domcontentloaded');
const result = await harness.executeStep(9, {
carSearch: 'Mazda MX-5',
carSearch: 'Acura ARX-06',
});
expect(result.success).toBe(true);
const page = harness.adapter.getPage();
expect(page).not.toBeNull();
const carsTable = page!
.locator('#select-car-set-cars table.table.table-striped')
.first();
expect(await carsTable.count()).toBeGreaterThan(0);
const acuraCell = carsTable.locator('tbody tr td >> text=Acura ARX-06 GTP');
expect(await acuraCell.count()).toBeGreaterThan(0);
});
it('provides detailed error context in validation failure', async () => {