feat(web-test): DCS report settings — human-readable labels for fillFields/selectValue/getFormState

fillFields({ 'Склад': 'value' }) now auto-resolves via DCS pair label
and auto-enables the checkbox. getFormState() returns reportSettings
array with readable names instead of raw КомпоновщикНастроек... fields.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Nick Shirokov
2026-02-28 17:05:16 +03:00
parent 5120b135f5
commit d6befb0dc8
2 changed files with 107 additions and 1 deletions
@@ -992,6 +992,11 @@ export async function fillFields(fields) {
continue;
}
try {
// Auto-enable DCS checkbox if resolved via label
if (r.dcsCheckbox && !r.dcsCheckbox.checked) {
await page.click(`[id="${r.dcsCheckbox.inputId}"]`);
await waitForStable();
}
const selector = `[id="${r.inputId}"]`;
if (r.isCheckbox) {
// Checkbox: compare desired with current, toggle if mismatch
@@ -1325,6 +1330,14 @@ export async function selectValue(fieldName, searchText) {
}
if (btn?.error) return btn;
// Auto-enable DCS checkbox if resolved via label
if (btn.dcsCheckbox) {
const cbSel = `[id="${btn.dcsCheckbox.inputId}"]`;
const isChecked = await page.$eval(cbSel, el =>
el.classList.contains('checked') || el.classList.contains('checkboxOn') || el.classList.contains('select'));
if (!isChecked) { await page.click(cbSel); await waitForStable(); }
}
// Helper: detect selection form (form number > formNum)
async function detectSelectionForm() {
return page.evaluate(`(() => {