Add Playwright tests for live site authentication and race page loading
- 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.
This commit is contained in:
parent
9f56dfba1d
commit
1d1bccdae6
23 changed files with 4358 additions and 11 deletions
33
faceai/tests/live-site/live-race.spec.js
Normal file
33
faceai/tests/live-site/live-race.spec.js
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
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(/\./);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue