Files
Sven 9de2358480 Portiere PHP-Cronjobs auf Spring-Tasks und ergänze Legacy-Tests
Migriert die weiterhin benötigten Zeitaufgaben einschließlich SOAP-Importen, Betriebsstatus und Wiederanlaufkontrolle. Aktiviert 115 native Spring-Tasks im Docker-Image ohne Cron-Daemon oder PHP und dokumentiert die entfallenen HHA-Aufrufe. Ergänzt PHP-/UI-Testwerkzeuge und aktualisiert den Projektstand auf Version 0.2.0.
2026-10-27 09:53:23 +01:00

45 lines
2.8 KiB
TypeScript

import { test as base, expect, type BrowserContext } from '@playwright/test';
import { installGuard } from './network';
type State = Awaited<ReturnType<BrowserContext['storageState']>>;
export const test = base.extend<{ guard: Awaited<ReturnType<typeof installGuard>> }, { signedIn: State }>({
signedIn: [async ({ browser }, use) => {
const username = process.env.VOTIAN_UI_USERNAME;
const password = process.env.VOTIAN_UI_PASSWORD;
if (!username || !password) throw new Error('Votian UI credentials required. Run python3 legacy-ui-tests/run.py.');
const context = await browser.newContext({ locale: 'de-DE', serviceWorkers: 'block' });
const guard = await installGuard(context, true);
try {
const page = await context.newPage();
await page.goto('https://test.sb.assecutor.de/admin/login.php');
const details = page.locator('details').filter({ has: page.locator('input[name="f_chk_account"]') });
if (await details.count() && !(await details.getAttribute('open'))) await details.locator('summary').click();
await page.locator('input[name="f_chk_account"]').fill(username);
await page.locator('input[name="f_chk_password"]').fill(password);
await page.locator('[name="f_submit"]').click();
await expect(page).toHaveURL(/\/admin\/start\.php/);
expect(guard.errors, 'Legacy JavaScript errors').toEqual([]);
expect(guard.denied, 'Unexpected requests during login').toEqual([]);
const state = await context.storageState();
await use(state);
} finally {
await context.close();
}
}, { scope: 'worker' }],
storageState: async ({ signedIn }, use) => { await use(signedIn); },
guard: [async ({ context }, use, info) => {
const guard = await installGuard(context);
await use(guard);
if (info.status !== info.expectedStatus) await info.attach('request-paths', { body: JSON.stringify([...new Set(guard.allowed)], null, 2), contentType: 'application/json' });
if (guard.consoleErrors.length) await info.attach('console-diagnostics', { body: JSON.stringify(guard.consoleErrors, null, 2), contentType: 'application/json' });
if (guard.knownErrors.length) await info.attach('known-opener-bug', { body: JSON.stringify(guard.knownErrors), contentType: 'application/json' });
if (guard.errors.length) await info.attach('legacy-js-errors', { body: JSON.stringify(guard.errors), contentType: 'application/json' });
if (guard.denied.length) {
await info.attach('blocked-request-paths', { body: JSON.stringify([...new Set(guard.denied)], null, 2), contentType: 'application/json' });
}
expect(guard.errors, 'Legacy JavaScript errors').toEqual([]);
expect(guard.denied, 'Unexpected request (blocked before it reached the server)').toEqual([]);
}, { auto: true }],
});
export { expect } from '@playwright/test';