openreader/tests/landing-routing.spec.ts
Richard R 28f8d50c05 refactor(settings): remove enableDestructiveDeleteActions runtime flag and related UI
Eliminate the enableDestructiveDeleteActions feature flag from runtime
configuration, admin panel, environment docs, and user settings modal.
Remove all references, toggles, and documentation for this flag. This
simplifies the runtime config and user interface by consolidating
destructive actions under account deletion only.

BREAKING CHANGE: The enableDestructiveDeleteActions runtime flag is no longer supported. Any configuration or code depending on this flag must be updated.
2026-06-01 20:38:54 -06:00

50 lines
1.7 KiB
TypeScript

import { expect, test } from '@playwright/test';
import { setupTest, uploadAndDisplay } from './helpers';
test.describe('Landing and app routing', () => {
test('public landing renders without anonymous auth bootstrap call', async ({ page }) => {
let anonymousSignInCalls = 0;
await page.route('**/api/auth/**', async (route) => {
if (route.request().url().includes('/sign-in/anonymous')) {
anonymousSignInCalls += 1;
}
await route.continue();
});
await page.goto('/');
await expect(page.getByRole('heading', { name: /hear every document/i })).toBeVisible({
timeout: 10000,
});
// Let in-flight requests settle before asserting no anonymous bootstrap happened.
await page.waitForTimeout(500);
expect(anonymousSignInCalls).toBe(0);
});
test('existing authenticated session visiting / redirects to /app', async ({ page }) => {
await page.goto('/app');
await page.waitForLoadState('networkidle');
await page.waitForSelector('.fixed.inset-0.bg-base.z-50', { state: 'detached', timeout: 15000 }).catch(() => {});
await page.goto('/');
await expect(page).toHaveURL(/\/app$/);
});
test('documents back link returns to /app', async ({ page }, testInfo) => {
test.setTimeout(120_000);
await setupTest(page, testInfo);
await uploadAndDisplay(page, 'sample.pdf');
await page.getByRole('link', { name: 'Documents' }).click();
await expect(page).toHaveURL(/\/app$/);
});
test('protected app routes redirect to /signin when anonymous auth is disabled', async ({ page }) => {
test.skip(process.env.USE_ANONYMOUS_AUTH_SESSIONS !== 'false');
await page.goto('/app');
await expect(page).toHaveURL(/\/signin$/);
});
});