From a8e61d02a2d685169ebd20833abe54e0444dafa3 Mon Sep 17 00:00:00 2001 From: Nick Shirokov Date: Tue, 2 Jun 2026 17:41:00 +0300 Subject: [PATCH] =?UTF-8?q?fix(web-test):=20=D0=BF=D0=BE=D1=87=D0=B8=D0=BD?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=BE=D0=B1=D1=8A=D0=B5=D0=BA=D1=82=D0=BD=D0=BE?= =?UTF-8?q?=D0=B3=D0=BE=20=D0=BF=D0=BE=D0=B8=D1=81=D0=BA=D0=B0=20selectVal?= =?UTF-8?q?ue({field:=20value})?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Три проблемы объектного поиска (следствие рефакторинга на модули): - импорт filterList отсутствовал — pickFromSelectionForm (Шаг 2) бросал ReferenceError, который молча глотался catch'ем, поиск по полю не работал; - dropdown-путь 3A падал на searchText.toLowerCase() (объект, не строка) — теперь объектный search уходит в форму выбора, где обрабатывается per-field; - сужен catch вокруг filterList: ReferenceError/TypeError пробрасываются, чтобы будущие missing-import не маскировались как 'поле не найдено'. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../scripts/engine/forms/select-value.mjs | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/.claude/skills/web-test/scripts/engine/forms/select-value.mjs b/.claude/skills/web-test/scripts/engine/forms/select-value.mjs index 22bec90b..c8aabbd2 100644 --- a/.claude/skills/web-test/scripts/engine/forms/select-value.mjs +++ b/.claude/skills/web-test/scripts/engine/forms/select-value.mjs @@ -1,4 +1,4 @@ -// web-test forms/select-value v1.22 — Reference & composite-type value selection: selectValue, fillReferenceField, selection/type-dialog pickers. +// web-test forms/select-value v1.24 — Reference & composite-type value selection: selectValue, fillReferenceField, selection/type-dialog pickers. // Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import { @@ -22,6 +22,7 @@ import { } from '../core/helpers.mjs'; import { pasteText } from '../core/clipboard.mjs'; import { getFormState } from './state.mjs'; +import { filterList } from '../table/filter.mjs'; /** * Scan visible grid rows for a text match (exact → startsWith → includes). @@ -165,7 +166,15 @@ export async function pickFromSelectionForm(selFormNum, fieldName, search, origF if (typeof search === 'object' && search) { // Per-field advanced search via filterList(val, {field}) for (const [fld, val] of Object.entries(search)) { - try { await filterList(String(val), { field: fld }); } catch { /* proceed */ } + try { + await filterList(String(val), { field: fld }); + } catch (e) { + // Re-throw programming errors (e.g. a missing import surfacing as + // ReferenceError) — only field-filter failures (not found / unsupported + // column) should be swallowed so we fall through to the re-scan. + if (e instanceof ReferenceError || e instanceof TypeError) throw e; + /* proceed */ + } } } else if (searchLower) { // Inline advanced search (Alt+F, "по части строки") @@ -736,6 +745,21 @@ export async function selectValue(fieldName, searchText, { type } = {}) { const regularItems = popupItems.filter(i => i.kind !== 'showAll'); const showAllItem = popupItems.find(i => i.kind === 'showAll'); + if (searchText && typeof searchText !== 'string') { + // Object search ({field: value}) can't be matched against dropdown item + // text — close the typeahead popup and open the full selection form, which + // handles per-field advanced search (pickFromSelectionForm → filterList). + await page.keyboard.press('Escape'); + await page.waitForTimeout(300); + const inputId = await findFieldInputId(formNum, btn.fieldName); + if (inputId) { await page.click(`[id="${inputId}"]`); await page.waitForTimeout(300); } + await page.keyboard.press('F4'); + await page.waitForTimeout(ACTION_WAIT); + const formResult = await openFormAndPick(); + if (formResult) return formResult; + throw new Error(`selectValue: object search ${JSON.stringify(searchText)} for "${btn.fieldName}" did not open a selection form`); + } + if (searchText) { const target = normYo(searchText.toLowerCase()); // Try to find match among regular dropdown items