diff --git a/frontend/e2e/documents.spec.ts b/frontend/e2e/documents.spec.ts index 8aae84bf..cd144535 100644 --- a/frontend/e2e/documents.spec.ts +++ b/frontend/e2e/documents.spec.ts @@ -482,7 +482,7 @@ test.describe('PDF annotations — read-only user', () => { // Isolated session — does not share the admin storage state test.use({ storageState: { cookies: [], origins: [] } }); - test('read-only user sees a disabled Annotieren button', async ({ page }) => { + test('read-only user does not see the Annotieren button', async ({ page }) => { test.setTimeout(60_000); await page.goto('/login'); await page.getByLabel('Benutzername').fill('reader'); @@ -494,12 +494,10 @@ test.describe('PDF annotations — read-only user', () => { const baseURL = process.env.E2E_BASE_URL ?? 'http://localhost:3000'; await page.goto(`${baseURL}/documents/${sharedAnnotationDocId}`); await page.waitForSelector('[data-hydrated]'); - // Wait for the PDF canvas — once rendered, the controls bar (with disabled button) is shown. - await page.locator('canvas').first().waitFor({ state: 'visible', timeout: 30000 }); - const disabledBtn = page.getByRole('button', { name: /annotieren/i }); - await expect(disabledBtn).toBeVisible({ timeout: 5000 }); - await expect(disabledBtn).toBeDisabled(); + // Reader users do not have ANNOTATE_ALL permission — the button must not be shown at all. + const annotateBtn = page.getByRole('button', { name: /annotieren/i }); + await expect(annotateBtn).not.toBeVisible({ timeout: 5000 }); await page.screenshot({ path: 'test-results/e2e/annotations-button-reader.png' }); });