test: add authenticated staging smoke helper

This commit is contained in:
a.tolmachev
2026-04-07 13:08:32 +03:00
parent e3cd02aa7e
commit 09e6260e32
9 changed files with 136 additions and 12 deletions
@@ -0,0 +1,42 @@
const { test, expect } = require('@playwright/test');
const { getSession, localized, login } = require('./helpers');
const CORE_PAGES = [
{ path: '/', heading: localized('Operations', 'Операции') },
{ path: '/agents', heading: localized('Agents', 'Агенты') },
{ path: '/api-keys', heading: localized('API Keys', 'API ключи') },
{ path: '/secrets', heading: localized('Secrets', 'Секреты') },
{ path: '/logs', heading: localized('Logs', 'Логи') },
{ path: '/usage', heading: localized('Usage', 'Использование') },
{ path: '/workspace-setup', heading: localized('Workspace', 'Воркспейс') },
{ path: '/settings', heading: localized('Settings', 'Настройки') },
{ path: '/stream-sessions', heading: localized('Stream Sessions', 'Stream Sessions') },
{ path: '/async-jobs', heading: localized('Async Jobs', 'Async Jobs') },
{ path: '/wizard/', heading: localized('Create', 'Создать') },
];
test('authenticated staging smoke logs in and exposes session json', async ({ page }) => {
await login(page);
const session = await getSession(page);
expect(session.user).toBeTruthy();
expect(Array.isArray(session.memberships)).toBe(true);
expect(session.memberships.length).toBeGreaterThan(0);
});
test('authenticated staging smoke opens core pages without console errors', async ({ page }) => {
const pageErrors = [];
page.on('pageerror', (error) => {
pageErrors.push(error.message);
});
await login(page);
for (const pageSpec of CORE_PAGES) {
await page.goto(pageSpec.path);
await expect(page.locator('#login-form')).toHaveCount(0);
await expect(page.locator('body')).toContainText(pageSpec.heading);
}
expect(pageErrors).toEqual([]);
});