23 lines
1.9 KiB
TypeScript
23 lines
1.9 KiB
TypeScript
import { test, expect } from '../../web/node_modules/@playwright/test/index.js';
|
|
import { login } from './helpers';
|
|
|
|
test('real TLS login follows announced configuration and restores session without invented simulation identity', async ({ page }) => {
|
|
test.skip(process.env.RMM_E2E_PROFILE !== 'dev/test' || process.env.RMM_E2E_MODE !== 'management-read');
|
|
const configResponse = page.waitForResponse(r => new URL(r.url()).pathname === '/auth/config');
|
|
await page.goto('/');
|
|
const response = await configResponse; expect(response.status()).toBe(200);
|
|
const config: unknown = await response.json();
|
|
if (!config || typeof config !== 'object' || !('oidc_configured' in config) || !('dev_login_enabled' in config) || !('oidc_login_url' in config)) throw new Error('Auth configuration schema missing');
|
|
expect(typeof config.oidc_configured).toBe('boolean'); expect(typeof config.dev_login_enabled).toBe('boolean');
|
|
if (config.oidc_configured) {
|
|
expect(config.oidc_login_url).toBe('/auth/oidc/login'); await expect(page.getByRole('link', { name: 'Mit SSO anmelden', exact: true })).toHaveAttribute('href', '/auth/oidc/login');
|
|
} else {
|
|
expect(config.oidc_login_url).toBeNull(); await expect(page.getByText('OIDC: not_configured', { exact: false })).toBeVisible(); await expect(page.getByRole('link', { name: 'Mit SSO anmelden', exact: true })).toHaveCount(0);
|
|
}
|
|
if (!config.dev_login_enabled) { await expect(page.locator('input[type="password"]')).toHaveCount(0); return; }
|
|
await expect(page.getByText('DEV/TEST · SIMULIERTER TESTPRINCIPAL', { exact: false })).toBeVisible();
|
|
await login(page); await page.reload(); await expect(page.getByRole('status')).toContainText('SIMULIERT');
|
|
await expect(page.getByRole('heading', { name: 'Geräte', exact: true })).toBeVisible();
|
|
await page.getByRole('button', { name: 'Abmelden', exact: true }).click(); await expect(page.getByRole('button', { name: 'Anmelden', exact: true })).toBeVisible();
|
|
});
|