157 — Create every variant on one order with unique codes¶
Description¶
One protocol of every ProtocolVariant is created on a single received order in one flow, proving cross-variant code uniqueness. The only-one-per-order variants (WORK_HANDOVER, CONSTRUCTION_SITE, RETAINAGE_REQUEST_SHORT/LONG_TERM) each allow exactly one; COMPLETED_WORK_LIST, DOCUMENTATION and TRAINING any number. The result is 7 protocols, each with a distinct generated code carrying its variant prefix, all bound to the same order.
Preconditions¶
- Clean database (
TestControl.cleanDb()) - User logged in with ADMIN and ACCOUNTING roles
- One customer, contract and received order created via API
Steps¶
- For each of the 7 variants, create a protocol on the same order via the create modal — Expected: each save navigates to the new protocol's detail page
- Open the flat grid — Expected: exactly 7 rows
- Read all codes — Expected: 7 codes, all distinct (
new Set(codes).size === 7) - For each variant, find its code by prefix — Expected: matches
^{PREFIX}\d{8}$(PPD/ZPS/SPP/ZPD/PZO/ZKZ/ZDZ) - Assert each row — Expected: correct type chip,
IN_PROCESS, bound to the same received order
Related¶
- Spec:
tests/e2e/tests/protocols.spec.ts - Code generation: shared per-year counter, prefix per variant (
ProtocolService.PROTOCOL_CODE_PREFIX); DB unique constraint onProtocol.code