Harden workstation UX and seed placeholder scans after Playwright QA.
CI / backend (push) Failing after 38s
CI / frontend (push) Successful in 9m35s

Fix mobile queue navigation, draft/loading states, and Intake overflow; seed MinIO demo PDFs so document viewing does not 500; add e2e smoke coverage.
This commit is contained in:
2026-10-06 15:07:15 +08:00
parent 7d7332641f
commit 3c7bf5bccb
47 changed files with 1160 additions and 140 deletions
+101
View File
@@ -0,0 +1,101 @@
import { test, expect, type Page } from '@playwright/test'
const password = process.env.E2E_PASSWORD ?? 'password'
const roleUsers = (process.env.E2E_ROLES ?? 'entry1,verifier1,approver1,intake1')
.split(',')
.map((s) => s.trim())
.filter(Boolean)
const viewports = [
{ name: 'mobile', width: 375, height: 812 },
{ name: 'tablet', width: 768, height: 1024 },
{ name: 'desktop', width: 1280, height: 800 },
] as const
const roleHome: Record<string, string> = {
entry1: '/entry',
verifier1: '/verification',
approver1: '/approval',
intake1: '/intake',
admin1: '/dashboard',
}
async function dismissTourIfPresent(page: Page) {
const skip = page.getByTestId('tour-skip')
if (await skip.isVisible({ timeout: 1500 }).catch(() => false)) {
await skip.click()
await expect(page.getByTestId('tour-overlay')).toBeHidden({ timeout: 5000 })
}
}
async function login(page: Page, username: string) {
await page.goto('/login')
await page.getByLabel('Username').fill(username)
await page.getByLabel('Password').fill(password)
await page.getByRole('button', { name: 'Sign In' }).click()
await expect(page).not.toHaveURL(/\/login$/, { timeout: 15_000 })
await dismissTourIfPresent(page)
}
async function openFirstQueueBatch(page: Page) {
await dismissTourIfPresent(page)
const row = page.locator('[data-testid="workstation-queue"] table tbody tr').first()
if ((await row.count()) === 0) {
const fallback = page.locator('main table tbody tr.cursor-pointer, main table tbody tr[class*="cursor-pointer"]').first()
if ((await fallback.count()) === 0) return false
await fallback.click({ force: true })
} else {
await row.click()
}
await page.waitForTimeout(500)
return /\/(entry|verification|approval)\/[^/]+/.test(page.url())
}
test.describe('Viewport smoke matrix', () => {
for (const vp of viewports) {
test(`entry1 @ ${vp.name} (${vp.width}x${vp.height})`, async ({ page }) => {
await page.setViewportSize({ width: vp.width, height: vp.height })
await login(page, 'entry1')
await expect(page).toHaveURL(new RegExp(roleHome.entry1))
const opened = await openFirstQueueBatch(page)
if (!opened) {
test.info().annotations.push({ type: 'note', description: 'No entry queue items' })
return
}
if (vp.width < 1280) {
const back = page.getByTestId('workstation-mobile-nav').getByRole('link')
await expect(back).toBeVisible()
await back.click()
await expect(page).toHaveURL(/\/entry\/?$/)
} else {
await expect(page.getByTestId('workstation-rail')).toBeVisible()
}
})
}
})
test.describe('Role-based smoke', () => {
for (const user of roleUsers) {
test(`${user} reaches role home`, async ({ page }) => {
await page.setViewportSize({ width: 1280, height: 800 })
await login(page, user)
const home = roleHome[user] ?? '/'
await expect(page).toHaveURL(new RegExp(`${home.replace('/', '\\/')}(\\/|$)`))
})
}
})
test('intake compact recent uploads (no page overflow)', async ({ page }) => {
await page.setViewportSize({ width: 1280, height: 800 })
await login(page, 'admin1')
await page.goto('/intake')
await expect(page.getByRole('heading', { name: 'Intake' })).toBeVisible()
const overflow = await page.evaluate(() => {
const doc = document.documentElement
return doc.scrollWidth > doc.clientWidth + 1
})
expect(overflow).toBe(false)
})