feat: Update FaceAI upload panel and improve race storage metadata handling in tests
All checks were successful
Publish FaceAI Container / publish (push) Successful in 4m32s
All checks were successful
Publish FaceAI Container / publish (push) Successful in 4m32s
This commit is contained in:
parent
0926c52a00
commit
c0d072c6ea
6 changed files with 130 additions and 47 deletions
|
|
@ -201,6 +201,13 @@ test('builds the simulator FaceAI handoff URL with the exact local race storage
|
|||
});
|
||||
|
||||
test('shows the unsupported-race message when the current race has no PKL data and lets the user go back', async ({ page }) => {
|
||||
const consoleErrors = [];
|
||||
page.on('console', (message) => {
|
||||
if (message.type() === 'error') {
|
||||
consoleErrors.push(message.text());
|
||||
}
|
||||
});
|
||||
|
||||
await launchFromSimulator(page, {
|
||||
raceId: '404',
|
||||
raceSlug: 'corsa-di-livorno',
|
||||
|
|
@ -211,6 +218,9 @@ test('shows the unsupported-race message when the current race has no PKL data a
|
|||
await expect(page.locator('.faceai-feedback')).toContainText('FaceAI non è disponibile per questa gara.');
|
||||
await expect(page.locator('input[type="file"]')).toBeDisabled();
|
||||
await expect(page.getByRole('button', { name: 'Scegli immagine' })).toBeDisabled();
|
||||
await expect.poll(() => {
|
||||
return consoleErrors.find((entry) => entry.includes('[FaceAI] Invalid race data:')) || null;
|
||||
}).toBeNull();
|
||||
|
||||
await page.waitForTimeout(2000);
|
||||
await expect(page).toHaveURL(FACEAI_HOME_URL_RE);
|
||||
|
|
@ -219,7 +229,7 @@ test('shows the unsupported-race message when the current race has no PKL data a
|
|||
await expect(page).toHaveURL(buildLegacySimulatorReturnMatcher('404'));
|
||||
});
|
||||
|
||||
test('shows a localized invalid-race error when session race data points to a missing folder', async ({ page }) => {
|
||||
test('shows a localized invalid-race error when the handoff omits race storage metadata', async ({ page }) => {
|
||||
const consoleErrors = [];
|
||||
page.on('console', (message) => {
|
||||
if (message.type() === 'error') {
|
||||
|
|
@ -227,17 +237,18 @@ test('shows a localized invalid-race error when session race data points to a mi
|
|||
}
|
||||
});
|
||||
|
||||
const simulatorUrl = buildSimulatorUrl({
|
||||
const handoffUrl = new URL(buildHandoffUrl({
|
||||
raceId: '405',
|
||||
lang: 'en',
|
||||
raceSlug: 'ghost-race',
|
||||
raceName: 'Ghost Race',
|
||||
raceFolder: 'THIS RACE DOES NOT EXIST'
|
||||
});
|
||||
}));
|
||||
handoffUrl.searchParams.delete('raceYear');
|
||||
handoffUrl.searchParams.delete('raceMonthFolder');
|
||||
handoffUrl.searchParams.delete('raceFolder');
|
||||
|
||||
await page.goto(simulatorUrl, { waitUntil: 'domcontentloaded' });
|
||||
await expect(page.locator('#faceaiLaunchButton')).toBeVisible();
|
||||
await page.locator('#faceaiLaunchButton').click();
|
||||
await page.goto(handoffUrl.toString(), { waitUntil: 'domcontentloaded' });
|
||||
|
||||
await page.waitForURL(FACEAI_HOME_URL_RE, {
|
||||
timeout: SHORT_UI_TIMEOUT_MS
|
||||
|
|
@ -250,10 +261,10 @@ test('shows a localized invalid-race error when session race data points to a mi
|
|||
await expect(page.getByRole('button', { name: 'Back to the race page' })).toBeVisible();
|
||||
await expect.poll(() => {
|
||||
return consoleErrors.find((entry) => entry.includes('[FaceAI] Invalid race data:')) || null;
|
||||
}).toContain('RACE_DIRECTORY_NOT_FOUND');
|
||||
}).toContain('MISSING_RACE_STORAGE');
|
||||
await expect.poll(() => {
|
||||
return consoleErrors.find((entry) => entry.includes('[FaceAI] Invalid race data:')) || null;
|
||||
}).toContain('THIS RACE DOES NOT EXIST');
|
||||
}).toContain('MISSING_RACE_STORAGE');
|
||||
|
||||
await page.getByRole('button', { name: 'Back to the race page' }).click();
|
||||
await expect(page).toHaveURL(buildLegacySimulatorReturnMatcher('405'));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue