food-market/tests/e2e/scenarios/documents-edge.yml
nns 17a454cce5 test(e2e): scenario documents-edge — критичные edge-кейсы посту
10 шагов покрывают самую опасную зону системы (потеря денег/остатков):

1. Bootstrap: орг + admin + product + supply (10 шт по 100 KZT).
2. Supply.Post → stock=10 invariant.
3. RetailSale qty=15 (>stock 10) → POST /post → 409 «Недостаточно».
4. После заблокированного post: stock=10 + Stock == Σ StockMovement.
5. RetailSale PaidCash+PaidCard < Total → 4xx (валидация платежа).
6. PUT проведённой Supply → 409.
7. DELETE проведённой Supply → 409.
8. После Sale qty=5: unpost Supply qty=10 → 409 (stock уйдёт в минус).
9. Дубль штрихкода в одной орге → 4xx.
10. Тот же штрихкод в другой орге → 201 (per-tenant unique).

Запуск: `bash tests/e2e/run.sh documents-edge --api-only`.
Все 10 шагов зелёные после фиксов RetailSale.Post + Supply.Unpost.

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

33 lines
1.9 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

name: documents-edge
description: |
Краевые случаи документов: защита от overselling, запреты на изменение
проведённых документов, валидация платежей, уникальность штрихкодов
per-tenant. Это сценарий регрессии для самой опасной зоны — потеря
денег/остатков при ошибках в RetailSale/Supply посту.
preconditions:
reset_db: true
smoke_login_super_admin: true
steps:
- id: step01_bootstrap
title: "SuperAdmin создаёт орг Test + admin, делаем product + supply (10 шт по 100 KZT)"
- id: step02_post_supply_stock_10
title: "Supply провести: stock=10, ReferencePrice=100, Cost=100"
- id: step03_oversell_blocked
title: "RetailSale qty=15 (больше остатка 10), POST /post возвращает 409"
- id: step04_oversell_stock_unchanged
title: "После заблокированного post stock остался 10, StockMovement не добавлен"
- id: step05_payment_mismatch_blocked
title: "RetailSale с PaidCash+PaidCard не равной Total отвергается на post"
- id: step06_edit_posted_supply_blocked
title: "PUT проведённой Supply (Posted) возвращает 409"
- id: step07_delete_posted_supply_blocked
title: "DELETE проведённой Supply возвращает 409"
- id: step08_unpost_negative_blocked
title: "После Sale qty=5 unpost Supply qty=10 возвращает 409 (stock минус)"
- id: step09_barcode_unique_within_org
title: "Дубль штрихкода в одной орге, POST второго product отвергается"
- id: step10_barcode_per_tenant
title: "Тот же штрихкод в другой орге допустим (per-tenant unique)"