Files

31 lines
1.4 KiB
JavaScript

// The organisation pages: each loads its form in the selected org, and the old
// settings audit route lands on the organisation's audit page.
const assert = require('node:assert/strict');
const { trackAudit } = require('./helpers/audit-helpers.cjs');
const PAGES = [
{ path: '/org/channels', heading: 'Channels', text: 'Chat session defaults' },
{ path: '/org/scheduling-policy', heading: 'Scheduling policy', text: 'Retries and polling' },
{ path: '/org/alerts', heading: 'Alert webhook', text: 'Webhook severity' },
];
module.exports = async ({ page, go, shot }) => {
for (const { path, heading, text } of PAGES) {
await go(path);
await page.getByRole('heading', { name: heading, exact: true }).waitFor();
await page.getByText(text, { exact: true }).first().waitFor();
assert.equal(new URL(page.url()).pathname, path);
await shot(path);
}
trackAudit(page);
await go('/org/audit');
await page.getByRole('heading', { name: 'Audit', exact: true }).first().waitFor();
await page.locator('[data-row-key]').first().waitFor();
await shot('/org/audit');
await go('/settings/audit?since=7d');
assert.equal(new URL(page.url()).pathname, '/org/audit', '/settings/audit did not redirect');
assert.equal(new URL(page.url()).searchParams.get('since'), '7d', 'redirect dropped the query');
await page.locator('[data-row-key]').first().waitFor();
};