feat(web-test): expand alias, tree expand fix, fillTableRow checkbox support

- 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) <noreply@anthropic.com>
This commit is contained in:
Nick Shirokov
2026-03-16 11:48:40 +03:00
parent 97820111d5
commit b603c7e3fa
+10 -10
View File
@@ -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 }];