mirror of
https://github.com/azaion/ui.git
synced 2026-06-21 13:41:12 +00:00
38eb87fb08
Scaffolds the Blackbox test project per AZ-456 / environment.md across
the three profiles:
- fast : Vitest 3.x + jsdom + MSW 2.x + RTL/jest-dom; tests/setup.ts
boots the MSW Node server with onUnhandledRequest:'error',
afterEach resets handlers, clears bearer + navigate-to-login
spy. Default handlers ship for every suite service plus OWM
and tile stand-ins. Fixtures mirror seed_* in test-data.md.
- e2e : Playwright ^1.49 with chromium + firefox projects against the
suite docker-compose stack; owm-stub + tile-stub Bun servers,
playwright-runner image, seeds.sql for the test-db.
- static: scripts/run-tests.sh extended — tsc --noEmit (test config),
vite build, ripgrep checks (with grep -r fallback), CSV
report at test-output/static-report.csv per AC-7 columns.
Smoke tests cover AC-3, AC-4 (fast, 5 tests, PASS) and AC-1, AC-2,
AC-5, AC-8 (e2e, gated by Risk 4 docker availability). Static profile
(13 checks) PASS — STC-SEC1 (no literal OWM key) lifted from
QUARANTINE per AZ-447 with a narrowed pattern.
Files:
+24 tests/**, +10 e2e/**, +vitest.config.ts, +tsconfig.test.json
~package.json (test scripts + devDeps for vitest, @testing-library/*,
msw, @playwright/test, jsdom, @types/node, @vitest/coverage-v8)
~scripts/run-tests.sh, scripts/run-performance-tests.sh — switched
RESULTS_DIR to test-output/, compose path to project-local
~.gitignore — added /test-output/
Verification:
bun run test:fast → 11 / 11 PASS
./scripts/run-tests.sh → static 13/13 + fast 11/11 PASS, exit 0
Tracker: AZ-456 → In Testing.
Co-authored-by: Cursor <cursoragent@cursor.com>
94 lines
5.3 KiB
PL/PgSQL
94 lines
5.3 KiB
PL/PgSQL
-- AZ-456 seed fixtures for the suite-e2e docker-compose stack.
|
|
--
|
|
-- The parent suite repo owns the canonical schema (../_docs/00_database_schema.md);
|
|
-- this file ONLY inserts seed rows the SPA tests need to read. Schema migrations
|
|
-- ship with each suite service's `:test` image and run before this script.
|
|
--
|
|
-- Layout mirrors `tests/fixtures/seed_*.ts` so fast and e2e profiles agree on
|
|
-- IDs / names / numeric enum values.
|
|
|
|
BEGIN;
|
|
|
|
-- Users (per seed_users.ts) -------------------------------------------------
|
|
INSERT INTO users (id, name, email, password_hash, role, is_active) VALUES
|
|
('user-alice', 'Alice Operator', 'op_alice@test.local', '$argon2id$v=19$m=65536,t=3,p=4$test$test', 'Operator', true),
|
|
('user-bob', 'Bob Operator', 'op_bob@test.local', '$argon2id$v=19$m=65536,t=3,p=4$test$test', 'Operator', true),
|
|
('user-carol', 'Carol Admin', 'admin_carol@test.local', '$argon2id$v=19$m=65536,t=3,p=4$test$test', 'Admin', true),
|
|
('user-dave', 'Dave Integrator', 'integrator_dave@test.local', '$argon2id$v=19$m=65536,t=3,p=4$test$test', 'SystemIntegrator', true)
|
|
ON CONFLICT (id) DO NOTHING;
|
|
|
|
-- Aircraft (per seed_aircraft.ts) -------------------------------------------
|
|
INSERT INTO aircraft (id, model, type, is_default) VALUES
|
|
('aircraft-1', 'Bayraktar TB2', 'Plane', true),
|
|
('aircraft-2', 'DJI Mavic 3', 'Copter', false),
|
|
('aircraft-3', 'Leleka-100', 'Plane', false)
|
|
ON CONFLICT (id) DO NOTHING;
|
|
|
|
-- Flights (per seed_flights.ts) ---------------------------------------------
|
|
INSERT INTO flights (id, name, created_date, aircraft_id) VALUES
|
|
('flight-1', 'Recon Alpha', '2026-05-01T10:00:00Z', 'aircraft-1'),
|
|
('flight-2', 'Recon Bravo', '2026-05-02T11:30:00Z', 'aircraft-1'),
|
|
('flight-3', 'Survey Charlie', '2026-05-03T14:15:00Z', 'aircraft-2'),
|
|
('flight-4', 'Patrol Delta', '2026-05-04T09:45:00Z', 'aircraft-3'),
|
|
('flight-5', 'Strike Echo', '2026-05-05T16:00:00Z', 'aircraft-1')
|
|
ON CONFLICT (id) DO NOTHING;
|
|
|
|
-- Detection classes (contract ordering [0..N-1, 20..20+N-1, 40..40+N-1], N=9)
|
|
INSERT INTO detection_classes (id, name, short_name, color, max_size_m, photo_mode) VALUES
|
|
(0, 'class-0', 'c0', '#e6194b', 5, 0),
|
|
(1, 'class-1', 'c1', '#3cb44b', 5, 0),
|
|
(2, 'class-2', 'c2', '#ffe119', 5, 0),
|
|
(3, 'class-3', 'c3', '#4363d8', 5, 0),
|
|
(4, 'class-4', 'c4', '#f58231', 5, 0),
|
|
(5, 'class-5', 'c5', '#911eb4', 5, 0),
|
|
(6, 'class-6', 'c6', '#46f0f0', 5, 0),
|
|
(7, 'class-7', 'c7', '#f032e6', 5, 0),
|
|
(8, 'class-8', 'c8', '#bcf60c', 5, 0),
|
|
(20, 'class-20', 'c20', '#e6194b', 5, 0),
|
|
(21, 'class-21', 'c21', '#3cb44b', 5, 0),
|
|
(22, 'class-22', 'c22', '#ffe119', 5, 0),
|
|
(23, 'class-23', 'c23', '#4363d8', 5, 0),
|
|
(24, 'class-24', 'c24', '#f58231', 5, 0),
|
|
(25, 'class-25', 'c25', '#911eb4', 5, 0),
|
|
(26, 'class-26', 'c26', '#46f0f0', 5, 0),
|
|
(27, 'class-27', 'c27', '#f032e6', 5, 0),
|
|
(28, 'class-28', 'c28', '#bcf60c', 5, 0),
|
|
(40, 'class-40', 'c40', '#e6194b', 5, 0),
|
|
(41, 'class-41', 'c41', '#3cb44b', 5, 0),
|
|
(42, 'class-42', 'c42', '#ffe119', 5, 0),
|
|
(43, 'class-43', 'c43', '#4363d8', 5, 0),
|
|
(44, 'class-44', 'c44', '#f58231', 5, 0),
|
|
(45, 'class-45', 'c45', '#911eb4', 5, 0),
|
|
(46, 'class-46', 'c46', '#46f0f0', 5, 0),
|
|
(47, 'class-47', 'c47', '#f032e6', 5, 0),
|
|
(48, 'class-48', 'c48', '#bcf60c', 5, 0)
|
|
ON CONFLICT (id) DO NOTHING;
|
|
|
|
-- Media (per seed_media.ts) -------------------------------------------------
|
|
-- mediaStatus values follow the UI's CURRENT 0..3 scheme; AC-04 (Step 4 fix)
|
|
-- will migrate the seed to the full 0..6 range. Test-data.md tracks this.
|
|
INSERT INTO media (id, name, path, media_type, media_status, duration, annotation_count, waypoint_id, user_id) VALUES
|
|
('media-1', 'sortie-1.jpg', '/media/sortie-1.jpg', 1, 1, NULL, 0, NULL, 'user-alice'),
|
|
('media-2', 'sortie-2.jpg', '/media/sortie-2.jpg', 1, 2, NULL, 0, 'wp-1', 'user-alice'),
|
|
('media-3', 'sortie-3.jpg', '/media/sortie-3.jpg', 1, 3, NULL, 4, 'wp-1', 'user-alice'),
|
|
('media-4', 'patrol-1.mp4', '/media/patrol-1.mp4', 2, 1, '00:01:30', 0, NULL, 'user-bob'),
|
|
('media-5', 'patrol-2.mp4', '/media/patrol-2.mp4', 2, 3, '00:02:15', 8, NULL, 'user-bob'),
|
|
('media-6', 'manual.jpg', '/media/manual.jpg', 1, 4, NULL, 1, NULL, 'user-alice')
|
|
ON CONFLICT (id) DO NOTHING;
|
|
|
|
-- Annotations (per seed_annotations.ts) -------------------------------------
|
|
INSERT INTO annotations (id, media_id, time, created_date, user_id, source, status, is_split, split_tile) VALUES
|
|
('ann-1', 'media-3', NULL, '2026-05-03T14:30:00Z', 'user-alice', 0, 10, false, NULL),
|
|
('ann-2', 'media-3', NULL, '2026-05-03T14:32:00Z', 'user-alice', 0, 20, true, '3 0.5 0.5 0.2 0.2'),
|
|
('ann-3', 'media-5', '00:01:00', '2026-05-04T10:15:00Z', 'user-bob', 1, 30, false, NULL),
|
|
('ann-4', 'media-5', '00:01:30', '2026-05-04T10:20:00Z', 'user-bob', 1, 20, true, 'garbage')
|
|
ON CONFLICT (id) DO NOTHING;
|
|
|
|
-- User settings (per seed_user_settings.ts) ---------------------------------
|
|
INSERT INTO user_settings (id, user_id, selected_flight_id, annotations_left_panel_width, annotations_right_panel_width, dataset_left_panel_width, dataset_right_panel_width) VALUES
|
|
('user-settings-alice', 'user-alice', 'flight-1', 280, 320, 240, 280),
|
|
('user-settings-bob', 'user-bob', 'flight-3', NULL, NULL, NULL, NULL)
|
|
ON CONFLICT (id) DO NOTHING;
|
|
|
|
COMMIT;
|