mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-08-06 11:40:20 +03:00
fix(web-test): fillFields date/time fields — paste instead of selectValue
Date fields have a CB (Choose Button) that opens a calendar, not a selection form. fillFields detected hasPick → delegated to selectValue → error "DLB click did not open a popup or selection form". Fix: detect date fields by `iCalendB` CSS class on CB button (dom.mjs), propagate `isDate` flag through field mapping, and use clipboard paste for date fields instead of selectValue. Reference fields with CB (without iCalendB) continue using selectValue as before. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
baefeaa05b
commit
a314ec32fc
@@ -1805,8 +1805,19 @@ export async function fillFields(fields) {
|
|||||||
// Combobox/reference with DLB: DLB-first, then paste fallback
|
// Combobox/reference with DLB: DLB-first, then paste fallback
|
||||||
const refResult = await fillReferenceField(selector, r.field, fields[r.field], formNum);
|
const refResult = await fillReferenceField(selector, r.field, fields[r.field], formNum);
|
||||||
results.push(refResult);
|
results.push(refResult);
|
||||||
|
} else if (r.hasPick && r.isDate) {
|
||||||
|
// Date/time field with calendar CB — use paste (calendar is not a selection form)
|
||||||
|
await page.click(selector);
|
||||||
|
await page.waitForTimeout(200);
|
||||||
|
await page.keyboard.press('Control+A');
|
||||||
|
await page.evaluate(`navigator.clipboard.writeText(${JSON.stringify(String(fields[r.field]))})`);
|
||||||
|
await page.keyboard.press('Control+V');
|
||||||
|
await page.waitForTimeout(300);
|
||||||
|
await page.keyboard.press('Tab');
|
||||||
|
await waitForStable();
|
||||||
|
results.push({ field: r.field, ok: true, value: String(fields[r.field]), method: 'paste' });
|
||||||
} else if (r.hasPick) {
|
} else if (r.hasPick) {
|
||||||
// Reference field without DLB (non-editable): delegate to selectValue (F4 → selection form)
|
// Reference field with CB (non-editable or editable ref): delegate to selectValue (F4 → selection form)
|
||||||
const svResult = await selectValue(r.field, String(fields[r.field]));
|
const svResult = await selectValue(r.field, String(fields[r.field]));
|
||||||
if (svResult?.error) {
|
if (svResult?.error) {
|
||||||
results.push({ field: r.field, error: svResult.error, message: svResult.message });
|
results.push({ field: r.field, error: svResult.error, message: svResult.message });
|
||||||
|
|||||||
@@ -1189,7 +1189,11 @@ export function resolveFieldsScript(formNum, fields) {
|
|||||||
const label = (titleEl?.innerText?.trim() || '').replace(/\\n/g, ' ').replace(/:$/, '');
|
const label = (titleEl?.innerText?.trim() || '').replace(/\\n/g, ' ').replace(/:$/, '');
|
||||||
const last = { inputId: el.id, name, label };
|
const last = { inputId: el.id, name, label };
|
||||||
if (document.getElementById(p + name + '_DLB')?.offsetWidth > 0) last.hasSelect = true;
|
if (document.getElementById(p + name + '_DLB')?.offsetWidth > 0) last.hasSelect = true;
|
||||||
if (document.getElementById(p + name + '_CB')?.offsetWidth > 0) last.hasPick = true;
|
const cbEl = document.getElementById(p + name + '_CB');
|
||||||
|
if (cbEl?.offsetWidth > 0) {
|
||||||
|
last.hasPick = true;
|
||||||
|
if (cbEl.classList.contains('iCalendB')) last.isDate = true;
|
||||||
|
}
|
||||||
allFields.push(last);
|
allFields.push(last);
|
||||||
});
|
});
|
||||||
// Checkboxes
|
// Checkboxes
|
||||||
@@ -1268,6 +1272,7 @@ export function resolveFieldsScript(formNum, fields) {
|
|||||||
if (found.isRadio) { entry.isRadio = true; entry.options = found.options; }
|
if (found.isRadio) { entry.isRadio = true; entry.options = found.options; }
|
||||||
if (found.hasSelect) entry.hasSelect = true;
|
if (found.hasSelect) entry.hasSelect = true;
|
||||||
if (found.hasPick) entry.hasPick = true;
|
if (found.hasPick) entry.hasPick = true;
|
||||||
|
if (found.isDate) entry.isDate = true;
|
||||||
if (found._dcsCheckbox) {
|
if (found._dcsCheckbox) {
|
||||||
entry.dcsCheckbox = { inputId: found._dcsCheckbox.inputId, checked: found._dcsCheckbox.checked };
|
entry.dcsCheckbox = { inputId: found._dcsCheckbox.inputId, checked: found._dcsCheckbox.checked };
|
||||||
delete found._dcsCheckbox;
|
delete found._dcsCheckbox;
|
||||||
|
|||||||
Reference in New Issue
Block a user