Skip to content

Commit 8512707

Browse files
committed
Migrate many tests to Window.WindowFinder
1 parent 17e37de commit 8512707

File tree

2 files changed

+34
-32
lines changed

2 files changed

+34
-32
lines changed

SequenceAnalysis/test/src/org/labkey/test/tests/external/labModules/SequenceTest.java

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import org.labkey.test.WebTestHelper;
4141
import org.labkey.test.categories.External;
4242
import org.labkey.test.categories.LabModule;
43+
import org.labkey.test.components.ext4.Window;
4344
import org.labkey.test.util.DataRegionTable;
4445
import org.labkey.test.util.Ext4Helper;
4546
import org.labkey.test.util.PasswordUtil;
@@ -172,7 +173,7 @@ private void importReadsetMetadata()
172173
//create readset records for illumina run
173174
goToProjectHome();
174175
waitAndClick(Locator.linkWithText("Plan Sequence Run (Create Readsets)"));
175-
waitForElement(Ext4Helper.Locators.window("Create Readsets"));
176+
new Window.WindowFinder(getDriver()).withTitle("Create Readsets").waitFor();
176177
waitAndClickAndWait(Ext4Helper.Locators.ext4Button("Submit"));
177178

178179
_helper.waitForField("Sample Id", WAIT_FOR_PAGE);
@@ -182,7 +183,7 @@ private void importReadsetMetadata()
182183
setFormElementJS(Locator.name("text"), getIlluminaNames());
183184

184185
waitAndClick(Ext4Helper.Locators.ext4Button("Upload"));
185-
waitForElement(Ext4Helper.Locators.window("Success"));
186+
new Window.WindowFinder(getDriver()).withTitle("Success").waitFor();
186187
_readsetCt += 14;
187188
assertTextPresent("Success!");
188189
waitAndClickAndWait(Ext4Helper.Locators.ext4Button("OK"));
@@ -419,7 +420,7 @@ private void readsetFeaturesTest() throws IOException
419420
dr = new DataRegionTable("query", this);
420421
dr.checkAllOnPage();
421422
dr.clickHeaderMenu("More Actions", false, "Download Sequence Files");
422-
waitForElement(Ext4Helper.Locators.window("Export Files"));
423+
new Window.WindowFinder(getDriver()).withTitle("Export Files").waitFor();
423424
waitForText("Export Files As");
424425
Ext4CmpRef window = _ext4Helper.queryOne("#exportFilesWin", Ext4CmpRef.class);
425426
String fileName = "MyFile";
@@ -449,7 +450,7 @@ private void readsetFeaturesTest() throws IOException
449450
assertEquals("Incorrect number of rows selected", 1, dr.getCheckedCount(this));
450451

451452
dr.clickHeaderMenu("More Actions", false, "View FASTQC Report");
452-
waitForElement(Ext4Helper.Locators.window("FastQC"));
453+
new Window.WindowFinder(getDriver()).withTitle("FastQC").waitFor();
453454
waitAndClickAndWait(Ext4Helper.Locators.ext4Button("OK"));
454455

455456
waitForText("File Summary");
@@ -468,7 +469,7 @@ private void readsetFeaturesTest() throws IOException
468469
Ext4FieldRef.getForLabel(this, "Name").setValue(newName);
469470
sleep(250); //wait for value to save
470471
clickButton("Submit", 0);
471-
waitForElement(Ext4Helper.Locators.window("Success"));
472+
new Window.WindowFinder(getDriver()).withTitle("Success").waitFor();
472473
assertTextPresent("Your upload was successful!");
473474
clickButton("OK");
474475

@@ -500,7 +501,7 @@ private void analysisPanelTest() throws Exception
500501
rowIds.add(dr.getDataAsText(6, "Readset Id"));
501502

502503
dr.clickHeaderMenu("More Actions", false, "Align/Analyze Selected");
503-
waitForElement(Ext4Helper.Locators.window("Import Data"));
504+
new Window.WindowFinder(getDriver()).withTitle("Import Data").waitFor();
504505
waitForText("Description");
505506
waitAndClickAndWait(Ext4Helper.Locators.ext4Button("Submit"));
506507

@@ -516,7 +517,7 @@ private void analysisPanelTest() throws Exception
516517
String[][] rocheAdapters = {{"Roche-454 FLX Amplicon A", "GCCTCCCTCGCGCCATCAG"}, {"Roche-454 FLX Amplicon B", "GCCTTGCCAGCCCGCTCAG"}};
517518

518519
waitForText("Readset Name");
519-
waitForElement(Ext4Helper.Locators.window("Copy Previous Run?"));
520+
new Window.WindowFinder(getDriver()).withTitle("Copy Previous Run?").waitFor();
520521
waitAndClick(Ext4Helper.Locators.window("Copy Previous Run?").append(Ext4Helper.Locators.ext4Button("Cancel")));
521522
waitForElementToDisappear(Ext4Helper.Locators.window("Copy Previous Run?"));
522523

@@ -534,7 +535,7 @@ private void analysisPanelTest() throws Exception
534535
waitForElement(win);
535536

536537
waitAndClick(Locator.id(_ext4Helper.queryOne("window ldk-linkbutton[text='View Description']", Ext4CmpRef.class).getId()).append(Locator.tag("a")));
537-
waitForElement(Ext4Helper.Locators.window("Tool Details"));
538+
new Window.WindowFinder(getDriver()).withTitle("Tool Details").waitFor();
538539
waitAndClick(Ext4Helper.Locators.window("Tool Details").append(Ext4Helper.Locators.ext4Button("Done")));
539540

540541
List<Ext4CmpRef> btns = _ext4Helper.componentQuery("window ldk-linkbutton[text='Add']", Ext4CmpRef.class);
@@ -578,7 +579,7 @@ private void analysisPanelTest() throws Exception
578579

579580
waitForText("Adapters");
580581
waitAndClick(Ext4Helper.Locators.ext4Button("Common Adapters").index(1));
581-
waitForElement(Ext4Helper.Locators.window("Choose Adapters"));
582+
new Window.WindowFinder(getDriver()).withTitle("Choose Adapters").waitFor();
582583
waitForText("Choose Adapter Group");
583584
Ext4FieldRef.getForLabel(this, "Choose Adapter Group").setValue("Roche-454 FLX Amplicon");
584585
waitAndClick(Ext4Helper.Locators.ext4Button("Submit"));
@@ -770,7 +771,7 @@ private void alignmentImportPanelTest(boolean sequencePipelineEnabled) throws Ex
770771
Assert.assertEquals("Incorrect starting value for input file-handling field", "delete", treatmentField.getValue());
771772

772773
waitAndClick(Ext4Helper.Locators.ext4Button("Import Data"));
773-
waitForElement(Ext4Helper.Locators.window("Error"));
774+
new Window.WindowFinder(getDriver()).withTitle("Error").waitFor();
774775
waitForElement(Locator.tagContainingText("div", "There are 4 errors. Please review the cells highlighted in red."));
775776
click(Ext4Helper.Locators.ext4Button("OK"));
776777

@@ -808,7 +809,7 @@ private void alignmentImportPanelTest(boolean sequencePipelineEnabled) throws Ex
808809
assertNull("genome field not set, except params to be null", panel.getEval("getJsonParams()"));
809810

810811
//close alert
811-
waitForElement(Ext4Helper.Locators.window("Error"));
812+
new Window.WindowFinder(getDriver()).withTitle("Error").waitFor();
812813
click(Ext4Helper.Locators.ext4Button("OK"));
813814

814815
//set genome field
@@ -949,7 +950,7 @@ private void readsetPanelTest() throws IOException
949950
//then split groups
950951
waitAndClick(readDataGrid.getRow(2));
951952
readDataGrid.clickTbarButton("Split/Regroup Selected");
952-
waitForElement(Ext4Helper.Locators.window("Split/Regroup Files"));
953+
new Window.WindowFinder(getDriver()).withTitle("Split/Regroup Files").waitFor();
953954
String groupName = "NewGroup";
954955
_ext4Helper.queryOne("window textfield", Ext4FieldRef.class).setValue(groupName);
955956
waitAndClick(Ext4Helper.Locators.ext4ButtonEnabled("OK"));
@@ -1000,7 +1001,7 @@ private void readsetPanelTest() throws IOException
10001001
assertTrue("3' barcode column should be hidden", (Boolean) readsetGrid.getEval("columns[3].hidden"));
10011002

10021003
waitAndClick(Ext4Helper.Locators.ext4Button("Import Data"));
1003-
waitForElement(Ext4Helper.Locators.window("Error"));
1004+
new Window.WindowFinder(getDriver()).withTitle("Error").waitFor();
10041005
Locator errorEl = Locator.tagContainingText("div", "There are 12 errors. Please review the cells highlighted in red.").notHidden();
10051006
waitForElement(errorEl);
10061007
click(Ext4Helper.Locators.ext4Button("OK"));
@@ -1011,7 +1012,7 @@ private void readsetPanelTest() throws IOException
10111012
readsetGrid.setGridCell(2, "readsetname", "Readset1"); //duplicate name
10121013

10131014
waitAndClick(Ext4Helper.Locators.ext4Button("Import Data"));
1014-
waitForElement(Ext4Helper.Locators.window("Error"));
1015+
new Window.WindowFinder(getDriver()).withTitle("Error").waitFor();
10151016
waitForElement(Locator.tagContainingText("div", "There are 2 errors. Please review the cells highlighted in red. Note: you can hover over the cell for more information on the issue."));
10161017
waitAndClick(Ext4Helper.Locators.ext4Button("OK"));
10171018

@@ -1022,7 +1023,7 @@ private void readsetPanelTest() throws IOException
10221023
readsetGrid.setGridCellJS(1, "barcode5", barcode);
10231024
readsetGrid.setGridCellJS(2, "barcode3", barcode);
10241025
waitAndClick(Ext4Helper.Locators.ext4Button("Import Data"));
1025-
waitForElement(Ext4Helper.Locators.window("Error"));
1026+
new Window.WindowFinder(getDriver()).withTitle("Error").waitFor();
10261027

10271028
waitForElement(Locator.tagContainingText("div", "There are 4 errors. Please review the cells highlighted in red."));
10281029
click(Ext4Helper.Locators.ext4Button("OK"));
@@ -1291,7 +1292,7 @@ private void readsetImportTest() throws IOException, CommandException
12911292
goToProjectHome();
12921293
_helper.initiatePipelineJob(_readsetPipelineName, Arrays.asList(filename1, filename2), getProjectName());
12931294
waitForText("Job Name");
1294-
waitForElement(Ext4Helper.Locators.window("Error"));
1295+
new Window.WindowFinder(getDriver()).withTitle("Error").waitFor();
12951296
waitForElement(Locator.tagContainingText("div", "There are errors with the input files"));
12961297
isTextPresent("File is already used in existing readsets')]");
12971298
waitAndClick(Ext4Helper.Locators.ext4Button("OK"));
@@ -1437,13 +1438,13 @@ public static Integer createReferenceGenome(BaseWebDriverTest test, int previous
14371438
dr.setFilter("name", "Equals", "SIVmac239_Test");
14381439
dr.checkCheckbox(0);
14391440
dr.clickHeaderMenu("More Actions", false, "Create Reference Genome");
1440-
test.waitForElement(Ext4Helper.Locators.window("Create Reference Genome"));
1441+
new Window.WindowFinder(test.getDriver()).withTitle("Create Reference Genome").waitFor();
14411442
Ext4FieldRef.getForLabel(test, "Name").setValue(TEST_GENOME_NAME);
14421443
String description = "This is a reference genome description";
14431444
Ext4FieldRef.getForLabel(test, "Description").setValue(description);
14441445
Ext4FieldRef.getForLabel(test, "Skip Aligner Index Creation").setChecked(true); //skip this since it requires sequence tools
14451446
test.waitAndClick(Ext4Helper.Locators.ext4ButtonEnabled("Submit"));
1446-
test.waitForElement(Ext4Helper.Locators.window("Success"));
1447+
new Window.WindowFinder(test.getDriver()).withTitle("Success").waitFor();
14471448
test.waitAndClickAndWait(Ext4Helper.Locators.ext4ButtonEnabled("OK"));
14481449
test.waitForPipelineJobsToComplete(previouslyStartedPipelineJobs + 1, "Create Reference Genome", false);
14491450
test.goToProjectHome();
@@ -1481,14 +1482,14 @@ public static int addReferenceGenomeTracks(BaseWebDriverTest test, String projec
14811482
test.log("adding track: " + f.getName());
14821483
DataRegionTable dr2 = DataRegionTable.findDataRegionWithinWebpart(test, "Annotations/Tracks");
14831484
dr2.clickHeaderButton("Add Annotation");
1484-
test.waitForElement(Ext4Helper.Locators.window("Import Annotations/Tracks"));
1485+
new Window.WindowFinder(test.getDriver()).withTitle("Import Annotations/Tracks").waitFor();
14851486
Ext4FieldRef.getForLabel(test, "Track Name").setValue(LabModuleHelper.getBaseName(f.getName()));
14861487
Ext4FieldRef.getForLabel(test, "Description").setValue("This is the track description");
14871488
Ext4FileFieldRef fileField = test._ext4Helper.queryOne("field[fieldLabel=File]", Ext4FileFieldRef.class);
14881489
fileField.setToFile(f);
14891490

14901491
test.waitAndClick(Ext4Helper.Locators.ext4ButtonEnabled("Submit"));
1491-
test.waitForElement(Ext4Helper.Locators.window("Success"));
1492+
new Window.WindowFinder(test.getDriver()).withTitle("Success").waitFor();
14921493
test.waitAndClickAndWait(Ext4Helper.Locators.ext4ButtonEnabled("OK"));
14931494
test.waitAndClickAndWait(Locator.tagWithText("a", "All"));
14941495

@@ -1517,14 +1518,14 @@ public static int addReferenceGenomeTracks(BaseWebDriverTest test, String projec
15171518
grid.setGridCellJS(1, "libraryId", genomeId);
15181519

15191520
test.waitAndClick(Ext4Helper.Locators.ext4ButtonEnabled("Submit"));
1520-
test.waitForElement(Ext4Helper.Locators.window("Error"));
1521+
new Window.WindowFinder(test.getDriver()).withTitle("Error").waitFor();
15211522
test.waitAndClick(Ext4Helper.Locators.ext4ButtonEnabled("OK"));
15221523

15231524
grid.setGridCellJS(2, "name", "Track2");
15241525
grid.setGridCellJS(2, "libraryId", genomeId);
15251526

15261527
test.waitAndClick(Ext4Helper.Locators.ext4ButtonEnabled("Submit"));
1527-
test.waitForElement(Ext4Helper.Locators.window("Success"));
1528+
new Window.WindowFinder(test.getDriver()).withTitle("Success").waitFor();
15281529
test.waitAndClickAndWait(Ext4Helper.Locators.ext4ButtonEnabled("OK"));
15291530
test.waitAndClickAndWait(Locator.tagWithText("a", "All"));
15301531

@@ -1557,11 +1558,11 @@ public static void addOutputFile(BaseWebDriverTest test, File toAdd, String geno
15571558
dr.clickHeaderButton("Import Files");
15581559
if (!isWorkbook)
15591560
{
1560-
test.waitForElement(Ext4Helper.Locators.window("Import Sequence Output File"));
1561+
new Window.WindowFinder(test.getDriver()).withTitle("Import Sequence Output File").waitFor();
15611562
test.waitAndClick(Ext4Helper.Locators.ext4Button("Submit"));
15621563
}
15631564

1564-
test.waitForElement(Ext4Helper.Locators.window("Import Output File"));
1565+
new Window.WindowFinder(test.getDriver()).withTitle("Import Output File").waitFor();
15651566
Ext4FieldRef.getForLabel(test, "Name").setValue(name);
15661567
Ext4ComboRef.getForLabel(test, "Category").setValue(category);
15671568
Ext4FieldRef.getForLabel(test, "Description").setValue(description);
@@ -1571,7 +1572,7 @@ public static void addOutputFile(BaseWebDriverTest test, File toAdd, String geno
15711572
fileField.setToFile(toAdd);
15721573

15731574
test.waitAndClick(Ext4Helper.Locators.ext4ButtonEnabled("Submit"));
1574-
test.waitForElement(Ext4Helper.Locators.window("Success"));
1575+
new Window.WindowFinder(test.getDriver()).withTitle("Success").waitFor();
15751576
test.waitAndClickAndWait(Ext4Helper.Locators.ext4ButtonEnabled("OK"));
15761577
}
15771578

@@ -1606,7 +1607,7 @@ private void basicOutputFilesTest(boolean sequencePipelineEnabled) throws Except
16061607
dr.clickHeaderButton("Visualize/Analyze Data");
16071608

16081609
//verify some of the handlers present
1609-
waitForElement(Ext4Helper.Locators.window("Visualize/Analyze Files"));
1610+
new Window.WindowFinder(getDriver()).withTitle("Visualize/Analyze Files").waitFor();
16101611
waitForElement(Locator.tagWithText("div", "Calculate Local Haplotypes"));
16111612
assertElementPresent(Locator.tagWithText("div", "Cleanup BAM File"));
16121613
assertElementPresent(Locator.tagWithText("div", "Picard Metrics"));
@@ -1616,11 +1617,11 @@ private void basicOutputFilesTest(boolean sequencePipelineEnabled) throws Except
16161617
waitAndClick(Ext4Helper.Locators.ext4Button("Submit"));
16171618

16181619
//workbook window
1619-
waitForElement(Ext4Helper.Locators.window("Create New Workbook or Add To Existing?"));
1620+
new Window.WindowFinder(getDriver()).withTitle("Create New Workbook or Add To Existing?").waitFor();
16201621
waitAndClick(Ext4Helper.Locators.ext4Button("Submit"));
16211622

16221623
//tool window
1623-
waitForElement(Ext4Helper.Locators.window("Picard Metrics"));
1624+
new Window.WindowFinder(getDriver()).withTitle("Picard Metrics").waitFor();
16241625

16251626
if (sequencePipelineEnabled)
16261627
{

jbrowse/test/src/org/labkey/test/tests/external/labModules/JBrowseTest.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.labkey.test.BaseWebDriverTest;
2424
import org.labkey.test.TestFileUtils;
2525
import org.labkey.test.TestTimeoutException;
26+
import org.labkey.test.components.ext4.Window;
2627
import org.labkey.test.util.DataRegionTable;
2728
import org.labkey.test.util.Ext4Helper;
2829
import org.labkey.test.util.ext4cmp.Ext4ComboRef;
@@ -230,11 +231,11 @@ private void testOutputFileProcessing() throws Exception
230231
dr.clickHeaderMenu("More Actions", false, "View In JBrowse");
231232

232233
String sessionName = "TestSession1";
233-
waitForElement(Ext4Helper.Locators.window("Create/Modify JBrowse Session"));
234+
new Window.WindowFinder(getDriver()).withTitle("Create/Modify JBrowse Session").waitFor();
234235
Ext4FieldRef.getForLabel(this, "Name").setValue(sessionName);
235236
Ext4FieldRef.getForLabel(this, "Description").setValue("This is the first session");
236237
waitAndClick(Ext4Helper.Locators.ext4ButtonEnabled("Submit"));
237-
waitForElement(Ext4Helper.Locators.window("Success"));
238+
new Window.WindowFinder(getDriver()).withTitle("Success").waitFor();
238239
waitAndClickAndWait(Ext4Helper.Locators.ext4ButtonEnabled("OK"));
239240
_completedPipelineJobs++;
240241
waitForPipelineJobsToComplete(_completedPipelineJobs, "Create New Session", false);
@@ -250,12 +251,12 @@ private void testOutputFileProcessing() throws Exception
250251
dr.checkCheckbox(1);
251252
dr.checkCheckbox(2);
252253
dr.clickHeaderMenu("More Actions", false, "View In JBrowse");
253-
waitForElement(Ext4Helper.Locators.window("Create/Modify JBrowse Session"));
254+
new Window.WindowFinder(getDriver()).withTitle("Create/Modify JBrowse Session").waitFor();
254255
Ext4FieldRef.getForBoxLabel(this, "Add To Existing Session").setChecked(true);
255256
Ext4FieldRef.waitForField(this, "Session");
256257
Ext4ComboRef.getForLabel(this, "Session").setComboByDisplayValue(sessionName);
257258
waitAndClick(Ext4Helper.Locators.ext4ButtonEnabled("Submit"));
258-
waitForElement(Ext4Helper.Locators.window("Success"));
259+
new Window.WindowFinder(getDriver()).withTitle("Success").waitFor();
259260
waitAndClickAndWait(Ext4Helper.Locators.ext4ButtonEnabled("OK"));
260261
_completedPipelineJobs++;
261262
waitForPipelineJobsToComplete(_completedPipelineJobs, "Add To Existing Session", false);

0 commit comments

Comments
 (0)