food-market/tests/e2e
nns f434e87d9b
Some checks are pending
Auto-tag / Create date-tag (push) Waiting to run
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 API / Build + push API (push) Waiting to run
Docker API / Deploy API on stage (push) Blocked by required conditions
Docker Web / Build + push Web (push) Waiting to run
Docker Web / Deploy Web on stage (push) Blocked by required conditions
fix(hotfix): invoice500 + фоновые 403 на reload + regression e2e
Owner caught on stage (2026-06-07 18:57):
1) POST /api/purchases/invoices/upload → 500: migration Phase31a создала
   invoice_uploads.UpdatedAt как NOT NULL, но конвенция проекта — DateTime?
   nullable + стамп только для Modified в AppDbContext.StampTimestamps.
   EF на INSERT отправлял UpdatedAt=NULL → 23502. Фикс: Phase31b DROP NOT NULL
   + Phase31b для invoice_aliases.
2) Фоновые 403 → тост «Нет доступа» при F5 на любой странице:
   - SavedPresets фетчил /api/user/presets (RequiresAdvancedMode) из любой
     страницы с фильтрами в простом режиме → 403;
   - useOnboardingProgress фетчил /api/organization/employees (Admin only)
     для кладовщика/кассира на '/' → 403.
   Фикс:
   - api.ts: GET-403 silent, тост только на действия юзера (POST/PUT/DELETE);
   - SavedPresets gated на advancedMode (useMe + enabled);
   - useOnboardingProgress canSeeEmployees-gate.
3) tests/food-market.IntegrationTests/InvoiceUploadHttpTests.cs — HTTP-прогон
   POST /upload через Testcontainers-Postgres (дыра: s31 pipeline tests
   проверяли matcher, но ни разу не инсертили в invoice_uploads).
4) tests/e2e/scenarios/stage-ui-menu-walk.spec.ts — regress: каждая демо-роль,
   каждый пункт меню, F5, assert 0 unexpected 4xx/5xx + 0 error-тостов +
   0 console.error. В quality-watchdog step 9 с 4-часовой каденцией.
5) tests/e2e/scenarios/stage-ui-invoice-upload.spec.ts — demo-keeper
   загружает реальное фото накладной (tests/fixtures/invoice-sample.jpg,
   сгенерирована Playwright-ом из HTML, 1800×2400 JPEG) → ждёт recognition
   → экран проверки. При не-настроенном Claude CLI тест fail'ится с ясным
   сообщением (это тоже баг).

Прогон локально 4/4 (InvoicePipelineTests 2/2 + InvoiceUploadHttpTests 2/2).
docs/hotfix-invoice500-403-progress.md — ход работы 1-4/5.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-10-05 00:21:41 +05:00
..
lib test(ui-deep): items 6-9 — Supply/RetailSale/InventoryDocs/Reports 2026-05-30 13:37:01 +05:00
reports test(s32): stage-ui-catalog-import spec + финал в progress-doc 2026-10-04 23:46:11 +05:00
scenarios fix(hotfix): invoice500 + фоновые 403 на reload + regression e2e 2026-10-05 00:21:41 +05:00
scripts fix(hotfix): invoice500 + фоновые 403 на reload + regression e2e 2026-10-05 00:21:41 +05:00
.gitignore feat(e2e): infrastructure + first full-cycle scenario + baseline report 2026-05-08 00:05:52 +05:00
package.json test(s15): axe a11y + focus traps + unit coverage 80% + property tests + backup drill 2026-06-07 14:53:38 +05:00
playwright.config.ts fix(stage-tests): IP-limit 60/min, locale ru-RU в playwright, исправлены payload'ы verify-spec'ов 2026-06-04 17:38:36 +05:00
pnpm-lock.yaml test(s15): axe a11y + focus traps + unit coverage 80% + property tests + backup drill 2026-06-07 14:53:38 +05:00
README.md feat(e2e): infrastructure + first full-cycle scenario + baseline report 2026-05-08 00:05:52 +05:00
run.sh feat(e2e): infrastructure + first full-cycle scenario + baseline report 2026-05-08 00:05:52 +05:00
runner.ts feat(e2e): infrastructure + first full-cycle scenario + baseline report 2026-05-08 00:05:52 +05:00
s23-setup.ts feat(s25): autonomous continuous quality monitoring (8/8) 2026-06-08 12:50:35 +05:00
tsconfig.json feat(e2e): infrastructure + first full-cycle scenario + baseline report 2026-05-08 00:05:52 +05:00

tests/e2e

Декларативные end-to-end сценарии. Один YAML описывает шаги, TypeScript-handler — конкретные API/UI/DB-проверки. Отчёт в Markdown.

Запуск

tests/e2e/run.sh full-cycle              # полный прогон (API + UI)
tests/e2e/run.sh full-cycle --api-only   # без Playwright, только axios + DB

Первый запуск установит node_modules/ (axios, pg, playwright, js-yaml, tsx).

Отчёт: tests/e2e/reports/<scenario>-<timestamp>.md.

Структура

tests/e2e/
├── runner.ts              # entry: парсит YAML, прогоняет steps, пишет report
├── run.sh                 # wrapper: pnpm install + tsx
├── lib/
│   ├── api.ts             # axios + login()
│   ├── db.ts              # docker exec psql, resetTenantData(), countRows()
│   └── report.ts          # markdown-аккумулятор
└── scenarios/
    ├── full-cycle.yml          # декларация шагов
    └── full-cycle.steps.ts     # код handler'ов

Preconditions

Поле reset_db: true в YAML вызывает resetTenantData() в lib/db.ts. Что чистится:

  • Tenant-таблицы (organizations, employees, supplies, retail_sales, …) — TRUNCATE … CASCADE.
  • AspNetUsers / users / AspNetUserRoles — оставляем только admin@food-market.local.
  • OpenIddict tokens — все valid → revoked.

Что НЕ чистится (берегём как baseline):

  • Реестр товаров: products, product_groups, units_of_measure, product_packagings, product_barcodes, product_prices, product_images.
  • Системные справочники: countries, currencies, price_types, employee_roles.
  • __EFMigrationsHistory, OpenIddict* таблицы (структура), platform_settings, system_settings.

После TRUNCATE — smoke login(admin@food-market.local). Если падает — runner выходит с кодом 3.

Добавление сценария

  1. scenarios/<name>.yml — мета + список steps[].id.
  2. scenarios/<name>.steps.ts — экспортируй функции с теми же id (async function stepXX_foo({ ctx, step, report })).
  3. Запусти tests/e2e/run.sh <name>.

ctx — общий объект между шагами для прокидывания id'ов созданных сущностей и токенов сессий.

step.checks — массив проверок (api/ui/db). Если хоть одна ok=false — шаг помечен как fail.

report.bug() / report.ux() / report.gap() / report.perf() — категоризованные находки в финальной секции.

Зависимости

  • Postgres контейнер food-market-postgres (psql вызывается через docker exec).
  • API на https://admin.food-market.kz (или E2E_ADMIN_URL env).
  • Playwright headless chromium для UI-проверок (pnpm exec playwright install chromium если нет).