33 lines
1.2 KiB
JavaScript
33 lines
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(/\./);
|
||
|
|
});
|