feat: Add FaceAI handoff URL builder and enhance race storage metadata handling
All checks were successful
Publish FaceAI Container / publish (push) Successful in 9m53s

This commit is contained in:
MaddoScientisto 2026-04-19 16:12:48 +02:00
commit 4f003bb5a9
5 changed files with 214 additions and 37 deletions

View file

@ -50,6 +50,15 @@ async function enterViaHandoff(page, options = {}) {
await waitForFaceAiHome(page);
}
async function readLaunchUrlFromLegacyPage(page) {
const launchUrl = await page.evaluate(() => {
return typeof buildFaceAiLaunchUrl === 'function' ? buildFaceAiLaunchUrl() : '';
});
expect(launchUrl, 'Expected the simulator race page to expose a FaceAI handoff URL builder.').toBeTruthy();
return new URL(launchUrl, 'http://127.0.0.1:8080');
}
async function startSearch(page, selfieName) {
const createResponsePromise = page.waitForResponse((response) => {
return response.url().includes('/api/searches')
@ -170,6 +179,27 @@ test('runs the simulator flow through FaceAI and returns to the filtered legacy
});
});
test('builds the simulator FaceAI handoff URL with the exact local race storage metadata', async ({ page }) => {
await page.goto(buildSimulatorUrl({
raceId: '202',
raceSlug: 'mezza-di-pisa',
raceName: 'Mezza di Pisa',
raceYear: '2026',
raceMonthFolder: '04.APRILE',
raceFolder: 'PISA'
}), { waitUntil: 'domcontentloaded' });
await expect(page.locator('#faceAiRaceYear')).toHaveValue('2026');
await expect(page.locator('#faceAiRaceMonthFolder')).toHaveValue('04.APRILE');
await expect(page.locator('#faceAiRaceFolder')).toHaveValue('PISA');
const launchUrl = await readLaunchUrlFromLegacyPage(page);
expect(launchUrl.searchParams.get('raceYear')).toBe('2026');
expect(launchUrl.searchParams.get('raceMonthFolder')).toBe('04.APRILE');
expect(launchUrl.searchParams.get('raceFolder')).toBe('PISA');
expect(launchUrl.searchParams.get('raceStorageRelativeDir')).toBe('2026/04.APRILE/PISA');
});
test('shows the unsupported-race message when the current race has no PKL data and lets the user go back', async ({ page }) => {
await launchFromSimulator(page, {
raceId: '404',