@silasfmartins/testhub 1.0.4 → 1.0.5
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.
|
@@ -978,14 +978,14 @@ export class WebActions {
|
|
|
978
978
|
}
|
|
979
979
|
static async withRecovery(originalElement, actionName, fn, valueForContext) {
|
|
980
980
|
// 🛡️ Guard: se já estiver em recovery, executar fn direto sem novo ciclo.
|
|
981
|
-
// Impede a cadeia click→recovery→click_other→click→recovery
|
|
981
|
+
// Impede a cadeia click→recovery→click_other→click→recovery→... (stack overflow)
|
|
982
982
|
if (WebActions._inRecovery) {
|
|
983
983
|
const initialCandidate = await WebActions.resolveCandidateForRecovery(originalElement);
|
|
984
984
|
return await fn(initialCandidate);
|
|
985
985
|
}
|
|
986
|
-
// 🔄 Refresh DOM antes da primeira tentativa
|
|
986
|
+
// 🔄 Refresh DOM antes da primeira tentativa
|
|
987
987
|
await WebActions.refreshDOM(150).catch(() => { });
|
|
988
|
-
// 🎯 Catalog pre-resolve + lazy auto-refresh
|
|
988
|
+
// 🎯 Catalog pre-resolve + lazy auto-refresh
|
|
989
989
|
if (typeof originalElement === "string") {
|
|
990
990
|
try {
|
|
991
991
|
WebActions.ensureCatalogExtractor();
|
|
@@ -1004,6 +1004,9 @@ export class WebActions {
|
|
|
1004
1004
|
}
|
|
1005
1005
|
catch { }
|
|
1006
1006
|
}
|
|
1007
|
+
// 🛡️ Capturar estado do lock ANTES de entrar no try/catch.
|
|
1008
|
+
// Somente quem mudou _inRecovery de false→true pode resetar no finally.
|
|
1009
|
+
const wasAlreadyInRecovery = WebActions._inRecovery;
|
|
1007
1010
|
try {
|
|
1008
1011
|
const initialCandidate = await WebActions.resolveCandidateForRecovery(originalElement);
|
|
1009
1012
|
return await fn(initialCandidate);
|
|
@@ -1011,8 +1014,8 @@ export class WebActions {
|
|
|
1011
1014
|
catch (error) {
|
|
1012
1015
|
// 🔄 Refresh DOM imediato após falha
|
|
1013
1016
|
await WebActions.refreshDOM(200).catch(() => { });
|
|
1014
|
-
// 🛡️ Ativar lock
|
|
1015
|
-
//
|
|
1017
|
+
// 🛡️ Ativar lock — click_other/navigateTo/switchTo dentro deste recovery
|
|
1018
|
+
// vão cair no guard acima e executar fn direto, sem nova recovery.
|
|
1016
1019
|
WebActions._inRecovery = true;
|
|
1017
1020
|
try {
|
|
1018
1021
|
const MIN_CONF = Number(process.env.AUTOCORE_RECOVERY_MIN_CONFIDENCE || "0.7");
|
|
@@ -1342,8 +1345,11 @@ export class WebActions {
|
|
|
1342
1345
|
throw error;
|
|
1343
1346
|
}
|
|
1344
1347
|
finally {
|
|
1345
|
-
// 🛡️
|
|
1346
|
-
|
|
1348
|
+
// 🛡️ Só resetar o lock se ESTE withRecovery foi quem ativou.
|
|
1349
|
+
// Se já estava em recovery antes (wasAlreadyInRecovery), não tocar no lock.
|
|
1350
|
+
if (!wasAlreadyInRecovery) {
|
|
1351
|
+
WebActions._inRecovery = false;
|
|
1352
|
+
}
|
|
1347
1353
|
}
|
|
1348
1354
|
}
|
|
1349
1355
|
// Helper genérico para tentar heurísticas de preenchimento/atribuição de valor
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@silasfmartins/testhub",
|
|
3
3
|
"description": "Biblioteca de utilitários para automação de testes",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.5",
|
|
5
5
|
"author": "Silas Martins Feliciano da Silva <silas.martins2041@gmail.com>",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/index.js",
|