From 2af73d25bf75b2d9f2adaeb9fffdb93a91898a82 Mon Sep 17 00:00:00 2001 From: Nick Shirokov Date: Tue, 3 Mar 2026 14:17:33 +0300 Subject: [PATCH] fix(web-test): handle follow-up info dialog after security confirmation in openFile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After clicking "Да" on the security confirmation, check for a second informational modal ("please re-open the file"). If present, dismiss it and retry the full Ctrl+O → filechooser cycle. Co-Authored-By: Claude Opus 4.6 --- .claude/skills/web-test/scripts/browser.mjs | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/.claude/skills/web-test/scripts/browser.mjs b/.claude/skills/web-test/scripts/browser.mjs index b8f13f86..d8922728 100644 --- a/.claude/skills/web-test/scripts/browser.mjs +++ b/.claude/skills/web-test/scripts/browser.mjs @@ -459,29 +459,36 @@ export async function openFile(filePath) { } await waitForStable(formBefore); } - // After confirmation, check if form appeared or we need to retry + // 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 const formAfter = await page.evaluate(detectFormScript()); if (formAfter != null && formAfter !== formBefore) { const state = await getFormState(); state.opened = { file: absPath, attempt: attempt + 1 }; return state; } - // Form didn't open — security dialog asked to re-open, retry + // Form didn't appear — retry continue; } // No security dialog — check if form appeared + if (err?.modal) { + throw new Error(`Error opening file: ${err.modal.message}`); + } const formAfter = await page.evaluate(detectFormScript()); if (formAfter != null && formAfter !== formBefore) { const state = await getFormState(); state.opened = { file: absPath, attempt: attempt + 1 }; return state; } - - // If modal error appeared instead of a form - if (err?.modal) { - throw new Error(`Error opening file: ${err.modal.message}`); - } } throw new Error(`Form did not open after ${MAX_ATTEMPTS} attempts for: ${absPath}`);