diff --git a/scripts/src/hwlab-node-web-observe-runner-source.ts b/scripts/src/hwlab-node-web-observe-runner-source.ts index 5fd33d68..3a72844d 100644 --- a/scripts/src/hwlab-node-web-observe-runner-source.ts +++ b/scripts/src/hwlab-node-web-observe-runner-source.ts @@ -1711,6 +1711,19 @@ async function openMdtodoSourceConfig(command) { ensureProjectManagementCommand("openMdtodoSourceConfig"); const beforeUrl = currentPageUrl(); const beforeProject = await projectManagementCommandSnapshot(); + const existingDialog = page.locator('[data-testid="mdtodo-source-form-hwpod"], [data-testid="mdtodo-source-config-dialog"], [role="dialog"]').first(); + if (await visibleLocator(existingDialog)) { + return { + beforeUrl, + afterUrl: currentPageUrl(), + type: "openMdtodoSourceConfig", + alreadyOpen: true, + beforeProject, + afterProject: await projectManagementCommandSnapshot(), + pageId, + valuesRedacted: true + }; + } const button = page.locator('[data-testid="mdtodo-source-config-open"]').first(); await button.waitFor({ state: "visible", timeout: 15000 }); await button.click(); @@ -1804,8 +1817,10 @@ async function reindexMdtodoSource(command) { const beforeUrl = currentPageUrl(); const beforeProject = await projectManagementCommandSnapshot(); await ensureMdtodoSourceConfigOpen(); - const reindex = await clickProjectButtonAndMaybeWait("mdtodo-source-reindex", /^\/v1\/project-management\/mdtodo\/sources/u); - return { beforeUrl, afterUrl: currentPageUrl(), type: "reindexMdtodoSource", reindex, beforeProject, afterProject: await projectManagementCommandSnapshot(), pageId, valuesRedacted: true }; + const dialogButton = page.locator('[data-testid="mdtodo-source-reindex-dialog"]').first(); + const buttonTestId = await visibleLocator(dialogButton) ? "mdtodo-source-reindex-dialog" : "mdtodo-source-reindex"; + const reindex = await clickProjectButtonAndMaybeWait(buttonTestId, /^\/v1\/project-management\/mdtodo\/sources/u); + return { beforeUrl, afterUrl: currentPageUrl(), type: "reindexMdtodoSource", buttonTestId, reindex, beforeProject, afterProject: await projectManagementCommandSnapshot(), pageId, valuesRedacted: true }; } async function selectTaskIfCommandTargetsOne(command) {