From ae1dcaac07fe27cd5352a70375e2d8315e3c74fa Mon Sep 17 00:00:00 2001 From: Nick Shirokov Date: Mon, 6 Apr 2026 16:27:24 +0300 Subject: [PATCH] feat(web-test): detect SpreadsheetDocument state bar (stateText) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Extract info bar messages from .stateWindowSupportSurface elements into errors.stateText — covers missing parameters, "report not generated", "settings changed", and "generating..." states. readSpreadsheet() now includes the state message in its error. Co-Authored-By: Claude Opus 4.6 (1M context) --- .claude/skills/web-test/SKILL.md | 2 ++ .claude/skills/web-test/scripts/browser.mjs | 7 ++++++- .claude/skills/web-test/scripts/dom.mjs | 10 +++++++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.claude/skills/web-test/SKILL.md b/.claude/skills/web-test/SKILL.md index e7774d51..2bd0cf36 100644 --- a/.claude/skills/web-test/SKILL.md +++ b/.claude/skills/web-test/SKILL.md @@ -155,6 +155,8 @@ const form = await getFormState(); **confirmation** — if present, a Yes/No dialog is shown. Call `clickElement('Да')` or `clickElement('Нет')`. +**errors.stateText** — array of SpreadsheetDocument state messages (e.g. `"Не установлено значение параметра \"X\""`, `"Отчет не сформирован..."`, `"Изменились настройки..."`). Present when the report area shows an info bar instead of data. + ### Reading data #### `readTable({ maxRows?, offset?, table? })` → `{ columns, rows, total, shown, offset }` diff --git a/.claude/skills/web-test/scripts/browser.mjs b/.claude/skills/web-test/scripts/browser.mjs index 81469409..ae38a397 100644 --- a/.claude/skills/web-test/scripts/browser.mjs +++ b/.claude/skills/web-test/scripts/browser.mjs @@ -1366,7 +1366,12 @@ export async function readSpreadsheet() { const { allCells } = await scanSpreadsheetCells(formNum); - if (allCells.size === 0) throw new Error('readSpreadsheet: no SpreadsheetDocument found. Report may not be generated yet.'); + if (allCells.size === 0) { + // Check for state window messages (info bar) that explain why the report is empty + const err = await checkForErrors(); + const hint = err?.stateText?.length ? err.stateText.join('; ') : ''; + throw new Error('readSpreadsheet: no SpreadsheetDocument found.' + (hint ? ' State: ' + hint : ' Report may not be generated yet.')); + } const mapping = buildSpreadsheetMapping(allCells); if (!mapping) { diff --git a/.claude/skills/web-test/scripts/dom.mjs b/.claude/skills/web-test/scripts/dom.mjs index d02cbe7b..b1bf7cca 100644 --- a/.claude/skills/web-test/scripts/dom.mjs +++ b/.claude/skills/web-test/scripts/dom.mjs @@ -1176,7 +1176,15 @@ export function checkErrorsScript() { } } - return (result.balloon || result.messages || result.modal || result.confirmation) ? result : null; + // 5. SpreadsheetDocument state window (info bar inside moxelContainer) + // Shows messages like "Не установлено значение параметра X" or "Отчет не сформирован" + const stateWins = [...document.querySelectorAll('.stateWindowSupportSurface')].filter(el => el.offsetWidth > 0); + if (stateWins.length) { + const texts = stateWins.map(el => el.innerText?.trim()).filter(Boolean); + if (texts.length) result.stateText = texts; + } + + return (result.balloon || result.messages || result.modal || result.confirmation || result.stateText) ? result : null; })()`; }