@@ -239,7 +239,7 @@ private String removeSpaces(String text)
239239 text = text .replaceAll ("<[^>]+>|&[^;]+;" , "" );
240240 text = text .replaceAll (" {2,}" , " " );
241241 text = text .replaceAll (", " , ",\n " ).replaceAll ("] " , "]\n " );
242- return text ;
242+ return StringUtils . trimToNull ( text ) ;
243243 }
244244
245245 public void goToAssayResultImport (String assayName )
@@ -259,7 +259,6 @@ public void goToAssayResultImport(String assayName, boolean supportsTemplates)
259259 _test .waitForText ("Data Import" );
260260 }
261261
262- @ LogMethod (quiet = true )
263262 public String clickAndGetExampleData ()
264263 {
265264 Locator btn = Ext4Helper .Locators .ext4ButtonEnabled ("Download Example Data" );
@@ -282,22 +281,29 @@ public String clickAndGetExampleData()
282281 return getExampleData (currentWindow );
283282 }
284283
285- @ LogMethod (quiet = true )
286284 private String getExampleData (String currentWindow )
287285 {
288286 String ret = null ;
289287
290288 Set <String > handles = _test .getDriver ().getWindowHandles ();
291- Assert .assertTrue ("Expected more than one open window, was: " + handles .size (), handles .size () > 1 );
292- for (String handle : _test .getDriver ().getWindowHandles ())
289+ Assert .assertEquals ("Expected more than one open window, found: " + StringUtils .join (handles , "," ), 2 , handles .size ());
290+ _test .log ("Current window: " + currentWindow + ", all: [" + StringUtils .join (handles , "," ) + "]" );
291+ for (String handle : handles )
293292 {
294- _test .log ("window: " + handle );
295293 if (!currentWindow .equals (handle ))
296294 {
295+ _test .log ("switching to: " + handle );
297296 _test .getDriver ().switchTo ().window (handle );
298- ret = _test .shortWait ().withMessage ("Unable to retrieve example data" )
297+ ret = _test .shortWait ().withMessage ("Unable to retrieve example data after shortWait " )
299298 .until (wd -> removeSpaces (StringUtils .trimToNull (_test .getHtmlSource ())));
300299
300+ if (StringUtils .trimToNull (ret ) == null )
301+ {
302+ _test .checker ().takeScreenShot ("DownloadExampleData" + handle );
303+ }
304+
305+ Assert .assertNotNull ("Unable to retrieve example data for window: " + handle , ret );
306+
301307 _test .getDriver ().close ();
302308 _test .getDriver ().switchTo ().window (currentWindow );
303309 }
0 commit comments