Files
EventHubFrontAdmin/playwright.config.ts
T
aleksey 7bd186eace
CI / test (push) Has been cancelled
CI / push-image (push) Has been cancelled
CI / ci-done (push) Has been cancelled
fix(e2e): интеграционные тесты на стендах без mocks.
ift-ui/stage-ui гоняют stand/integration против живого API; mock-suite остаётся в CI.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-16 14:11:54 +03:00

59 lines
1.8 KiB
TypeScript

import { defineConfig, devices } from '@playwright/test';
const port = Number(process.env.E2E_PORT || 4173);
const baseURL = process.env.E2E_BASE_URL || `http://127.0.0.1:${port}`;
const iftBaseURL = process.env.E2E_IFT_BASE_URL || 'https://admin-ui.ift.eventhub.local';
const stageBaseURL = process.env.E2E_STAGE_BASE_URL || 'https://admin-ui.stage.eventhub.local';
const liveTarget = process.env.E2E_TARGET;
const liveChrome = {
...devices['Desktop Chrome'],
ignoreHTTPSErrors: true,
};
/** Mock-suite (CI / локально): preview + page.route mocks. */
const mockProject = {
name: 'mock',
use: { ...devices['Desktop Chrome'] },
testIgnore: [/stand\//, /ift\//],
};
/** IFT/stage после деплоя: живой SPA + admin-api, без mocks. */
const standTestMatch = /stand\//;
export default defineConfig({
testDir: './e2e/tests',
fullyParallel: false,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 1 : 0,
workers: 1,
reporter: process.env.CI ? [['list'], ['html', { open: 'never' }]] : 'list',
timeout: 90_000,
expect: { timeout: 10_000 },
use: {
baseURL,
trace: 'on-first-retry',
locale: 'ru-RU',
},
projects: [
mockProject,
{
name: 'ift-ui',
use: { ...liveChrome, baseURL: iftBaseURL },
testMatch: standTestMatch,
},
{
name: 'stage-ui',
use: { ...liveChrome, baseURL: stageBaseURL },
testMatch: standTestMatch,
},
],
webServer: liveTarget
? undefined
: {
command: `npm run preview -- --host 127.0.0.1 --port ${port}`,
url: baseURL,
reuseExistingServer: !process.env.CI,
timeout: 120_000,
},
});