From b603c7e3fac01b2b8830e4765e697f0383a2f5de Mon Sep 17 00:00:00 2001 From: Nick Shirokov Date: Mon, 16 Mar 2026 11:48:40 +0300 Subject: [PATCH] feat(web-test): expand alias, tree expand fix, fillTableRow checkbox support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - clickElement: add `expand` option (alias for `toggle`) for tree expand/collapse - clickElement: fallback to dblclick when tree +/- icon not found - dom.mjs: search [tree="true"] in entire line, not just first imgBox - fillTableRow: detect checkbox cells via .gridBox > .checkbox, click checkbox icon directly (not cell center). Supports named columns (Активен, Проверен) - SKILL.md: document `expand` instead of `toggle` Co-Authored-By: Claude Opus 4.6 (1M context) --- .claude/skills/web-test/scripts/browser.mjs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.claude/skills/web-test/scripts/browser.mjs b/.claude/skills/web-test/scripts/browser.mjs index e9d8d63b..4f66dfcf 100644 --- a/.claude/skills/web-test/scripts/browser.mjs +++ b/.claude/skills/web-test/scripts/browser.mjs @@ -2188,20 +2188,20 @@ export async function fillTableRow(fields, { tab, add, row, table } = {}) { await page.mouse.click(cellCoords.x, cellCoords.y); // Check if clicked cell is a checkbox (toggle-on-click, no edit mode) - const checkboxState = await page.evaluate(`(() => { + const checkboxInfo = await page.evaluate(`(() => { const el = document.elementFromPoint(${cellCoords.x}, ${cellCoords.y}); - const line = el?.closest('.gridLine'); - if (!line) return null; - const chk = line.querySelector('.checkbox'); + const cell = el?.closest('.gridBox'); + if (!cell) return null; + const chk = cell.querySelector('.checkbox'); if (!chk) return null; - return { checked: chk.classList.contains('select') }; + const r = chk.getBoundingClientRect(); + return { checked: chk.classList.contains('select'), x: Math.round(r.x + r.width/2), y: Math.round(r.y + r.height/2) }; })()`); - if (checkboxState !== null) { - // Checkbox cell — click already toggled it + if (checkboxInfo !== null) { + // Checkbox cell found — click directly on the checkbox icon (not cell center) const desired = ['true', 'да', '1', 'yes'].includes(String(firstVal0).toLowerCase().trim()); - if (checkboxState.checked !== desired) { - // Click toggled to wrong state — click again to undo - await page.mouse.click(cellCoords.x, cellCoords.y); + if (checkboxInfo.checked !== desired) { + await page.mouse.click(checkboxInfo.x, checkboxInfo.y); await page.waitForTimeout(300); } const results = [{ field: firstKey0, ok: true, method: 'toggle', value: desired }];