test(ui): accept trailing slashes in migration sidebar links

This commit is contained in:
Yuneng Jiang 2026-09-06 00:38:07 -07:00
parent 4104868458
commit a08fb489cd
No known key found for this signature in database

View file

@ -29,12 +29,12 @@ async function expectRendered(page: Page) {
}
/**
* Click a migrated page's sidebar link. Migrated items render as <a href=".../ui/<segment>">;
* Click a migrated page's sidebar link. Migrated items render as <a href=".../ui/<segment>/">;
* nested ones live under collapsible groups whose children only render while the
* group is open, so expand collapsed groups until the link is clickable.
*/
async function clickSidebar(page: Page, segment: string) {
const link = sidebar(page).locator(`a[href$="/ui/${segment}"]`).first();
const link = sidebar(page).locator(`a[href$="/ui/${segment}"], a[href$="/ui/${segment}/"]`).first();
const collapsedGroups = sidebar(page).getByRole("button", { expanded: false });
for (let i = 0; i < 8 && !(await link.isVisible().catch(() => false)); i++) {
const stillCollapsed = await collapsedGroups.count();