Skip to content

Commit

Permalink
await menu close if not navigating
Browse files Browse the repository at this point in the history
  • Loading branch information
labkey-chrisj committed Nov 21, 2023
1 parent 374dd91 commit 1a2b465
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/org/labkey/test/components/html/BootstrapMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.labkey.test.components.react.BaseBootstrapMenu;
import org.labkey.test.util.LogMethod;
import org.labkey.test.util.LoggedParam;
import org.openqa.selenium.StaleElementReferenceException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;

Expand Down Expand Up @@ -110,6 +111,18 @@ public void clickSubMenu(int timeout, @LoggedParam String ... subMenuLabels)
getWrapper().scrollIntoView(item);

getWrapper().clickAndWait(item, timeout);

if (0 == timeout) // if we aren't waiting to navigate, wait for the menu to close
WebDriverWrapper.waitFor(()-> {
try
{
return !isExpanded();
}
catch (StaleElementReferenceException success)
{
return true;
}
}, 1000);
}

@LogMethod(quiet = true)
Expand Down

0 comments on commit 1a2b465

Please sign in to comment.