Skip to content

Commit

Permalink
Add small delay to handle scroll event, disclosure_navigation_hybrid …
Browse files Browse the repository at this point in the history
…test
  • Loading branch information
stalgiag committed Dec 4, 2024
1 parent 900f783 commit 856188e
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions test/tests/disclosure_navigation_hybrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,24 +83,10 @@ ariaTest(
if (links.length > 0) {
await buttons[b].click();

let retries = 1;
let menuVisible = false;

while (retries >= 0 && !menuVisible) {
await buttons[b].click();

menuVisible = await menus[b].isDisplayed();

if (!menuVisible && retries === 0) {
throw new Error(
`Failed to make menu ${b} visible after multiple attempts`
);
}
retries--;
}

t.true(menuVisible, `Menu ${b} should be visible before clicking link`);
await links[0].click();
// Add a small delay here to ensure that the scroll to focus event
// has time to complete and doesn't interfere with the next assertion
await t.context.session.sleep(300);

t.is(
await links[0].getAttribute('aria-current'),
Expand Down

0 comments on commit 856188e

Please sign in to comment.