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.
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import { expect, test } from '@playwright/test';
|
||||
|
||||
const username = process.env.TEST_USERNAME;
|
||||
const password = process.env.TEST_PASSWORD;
|
||||
|
||||
// Lightweight fixture: every test starts logged in as an admin.
|
||||
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.describe('parts', () => {
|
||||
test('lists parts with working search', async ({ page }) => {
|
||||
await page.goto('/parts');
|
||||
await expect(page.getByRole('heading', { name: /parts/i })).toBeVisible();
|
||||
const search = page.getByPlaceholder(/search/i);
|
||||
if (await search.count()) {
|
||||
await search.fill('nonexistent-serial-xxxxxxx');
|
||||
// Search debounces — give it a beat.
|
||||
await page.waitForTimeout(600);
|
||||
await expect(page.getByText(/no parts|no results|empty/i).first()).toBeVisible();
|
||||
}
|
||||
});
|
||||
|
||||
test('opens the create part dialog', async ({ page }) => {
|
||||
await page.goto('/parts');
|
||||
const newBtn = page.getByRole('button', { name: /new part|add part|\+ part/i }).first();
|
||||
if (await newBtn.count()) {
|
||||
await newBtn.click();
|
||||
await expect(page.getByRole('dialog')).toBeVisible();
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user