Files
archie/e2e/checks/task-recovery.cjs

30 lines
1.4 KiB
JavaScript

// A parked task whose blocker has a fix links to the page that supplies it, from
// Needs attention on the dashboard and from the Stage Rail on the task page.
// The seed's work requests park for want of a repository connection.
const assert = require('node:assert/strict');
module.exports = async ({ page, go, shot, settled, skip }) => {
await go('/');
const tasks = await page.evaluate(async () => (await fetch('/api/tasks?limit=100')).json());
if (!tasks.some((task) => task.status === 'parked')) skip('no parked task');
const parked = tasks.find((task) => task.status === 'parked' && task.recovery);
assert.ok(parked, 'no parked task in the list carries a recovery link');
const { label, link } = parked.recovery;
const row = page.getByRole('link', { name: parked.title, exact: true }).locator('xpath=ancestor::*[.//a[normalize-space()="' + label + '"]][1]');
const fromDashboard = row.getByRole('link', { name: label, exact: true });
await fromDashboard.waitFor();
assert.equal(await fromDashboard.getAttribute('href'), link);
await shot('needs-attention');
await fromDashboard.click();
await settled(link);
await go(`/tasks/${parked.id}`);
const fromRail = page.getByRole('complementary', { name: 'Task details' }).getByRole('link', { name: label, exact: true });
await fromRail.waitFor();
assert.equal(await fromRail.getAttribute('href'), link);
await shot('stage-rail');
await fromRail.click();
await settled(link);
};