2323import org .labkey .test .WebDriverWrapper ;
2424import org .labkey .test .util .DataRegionTable ;
2525import org .labkey .test .util .Ext4Helper ;
26+ import org .labkey .test .util .LogMethod ;
2627import org .labkey .test .util .UIAssayHelper ;
2728import org .labkey .test .util .ext4cmp .Ext4CmpRef ;
2829import org .labkey .test .util .ext4cmp .Ext4ComboRef ;
@@ -225,9 +226,13 @@ public Locator getAssayWell(String text, String color)
225226 return Locator .xpath ("//div[contains(@style, '" + color + "') and normalize-space() = '" + text + "']" );
226227 }
227228
228- public String getPageText ( )
229+ private String removeSpaces ( String text )
229230 {
230- String text = _test .getHtmlSource ();
231+ if (text == null )
232+ {
233+ return null ;
234+ }
235+
231236 //the browser converts line breaks to spaces. this is a hack to get them back
232237 text = text .replaceAll ("<[^>]+>|&[^;]+;" , "" );
233238 text = text .replaceAll (" {2,}" , " " );
@@ -252,6 +257,7 @@ public void goToAssayResultImport(String assayName, boolean supportsTemplates)
252257 _test .waitForText ("Data Import" );
253258 }
254259
260+ @ LogMethod (quiet = true )
255261 public String clickAndGetExampleData ()
256262 {
257263 Locator btn = Locator .linkContainingText ("Download Example Data" );
@@ -274,6 +280,7 @@ public String clickAndGetExampleData()
274280 return getExampleData (currentWindow );
275281 }
276282
283+ @ LogMethod (quiet = true )
277284 private String getExampleData (String currentWindow )
278285 {
279286 String ret = null ;
@@ -282,11 +289,12 @@ private String getExampleData(String currentWindow)
282289 Assert .assertTrue ("Expected more than one open window, was: " + handles .size (), handles .size () > 1 );
283290 for (String handle : _test .getDriver ().getWindowHandles ())
284291 {
292+ _test .log ("window: " + handle );
285293 if (!currentWindow .equals (handle ))
286294 {
287295 _test .getDriver ().switchTo ().window (handle );
288296 ret = _test .shortWait ().withMessage ("Unable to retrieve example data" )
289- .until (wd -> StringUtils .trimToNull (getPageText ( )));
297+ .until (wd -> removeSpaces ( StringUtils .trimToNull (_test . getHtmlSource () )));
290298
291299 _test .getDriver ().close ();
292300 _test .getDriver ().switchTo ().window (currentWindow );
0 commit comments