mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-06-13 01:14:56 +03:00
fix(web-test): route reference fields without DLB through selectValue
Reference fields with pick button (_CB) but no dropdown button (_DLB) were going through the plain paste path, which silently failed for non-editable fields. Now detected via hasPick flag in resolveFieldsScript and delegated to selectValue (F4 → selection form). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1532,9 +1532,17 @@ export async function fillFields(fields) {
|
||||
results.push({ field: r.field, error: 'option_not_found', available: r.options.map(o => o.label) });
|
||||
}
|
||||
} else if (r.hasSelect) {
|
||||
// Reference field: DLB-based selection (dropdown or selection form)
|
||||
// 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) {
|
||||
// Reference field without DLB (non-editable): delegate to selectValue (F4 → selection form)
|
||||
const svResult = await selectValue(r.field, String(fields[r.field]));
|
||||
if (svResult?.error) {
|
||||
results.push({ field: r.field, error: svResult.error, message: svResult.message });
|
||||
} else {
|
||||
results.push({ field: r.field, ok: true, value: svResult.value || String(fields[r.field]), method: svResult.method || 'form' });
|
||||
}
|
||||
} else {
|
||||
// Plain field: clipboard paste + Tab to commit
|
||||
// page.fill() sets DOM value but doesn't trigger 1C input events;
|
||||
|
||||
@@ -1159,6 +1159,7 @@ export function resolveFieldsScript(formNum, fields) {
|
||||
const label = (titleEl?.innerText?.trim() || '').replace(/\\n/g, ' ').replace(/:$/, '');
|
||||
const last = { inputId: el.id, name, label };
|
||||
if (document.getElementById(p + name + '_DLB')?.offsetWidth > 0) last.hasSelect = true;
|
||||
if (document.getElementById(p + name + '_CB')?.offsetWidth > 0) last.hasPick = true;
|
||||
allFields.push(last);
|
||||
});
|
||||
// Checkboxes
|
||||
@@ -1236,6 +1237,7 @@ export function resolveFieldsScript(formNum, fields) {
|
||||
if (found.isCheckbox) { entry.isCheckbox = true; entry.checked = found.checked; }
|
||||
if (found.isRadio) { entry.isRadio = true; entry.options = found.options; }
|
||||
if (found.hasSelect) entry.hasSelect = true;
|
||||
if (found.hasPick) entry.hasPick = true;
|
||||
if (found._dcsCheckbox) {
|
||||
entry.dcsCheckbox = { inputId: found._dcsCheckbox.inputId, checked: found._dcsCheckbox.checked };
|
||||
delete found._dcsCheckbox;
|
||||
|
||||
Reference in New Issue
Block a user