fix(e2e): интеграционные тесты на стендах без mocks.
ift-ui/stage-ui гоняют stand/integration против живого API; mock-suite остаётся в CI. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import type { Page } from '@playwright/test';
|
||||
|
||||
/** Учётки superadmin со стенда (CI: load-stand-smoke-env.sh). */
|
||||
export function standAdminEmail(): string | undefined {
|
||||
return process.env.SMOKE_ADMIN_EMAIL || process.env.ADMIN_SUPER_EMAIL || process.env.E2E_ADMIN_EMAIL;
|
||||
}
|
||||
|
||||
export function standAdminPassword(): string | undefined {
|
||||
return (
|
||||
process.env.SMOKE_ADMIN_PASSWORD ||
|
||||
process.env.ADMIN_SUPER_PASSWORD ||
|
||||
process.env.E2E_ADMIN_PASSWORD
|
||||
);
|
||||
}
|
||||
|
||||
export function hasStandCredentials(): boolean {
|
||||
return Boolean(standAdminEmail() && standAdminPassword());
|
||||
}
|
||||
|
||||
/** Реальный login против admin-api стенда (без Playwright route mocks). */
|
||||
export async function loginAsStandAdmin(page: Page) {
|
||||
const email = standAdminEmail();
|
||||
const password = standAdminPassword();
|
||||
if (!email || !password) {
|
||||
throw new Error('Stand admin credentials missing (SMOKE_ADMIN_* / ADMIN_SUPER_*)');
|
||||
}
|
||||
await page.goto('/login');
|
||||
await page.getByLabel(/email/i).fill(email);
|
||||
await page.getByLabel(/пароль|password/i).fill(password);
|
||||
await page.getByTestId('btn-login').click();
|
||||
await page.getByTestId('layout-shell').waitFor({ state: 'visible', timeout: 30_000 });
|
||||
}
|
||||
Reference in New Issue
Block a user