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:
bchanot committed 2026-11-02 21:21:59 +01:00
1 parent 14ff890761
commit 4111efa1d1
15 files changed
+856 -56

No files matched your search

+40
View File
@@ -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', [])