mirror of
https://github.com/azaion/ui.git
synced 2026-06-21 18:31:11 +00:00
ab22223580
Implements 22 blackbox test scenarios across the four batch-2 tasks:
AZ-457 - Auth & token handling (11 scenarios, fast + e2e):
- src/api/client.test.ts: FT-P-02, NFT-SEC-04, NFT-PERF-02, NFT-RES-01,
NFT-RES-08 (apiClient surface)
- src/auth/AuthContext.test.tsx: FT-P-01 (it.fails - Step 4 drift),
FT-P-03, NFT-SEC-01, NFT-SEC-02
- src/auth/ProtectedRoute.test.tsx: FT-N-04, NFT-RES-08 (router half)
- e2e/tests/auth.e2e.ts: FT-P-02 e2e, NFT-SEC-01/02/03 (cookie attrs
via Playwright context.cookies(), gated by suite stack)
AZ-459 - Wire-contract enums (4 scenarios):
- tests/wire_contract.test.ts: FT-P-04 (AnnotationStatus, it.fails),
FT-P-05 (MediaStatus + Affiliation it.fails; CombatReadiness skip
per verification_pending), FT-P-06 (AnnotationSource control +
spec value-set membership), FT-N-15 (typed-enum shape + skip for
value-set verification)
- e2e/tests/wire_contract.e2e.ts: FT-P-06 against real annotations/
service, drift-gated via AZAION_RUN_DRIFT_E2E
- scripts/run-tests.sh STC-FN15: ripgrep static for MediaType
magic-literal hygiene
AZ-465 - i18n (4 scenarios, all static + quarantined fast):
- scripts/check-i18n-coverage.mjs: FT-P-22 (en vs ua key parity) +
FT-P-23 (no raw user strings outside t() in src/**/*.tsx); refined
JSX text-node regex with negative lookbehind to drop TS generics
+ arrow-function false positives
- tests/i18n-allowlist.json: snapshot of current pre-existing raw
strings (CI gates growth per AZ-465 Constraints)
- tests/i18n.test.tsx: FT-P-24 + FT-P-25 it.skip (QUARANTINE - i18n
detector + persistence not wired today; control tests assert the
gap so the skip flips to a real test once Step 4 lands)
AZ-481 - CI image labels (3 scenarios, static against
.woodpecker/build-arm.yml):
- scripts/check-ci-image-labels.mjs: NFT-RES-LIM-11 (tag scheme
${CI_COMMIT_BRANCH}-arm), NFT-RES-LIM-12 (revision/created/source
PASS, image.title reported as DRIFT - foundation/CI-CD owns the
fix), NFT-RES-LIM-13 (revision = $CI_COMMIT_SHA)
Cross-cutting:
- scripts/run-tests.sh: src_grep now excludes *.test.{ts,tsx} +
*.spec.{ts,tsx} so production-source static checks (STC-SEC4,
STC-FN15, etc.) don't false-positive on test prose
- tsconfig.json: exclude src/**/*.{test,spec}.{ts,tsx} so production
tsc -b doesn't see jest-dom matchers
- _docs/03_implementation/batch_02_report.md: full per-task AC
coverage matrix + drift inventory + verification run
- _docs/_autodev_state.md: 22 tasks remain after batch 2
Verification (host):
fast : 7 files, 38 passed | 4 skipped (quarantined)
static : 19/19 checks PASS (was 13 in batch 1; +6 from batch 2)
e2e : not run on host (Risk 4 - requires suite docker stack)
Co-authored-by: Cursor <cursoragent@cursor.com>
67 lines
2.9 KiB
TypeScript
67 lines
2.9 KiB
TypeScript
import { test, expect } from '@playwright/test'
|
|
|
|
// AZ-459 / FT-P-06 e2e — detection wire payload uses spec enum values for
|
|
// affiliation and combatReadiness against the real annotations/ + detect/
|
|
// services. Profile: e2e (gated by docker compose stack).
|
|
//
|
|
// The fast counterpart (tests/wire_contract.test.ts) asserts the typed enum
|
|
// SHAPES; the e2e half asserts the actual outbound POST body when the SPA
|
|
// triggers an annotation save (the wire-format contract per AC-04).
|
|
//
|
|
// Enum value sets pinned in _docs/00_problem/input_data/enum_spec_snapshot.json.
|
|
|
|
const ALICE_EMAIL = 'op_alice@test.local'
|
|
const ALICE_PASSWORD = 'TestPassword!23'
|
|
|
|
// Pinned per snapshot (not currently met by the UI — see ui_drift_summary).
|
|
// The e2e test asserts the payload uses values FROM these spec sets. When
|
|
// the UI is fixed (Step 4), the test stays green; today the test fails with
|
|
// the documented drift, so we tag the wire-format scenarios `@drift` so the
|
|
// runner can downgrade them to documentary while QUARANTINEd.
|
|
const SPEC_AFFILIATION_VALUES = new Set([0, 10, 20, 30])
|
|
const SPEC_ANNOTATION_STATUS_VALUES = new Set([0, 10, 20, 30, 40])
|
|
|
|
test.describe('AZ-459 e2e — wire-contract enum values @drift', () => {
|
|
test.skip(
|
|
process.env.AZAION_RUN_DRIFT_E2E !== '1',
|
|
'QUARANTINE: enum drift documented (ui_drift_summary in enum_spec_snapshot.json); ' +
|
|
'set AZAION_RUN_DRIFT_E2E=1 to exercise the assertion against today\'s drifted UI ' +
|
|
'(expect failure until Step 4 lifts the drift on src/types/index.ts).',
|
|
)
|
|
|
|
test('FT-P-06 (rows 18, 19): annotation save body uses spec affiliation + status values', async ({ page }) => {
|
|
// Arrange — log in.
|
|
await page.goto('/login')
|
|
await page.getByLabel(/email/i).fill(ALICE_EMAIL)
|
|
await page.getByLabel(/password/i).fill(ALICE_PASSWORD)
|
|
await page.getByRole('button', { name: /sign in/i }).click()
|
|
await page.waitForLoadState('networkidle')
|
|
|
|
// Capture the next /api/annotations/annotations POST body.
|
|
const savePromise = page.waitForRequest(
|
|
(req) =>
|
|
req.url().includes('/api/annotations/annotations') &&
|
|
req.method() === 'POST',
|
|
)
|
|
|
|
// Trigger an annotation save through the UI. The actual flow depends on
|
|
// the seeded fixtures; this test relies on the AnnotationsPage save
|
|
// button being reachable from a logged-in op_alice session.
|
|
await page.goto('/annotations')
|
|
await page.getByRole('button', { name: /save/i }).first().click()
|
|
|
|
const saveReq = await savePromise
|
|
const body = saveReq.postDataJSON() as { status?: number; detections?: Array<{ affiliation?: number }> }
|
|
|
|
// Assert
|
|
if (typeof body.status === 'number') {
|
|
expect(SPEC_ANNOTATION_STATUS_VALUES.has(body.status)).toBe(true)
|
|
}
|
|
for (const det of body.detections ?? []) {
|
|
if (typeof det.affiliation === 'number') {
|
|
expect(SPEC_AFFILIATION_VALUES.has(det.affiliation)).toBe(true)
|
|
}
|
|
}
|
|
})
|
|
})
|