mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-18 16:49:41 +03:00
feat(web-test): гард недоступных элементов + метка disabled в getFormState
clickElement/fillFields/selectValue бросали ложный успех при действии над недоступным (disabled) контролом — в 1С это no-op. Причина: резолвер цели клика не смотрел признак недоступности, который ридер getFormState уже знал. - резолвер клика снимает disabled (кнопки/frameButton/флажок/тумблер/поле), clickElement бросает `"X" is disabled` вместо тихого no-op; - fillFields и selectValue тоже бросают на недоступном поле/флажке/ссылке; - getFormState помечает disabled у frameButton, флажка, переключателя и тумблера (раньше был только у a.press-кнопок и полей ввода); - стенд: обработка ПроверкаДоступности с парами доступный/недоступный по всем типам контролов (в подсистеме Администрирование) + тест 23-availability; - SKILL.md: заметка про disabled у getFormState и throw у clickElement. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// web-test forms/select-value v1.33 — Reference & composite-type value selection: selectValue (+ array multi-select), fillReferenceField, selection/type-dialog pickers.
|
||||
// web-test forms/select-value v1.34 — Reference & composite-type value selection: selectValue (+ array multi-select), fillReferenceField, selection/type-dialog pickers.
|
||||
// Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
|
||||
import {
|
||||
@@ -942,6 +942,9 @@ export async function selectValue(fieldName, searchText, { type } = {}) {
|
||||
btn = await page.evaluate(findFieldButtonScript(formNum, fieldName, 'CB'));
|
||||
}
|
||||
if (btn?.error) return btn;
|
||||
// Disabled reference field keeps its pick button visible, so the click would silently
|
||||
// do nothing. Fail loud, consistent with clickElement's disabled guard.
|
||||
if (btn?.disabled) throw new Error(`selectValue: field "${btn.fieldName || fieldName}" is disabled`);
|
||||
if (highlightMode) try { await highlight(fieldName); await page.waitForTimeout(500); await unhighlight(); } catch {}
|
||||
try {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user