End to end tests

This commit is contained in:
MaddoScientisto 2026-04-12 19:31:12 +02:00
commit fed82d1ae8
26 changed files with 1016 additions and 37 deletions

View file

@ -39,6 +39,19 @@ try {
'token' => $token
));
$result = faceai_fetch_json($bridgeUrl);
$matches = is_array($result['matches'] ?? null) ? $result['matches'] : array();
$photos = array_map(static function ($match) {
$photoId = (string) ($match['photoId'] ?? ($match['id'] ?? ''));
return array(
'id' => $photoId,
'photoId' => $photoId,
'label' => (string) ($match['label'] ?? $photoId),
'checkpoint' => (string) ($match['checkpoint'] ?? '-'),
'previewUrl' => (string) ($match['previewUrl'] ?? ''),
'score' => $match['score'] ?? null,
);
}, $matches);
faceai_sim_render_page(array(
'raceId' => (string) ($result['raceId'] ?? ($payload['raceId'] ?? '')),
@ -46,9 +59,9 @@ try {
'raceSlug' => (string) ($result['raceId'] ?? ($payload['raceId'] ?? '')),
'raceName' => (string) ($result['raceName'] ?? ('Race ' . ($payload['raceId'] ?? ''))),
'returnUrl' => (string) ($result['returnUrl'] ?? 'faceai_simulator.php'),
'banner' => 'Vista filtrata da FaceAI. Sono state trovate <strong>' . count($result['matches'] ?? array()) . '</strong> foto corrispondenti per l utente corrente.',
'totalLabel' => count($result['matches'] ?? array()) . ' foto da FaceAI',
'photos' => is_array($result['matches'] ?? null) ? $result['matches'] : array(),
'banner' => 'Vista filtrata da FaceAI. Sono state trovate <strong>' . count($photos) . '</strong> foto corrispondenti per l utente corrente.',
'totalLabel' => count($photos) . ' foto da FaceAI',
'photos' => $photos,
'showSimulatorBootstrap' => false
));
} catch (Throwable $error) {