fix(web-test): use includes instead of startsWith for grid button id-prefix fallback

Button ids like allActionsРазделыКоманднаяПанель contain gridName
in the middle, not at the start. Using includes() catches both
prefix patterns (ИсходящиеКоманднаяПанель_Добавить) and infix
patterns (allActionsРазделыКоманднаяПанель).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Nick Shirokov
2026-03-14 12:28:50 +03:00
parent 24a48b4a9f
commit 07be2bcafd
+1 -1
View File
@@ -660,7 +660,7 @@ export function findClickTargetScript(formNum, text, { tableName, gridSelector }
// Fallback: filter by gridName id-prefix (e.g. ИсходящиеКоманднаяПанель_Добавить)
const gridName = gridEl.id ? gridEl.id.replace(p, '') : '';
if (gridName) {
const prefixItems = items.filter(i => i.label && i.label.startsWith(gridName));
const prefixItems = items.filter(i => i.label && i.label.includes(gridName));
let pf = prefixItems.find(i => i.name.toLowerCase() === target);
if (!pf) pf = prefixItems.find(i => i.label && i.label.toLowerCase().includes(target));
if (!pf) pf = prefixItems.find(i => i.name.toLowerCase().includes(target));