food-market/tests/e2e/playwright.config.ts
nns eb867697d0
Some checks are pending
CI / Backend (.NET 8) (push) Waiting to run
CI / Web (React + Vite) (push) Waiting to run
CI / POS (WPF, Windows) (push) Waiting to run
Docker Web / Build + push Web (push) Waiting to run
Docker Web / Deploy Web on stage (push) Blocked by required conditions
test(ui-deep): setup + Item 1 — signup flow (5 specs)
Sprint UI-deep, пункт 1: реальный Chromium через Playwright Test.
Установлены @playwright/test 1.60.0 и otplib (для item 11).
Конфиг tests/e2e/playwright.config.ts — workers=1, traces+screenshots
on-failure, screenshot dir reports/playwright-artifacts/.

Хелперы tests/e2e/lib/ui.ts:
- apiSignup() — быстрый signup через API + login
- attachSession() — кладёт access_token в localStorage, грузит путь
- watchPage() — listener console-errors и network 4xx/5xx
- expectNoErrors() — assert после flow'a

Item 1 (5 specs, все ✓ на стейдже):
- 1.1 attach session → /dashboard, без console-ошибок
- 1.2 создание товара через UI (Empty CTA → форма → Сохранить)
- 1.3 первый контрагент через Modal
- 1.4 создать товар + контрагент через API, открыть форму приёмки,
       smoke на компоненты страницы
- 1.5 OnboardingPage (/) рендерится

Найден 1 реальный баг → починен:
- ProductEditPage: race на currencies.data — если быстро Сохранить,
  цена-MoneyInput добавляет строку с currencyId='' → server 400 с
  криптичным JSON validation. Фикс: MoneyInput disabled пока
  !currencies.data + canSave проверяет row.currencyId.
- Form error display показывал "Request failed with status code 400";
  теперь использует общий humanizeError() (exporting из @/lib/api).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-30 12:33:10 +05:00

40 lines
1.3 KiB
TypeScript

import { defineConfig, devices } from '@playwright/test'
/**
* Конфиг Playwright Test для UI-deep тестирования стейджа.
* Запуск: pnpm exec playwright test (или `npx playwright test`).
*
* Env:
* E2E_ADMIN_URL — базовый URL (default https://test.admin.food-market.kz)
* CI=1 — включает workers=1, full retry off
*/
const baseURL = process.env.E2E_ADMIN_URL ?? 'https://test.admin.food-market.kz'
export default defineConfig({
testDir: './scenarios',
testMatch: /stage-ui-.*\.spec\.ts$/,
fullyParallel: false, // тесты делят tenant-данные через API, серий безопаснее
forbidOnly: !!process.env.CI,
retries: 0,
workers: 1,
reporter: [
['list'],
['html', { outputFolder: 'reports/playwright-html', open: 'never' }],
],
use: {
baseURL,
headless: true,
ignoreHTTPSErrors: true,
viewport: { width: 1280, height: 800 },
actionTimeout: 15_000,
navigationTimeout: 30_000,
screenshot: 'only-on-failure',
trace: 'retain-on-failure',
video: 'retain-on-failure',
},
outputDir: 'reports/playwright-artifacts',
projects: [
{ name: 'chromium-desktop', use: { ...devices['Desktop Chrome'], viewport: { width: 1280, height: 800 } } },
],
})