diff --git a/src/org/labkey/test/Locator.java b/src/org/labkey/test/Locator.java index 57503a7795..9e7b88809e 100644 --- a/src/org/labkey/test/Locator.java +++ b/src/org/labkey/test/Locator.java @@ -689,11 +689,6 @@ public static XPathLocator linkWithImage(String image) return tag("a").withChild(tag("img").withAttributeContaining("src", image)); } - public static XPathLocator gwtButton(String text) - { - return tag("a").withClass("gwt-Anchor").withText(text); - } - public static XPathLocator button(String text) { return tag("button").notHidden().withPredicate("not(contains(@class, 'tab'))").withText(text); @@ -907,21 +902,6 @@ public static XPathLocator lookupLink(String schemaName, String queryName, Strin return tagWithClass("span", "labkey-link").containing(linkText); } - public static XPathLocator gwtTextBoxByLabel(String label) - { - return tagWithClass("input", "gwt-TextBox").withPredicate(xpath("../preceding-sibling::td").withText(label)); - } - - public static XPathLocator gwtListBoxByLabel(String label) - { - return tagWithClass("select", "gwt-ListBox").withPredicate(xpath("../preceding-sibling::label").withText(label)); - } - - public static XPathLocator gwtCheckBoxOnImportGridByColLabel(String label) - { - return tagWithAttribute("input", "type", "checkbox").withPredicate(xpath("../../following-sibling::td/span").containing(label)); - } - public static Locator permissionRendered() { return Locators.pageSignal("policyRendered"); diff --git a/src/org/labkey/test/WebDriverWrapper.java b/src/org/labkey/test/WebDriverWrapper.java index af3e2b6a67..b8fa2a7de1 100644 --- a/src/org/labkey/test/WebDriverWrapper.java +++ b/src/org/labkey/test/WebDriverWrapper.java @@ -3260,8 +3260,6 @@ public WebElement findButton(String text) Locator.extButton(text), // normal HTML button: Locator.button(text), - // GWT button: - Locator.gwtButton(text), // bootstrap button BootstrapLocators.button(text) ); @@ -3519,8 +3517,8 @@ else if (text.length() < 1000 && !text.contains("\n") && !text.contains("\t")) try { String elementClass = input.getAttribute("class"); - if (elementClass.contains("gwt-TextBox") || elementClass.contains("gwt-TextArea") || elementClass.contains("x-form-text")) - fireEvent(input, SeleniumEvent.blur); // Make GWT and ExtJS form elements behave better + if (elementClass.contains("x-form-text")) + fireEvent(input, SeleniumEvent.blur); // Make ExtJS form elements behave better } catch(StaleElementReferenceException stale) { diff --git a/src/org/labkey/test/util/Crawler.java b/src/org/labkey/test/util/Crawler.java index 9b7d6b8884..cb6bb82efa 100644 --- a/src/org/labkey/test/util/Crawler.java +++ b/src/org/labkey/test/util/Crawler.java @@ -947,7 +947,7 @@ else if (downloadDir.isDirectory()) // Don't check for download if dir doesn't e { File[] filesArray = WebDriverWrapper.getNewFiles(0, downloadDir, existingDownloads); downloadedFiles.setValue(filesArray); - if (downloadedFiles.getValue().length > 0) + if (downloadedFiles.get().length > 0) { navigated.setValue(false); // Don't wait for page load when a download occurs return true; // Stop waiting @@ -966,24 +966,24 @@ else if (downloadDir.isDirectory()) // Don't check for download if dir doesn't e { TestLogger.warn("URL didn't trigger a download or navigation: " + fullURL); } - return navigated.getValue(); + return navigated.get(); }); - if (!navigated.getValue()) + if (!navigated.get()) { logMessage = logMessage.replace(messagePrefix, "Downloading from "); } logMessage += TestLogger.formatElapsedTime(elapsedTime); - return navigated.getValue(); + return navigated.get(); } finally { TestLogger.info(logMessage); // log after navigation to - if (downloadedFiles.getValue() != null) + if (downloadedFiles.get() != null) { - Arrays.stream(downloadedFiles.getValue()).forEach(file -> { + Arrays.stream(downloadedFiles.get()).forEach(file -> { TestLogger.info(" \u2517" + file.getName()); // Log downloaded files FileUtils.deleteQuietly(file); // Clean up crawled downloads }); @@ -996,7 +996,7 @@ private List crawlLink(final UrlToCheck urlToCheck) String relativeURL = urlToCheck.getRelativeURL(); ControllerActionId actionId = new ControllerActionId(relativeURL); URL actualUrl; // URL might redirect - boolean navigated = true; // URL might download + boolean navigated; // URL might download List newUrlsToCheck = new ArrayList<>(); // Keep track of where crawler has been @@ -1010,15 +1010,7 @@ private List crawlLink(final UrlToCheck urlToCheck) try { - try - { - navigated = beginAt(relativeURL); - } - catch (UnhandledAlertException alert) - { - if (isRealFailure(alert)) - throw alert; - } + navigated = beginAt(relativeURL); if (navigated) // These checks were already performed if navigation didn't occur { @@ -1059,7 +1051,7 @@ private List crawlLink(final UrlToCheck urlToCheck) List serverError = _test.getTexts(Locator.css("table.server-error").findElements(_test.getDriver())); if (!serverError.isEmpty()) { - String[] errorLines = serverError.get(0).split("\n"); + String[] errorLines = serverError.getFirst().split("\n"); fail(relativeURL + "\nproduced error: \"" + errorLines[0] + "\"." + originMessage); } @@ -1270,7 +1262,7 @@ protected void checkForForbiddenWords(String relativeURL) public static void tryInject(WebDriverWrapper test, Runnable r) { - tryInject(test, arg -> {r.run(); return true;}, null); + tryInject(test, _ -> {r.run(); return true;}, null); } /** @@ -1342,15 +1334,6 @@ else if (responseCode == 400 && !test.onLabKeyPage()) } } - /** Ignore GWT alerts from designer pages */ - private boolean isRealFailure(Exception e) - { - return !(e instanceof UnhandledAlertException && ( - e.getMessage().contains("Script Tag Failure - no status available") || // alert when navigating away quickly - e.getMessage().contains("Service_Proxy") // Alert from various GWT services (e.g. "from StudyDefinitionService_Proxy.getBlank") - )); - } - private void testInjection(URL start) { String base = stripQueryParams(stripHash(start.toString())); @@ -1409,16 +1392,11 @@ private void testInjection(URL start) } catch (Exception ex) { - if (isRealFailure(ex)) - { - throw new AssertionError("Non-injection error while attempting script injection on " + actionId + "\n" + - "param: " + paramMalicious + "\n" + - "URL: " + urlMalicious, ex); - } + throw new AssertionError("Non-injection error while attempting script injection on " + actionId + "\n" + + "param: " + paramMalicious + "\n" + + "URL: " + urlMalicious, ex); } } - // TODO this blows up jquery document completed handling, which causes pageload to not fire and then timeout - /// tryInject(_test, urlTester, base + "?" + query + "#" + injectString); } static Random random = new Random();