fix(app): unreadable permissions show a retry, never the form (V1-2.5 L1)
Owner checkpoint 2026-11-02: creation page checks loading, server refusal, failed read, then the editor rule; Administration home shows the same notice. reloadAccess re-reads roles and grants without wiping held state; refreshAccount (no caller) removed. Zone panel live region always mounted. Unit and e2e for reviewer-only and editor.
This commit is contained in:
1 parent
14ff890761
commit
4111efa1d1
15 files changed
+856
-56
No files matched your search
@@ -408,6 +408,43 @@ for (const [locale, dict] of LANGUAGES) {
|
||||
).toBe('1')
|
||||
})
|
||||
|
||||
test('creation page: unreadable permissions show a retry, never the form', async ({
|
||||
page,
|
||||
requests,
|
||||
}, info) => {
|
||||
test.skip(
|
||||
isPhone(info),
|
||||
'desktop journey (the admin screens at 375 px are covered below)',
|
||||
)
|
||||
const { account, secret } = await staff(locale, 'admin', ['sheet_editor'])
|
||||
requests.forbid(account.email, account.password, account.displayName)
|
||||
await openAdmin(page, dict, info, account, secret)
|
||||
await page.goto('/app/admin/sheets/new')
|
||||
await expect(heading(page, dict['admin.sheets.new'])).toBeVisible()
|
||||
await expect(page.locator('#sheet-species-id')).toBeVisible()
|
||||
|
||||
// The own-grants read fails: the unavailable screen, no field.
|
||||
const grants = '**/rest/v1/anatomical_catalog_grants*'
|
||||
await page.route(grants, (route) =>
|
||||
route.fulfill({
|
||||
status: 500,
|
||||
contentType: 'application/json',
|
||||
body: '{}',
|
||||
}),
|
||||
)
|
||||
await page.reload()
|
||||
await expect(
|
||||
heading(page, dict['permissions_unavailable.title']),
|
||||
).toBeVisible()
|
||||
await expect(page.locator('#sheet-species-id')).toHaveCount(0)
|
||||
await expectAccessible(page, 'the unavailable permissions screen')
|
||||
|
||||
// Restored: Retry reads again and the form comes back.
|
||||
await page.unroute(grants)
|
||||
await page.getByRole('button', { name: dict['common.retry'] }).click()
|
||||
await expect(page.locator('#sheet-species-id')).toBeVisible()
|
||||
})
|
||||
|
||||
test('A1: an editor at aal2 creates a sheet on a new inactive species; it opens on draft v1', async ({
|
||||
page,
|
||||
requests,
|
||||
@@ -641,6 +678,9 @@ for (const [locale, dict] of LANGUAGES) {
|
||||
// The rights screen by its address: refused by the server.
|
||||
await page.goto('/app/admin/access')
|
||||
await expect(heading(page, dict['access_denied.title'])).toBeVisible()
|
||||
// The creation page: no form for a reviewer-only account.
|
||||
await page.goto('/app/admin/sheets/new')
|
||||
await expect(heading(page, dict['access_denied.title'])).toBeVisible()
|
||||
await signOut(page, dict, info)
|
||||
|
||||
const admin = await staff(locale, 'admin', [])
|
||||
|
||||
@@ -195,6 +195,40 @@ for (const [locale, dict] of LANGUAGES) {
|
||||
await expectNoHorizontalOverflow(page, `the sheet page at ${width} px`)
|
||||
}
|
||||
|
||||
// Narrow screens (viewport set here, whatever the project): the zone
|
||||
// panel keeps its live region from the first render, and the references
|
||||
// card never covers the drawing.
|
||||
const original = page.viewportSize()!
|
||||
for (const width of [320, 375]) {
|
||||
await page.setViewportSize({ width, height: 667 })
|
||||
await openSheet(page, `/app/anatomy/${listed.id}`, name(listed))
|
||||
const panel = page.locator('[aria-live="polite"]', {
|
||||
has: page.locator('#catalogue-zone-title'),
|
||||
})
|
||||
await expect(panel, `live region before a pick at ${width} px`).toHaveCount(1)
|
||||
const chooser = page.getByRole('combobox', {
|
||||
name: dict['catalogue.zone.choose'],
|
||||
})
|
||||
const first = await chooser.locator('option').nth(1).getAttribute('value')
|
||||
await chooser.selectOption(first!)
|
||||
const zoneName = (await chooser.locator('option:checked').textContent()) ?? ''
|
||||
await expect(panel, `live region after a pick at ${width} px`).toContainText(zoneName)
|
||||
const drawingBox = await page
|
||||
.getByTestId('catalogue-canvas-drawing')
|
||||
.locator('svg')
|
||||
.first()
|
||||
.boundingBox()
|
||||
const referencesBox = await page
|
||||
.getByRole('heading', { level: 2, name: dict['catalogue.references.title'] })
|
||||
.locator('xpath=ancestor::section[1]')
|
||||
.boundingBox()
|
||||
expect(
|
||||
referencesBox!.y,
|
||||
`references below the drawing at ${width} px`,
|
||||
).toBeGreaterThanOrEqual(drawingBox!.y + drawingBox!.height - 1)
|
||||
}
|
||||
await page.setViewportSize(original)
|
||||
|
||||
// A zone picked on the drawing, then one from the list: its panel shows.
|
||||
const zone = page.getByRole('combobox', {
|
||||
name: dict['catalogue.zone.choose'],
|
||||
|
||||
Reference in new issue
Block a user