mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-06-11 00:14:56 +03:00
fix(web-test): handle follow-up info dialog after security confirmation in openFile
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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}`);
|
||||
|
||||
Reference in New Issue
Block a user