mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-19 00:59:40 +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/fill v1.20 — Fill form fields by name (text/checkbox/date/number/dropdown/reference; array → multi-select via selectValue). Delegates references to selectValue / fillReferenceField.
|
||||
// web-test forms/fill v1.21 — Fill form fields by name (text/checkbox/date/number/dropdown/reference; array → multi-select via selectValue). Delegates references to selectValue / fillReferenceField.
|
||||
// Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
|
||||
import {
|
||||
@@ -33,6 +33,12 @@ export async function fillFields(fields) {
|
||||
results.push(r);
|
||||
continue;
|
||||
}
|
||||
// Disabled field: filling/toggling it is a silent no-op in 1C. Fail loud via the
|
||||
// standard failure aggregation below instead of reporting a fake success.
|
||||
if (r.disabled) {
|
||||
results.push({ field: r.field, error: 'disabled', message: `field "${r.field}" is disabled` });
|
||||
continue;
|
||||
}
|
||||
// Array value → multi-select. Delegate to selectValue's array branch (auto-detects
|
||||
// the surface) so fillFields({field:[...]}) works the same as selectValue(field,[...]).
|
||||
if (Array.isArray(fields[r.field])) {
|
||||
|
||||
@@ -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