From 8b0664b18dca37df91d0e6c0ef11acd0c8472508 Mon Sep 17 00:00:00 2001 From: Nick Shirokov Date: Tue, 3 Mar 2026 14:19:24 +0300 Subject: [PATCH] fix(web-test): avoid confusing small EPF form with info dialog in openFile Check form change before checkForErrors() to prevent misidentifying a small EPF form (< 20 elements) as an informational modal dialog. Only call checkForErrors() on suspiciously tiny new forms. Co-Authored-By: Claude Opus 4.6 --- .claude/skills/web-test/scripts/browser.mjs | 25 ++++++++++++--------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/.claude/skills/web-test/scripts/browser.mjs b/.claude/skills/web-test/scripts/browser.mjs index d8922728..2831f084 100644 --- a/.claude/skills/web-test/scripts/browser.mjs +++ b/.claude/skills/web-test/scripts/browser.mjs @@ -459,18 +459,23 @@ export async function openFile(filePath) { } await waitForStable(formBefore); } - // After confirmation, check for a follow-up informational dialog (OK button) - // 1C may show "file opened in safe mode, please re-open" modal - const err2 = await checkForErrors(); - if (err2?.modal) { - await dismissPendingErrors(); - await waitForStable(formBefore); - // Dismissed the info dialog — retry the whole open cycle - continue; - } - // Check if the EPF form appeared + // After confirmation, check if EPF form appeared or a follow-up dialog showed. + // Check form change FIRST — avoids confusing a small EPF form with a modal dialog. const formAfter = await page.evaluate(detectFormScript()); if (formAfter != null && formAfter !== formBefore) { + // New form appeared — but is it the EPF or an informational dialog? + // Informational "re-open" dialogs are tiny (< 20 elements). + const elCount = await page.evaluate(`document.querySelectorAll('[id^="form${formAfter}_"]').length`); + if (elCount < 20) { + // Likely an info dialog — check and dismiss + const err2 = await checkForErrors(); + if (err2?.modal) { + await dismissPendingErrors(); + await waitForStable(formBefore); + continue; // retry open cycle + } + } + // It's the real EPF form const state = await getFormState(); state.opened = { file: absPath, attempt: attempt + 1 }; return state;