1515 */
1616package org .labkey .test .pipeline ;
1717
18- import org .apache . commons . lang3 . StringUtils ;
18+ import org .labkey . test . BaseWebDriverTest ;
1919import org .labkey .test .Locator ;
20+ import org .labkey .test .components .WebDriverComponent ;
21+ import org .openqa .selenium .WebDriver ;
22+ import org .openqa .selenium .WebElement ;
2023
21- import static org .junit .Assert .* ;
24+ import static org .junit .Assert .assertTrue ;
2225
2326/**
2427 * <code>ExperimentGraph</code>
2528 */
26- public class ExperimentGraph
29+ public class ExperimentGraph extends WebDriverComponent
2730{
28- private static final String MAP_NAME = "graphmap" ;
29-
30- private final PipelineWebTestBase _test ;
31+ private final WebElement _el ;
32+ private final WebDriver _driver ;
3133
32- public ExperimentGraph (PipelineWebTestBase test )
34+ public ExperimentGraph (BaseWebDriverTest test )
3335 {
34- _test = test ;
36+ _driver = test .getDriver ();
37+ _el = Locator .id ("graph_root" ).findElement (test .getDriver ());
38+ }
39+
40+ @ Override
41+ protected WebDriver getDriver ()
42+ {
43+ return _driver ;
44+ }
45+
46+ @ Override
47+ public WebElement getComponentElement ()
48+ {
49+ return _el ;
3550 }
3651
3752 public void clickLink (String link )
3853 {
39- _test .clickAndWait (Locator . imageMapLinkByTitle ( MAP_NAME , link ));
54+ getWrapper () .clickAndWait (svgLinkByTitle ( link ));
4055 }
4156
4257 public void clickInputLink (String input )
@@ -61,7 +76,7 @@ public String getOutputLinkText(String output)
6176
6277 public boolean isNodePresent (String link )
6378 {
64- return _test . isElementPresent ( Locator . imageMapLinkByTitle ( MAP_NAME , link ));
79+ return svgLinkByTitle ( link ). isDisplayed ( );
6580 }
6681
6782 public boolean isInputPresent (String input )
@@ -94,20 +109,14 @@ public void validate(PipelineTestParams tp)
94109 String [] names = tp .getExperimentLinks ();
95110 for (String name : names )
96111 {
97- if (_test .isTextPresent (name ))
98- {
99- assertNodePresent (name );
100- String baseName = getBaseName (tp );
101- assertInputPresent (tp .getParametersFile ());
102- for (String inputExt : tp .getInputExtensions ())
103- assertInputPresent (baseName + inputExt );
104- for (String outputExt : tp .getOutputExtensions ())
105- assertOutputPresent (baseName + outputExt );
106- return ;
107- }
112+ assertNodePresent (name );
113+ String baseName = getBaseName (tp );
114+ assertInputPresent (tp .getParametersFile ());
115+ for (String inputExt : tp .getInputExtensions ())
116+ assertInputPresent (baseName + inputExt );
117+ for (String outputExt : tp .getOutputExtensions ())
118+ assertOutputPresent (baseName + outputExt );
108119 }
109-
110- assertTrue ("Unable to find experiment links: " + StringUtils .join (names , ", " ), false );
111120 }
112121
113122 private String getBaseName (PipelineTestParams tp )
@@ -122,12 +131,18 @@ private String getBaseName(PipelineTestParams tp)
122131 {
123132 for (String sampleName : sampleNames )
124133 {
125- if (_test .isTextPresent (sampleName ))
134+ if (getWrapper () .isTextPresent (sampleName ))
126135 return sampleName ;
127136 }
128137 }
129138
130139 // Probably fail later, but simpler than checking for null return.
131140 return "all" ;
132141 }
142+
143+ private WebElement svgLinkByTitle (String title )
144+ {
145+ return Locator .css ("a" ).withAttribute ("xlink\\ :title" , title ).findWhenNeeded (_el );
146+ }
147+
133148}
0 commit comments