mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-20 17:40:59 +03:00
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:
co-authored by
Claude Opus 4.6
parent
97820111d5
commit
b603c7e3fa
@@ -2188,20 +2188,20 @@ export async function fillTableRow(fields, { tab, add, row, table } = {}) {
|
|||||||
await page.mouse.click(cellCoords.x, cellCoords.y);
|
await page.mouse.click(cellCoords.x, cellCoords.y);
|
||||||
|
|
||||||
// Check if clicked cell is a checkbox (toggle-on-click, no edit mode)
|
// 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 el = document.elementFromPoint(${cellCoords.x}, ${cellCoords.y});
|
||||||
const line = el?.closest('.gridLine');
|
const cell = el?.closest('.gridBox');
|
||||||
if (!line) return null;
|
if (!cell) return null;
|
||||||
const chk = line.querySelector('.checkbox');
|
const chk = cell.querySelector('.checkbox');
|
||||||
if (!chk) return null;
|
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) {
|
if (checkboxInfo !== null) {
|
||||||
// Checkbox cell — click already toggled it
|
// Checkbox cell found — click directly on the checkbox icon (not cell center)
|
||||||
const desired = ['true', 'да', '1', 'yes'].includes(String(firstVal0).toLowerCase().trim());
|
const desired = ['true', 'да', '1', 'yes'].includes(String(firstVal0).toLowerCase().trim());
|
||||||
if (checkboxState.checked !== desired) {
|
if (checkboxInfo.checked !== desired) {
|
||||||
// Click toggled to wrong state — click again to undo
|
await page.mouse.click(checkboxInfo.x, checkboxInfo.y);
|
||||||
await page.mouse.click(cellCoords.x, cellCoords.y);
|
|
||||||
await page.waitForTimeout(300);
|
await page.waitForTimeout(300);
|
||||||
}
|
}
|
||||||
const results = [{ field: firstKey0, ok: true, method: 'toggle', value: desired }];
|
const results = [{ field: firstKey0, ok: true, method: 'toggle', value: desired }];
|
||||||
|
|||||||
Reference in New Issue
Block a user