feat: Enhance FaceAI functionality with storage management and update deployment instructions
All checks were successful
Publish FaceAI Container / publish (push) Successful in 5m45s
All checks were successful
Publish FaceAI Container / publish (push) Successful in 5m45s
This commit is contained in:
parent
c0d072c6ea
commit
23f811e465
14 changed files with 500 additions and 22 deletions
|
|
@ -1,3 +1,4 @@
|
|||
const path = require('path');
|
||||
const { test, expect } = require('@playwright/test');
|
||||
const {
|
||||
LIVE_EXPECTED_RACE_STORAGE,
|
||||
|
|
@ -112,6 +113,16 @@ async function readVisibleLegacyPhotoIds(page) {
|
|||
});
|
||||
}
|
||||
|
||||
async function readFaceAiMatchState(page) {
|
||||
return page.evaluate(() => {
|
||||
if (typeof getFaceAiMatchState === 'function') {
|
||||
return getFaceAiMatchState();
|
||||
}
|
||||
|
||||
return window.faceAiMatchState || null;
|
||||
});
|
||||
}
|
||||
|
||||
async function waitForVisibleLegacyPhotoIds(page, expectedCount) {
|
||||
await expect.poll(async () => {
|
||||
const visiblePhotoIds = await readVisibleLegacyPhotoIds(page);
|
||||
|
|
@ -345,7 +356,7 @@ test('accepts the supplied portrait image for the live upload flow', async ({ pa
|
|||
await expect(fileInput).toBeEnabled();
|
||||
await fileInput.setInputFiles(LIVE_SITE_PORTRAIT_PATH);
|
||||
|
||||
await expect(page.locator('.faceai-file-name')).toContainText('test_portrait_1.png');
|
||||
await expect(page.locator('.faceai-file-name')).toContainText(path.basename(LIVE_SITE_PORTRAIT_PATH));
|
||||
|
||||
const searchResponsePromise = page.waitForResponse((response) => {
|
||||
return response.request().method() === 'POST' && response.url().includes('/api/searches');
|
||||
|
|
@ -376,15 +387,26 @@ test('accepts the supplied portrait image for the live upload flow', async ({ pa
|
|||
await expect.poll(async () => page.url(), {
|
||||
timeout: 30 * 1000,
|
||||
message: 'Expected the browser to land on the legacy race page with FaceAI filter parameters after FaceAI completed.'
|
||||
}).toMatch(new RegExp(`^${escapeRegExp(LIVE_SITE_BASE_URL)}/.*faceaiPhotoIds=`));
|
||||
}).toMatch(new RegExp(`^${escapeRegExp(LIVE_SITE_BASE_URL)}/.*(?:faceaiPhotoIds=|faceaiMatchStorageKey=)`));
|
||||
|
||||
await expect(page.locator('form[onsubmit="return searching()"]')).toBeVisible();
|
||||
await expect(page.locator('#faceAiFilterBanner')).toContainText(/Face ID filter active|Filtro Face ID attivo/i);
|
||||
await expect(page.locator('.gallery-card')).toHaveCount(0);
|
||||
|
||||
const finalUrl = new URL(page.url());
|
||||
const expectedPhotoIds = (finalUrl.searchParams.get('faceaiPhotoIds') || '').split(',').map((value) => value.trim()).filter(Boolean);
|
||||
await expect.poll(async () => {
|
||||
const matchState = await readFaceAiMatchState(page);
|
||||
return Array.isArray(matchState && matchState.photoIds) ? matchState.photoIds.length : 0;
|
||||
}, {
|
||||
timeout: 30 * 1000,
|
||||
message: 'Expected the legacy race page to resolve FaceAI match state after redirect.'
|
||||
}).toBeGreaterThan(0);
|
||||
|
||||
const matchState = await readFaceAiMatchState(page);
|
||||
|
||||
const expectedPhotoIds = Array.isArray(matchState.photoIds) ? matchState.photoIds.map((value) => String(value || '').trim()).filter(Boolean) : [];
|
||||
expect(expectedPhotoIds.length, 'Expected the final race page URL to include at least one FaceAI photo identifier.').toBeGreaterThan(0);
|
||||
expect(Number(finalUrl.searchParams.get('faceaiMatchCount') || 0)).toBe(expectedPhotoIds.length);
|
||||
|
||||
for (const photoKey of expectedPhotoIds) {
|
||||
const lookup = await lookupLivePhoto(page, photoKey);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue