@@ -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 + "\n produced 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