From f203404c7382b551fe8238f353080280a5b20bcc Mon Sep 17 00:00:00 2001 From: chen <23054115+cwkang1998@users.noreply.github.com> Date: Tue, 17 Nov 2026 12:18:57 +0700 Subject: [PATCH] fix(statechart-dashboard): wait for the opened chart by its id in verify verify() opened a chart and then waited until the page heading showed the chart's title. Two charts can share a title. For the second of them the wait returned at once, while the page still showed the first chart. The page then drew the second chart on its hashchange event, so the next click on Fit hit a detached node. The wait now also needs the navigation to mark this chart's id as the current page. The page sets that mark in the same step that draws the chart. --- skills/statechart-dashboard/scripts/verify.mjs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/skills/statechart-dashboard/scripts/verify.mjs b/skills/statechart-dashboard/scripts/verify.mjs index 3e64fd7..c62612a 100644 --- a/skills/statechart-dashboard/scripts/verify.mjs +++ b/skills/statechart-dashboard/scripts/verify.mjs @@ -27,7 +27,13 @@ export async function verify(page) { continue; } await button.click(); - await page.waitForFunction(title => document.querySelector('main h1')?.textContent === title, { timeout: 5000 }, c.title); + // Two charts can share a title, so only the id in the navigation shows that this chart is open. + await page.waitForFunction( + (id, title) => document.querySelector('nav [aria-current="page"]')?.dataset.open === id && document.querySelector('main h1')?.textContent === title, + { timeout: 5000 }, + c.id, + c.title, + ); if (c.drawn) { await page.click('[data-zoom="fit"]');