test(e2e): Alle opgaver-prøven rydder sin gruppe op igen
Den efterlod en projektgruppe på den fælles konto, og to af de andre gruppeprøver regner med, at der kun er deres egen i sidebjælken. Kun gruppen slettes: projekterne i papirkurven gav gendannelsesprøven mere end sin egen at vælge imellem. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
2aa56e3b6d
commit
22b79cdfa7
+63
-44
@@ -283,57 +283,76 @@ test('Alle opgaver viser det hele inddelt efter gruppe, prioritet og dato', asyn
|
|||||||
});
|
});
|
||||||
const loose = await send('POST', '/projects', { name: `Løst ${stamp}` });
|
const loose = await send('POST', '/projects', { name: `Løst ${stamp}` });
|
||||||
await send('POST', '/tasks', { content: `Ring til VVS ${stamp}`, project_id: loose.id });
|
await send('POST', '/tasks', { content: `Ring til VVS ${stamp}`, project_id: loose.id });
|
||||||
return { group: group.name, project: project.name };
|
return {
|
||||||
|
group: group.name,
|
||||||
|
project: project.name,
|
||||||
|
ids: { group: group.id }
|
||||||
|
};
|
||||||
}, stamp);
|
}, stamp);
|
||||||
|
|
||||||
// Through the sidebar, so the entry is tested as well as the page.
|
// The group is removed again whatever happens below: the suite shares one
|
||||||
await page.reload();
|
// account, and a group left in the sidebar breaks the tests that expect one
|
||||||
const sidebar = page.getByRole('navigation', { name: 'Hovedmenu' });
|
// there. Only the group — deleting the projects as well puts them in the trash,
|
||||||
await sidebar.getByRole('link', { name: 'Alle opgaver' }).click();
|
// where the restore test then finds more than its own.
|
||||||
await expect(page.getByRole('heading', { name: 'Alle opgaver', level: 1 })).toBeVisible();
|
try {
|
||||||
|
|
||||||
// By group: the group's heading, the project under it, the task under that.
|
// Through the sidebar, so the entry is tested as well as the page.
|
||||||
const groupSection = page.locator('[data-bucket]').filter({
|
await page.reload();
|
||||||
has: page.getByRole('heading', { name: names.group })
|
const sidebar = page.getByRole('navigation', { name: 'Hovedmenu' });
|
||||||
});
|
await sidebar.getByRole('link', { name: 'Alle opgaver' }).click();
|
||||||
await expect(groupSection.getByRole('link', { name: names.project })).toBeVisible();
|
await expect(page.getByRole('heading', { name: 'Alle opgaver', level: 1 })).toBeVisible();
|
||||||
await expect(groupSection.getByText(`Slå græs ${stamp}`)).toBeVisible();
|
|
||||||
// And the loose project's task is NOT in the group — a list of everything
|
|
||||||
// passes any check that only asks whether the right task is in it.
|
|
||||||
await expect(groupSection.getByText(`Ring til VVS ${stamp}`)).toHaveCount(0);
|
|
||||||
const ungrouped = page.locator('[data-bucket]').filter({
|
|
||||||
has: page.getByRole('heading', { name: 'Uden gruppe' })
|
|
||||||
});
|
|
||||||
await expect(ungrouped.getByText(`Ring til VVS ${stamp}`)).toBeVisible();
|
|
||||||
|
|
||||||
// Folding a group hides its tasks and keeps its heading.
|
// By group: the group's heading, the project under it, the task under that.
|
||||||
await groupSection.getByRole('button', { name: names.group }).click();
|
const groupSection = page.locator('[data-bucket]').filter({
|
||||||
await expect(groupSection.getByText(`Slå græs ${stamp}`)).toHaveCount(0);
|
has: page.getByRole('heading', { name: names.group })
|
||||||
await groupSection.getByRole('button', { name: names.group }).click();
|
});
|
||||||
await expect(groupSection.getByText(`Slå græs ${stamp}`)).toBeVisible();
|
await expect(groupSection.getByRole('link', { name: names.project })).toBeVisible();
|
||||||
|
await expect(groupSection.getByText(`Slå græs ${stamp}`)).toBeVisible();
|
||||||
|
// And the loose project's task is NOT in the group — a list of everything
|
||||||
|
// passes any check that only asks whether the right task is in it.
|
||||||
|
await expect(groupSection.getByText(`Ring til VVS ${stamp}`)).toHaveCount(0);
|
||||||
|
const ungrouped = page.locator('[data-bucket]').filter({
|
||||||
|
has: page.getByRole('heading', { name: 'Uden gruppe' })
|
||||||
|
});
|
||||||
|
await expect(ungrouped.getByText(`Ring til VVS ${stamp}`)).toBeVisible();
|
||||||
|
|
||||||
// By priority: the prioritised task under Prioritet 1, the other under none.
|
// Folding a group hides its tasks and keeps its heading.
|
||||||
await page.getByRole('button', { name: 'Prioritet', exact: true }).click();
|
await groupSection.getByRole('button', { name: names.group }).click();
|
||||||
// Anchored: the heading's name includes its count, so "Ingen prioritet 1" also
|
await expect(groupSection.getByText(`Slå græs ${stamp}`)).toHaveCount(0);
|
||||||
// contains "prioritet 1" — and that bucket is the one holding the other task.
|
await groupSection.getByRole('button', { name: names.group }).click();
|
||||||
const p1 = page.locator('[data-bucket]').filter({
|
await expect(groupSection.getByText(`Slå græs ${stamp}`)).toBeVisible();
|
||||||
has: page.getByRole('heading', { name: /^Prioritet 1\b/ })
|
|
||||||
});
|
|
||||||
await expect(p1.getByText(`Slå græs ${stamp}`)).toBeVisible();
|
|
||||||
await expect(p1.getByText(`Ring til VVS ${stamp}`)).toHaveCount(0);
|
|
||||||
// Out of its project, a row says where it lives.
|
|
||||||
await expect(p1.getByText(names.project)).toBeVisible();
|
|
||||||
|
|
||||||
// The choice survives a reload.
|
// By priority: the prioritised task under Prioritet 1, the other under none.
|
||||||
await page.reload();
|
await page.getByRole('button', { name: 'Prioritet', exact: true }).click();
|
||||||
await expect(page.getByRole('heading', { name: /^Prioritet 1\b/ })).toBeVisible();
|
// Anchored: the heading's name includes its count, so "Ingen prioritet 1" also
|
||||||
|
// contains "prioritet 1" — and that bucket is the one holding the other task.
|
||||||
|
const p1 = page.locator('[data-bucket]').filter({
|
||||||
|
has: page.getByRole('heading', { name: /^Prioritet 1\b/ })
|
||||||
|
});
|
||||||
|
await expect(p1.getByText(`Slå græs ${stamp}`)).toBeVisible();
|
||||||
|
await expect(p1.getByText(`Ring til VVS ${stamp}`)).toHaveCount(0);
|
||||||
|
// Out of its project, a row says where it lives.
|
||||||
|
await expect(p1.getByText(names.project)).toBeVisible();
|
||||||
|
|
||||||
// By date: neither has one.
|
// The choice survives a reload.
|
||||||
await page.getByRole('button', { name: 'Dato', exact: true }).click();
|
await page.reload();
|
||||||
const noDate = page.locator('[data-bucket]').filter({
|
await expect(page.getByRole('heading', { name: /^Prioritet 1\b/ })).toBeVisible();
|
||||||
has: page.getByRole('heading', { name: 'Uden dato' })
|
|
||||||
});
|
// By date: neither has one.
|
||||||
await expect(noDate.getByText(`Ring til VVS ${stamp}`)).toBeVisible();
|
await page.getByRole('button', { name: 'Dato', exact: true }).click();
|
||||||
|
const noDate = page.locator('[data-bucket]').filter({
|
||||||
|
has: page.getByRole('heading', { name: 'Uden dato' })
|
||||||
|
});
|
||||||
|
await expect(noDate.getByText(`Ring til VVS ${stamp}`)).toBeVisible();
|
||||||
|
} finally {
|
||||||
|
await page.evaluate(async (group) => {
|
||||||
|
await fetch(`/api/v1/project-groups/${group}`, {
|
||||||
|
method: 'DELETE',
|
||||||
|
credentials: 'include',
|
||||||
|
headers: { 'Sec-Fetch-Site': 'same-origin' }
|
||||||
|
});
|
||||||
|
}, names.ids.group);
|
||||||
|
}
|
||||||
|
|
||||||
expect(trouble).toEqual([]);
|
expect(trouble).toEqual([]);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user