Skip to content

Commit 2e3cec3

Browse files
committed
add MAX_TRIES to avoid infinite loop
1 parent 604a932 commit 2e3cec3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Diff for: scripts/actions/webdriver-mobile.mjs

+4-1
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,15 @@ const navTest = async () => {
7979
console.log('\nOpening mobile Nav menu');
8080
let _desktopRN;
8181
let releaseNotes;
82+
const MAX_TRIES = 3;
83+
let tries = 0;
8284
do {
8385
await hamburgerButton.click();
8486
await driver.sleep(SLEEP_TIME);
8587
// nav on mobile is a new list, the desktop nav comes first in the DOM but is hidden
8688
[_desktopRN, releaseNotes] = await waitForXPath(releaseNotesXPath);
87-
} while (releaseNotes == null);
89+
tries += 1;
90+
} while (releaseNotes == null && tries < MAX_TRIES);
8891
const [_desktopINN, initialNextNode] = await waitForXPath(nextNodeXPath);
8992
await driver.executeScript('arguments[0].scrollIntoView()', releaseNotes);
9093
console.log('\nClicking Release Notes div');

0 commit comments

Comments
 (0)