chore: initial Vector 2.0 monorepo
CI / Lint · Typecheck · Test · Build (push) Failing after 5m41s
CI / Playwright (smoke) (push) Has been skipped

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:
2026-04-16 20:52:32 -04:00
commit 7c0d422228
216 changed files with 19393 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
{
"name": "@vector/e2e",
"version": "0.0.0",
"private": true,
"type": "module",
"scripts": {
"test": "playwright test",
"test:ui": "playwright test --ui",
"install-browsers": "playwright install --with-deps chromium",
"typecheck": "tsc -p tsconfig.json --noEmit",
"clean": "rimraf test-results playwright-report .turbo"
},
"devDependencies": {
"@playwright/test": "^1.50.0",
"@types/node": "^22.10.2",
"typescript": "^5.7.2"
}
}
+21
View File
@@ -0,0 +1,21 @@
import { defineConfig, devices } from '@playwright/test';
// Pointed at a local dev server by default. Override in CI with BASE_URL.
// Start the web + api stack yourself (`pnpm dev` from repo root) before running `pnpm -C apps/e2e test`.
const BASE_URL = process.env.BASE_URL ?? 'http://localhost:5173';
export default defineConfig({
testDir: './tests',
timeout: 30_000,
expect: { timeout: 5_000 },
fullyParallel: true,
forbidOnly: Boolean(process.env.CI),
retries: process.env.CI ? 2 : 0,
reporter: [['list'], ['html', { open: 'never' }]],
use: {
baseURL: BASE_URL,
trace: 'on-first-retry',
screenshot: 'only-on-failure',
},
projects: [{ name: 'chromium', use: { ...devices['Desktop Chrome'] } }],
});
+22
View File
@@ -0,0 +1,22 @@
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');
});
+26
View File
@@ -0,0 +1,26 @@
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('bulk-edit dialog opens from the parts table', async ({ page }) => {
await page.goto('/parts');
// Select the first visible checkbox (row selector). If there are no rows, skip.
const rowCheckbox = page.locator('tr [role=checkbox]').first();
if ((await rowCheckbox.count()) === 0) test.skip(true, 'no parts to bulk-edit');
await rowCheckbox.check();
await page.getByRole('button', { name: /bulk|change state|edit selected/i }).first().click();
await expect(page.getByRole('dialog')).toBeVisible();
await expect(page.getByText(/bulk/i).first()).toBeVisible();
});
+28
View File
@@ -0,0 +1,28 @@
import { expect, test } from '@playwright/test';
// Requires a dev user. Set TEST_USERNAME / TEST_PASSWORD in the environment; otherwise the test skips.
const username = process.env.TEST_USERNAME;
const password = process.env.TEST_PASSWORD;
test.describe('login', () => {
test.skip(!username || !password, 'TEST_USERNAME/TEST_PASSWORD not set');
test('logs in and lands on the dashboard', async ({ page }) => {
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 });
await expect(page.getByRole('heading', { name: /dashboard/i })).toBeVisible();
});
test('shows an error on bad credentials', async ({ page }) => {
await page.goto('/login');
await page.getByLabel(/username/i).fill('does-not-exist');
await page.getByLabel(/password/i).fill('wrong-password');
await page.getByRole('button', { name: /sign in|log in/i }).click();
await expect(page.getByText(/invalid|incorrect|unauthor/i)).toBeVisible();
});
});
+37
View File
@@ -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();
}
});
});
+24
View File
@@ -0,0 +1,24 @@
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('repairs page renders and filters by status', async ({ page }) => {
await page.goto('/repairs');
await expect(page.getByRole('heading', { name: /repairs/i })).toBeVisible();
const statusFilter = page.getByRole('combobox').first();
if (await statusFilter.count()) {
await statusFilter.click();
await page.getByRole('option', { name: /in progress|pending/i }).first().click();
}
});
+13
View File
@@ -0,0 +1,13 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "Bundler",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"noEmit": true,
"types": ["node"]
},
"include": ["playwright.config.ts", "tests/**/*.ts"]
}