www in docker support

This commit is contained in:
MaddoScientisto 2026-04-22 18:41:37 +02:00
commit c227fce036
2145 changed files with 399596 additions and 58 deletions

View file

@ -2,6 +2,7 @@ const { test, expect } = require('@playwright/test');
const {
EXPECTED_MATCH_COUNT,
FACEAI_BASE_URL,
LEGACY_RACE_ID,
buildHandoffUrl,
buildSimulatorUrl,
getSearchArtifacts,
@ -19,7 +20,7 @@ const LEGACY_RETURN_TIMEOUT_MS = 75 * 1000;
const FILE_CHOOSER_TIMEOUT_MS = 8 * 1000;
function buildLegacySimulatorReturnMatcher(raceId) {
return new RegExp(`http:\\/\\/(localhost|127\\.0\\.0\\.1):8080\\/faceai_simulator\\.php\\?raceId=${raceId}.*`);
return new RegExp(`http://(localhost|127\\.0\\.0\\.1):8080/Foto2\\.abl\\?id_gara=${raceId}.*`);
}
function assertLogDoesNotContain(content, patterns, label) {
@ -55,7 +56,7 @@ async function readLaunchUrlFromLegacyPage(page) {
return typeof buildFaceAiLaunchUrl === 'function' ? buildFaceAiLaunchUrl() : '';
});
expect(launchUrl, 'Expected the simulator race page to expose a FaceAI handoff URL builder.').toBeTruthy();
expect(launchUrl, 'Expected the legacy race page to expose a FaceAI handoff URL builder.').toBeTruthy();
return new URL(launchUrl, 'http://127.0.0.1:8080');
}
@ -110,16 +111,16 @@ async function waitForLegacyResult(page, raceId, expectedMatchCount = null) {
await expect.poll(() => page.url(), {
timeout: 15 * 1000,
message: 'Expected the legacy simulator return URL to include FaceAI filter parameters.'
}).toMatch(/faceaiPhotoIds=/);
message: 'Expected the legacy race return URL to include FaceAI direct-return parameters.'
}).toMatch(/faceaiResultId=|faceaiMatchStorageKey=|faceaiPhotoIds=/);
if (expectedMatchCount === null) {
return;
}
const finalUrl = new URL(page.url());
const photoIds = (finalUrl.searchParams.get('faceaiPhotoIds') || '').split(',').map((value) => value.trim()).filter(Boolean);
expect(photoIds.length).toBe(expectedMatchCount);
await expect(page.locator('#faceAiPhotoCountValue')).toHaveText(String(expectedMatchCount), {
timeout: SHORT_UI_TIMEOUT_MS
});
}
async function verifySearchLogs(searchId, { expectedMatchCount, expectedSelfieName }) {
@ -159,19 +160,19 @@ async function closeContexts(contexts) {
}));
}
test('runs the simulator flow through FaceAI and returns to the filtered legacy result', async ({ page }) => {
test('runs the legacy Tomcat flow through FaceAI and returns to the filtered legacy result', async ({ page }) => {
test.slow();
await launchFromSimulator(page, {
raceId: '202',
raceSlug: 'mezza-di-pisa',
raceName: 'Mezza di Pisa',
raceFolder: 'PISA'
raceId: LEGACY_RACE_ID,
raceSlug: 'livorno',
raceName: 'Livorno',
raceFolder: 'LIVORNO'
});
const search = await startSearch(page, 'DSC_1960.JPG');
await waitForLegacyResult(page, '202', EXPECTED_MATCH_COUNT);
await waitForLegacyResult(page, LEGACY_RACE_ID, EXPECTED_MATCH_COUNT);
await verifySearchLogs(search.id, {
expectedMatchCount: EXPECTED_MATCH_COUNT,
@ -179,25 +180,25 @@ 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 }) => {
test('builds the legacy 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',
raceId: LEGACY_RACE_ID,
raceSlug: 'livorno',
raceName: 'Livorno',
raceYear: '2026',
raceMonthFolder: '04.APRILE',
raceFolder: 'PISA'
raceFolder: 'LIVORNO'
}), { waitUntil: 'domcontentloaded' });
await expect(page.locator('#faceAiRaceYear')).toHaveValue('2026');
await expect(page.locator('#faceAiRaceMonthFolder')).toHaveValue('04.APRILE');
await expect(page.locator('#faceAiRaceFolder')).toHaveValue('PISA');
await expect(page.locator('#faceAiRaceFolder')).toHaveValue('LIVORNO');
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');
expect(launchUrl.searchParams.get('raceFolder')).toBe('LIVORNO');
expect(launchUrl.searchParams.get('raceStorageRelativeDir')).toBe('2026/04.APRILE/LIVORNO');
});
test('shows the unsupported-race message when the current race has no PKL data and lets the user go back', async ({ page }) => {