Skip to content

Commit b2d9dfb

Browse files
authored
Continue to debug intermittent test failures (#22)
* Continue to debug intermittent test failures
1 parent 6a9a436 commit b2d9dfb

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

LDK/test/src/org/labkey/test/util/external/labModules/LabModuleHelper.java

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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,31 @@ 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();
291289
Assert.assertEquals("Expected more than one open window, found: " + StringUtils.join(handles, ","), 2, handles.size());
292-
_test.log("Current windows: [" + StringUtils.join(handles, ",") + "]");
290+
_test.log("Current window: " + currentWindow + ", all: [" + StringUtils.join(handles, ",") + "]");
293291
for (String handle : handles)
294292
{
295-
_test.log("window: " + handle);
293+
_test.log("inspecting window: " + handle);
296294
if (!currentWindow.equals(handle))
297295
{
296+
_test.log("switching to: " + handle);
298297
_test.getDriver().switchTo().window(handle);
299-
ret = _test.shortWait().withMessage("Unable to retrieve example data")
300-
.until(wd -> removeSpaces(StringUtils.trimToNull(_test.getHtmlSource())));
298+
ret = _test.shortWait().withMessage("Unable to retrieve example data after shortWait")
299+
.until(wd -> StringUtils.trimToNull(_test.getHtmlSource()));
300+
301+
if (StringUtils.trimToNull(ret) == null)
302+
{
303+
_test.checker().takeScreenShot("DownloadExampleData" + handle);
304+
}
305+
306+
Assert.assertNotNull("Unable to retrieve example data for window: " + handle, StringUtils.trimToNull(ret));
307+
ret = StringUtils.trimToNull(removeSpaces(ret));
308+
Assert.assertNotNull("Unable to retrieve example data for window after remove spaces: " + handle, ret);
301309

302310
_test.getDriver().close();
303311
_test.getDriver().switchTo().window(currentWindow);

0 commit comments

Comments
 (0)