Files
Vector/apps/e2e/tests/admin-audit.spec.ts
josh 7c0d422228
CI / Lint · Typecheck · Test · Build (push) Failing after 5m41s
CI / Playwright (smoke) (push) Has been skipped
chore: initial Vector 2.0 monorepo
Ground-up TypeScript rewrite of the Vector hardware parts inventory
system. Ships the full roadmap (Phases 0-8) in one initial commit:

- pnpm + Turbo monorepo: apps/{api,web,e2e}, packages/{db,shared,ui,config}
- Express 5 + Prisma 5 + zod validation + JWT w/ refresh-token rotation
- React 19 + Vite + shadcn/ui + TanStack Query/Table + nuqs URL state
- Repair/RMA, tags, bulk ops, saved views, CSV audit export
- Analytics dashboard on Recharts + EOL tracking
- Signed webhook subscriptions (HMAC-SHA256) with in-process emitter
- Vitest unit tests (shared schemas, api services/helpers) + Playwright skeleton
- Gitea Actions CI (lint, typecheck, test+coverage, build) + Renovate

Deferred follow-ups: Postgres cutover (data-migration script ready),
BullMQ worker for webhook delivery, @react-pdf PDF export, CSV import wizard.
2026-04-16 20:52:32 -04:00

23 lines
916 B
TypeScript

import { expect, test } from '@playwright/test';
const username = process.env.TEST_USERNAME;
const password = process.env.TEST_PASSWORD;
test.beforeEach(async ({ page }) => {
test.skip(!username || !password, 'TEST_USERNAME/TEST_PASSWORD not set');
await page.goto('/login');
await page.getByLabel(/username/i).fill(username!);
await page.getByLabel(/password/i).fill(password!);
await page.getByRole('button', { name: /sign in|log in/i }).click();
await expect(page).toHaveURL(/\/(?!login)/, { timeout: 10_000 });
});
test('admin can fetch the audit CSV export', async ({ page, request }) => {
const csv = await request.get('/api/admin/audit/events.csv');
expect(csv.status()).toBe(200);
expect(csv.headers()['content-type']).toContain('text/csv');
const body = await csv.text();
expect(body.split('\n')[0]).toContain('createdAt');
expect(body.split('\n')[0]).toContain('eventType');
});