Bundles the prior autonomous-session output that was sitting unstaged: - Em-dash sweep across src/ + tests/ (en-dash/em-dash to hyphen, ~2280 instances) - country-flag-icons rollout (CountryFlag component, replaces emoji glyphs that never rendered on Windows; lazy-loads the 3x2 SVG index as a single chunk after the per-subpath dynamic-import approach silently failed in webpack) - Admin IA Phase 1+2: 7-domain regroup, 41 to 38 pages, /admin/berths index, redirects (ocr to ai, reports to dashboard, invitations to users), docs/admin-ia-proposal.md - Per-template email tester (registry + endpoint + UI on Email admin page) - Cancel-document mode picker (delete-from-Documenso vs keep-for-audit) - Dashboard PDF report: 25 widgets, SVG charts, date-range picker, 11 resolvers - Customize-widgets per-region sortables at xl+ (charts/rails/feed); single flat sortable below xl when the layout stacks; per-viewport saved orders - Audit doc updates capturing each shipped item - Lint fixes: react-compiler immutability in DonutChart (reduce instead of let-reassign), set-state-in-effect disables in CountryFlag and UploadForSigning preview-bytes effect, unused 'confirm' destructures in interest contract + reservation tabs, unescaped apostrophe in test-template card copy
87 lines
2.7 KiB
TypeScript
87 lines
2.7 KiB
TypeScript
import { test, expect } from '@playwright/test';
|
|
import { login, PORT_SLUG } from './helpers';
|
|
|
|
test.describe('Error Handling', () => {
|
|
test('non-existent route shows 404 page', async ({ page }) => {
|
|
await login(page, 'super_admin');
|
|
|
|
await page.goto(`/${PORT_SLUG}/this-page-does-not-exist`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const is404 = await page
|
|
.getByText('404')
|
|
.isVisible()
|
|
.catch(() => false);
|
|
const isNotFound = await page
|
|
.getByText(/not found/i)
|
|
.isVisible()
|
|
.catch(() => false);
|
|
|
|
expect(is404 || isNotFound).toBeTruthy();
|
|
});
|
|
|
|
test('empty required fields show validation errors', async ({ page }) => {
|
|
await login(page, 'super_admin');
|
|
|
|
// Go to new invoice page (has required fields)
|
|
await page.goto(`/${PORT_SLUG}/invoices/new`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
// Click Next without filling required fields
|
|
const nextBtn = page.getByRole('button', { name: /next/i });
|
|
if (await nextBtn.isVisible({ timeout: 5_000 }).catch(() => false)) {
|
|
await nextBtn.click();
|
|
await page.waitForTimeout(1000);
|
|
|
|
// Should see validation error messages (red text)
|
|
const errorMsg = page.locator('.text-destructive').first();
|
|
await expect(errorMsg).toBeVisible({ timeout: 5_000 });
|
|
}
|
|
});
|
|
|
|
test('non-existent entity shows error or 404', async ({ page }) => {
|
|
await login(page, 'super_admin');
|
|
|
|
// Navigate to a client with a fake UUID
|
|
await page.goto(`/${PORT_SLUG}/clients/00000000-0000-0000-0000-000000000000`);
|
|
await page.waitForLoadState('networkidle');
|
|
await page.waitForTimeout(3000);
|
|
|
|
// Should show 404, not found, error, or empty state - but NOT crash
|
|
const is404 = await page
|
|
.getByText('404')
|
|
.isVisible()
|
|
.catch(() => false);
|
|
const isNotFound = await page
|
|
.getByText(/not found/i)
|
|
.isVisible()
|
|
.catch(() => false);
|
|
const isError = await page
|
|
.getByText(/error|not exist/i)
|
|
.isVisible()
|
|
.catch(() => false);
|
|
const noData = await page
|
|
.getByText(/no client|loading/i)
|
|
.isVisible()
|
|
.catch(() => false);
|
|
|
|
// At minimum, the page should not be a blank crash
|
|
const body = await page.locator('body').textContent();
|
|
expect(body && body.length > 10).toBeTruthy();
|
|
});
|
|
|
|
test('login form shows validation for invalid email', async ({ page }) => {
|
|
await page.goto('/login');
|
|
|
|
await page.fill('#email', 'not-an-email');
|
|
await page.fill('#password', 'x');
|
|
await page.click('button[type="submit"]');
|
|
|
|
await page.waitForTimeout(1000);
|
|
|
|
// Should see validation error for email
|
|
const errorMsg = page.locator('.text-destructive').first();
|
|
await expect(errorMsg).toBeVisible({ timeout: 5_000 });
|
|
});
|
|
});
|