Retry search text for any type of error

This commit is contained in:
Himanshu Mishra
2020-05-05 20:09:03 +09:00
parent 9ea93173f0
commit 82b6f1e4cb
+7 -8
View File
@@ -130,15 +130,14 @@ async function waitForPageWithText(
);
break;
} catch (error) {
if (error instanceof browser.assert.AssertionError) {
findTextAttempts++;
if (findTextAttempts <= maxFindTextAttempts) {
await browser.visit(path);
await new Promise(resolve => setTimeout(resolve, intervalMs));
continue
}
findTextAttempts++;
if (findTextAttempts <= maxFindTextAttempts) {
await browser.visit(path);
await new Promise(resolve => setTimeout(resolve, intervalMs));
continue
} else {
throw error;
}
throw error;
}
}
}