@arcadialdev/arcality 2.4.35 → 2.4.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcadialdev/arcality",
3
- "version": "2.4.35",
3
+ "version": "2.4.36",
4
4
  "description": "AI-powered QA testing tool — Autonomous web testing agent by Arcadial",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -956,6 +956,48 @@ ${relevantFailures.map((m) => `- ${m.prompt}`).join("\n")}
956
956
  const idx = startIdx + localCount++;
957
957
  htmlEl.setAttribute("agent-idx", idx.toString());
958
958
  let name = text || htmlEl.getAttribute("aria-label") || htmlEl.getAttribute("title") || htmlEl.getAttribute("placeholder");
959
+ if (!name && (tag === "input" || tag === "select" || htmlEl.getAttribute("role") === "combobox")) {
960
+ const labelledBy = htmlEl.getAttribute("aria-labelledby");
961
+ if (labelledBy) {
962
+ const labelEl = document.getElementById(labelledBy);
963
+ if (labelEl)
964
+ name = labelEl.innerText.trim();
965
+ }
966
+ if (!name && htmlEl.id) {
967
+ const forLabel = document.querySelector(`label[for="${htmlEl.id}"]`);
968
+ if (forLabel)
969
+ name = forLabel.innerText.trim();
970
+ }
971
+ if (!name) {
972
+ const parentLabel = htmlEl.closest("label");
973
+ if (parentLabel)
974
+ name = parentLabel.innerText.replace(htmlEl.textContent || "", "").trim();
975
+ }
976
+ if (!name) {
977
+ let prev = htmlEl.previousElementSibling;
978
+ let tries = 0;
979
+ while (prev && tries < 3) {
980
+ const prevText = (prev.innerText || "").trim();
981
+ if (prevText && prevText.length > 1 && prevText.length < 60) {
982
+ name = prevText;
983
+ break;
984
+ }
985
+ prev = prev.previousElementSibling;
986
+ tries++;
987
+ }
988
+ }
989
+ if (!name) {
990
+ const container = htmlEl.closest("div, fieldset, section");
991
+ if (container) {
992
+ const labelInContainer = container.querySelector('label, [class*="label"], [class*="placeholder"]');
993
+ if (labelInContainer) {
994
+ const labelText = (labelInContainer.innerText || "").trim();
995
+ if (labelText && labelText.length < 60)
996
+ name = labelText;
997
+ }
998
+ }
999
+ }
1000
+ }
959
1001
  if (!name) {
960
1002
  const iconMatch = htmlEl.outerHTML.match(/fa-([a-z0-9-]+)|md-([a-z0-9-]+)|bi-([a-z0-9-]+)/i);
961
1003
  if (iconMatch) {
@@ -2863,14 +2905,17 @@ function captureValidationRule(errorMessage, context) {
2863
2905
  }
2864
2906
  }
2865
2907
  const lastAction = history[history.length - 1];
2866
- if (lastAction && lastAction.includes(`click en "${desc}"`)) {
2908
+ const isGenericName = !desc || desc === "[input]" || desc === "[button]" || desc === "[select]" || desc === "[div]" || desc.trim().length < 3;
2909
+ if (!isGenericName && lastAction && lastAction.includes(`click en "${desc}"`)) {
2867
2910
  const isDotsTrigger = desc.includes("dots") || desc.includes("vert") || desc.includes("menu") || desc.includes("opciones");
2868
2911
  const sameActionCount = history.filter((h) => h.includes(`click en "${desc}"`)).length;
2869
- const toleranceLimit = allowRepeatedNames ? 3 : 1;
2870
- if (isDotsTrigger && sameActionCount < 2) {
2912
+ const toleranceLimit = allowRepeatedNames ? 4 : 2;
2913
+ if (isDotsTrigger && sameActionCount < 3) {
2871
2914
  console.log(` \u26A0\uFE0F Re-intentando click en men\xFA "${desc}"...`);
2872
2915
  } else if (allowRepeatedNames && sameActionCount < toleranceLimit) {
2873
2916
  console.log(` \u26A0\uFE0F Click repetido permitido por contexto de misi\xF3n en "${desc}"...`);
2917
+ } else if (sameActionCount < toleranceLimit) {
2918
+ console.log(` \u26A0\uFE0F Re-intento ${sameActionCount} en "${desc}"...`);
2874
2919
  } else {
2875
2920
  const bodyText = await page.innerText("body").catch(() => "");
2876
2921
  if (bodyText.match(/ligado|depende|no se puede/i)) {
@@ -2881,9 +2926,9 @@ function captureValidationRule(errorMessage, context) {
2881
2926
  break;
2882
2927
  }
2883
2928
  console.log(`
2884
- \u{1F6D1} [AUTO-STOP] Bloqueando click duplicado en "${desc}". Forzando re-evaluaci\xF3n.`);
2885
- history.push(`Turno ${stepCount}: Bloqueado click repetido en "${desc}" (Evitando bucle)`);
2886
- await page.waitForTimeout(1e3);
2929
+ \u{1F6D1} [AUTO-STOP] Bloqueando click repetido en "${desc}" (${sameActionCount} veces). Forzando re-evaluaci\xF3n.`);
2930
+ history.push(`Turno ${stepCount}: \u{1F6D1} [AUTO-STOP] El click en "${desc}" fue bloqueado despu\xE9s de ${sameActionCount} repeticiones. Usa un IDX diferente o intenta hacer scroll para revelar el elemento. Si es un dropdown que no abre, usa interact_native_control.`);
2931
+ await page.waitForTimeout(800);
2887
2932
  break;
2888
2933
  }
2889
2934
  }