mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-06-25 22:44:37 +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:
@@ -1805,8 +1805,19 @@ export async function fillFields(fields) {
|
||||
// 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 && 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) {
|
||||
// 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]));
|
||||
if (svResult?.error) {
|
||||
results.push({ field: r.field, error: svResult.error, message: svResult.message });
|
||||
|
||||
Reference in New Issue
Block a user