Skip to content

Commit 3262c46

Browse files
committed
Merge discvr-21.3 to discvr-21.7
2 parents 1fa8c4a + dbad6c2 commit 3262c46

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,21 @@
2020
import org.junit.Assert;
2121
import org.labkey.test.BaseWebDriverTest;
2222
import org.labkey.test.Locator;
23+
import org.labkey.test.WebDriverWrapper;
2324
import org.labkey.test.util.DataRegionTable;
2425
import org.labkey.test.util.Ext4Helper;
2526
import org.labkey.test.util.UIAssayHelper;
2627
import org.labkey.test.util.ext4cmp.Ext4CmpRef;
2728
import org.labkey.test.util.ext4cmp.Ext4ComboRef;
2829
import org.labkey.test.util.ext4cmp.Ext4FieldRef;
2930
import org.labkey.test.util.ext4cmp.Ext4GridRef;
31+
import org.openqa.selenium.TimeoutException;
3032

3133
import java.io.File;
3234
import java.text.SimpleDateFormat;
3335
import java.util.List;
3436
import java.util.Random;
37+
import java.util.Set;
3538

3639
import static org.junit.Assert.assertEquals;
3740
import static org.junit.Assert.assertTrue;
@@ -249,10 +252,33 @@ public void goToAssayResultImport(String assayName, boolean supportsTemplates)
249252
_test.waitForText("Data Import");
250253
}
251254

255+
public String clickAndGetExampleData()
256+
{
257+
Locator btn = Locator.linkContainingText("Download Example Data");
258+
_test.waitForElement(btn);
259+
_test.waitAndClick(btn);
260+
261+
int iterations = 0;
262+
while (_test.getDriver().getWindowHandles().size() < 2)
263+
{
264+
iterations++;
265+
WebDriverWrapper.sleep(100);
266+
267+
if (iterations > 20)
268+
{
269+
throw new TimeoutException("Timed out waiting for second browser window");
270+
}
271+
}
272+
273+
return getExampleData();
274+
}
275+
252276
public String getExampleData()
253277
{
254278
String ret = null;
255279

280+
Set<String> handles = _test.getDriver().getWindowHandles();
281+
Assert.assertTrue("Expected more than one open window, was: " + handles.size(), handles.size() > 1);
256282
String currentWindow = _test.getDriver().getWindowHandle();
257283
for (String handle : _test.getDriver().getWindowHandles())
258284
{

0 commit comments

Comments
 (0)