All checks were successful
Wire viewer-frontend Vitest into Gitea Actions, centralize DEV base URLs in env-defaults.json, expand playkit API catalog specs, and land auth/mail flows plus verify-email public-host redirect and idle-logout e2e hooks.
60 lines
1.8 KiB
TypeScript
60 lines
1.8 KiB
TypeScript
import {
|
|
assertPublicHost,
|
|
waitForUrlHost,
|
|
} from '@levkin/playkit';
|
|
import { test, expect } from '../fixtures';
|
|
|
|
test.describe('auth @smoke', () => {
|
|
test('login page loads on public host', async ({
|
|
page,
|
|
playkitConfig,
|
|
timings,
|
|
loginPage,
|
|
}) => {
|
|
assertPublicHost(playkitConfig.baseUrl);
|
|
|
|
await timings.measure('login_page', () => loginPage.openLogin());
|
|
|
|
await expect(page.getByRole('heading', { name: /Sign in/i })).toBeVisible();
|
|
await expect(page.locator('#email')).toBeVisible();
|
|
await waitForUrlHost(page, playkitConfig.expectedHost);
|
|
expect(new URL(page.url()).hostname).toBe(playkitConfig.expectedHost);
|
|
});
|
|
|
|
test('sign-out stays on public host (Kolby #57)', async ({
|
|
page,
|
|
playkitConfig,
|
|
timings,
|
|
loginPage,
|
|
accountMenu,
|
|
e2eCredentials,
|
|
}) => {
|
|
test.skip(
|
|
!e2eCredentials,
|
|
'Set E2E_ADMIN_EMAIL and E2E_ADMIN_PASSWORD (Infisical / Gitea secrets)',
|
|
);
|
|
|
|
assertPublicHost(playkitConfig.baseUrl);
|
|
|
|
await timings.measure('login', async () => {
|
|
await loginPage.openLogin();
|
|
await loginPage.signIn(e2eCredentials!.email, e2eCredentials!.password);
|
|
await page.waitForURL((url) => !url.pathname.includes('/login'), { timeout: 30_000 });
|
|
await page.getByLabel('Account menu').waitFor({ state: 'visible', timeout: 30_000 });
|
|
});
|
|
|
|
await waitForUrlHost(page, playkitConfig.expectedHost);
|
|
|
|
await timings.measure('sign_out', () => accountMenu.signOut());
|
|
|
|
// After sign-out, NextAuth must redirect to the public host — never 10.x.
|
|
await waitForUrlHost(page, playkitConfig.expectedHost);
|
|
expect(new URL(page.url()).hostname).toBe(playkitConfig.expectedHost);
|
|
expect(page.url()).not.toMatch(/10\.\d+\.\d+\.\d+/);
|
|
|
|
await expect(page.getByRole('button', { name: /Sign in/i })).toBeVisible({
|
|
timeout: 15_000,
|
|
});
|
|
});
|
|
});
|