This commit is contained in:
parent
325e2f1ee9
commit
08e573d63c
17 changed files with 348 additions and 26 deletions
33
tests/playwright/auth-bypass.spec.ts
Normal file
33
tests/playwright/auth-bypass.spec.ts
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
import { expect, test } from '@playwright/test';
|
||||
|
||||
test('home loads without a login screen', async ({ page }) => {
|
||||
await page.goto('/');
|
||||
|
||||
await expect(page).toHaveURL(/\/$/);
|
||||
await expect(page.getByRole('heading', { name: 'WorkTracker' })).toBeVisible();
|
||||
await expect(page.getByRole('heading', { name: 'Login' })).toHaveCount(0);
|
||||
});
|
||||
|
||||
test('protected pages are directly available without redirecting to login', async ({ page }) => {
|
||||
const pages = [
|
||||
{ path: '/grid', heading: 'Grid View' },
|
||||
{ path: '/calendar', heading: 'Calendar' },
|
||||
{ path: '/summary', heading: 'Monthly Summary' },
|
||||
{ path: '/settings', heading: 'Settings' },
|
||||
{ path: '/workday', heading: 'Work Day Entry' },
|
||||
{ path: '/auth', heading: 'You are authenticated' }
|
||||
];
|
||||
|
||||
for (const target of pages) {
|
||||
await page.goto(target.path);
|
||||
await expect(page).not.toHaveURL(/\/login/i);
|
||||
await expect(page.getByRole('heading', { name: target.heading })).toBeVisible();
|
||||
}
|
||||
});
|
||||
|
||||
test('login route redirects away when built-in authentication is disabled', async ({ page }) => {
|
||||
await page.goto('/login');
|
||||
|
||||
await expect(page).toHaveURL(/\/$/);
|
||||
await expect(page.getByRole('heading', { name: 'WorkTracker' })).toBeVisible();
|
||||
});
|
||||
21
tests/playwright/health.spec.ts
Normal file
21
tests/playwright/health.spec.ts
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import { expect, test } from '@playwright/test';
|
||||
|
||||
test('health endpoint reports healthy zero-trust mode', async ({ request }) => {
|
||||
const response = await request.get('/healthz');
|
||||
|
||||
expect(response.ok()).toBeTruthy();
|
||||
|
||||
const payload = await response.json();
|
||||
|
||||
expect(payload.status).toBe('Healthy');
|
||||
expect(payload.authenticationEnabled).toBe(false);
|
||||
expect(payload.storage.appSettingsReady).toBe(true);
|
||||
expect(payload.storage.usersReady).toBe(true);
|
||||
expect(payload.storage.workDaysReady).toBe(true);
|
||||
});
|
||||
|
||||
test('authenticated identity is the default admin user', async ({ page }) => {
|
||||
await page.goto('/auth');
|
||||
|
||||
await expect(page.getByText('Hello Admin!')).toBeVisible();
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue