Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 28 additions & 6 deletions src/org/labkey/test/WebDriverWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
import org.openqa.selenium.Keys;
import org.openqa.selenium.NoAlertPresentException;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.NoSuchWindowException;
import org.openqa.selenium.ScriptTimeoutException;
import org.openqa.selenium.SearchContext;
import org.openqa.selenium.StaleElementReferenceException;
Expand Down Expand Up @@ -1631,14 +1632,12 @@ public boolean isTextPresent(String... texts)
if (htmlSource == null || !htmlSource.contains(text))
present.setFalse();

return present.getValue();
return present.get();
};
TextSearcher searcher = new TextSearcher(this);
searcher.setSearchTransformer(TextSearcher.TextTransformers.IDENTITY);
searcher.setSourceTransformer(TextSearcher.TextTransformers.IDENTITY);
searcher.searchForTexts(handler, Arrays.asList(texts));

return present.getValue();
return present.get();
}

public List<String> getTextOrder(TextSearcher searcher, String... texts)
Expand Down Expand Up @@ -1729,12 +1728,12 @@ public boolean isAnyTextPresent(String... texts)
if (htmlSource.contains(text))
found.setTrue();

return !found.getValue(); // stop searching if any value is found
return !found.get(); // stop searching if any value is found
};
TextSearcher searcher = new TextSearcher(this);
searcher.searchForTexts(handler, Arrays.asList(texts));

return found.getValue();
return found.get();
}

/**
Expand Down Expand Up @@ -2134,6 +2133,29 @@ public long doAndMaybeWaitForPageToLoad(int msWait, Supplier<Boolean> action)
return loadTimer.elapsed().toMillis();
}

public long doAndWaitForWindow(Runnable action, String windowName)
{
return doAndMaybeWaitForPageToLoad(10_000, () -> {
String initialWindow = getDriver().getWindowHandle();
boolean targetWindowExists;
try
{
getDriver().switchTo().window(windowName);
getDriver().switchTo().window(initialWindow);
targetWindowExists = true;
}
catch (NoSuchWindowException e)
{
targetWindowExists = false;
}

action.run();

getDriver().switchTo().window(windowName);
return targetWindowExists;
});
}

public long doAndAcceptUnloadAlert(Runnable func, String partialAlertText)
{
return doAndWaitForPageToLoad(() ->
Expand Down
5 changes: 3 additions & 2 deletions src/org/labkey/test/pages/ConfigureReportsAndScriptsPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.labkey.test.util.LogMethod;
import org.labkey.test.util.LoggedParam;
import org.labkey.test.util.TestLogger;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;

import java.io.File;
Expand All @@ -45,7 +46,7 @@ public class ConfigureReportsAndScriptsPage extends LabKeyPage
private static final String DEFAULT_ENGINE = "Mozilla Rhino";
private static final String EDIT_WINDOW_TITLE = "Edit Engine Configuration";

public ConfigureReportsAndScriptsPage(WebDriverWrapper test)
public ConfigureReportsAndScriptsPage(WebDriver test)
{
super(test);
waitForEnginesGrid();
Expand All @@ -54,7 +55,7 @@ public ConfigureReportsAndScriptsPage(WebDriverWrapper test)
public static ConfigureReportsAndScriptsPage beginAt(WebDriverWrapper driver)
{
driver.beginAt(WebTestHelper.buildURL("core", "configureReportsAndScripts"));
return new ConfigureReportsAndScriptsPage(driver);
return new ConfigureReportsAndScriptsPage(driver.getDriver());
}

public void waitForEnginesGrid()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ public static ConfigureSystemMaintenancePage beginAt(WebDriverWrapper webDriverW
*/
public PipelineStatusDetailsPage runMaintenanceTask(String description)
{
click(Locator.tagWithAttribute("input", "type", "checkbox")
.followingSibling("a").withText(description));
getDriver().switchTo().window("systemMaintenance");
doAndWaitForWindow(() -> click(Locator.tagWithAttribute("input", "type", "checkbox")
.followingSibling("a").withText(description)), "systemMaintenance");

PipelineStatusDetailsPage pipelineStatusDetailsPage = new PipelineStatusDetailsPage(getDriver());
pipelineStatusDetailsPage.waitForComplete();
Expand Down
Loading