|
20 | 20 | import org.junit.Assert; |
21 | 21 | import org.labkey.test.BaseWebDriverTest; |
22 | 22 | import org.labkey.test.Locator; |
| 23 | +import org.labkey.test.WebDriverWrapper; |
23 | 24 | import org.labkey.test.util.DataRegionTable; |
24 | 25 | import org.labkey.test.util.Ext4Helper; |
25 | 26 | import org.labkey.test.util.UIAssayHelper; |
26 | 27 | import org.labkey.test.util.ext4cmp.Ext4CmpRef; |
27 | 28 | import org.labkey.test.util.ext4cmp.Ext4ComboRef; |
28 | 29 | import org.labkey.test.util.ext4cmp.Ext4FieldRef; |
29 | 30 | import org.labkey.test.util.ext4cmp.Ext4GridRef; |
| 31 | +import org.openqa.selenium.TimeoutException; |
30 | 32 |
|
31 | 33 | import java.io.File; |
32 | 34 | import java.text.SimpleDateFormat; |
33 | 35 | import java.util.List; |
34 | 36 | import java.util.Random; |
| 37 | +import java.util.Set; |
35 | 38 |
|
36 | 39 | import static org.junit.Assert.assertEquals; |
37 | 40 | import static org.junit.Assert.assertTrue; |
@@ -249,10 +252,33 @@ public void goToAssayResultImport(String assayName, boolean supportsTemplates) |
249 | 252 | _test.waitForText("Data Import"); |
250 | 253 | } |
251 | 254 |
|
| 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 | + |
252 | 276 | public String getExampleData() |
253 | 277 | { |
254 | 278 | String ret = null; |
255 | 279 |
|
| 280 | + Set<String> handles = _test.getDriver().getWindowHandles(); |
| 281 | + Assert.assertTrue("Expected more than one open window, was: " + handles.size(), handles.size() > 1); |
256 | 282 | String currentWindow = _test.getDriver().getWindowHandle(); |
257 | 283 | for (String handle : _test.getDriver().getWindowHandles()) |
258 | 284 | { |
|
0 commit comments