- Introduced `auth.setup.js` to handle authentication against the live site and store the session state. - Created `live-race.spec.js` to test loading a live race page with an authenticated session, including cookie validation. - Added utility functions in `live-site-test-utils.js` for managing authentication, dismissing cookie banners, and checking UI states. - Included a temporary JSON file for live state inspection. - Updated deployment manifest to reflect new and modified files. - Implemented `_inc_faceai_identity.jsp` for managing FaceAI identity cookies and included it in relevant JSP files. - Added language management JavaScript in `lang.js`. - Adjusted `fotoCR-en.jsp` and `fotoCR.jsp` to include the FaceAI identity logic. - Created a tarball for staging deployment.
33 lines
No EOL
1.2 KiB
JavaScript
33 lines
No EOL
1.2 KiB
JavaScript
const { test, expect } = require('@playwright/test');
|
|
const {
|
|
LIVE_SITE_RACE_URL,
|
|
dismissCookieBanner,
|
|
expectRacePageLoaded,
|
|
performLiveLogin,
|
|
waitForLoggedInUi
|
|
} = require('./live-site-test-utils');
|
|
|
|
test('loads a live race page with an authenticated session', async ({ page }) => {
|
|
await page.goto(LIVE_SITE_RACE_URL, { waitUntil: 'domcontentloaded' });
|
|
await dismissCookieBanner(page);
|
|
|
|
try {
|
|
await waitForLoggedInUi(page);
|
|
} catch (error) {
|
|
await performLiveLogin(page);
|
|
await page.goto(LIVE_SITE_RACE_URL, { waitUntil: 'domcontentloaded' });
|
|
await dismissCookieBanner(page);
|
|
await waitForLoggedInUi(page);
|
|
}
|
|
|
|
await expectRacePageLoaded(page);
|
|
await expect(page.locator('h1')).toContainText(/HALF MARATHON FIRENZE|Competitions|Gare/i);
|
|
|
|
const cookies = await page.context().cookies(LIVE_SITE_RACE_URL);
|
|
const faceAiIdentityCookie = cookies.find((cookie) => cookie.name === 'rus_faceai_identity');
|
|
|
|
expect(faceAiIdentityCookie, 'Expected the race page to mint the FaceAI identity cookie for the authenticated session.').toBeTruthy();
|
|
expect(faceAiIdentityCookie.httpOnly).toBe(true);
|
|
expect(faceAiIdentityCookie.secure).toBe(true);
|
|
expect(faceAiIdentityCookie.value).toMatch(/\./);
|
|
}); |