Skip to content

Commit 11bd758

Browse files
committed
initial selenium tests
1 parent ff6ace4 commit 11bd758

File tree

1 file changed

+36
-8
lines changed

1 file changed

+36
-8
lines changed

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

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,15 @@
1919
import org.apache.commons.lang3.StringUtils;
2020
import org.apache.commons.lang3.SystemUtils;
2121
import org.junit.Test;
22+
import org.junit.experimental.categories.Category;
2223
import org.labkey.serverapi.reader.Readers;
2324
import org.labkey.test.BaseWebDriverTest;
2425
import org.labkey.test.Locator;
26+
import org.labkey.test.Locators;
2527
import org.labkey.test.TestFileUtils;
2628
import org.labkey.test.TestTimeoutException;
29+
import org.labkey.test.categories.External;
30+
import org.labkey.test.categories.LabModule;
2731
import org.labkey.test.components.ext4.Window;
2832
import org.labkey.test.util.DataRegionTable;
2933
import org.labkey.test.util.Ext4Helper;
@@ -45,13 +49,19 @@
4549
import java.util.zip.ZipEntry;
4650
import java.util.zip.ZipInputStream;
4751

52+
import java.util.Set;
53+
import org.jetbrains.annotations.NotNull;
54+
import org.openqa.selenium.Keys;
55+
import org.openqa.selenium.WebElement;
56+
import org.openqa.selenium.By;
57+
import org.openqa.selenium.interactions.Actions;
4858

4959
/**
5060
* Created by bimber on 1/20/2015.
5161
*/
5262

5363
//disabled until we have a solution to install the jbrowse scripts on team city
54-
//@Category({External.class, LabModule.class})
64+
@Category({External.class, LabModule.class})
5565
public class JBrowseTest extends BaseWebDriverTest
5666
{
5767
protected LabModuleHelper _helper = new LabModuleHelper(this);
@@ -67,18 +77,33 @@ protected String getProjectName()
6777
public void testSteps() throws Exception
6878
{
6979
setUpTest();
70-
80+
testDemoNoSession();
7181
testDemoUi();
7282
//testOutputFileProcessing();
7383
}
7484

75-
private void testDemoUi()
85+
private void testDemoNoSession()
7686
{
77-
beginAt("/home/jbrowse-jbrowse.view");
78-
79-
waitAndClick(Locator.tagWithClass("span", "MuiButton-label"));
87+
beginAt("/home/jbrowse-jbrowse.view?");
88+
assertElementVisible(Locator.xpath("/html/body/div[2]/div/div[3]/div/div/div/p"));
89+
}
8090

81-
waitAndClick(Locator.tagWithClass("span", "MuiButton-label").containing("Open track selector"));
91+
private void testDemoUi()
92+
{
93+
beginAt("/home/jbrowse-jbrowse.view?session=demo");
94+
95+
waitAndClick(Locator.xpath("//*[text() = 'Open track selector']/.."));
96+
waitAndClick(Locator.xpath("//*[text() = 'ClinVar variants (NCBI)']")); // Display the relevant variants
97+
Locator.css("body").findElement(getDriver()).sendKeys(Keys.ESCAPE); // exit out of our modal
98+
while (isTextPresent("Loading")){ // wait for loading to finish up
99+
sleep(10);
100+
}
101+
waitAndClick(Locator.xpath("//span[text()='ClinVar variants (NCBI)']/../button[2]")); // three dots
102+
waitAndClick(Locator.xpath("//span[text()='WidgetDisplay']")); // WidgetDisplay option
103+
Actions actions = new Actions(getDriver());
104+
WebElement toClick = getDriver().findElement(By.xpath("//*[name()='text' and contains(text(), '294665')]/..")); // 294665 is a visible element given minimalSession's location
105+
actions.click(toClick).perform();
106+
assertTextPresent("Hello"); // Check our modal displayed correctly
82107

83108
}
84109

@@ -94,10 +119,11 @@ protected void setUpTest() throws Exception
94119
_containerHelper.enableModule("JBrowse");
95120

96121
//create genome and add resources
97-
Integer genomeId = SequenceTest.createReferenceGenome(this, _completedPipelineJobs);
122+
/*Integer genomeId = SequenceTest.createReferenceGenome(this, _completedPipelineJobs);
98123
_completedPipelineJobs++; //keep track of pipeline jobs
99124
100125
_completedPipelineJobs = SequenceTest.addReferenceGenomeTracks(this, getProjectName(), SequenceTest.TEST_GENOME_NAME, genomeId, _completedPipelineJobs);
126+
*/
101127
}
102128

103129
@Override
@@ -164,4 +190,6 @@ public List<String> getAssociatedModules()
164190
// //TODO: reprocess one of these JSONFiles. make sure original files are deleted + session reprocessed
165191
// beginAt("/sequenceanalysis/" + getContainerId() + "/begin.view");
166192
// }
193+
194+
167195
}

0 commit comments

Comments
 (0)