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.
56 lines
3.3 KiB
TypeScript
56 lines
3.3 KiB
TypeScript
import { randomBytes } from 'node:crypto';
|
|
import { test, expect } from '../support/fixtures';
|
|
import { openOrder, fields, fillTestOrder } from '../support/order-page';
|
|
import { recordOrder } from '../support/network';
|
|
|
|
test('Testauftrag speichern und in frischer Detailansicht wieder öffnen', async ({ page, context, guard }, info) => {
|
|
test.skip(process.env.VOTIAN_UI_CREATE_ORDER !== '1' && !process.env.VOTIAN_UI_VERIFY_ORDER_ID, 'Speichern nur mit --create-order; vorhandenen Testauftrag mit VERIFY_ORDER_ID prüfen.');
|
|
test.setTimeout(90_000);
|
|
let id = process.env.VOTIAN_UI_VERIFY_ORDER_ID;
|
|
let marker = process.env.VOTIAN_UI_VERIFY_ORDER_MARKER;
|
|
if (!id) {
|
|
if (info.retry || info.repeatEachIndex) throw new Error('A save test must never be automatically retried or repeated.');
|
|
marker = 'UI-TEST-' + new Date().toISOString().replace(/[-:]/g, '').slice(0, 15) + '-' + randomBytes(3).toString('hex');
|
|
const order = await openOrder(page);
|
|
await fillTestOrder(order, marker);
|
|
expect(guard.denied, 'All lookups must finish before enabling a save').toEqual([]);
|
|
guard.armCreation(marker);
|
|
const unexpectedDialogs: string[] = [];
|
|
let savedId: string | undefined;
|
|
order.on('dialog', async dialog => {
|
|
const match = dialog.message().match(/^Der Auftrag wurde gespeichert!\s*Auftragsnummer:\s*(\d+)\s*$/);
|
|
if (dialog.type() === 'alert' && match) {
|
|
savedId = match[1];
|
|
recordOrder({ state: 'server-confirmed', marker, id: savedId });
|
|
await dialog.accept();
|
|
} else {
|
|
unexpectedDialogs.push(dialog.type() + ': ' + dialog.message());
|
|
await dialog.dismiss();
|
|
}
|
|
});
|
|
await fields(order).options.locator('[name="toursubmit"]').click();
|
|
await expect.poll(() => Boolean(savedId || unexpectedDialogs.length), { timeout: 30_000, message: 'Server bestätigt gespeicherten Auftrag mit Nummer' }).toBe(true);
|
|
expect(unexpectedDialogs).toEqual([]);
|
|
expect(guard.denied).toEqual([]);
|
|
expect(savedId).toMatch(/^\d+$/);
|
|
expect(guard.saveAttempts).toBe(1);
|
|
id = savedId;
|
|
}
|
|
expect(marker, 'Marker des gespeicherten Testauftrags').toMatch(/^UI-TEST-/);
|
|
guard.allowOrderRead(id!);
|
|
const detail = await context.newPage();
|
|
await detail.goto('/admin/jb_detail.php?job_id=' + id);
|
|
await expect(detail.locator('body')).toContainText(marker!);
|
|
await expect(detail.locator('body')).toContainText('Testkunde Assecutor 1');
|
|
await expect(detail.locator('body')).toContainText('Testkunde Assecutor 2');
|
|
await expect(detail.locator('body')).toContainText('NICHT AUSFÜHREN');
|
|
await expect(detail.locator('body')).toContainText('keine echte Beförderung');
|
|
await expect(detail.locator('tr:has(> td:text-is("Fixpreis"))')).toContainText('10,00');
|
|
await expect(detail.locator('tr:has(> td:text-is("Firma")) > td')).toHaveText(['Firma', 'Testkunde Assecutor 1', 'Testkunde Assecutor 2']);
|
|
await expect(detail.getByText('UNFERTIG!', { exact: true })).toBeVisible();
|
|
await expect(detail.getByRole('link', { name: 'Kurierhistorie', exact: true })).toHaveCount(0);
|
|
await info.attach('saved-test-order', { body: JSON.stringify({ id, marker, url: detail.url() }, null, 2), contentType: 'application/json' });
|
|
await detail.screenshot({ path: info.outputPath('testauftrag-gespeichert.png'), fullPage: true });
|
|
recordOrder({ state: 'ui-verified', marker, id });
|
|
});
|