Skip to content

Commit 26edaa6

Browse files
Merge remote-tracking branch 'origin/develop' into fb_lintCleanup
2 parents 63744c4 + 4b085b7 commit 26edaa6

3 files changed

Lines changed: 15 additions & 59 deletions

File tree

src/org/labkey/test/Locator.java

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -689,11 +689,6 @@ public static XPathLocator linkWithImage(String image)
689689
return tag("a").withChild(tag("img").withAttributeContaining("src", image));
690690
}
691691

692-
public static XPathLocator gwtButton(String text)
693-
{
694-
return tag("a").withClass("gwt-Anchor").withText(text);
695-
}
696-
697692
public static XPathLocator button(String text)
698693
{
699694
return tag("button").notHidden().withPredicate("not(contains(@class, 'tab'))").withText(text);
@@ -907,21 +902,6 @@ public static XPathLocator lookupLink(String schemaName, String queryName, Strin
907902
return tagWithClass("span", "labkey-link").containing(linkText);
908903
}
909904

910-
public static XPathLocator gwtTextBoxByLabel(String label)
911-
{
912-
return tagWithClass("input", "gwt-TextBox").withPredicate(xpath("../preceding-sibling::td").withText(label));
913-
}
914-
915-
public static XPathLocator gwtListBoxByLabel(String label)
916-
{
917-
return tagWithClass("select", "gwt-ListBox").withPredicate(xpath("../preceding-sibling::label").withText(label));
918-
}
919-
920-
public static XPathLocator gwtCheckBoxOnImportGridByColLabel(String label)
921-
{
922-
return tagWithAttribute("input", "type", "checkbox").withPredicate(xpath("../../following-sibling::td/span").containing(label));
923-
}
924-
925905
public static Locator permissionRendered()
926906
{
927907
return Locators.pageSignal("policyRendered");

src/org/labkey/test/WebDriverWrapper.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3252,8 +3252,6 @@ public WebElement findButton(String text)
32523252
Locator.extButton(text),
32533253
// normal HTML button:
32543254
Locator.button(text),
3255-
// GWT button:
3256-
Locator.gwtButton(text),
32573255
// bootstrap button
32583256
BootstrapLocators.button(text)
32593257
);
@@ -3511,8 +3509,8 @@ else if (text.length() < 1000 && !text.contains("\n") && !text.contains("\t"))
35113509
try
35123510
{
35133511
String elementClass = input.getAttribute("class");
3514-
if (elementClass.contains("gwt-TextBox") || elementClass.contains("gwt-TextArea") || elementClass.contains("x-form-text"))
3515-
fireEvent(input, SeleniumEvent.blur); // Make GWT and ExtJS form elements behave better
3512+
if (elementClass.contains("x-form-text"))
3513+
fireEvent(input, SeleniumEvent.blur); // Make ExtJS form elements behave better
35163514
}
35173515
catch(StaleElementReferenceException stale)
35183516
{

src/org/labkey/test/util/Crawler.java

Lines changed: 13 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,7 @@ else if (downloadDir.isDirectory()) // Don't check for download if dir doesn't e
947947
{
948948
File[] filesArray = WebDriverWrapper.getNewFiles(0, downloadDir, existingDownloads);
949949
downloadedFiles.setValue(filesArray);
950-
if (downloadedFiles.getValue().length > 0)
950+
if (downloadedFiles.get().length > 0)
951951
{
952952
navigated.setValue(false); // Don't wait for page load when a download occurs
953953
return true; // Stop waiting
@@ -966,24 +966,24 @@ else if (downloadDir.isDirectory()) // Don't check for download if dir doesn't e
966966
{
967967
TestLogger.warn("URL didn't trigger a download or navigation: " + fullURL);
968968
}
969-
return navigated.getValue();
969+
return navigated.get();
970970
});
971971

972-
if (!navigated.getValue())
972+
if (!navigated.get())
973973
{
974974
logMessage = logMessage.replace(messagePrefix, "Downloading from ");
975975
}
976976

977977
logMessage += TestLogger.formatElapsedTime(elapsedTime);
978978

979-
return navigated.getValue();
979+
return navigated.get();
980980
}
981981
finally
982982
{
983983
TestLogger.info(logMessage); // log after navigation to
984-
if (downloadedFiles.getValue() != null)
984+
if (downloadedFiles.get() != null)
985985
{
986-
Arrays.stream(downloadedFiles.getValue()).forEach(file -> {
986+
Arrays.stream(downloadedFiles.get()).forEach(file -> {
987987
TestLogger.info(" \u2517" + file.getName()); // Log downloaded files
988988
FileUtils.deleteQuietly(file); // Clean up crawled downloads
989989
});
@@ -996,7 +996,7 @@ private List<UrlToCheck> crawlLink(final UrlToCheck urlToCheck)
996996
String relativeURL = urlToCheck.getRelativeURL();
997997
ControllerActionId actionId = new ControllerActionId(relativeURL);
998998
URL actualUrl; // URL might redirect
999-
boolean navigated = true; // URL might download
999+
boolean navigated; // URL might download
10001000
List<UrlToCheck> newUrlsToCheck = new ArrayList<>();
10011001

10021002
// Keep track of where crawler has been
@@ -1010,15 +1010,7 @@ private List<UrlToCheck> crawlLink(final UrlToCheck urlToCheck)
10101010

10111011
try
10121012
{
1013-
try
1014-
{
1015-
navigated = beginAt(relativeURL);
1016-
}
1017-
catch (UnhandledAlertException alert)
1018-
{
1019-
if (isRealFailure(alert))
1020-
throw alert;
1021-
}
1013+
navigated = beginAt(relativeURL);
10221014

10231015
if (navigated) // These checks were already performed if navigation didn't occur
10241016
{
@@ -1059,7 +1051,7 @@ private List<UrlToCheck> crawlLink(final UrlToCheck urlToCheck)
10591051
List<String> serverError = _test.getTexts(Locator.css("table.server-error").findElements(_test.getDriver()));
10601052
if (!serverError.isEmpty())
10611053
{
1062-
String[] errorLines = serverError.get(0).split("\n");
1054+
String[] errorLines = serverError.getFirst().split("\n");
10631055
fail(relativeURL + "\nproduced error: \"" + errorLines[0] + "\"." + originMessage);
10641056
}
10651057

@@ -1270,7 +1262,7 @@ protected void checkForForbiddenWords(String relativeURL)
12701262

12711263
public static void tryInject(WebDriverWrapper test, Runnable r)
12721264
{
1273-
tryInject(test, arg -> {r.run(); return true;}, null);
1265+
tryInject(test, _ -> {r.run(); return true;}, null);
12741266
}
12751267

12761268
/**
@@ -1342,15 +1334,6 @@ else if (responseCode == 400 && !test.onLabKeyPage())
13421334
}
13431335
}
13441336

1345-
/** Ignore GWT alerts from designer pages */
1346-
private boolean isRealFailure(Exception e)
1347-
{
1348-
return !(e instanceof UnhandledAlertException && (
1349-
e.getMessage().contains("Script Tag Failure - no status available") || // alert when navigating away quickly
1350-
e.getMessage().contains("Service_Proxy") // Alert from various GWT services (e.g. "from StudyDefinitionService_Proxy.getBlank")
1351-
));
1352-
}
1353-
13541337
private void testInjection(URL start)
13551338
{
13561339
String base = stripQueryParams(stripHash(start.toString()));
@@ -1409,16 +1392,11 @@ private void testInjection(URL start)
14091392
}
14101393
catch (Exception ex)
14111394
{
1412-
if (isRealFailure(ex))
1413-
{
1414-
throw new AssertionError("Non-injection error while attempting script injection on " + actionId + "\n" +
1415-
"param: " + paramMalicious + "\n" +
1416-
"URL: " + urlMalicious, ex);
1417-
}
1395+
throw new AssertionError("Non-injection error while attempting script injection on " + actionId + "\n" +
1396+
"param: " + paramMalicious + "\n" +
1397+
"URL: " + urlMalicious, ex);
14181398
}
14191399
}
1420-
// TODO this blows up jquery document completed handling, which causes pageload to not fire and then timeout
1421-
/// tryInject(_test, urlTester, base + "?" + query + "#" + injectString);
14221400
}
14231401

14241402
static Random random = new Random();

0 commit comments

Comments
 (0)