diff --git a/.claude/skills/web-test/scripts/dom/forms.mjs b/.claude/skills/web-test/scripts/dom/forms.mjs index d4a95e5d..d309764f 100644 --- a/.claude/skills/web-test/scripts/dom/forms.mjs +++ b/.claude/skills/web-test/scripts/dom/forms.mjs @@ -1,4 +1,4 @@ -// web-test dom/forms v1.5 — form detection, content read, click-target/field-button resolution +// web-test dom/forms v1.6 — form detection, content read, click-target/field-button resolution // Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import { DETECT_FORM_FN, READ_FORM_FN } from './_shared.mjs'; @@ -331,6 +331,7 @@ export function resolveFieldsScript(formNum, fields) { if (cbEl?.offsetWidth > 0) { last.hasPick = true; if (cbEl.classList.contains('iCalendB')) last.isDate = true; + else if (cbEl.classList.contains('iCalcB')) last.isCalc = true; } allFields.push(last); }); @@ -411,6 +412,7 @@ export function resolveFieldsScript(formNum, fields) { if (found.hasSelect) entry.hasSelect = true; if (found.hasPick) entry.hasPick = true; if (found.isDate) entry.isDate = true; + if (found.isCalc) entry.isCalc = true; if (found._dcsCheckbox) { entry.dcsCheckbox = { inputId: found._dcsCheckbox.inputId, checked: found._dcsCheckbox.checked }; delete found._dcsCheckbox; diff --git a/.claude/skills/web-test/scripts/engine/forms/fill.mjs b/.claude/skills/web-test/scripts/engine/forms/fill.mjs index bada6f2c..b8bfd5e4 100644 --- a/.claude/skills/web-test/scripts/engine/forms/fill.mjs +++ b/.claude/skills/web-test/scripts/engine/forms/fill.mjs @@ -1,4 +1,4 @@ -// web-test forms/fill v1.18 — Fill form fields by name (text/checkbox/date/dropdown/reference). Delegates references to selectValue / fillReferenceField. +// web-test forms/fill v1.19 — Fill form fields by name (text/checkbox/date/number/dropdown/reference). Delegates references to selectValue / fillReferenceField. // Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import { @@ -95,8 +95,9 @@ export async function fillFields(fields) { // Combobox/reference with DLB: DLB-first, then paste fallback const refResult = await fillReferenceField(selector, r.field, fields[r.field], formNum); results.push(refResult); - } else if (r.hasPick && r.isDate) { - // Date/time field with calendar CB — use paste (calendar is not a selection form) + } else if (r.hasPick && (r.isDate || r.isCalc)) { + // Date/time (calendar CB) or numeric (calculator CB) field — use paste: + // the pick button is a calendar/calculator widget, not a selection form. await page.click(selector); await page.waitForTimeout(200); await page.keyboard.press('Control+A'); diff --git a/tests/web-test/03-fillfields.test.mjs b/tests/web-test/03-fillfields.test.mjs index 119d7cca..318541b4 100644 --- a/tests/web-test/03-fillfields.test.mjs +++ b/tests/web-test/03-fillfields.test.mjs @@ -15,7 +15,8 @@ export default async function({ navigateSection, openCommand, clickElement, fill const result = await fillFields({ 'Артикул': 'TEST-001', 'Активен': false, // Boolean → CheckBoxField, toggle - 'ДатаПоступления': '15.05.2026', // date + 'ДатаПоступления': '15.05.2026', // date → CB iCalendB calendar, paste + 'Цена': '777', // Number → CB iCalcB calculator, paste 'ВидНоменклатуры': 'Услуга', // EnumRef dropdown }); @@ -23,11 +24,14 @@ export default async function({ navigateSection, openCommand, clickElement, fill for (const f of result.filled) { assert.ok(f.ok, `fillField "${f.field}" должен вернуть ok=true`); } + assert.equal(result.filled.find(f => f.field === 'Цена')?.method, 'paste', + 'Цена через paste (калькулятор ≠ форма выбора)'); const state = await getFormState(); assert.equal(findField(state, 'Артикул')?.value, 'TEST-001', 'Артикул text'); assert.equal(findField(state, 'Активен')?.value, false, 'Активен checkbox=false'); assert.equal(findField(state, 'ДатаПоступления')?.value, '15.05.2026', 'ДатаПоступления'); + assert.equal(findField(state, 'Цена')?.value, '777,00', 'Цена записалась (1С форматирует → 777,00)'); assert.equal(findField(state, 'ВидНоменклатуры')?.value, 'Услуга', 'ВидНоменклатуры dropdown'); await closeForm({ save: false });