Revision 612bd041
Added by Andreas Kohlbecker almost 13 years ago
.gitattributes | ||
---|---|---|
272 | 272 |
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/pages/PolytomousKeyPage.java -text |
273 | 273 |
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/pages/PortalPage.java -text |
274 | 274 |
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/pages/TaxonProfilePage.java -text |
275 |
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/selenium/AllTrue.java -text |
|
275 | 276 |
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/selenium/JUnitWebDriverWait.java -text |
277 |
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/selenium/UrlLoaded.java -text |
|
276 | 278 |
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/selenium/VisibilityOfElementLocated.java -text |
277 | 279 |
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/selenium/WebDriverFactory.java -text |
278 | 280 |
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/resources/eu/etaxonomy/dataportal/DataPortalTest.xml -text |
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/pages/PolytomousKeyPage.java | ||
---|---|---|
15 | 15 |
import org.openqa.selenium.support.PageFactory; |
16 | 16 |
|
17 | 17 |
import eu.etaxonomy.dataportal.DataPortalContext; |
18 |
import eu.etaxonomy.dataportal.selenium.AllTrue; |
|
19 |
import eu.etaxonomy.dataportal.selenium.UrlLoaded; |
|
18 | 20 |
import eu.etaxonomy.dataportal.selenium.VisibilityOfElementLocated; |
19 | 21 |
|
20 | 22 |
public class PolytomousKeyPage extends PortalPage { |
... | ... | |
99 | 101 |
WebElement linkContainer = keyEntry.findElement(By.className(data.linkClass.name())); |
100 | 102 |
WebElement link = linkContainer.findElement(By.tagName("a")); |
101 | 103 |
Assert.assertEquals("link text", data.linkText, link.getText()); |
102 |
logger.info("testing " + data.linkClass.name() + " : " + getInitialUrlBase() + ":" + link.getAttribute("href")); |
|
104 |
String linkUrl = link.getAttribute("href"); |
|
105 |
|
|
106 |
logger.info("clicking on " + data.linkClass.name() + " : " + linkUrl); |
|
103 | 107 |
|
104 | 108 |
// click and wait |
105 | 109 |
link.click(); |
106 |
wait.until(new VisibilityOfElementLocated(By.id("container")));
|
|
110 |
wait.until(new AllTrue(new UrlLoaded(linkUrl), new VisibilityOfElementLocated(By.id("container"))));
|
|
107 | 111 |
|
108 | 112 |
PortalPage nextPage = null; |
109 | 113 |
if(data.linkClass.equals(LinkClass.nodeLinkToTaxon)){ |
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/selenium/AllTrue.java | ||
---|---|---|
1 |
/** |
|
2 |
* |
|
3 |
*/ |
|
4 |
package eu.etaxonomy.dataportal.selenium; |
|
5 |
|
|
6 |
import java.util.ArrayList; |
|
7 |
import java.util.Arrays; |
|
8 |
import java.util.List; |
|
9 |
|
|
10 |
import org.openqa.selenium.WebDriver; |
|
11 |
|
|
12 |
import com.google.common.base.Function; |
|
13 |
|
|
14 |
/** |
|
15 |
* @author andreas |
|
16 |
* |
|
17 |
*/ |
|
18 |
public class AllTrue implements Function<WebDriver, Boolean> { |
|
19 |
|
|
20 |
List<Function<WebDriver, Boolean>> functions = new ArrayList<Function<WebDriver, Boolean>>(); |
|
21 |
|
|
22 |
public AllTrue(Function<WebDriver, Boolean> ... functions) { |
|
23 |
if(functions == null){ |
|
24 |
throw new NullPointerException("Constructor parameter mus not be null"); |
|
25 |
} |
|
26 |
this.functions = Arrays.asList(functions); |
|
27 |
} |
|
28 |
|
|
29 |
/* (non-Javadoc) |
|
30 |
* @see com.google.common.base.Function#apply(java.lang.Object) |
|
31 |
*/ |
|
32 |
public Boolean apply(WebDriver driver) { |
|
33 |
Boolean allTrue = true; |
|
34 |
for(Function<WebDriver, Boolean> f : functions){ |
|
35 |
allTrue &= f.apply(driver); |
|
36 |
} |
|
37 |
return allTrue; |
|
38 |
} |
|
39 |
|
|
40 |
} |
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/selenium/UrlLoaded.java | ||
---|---|---|
1 |
/** |
|
2 |
* |
|
3 |
*/ |
|
4 |
package eu.etaxonomy.dataportal.selenium; |
|
5 |
|
|
6 |
import org.openqa.selenium.WebDriver; |
|
7 |
|
|
8 |
import com.google.common.base.Function; |
|
9 |
|
|
10 |
/** |
|
11 |
* @author andreas |
|
12 |
* |
|
13 |
*/ |
|
14 |
public class UrlLoaded implements Function<WebDriver, Boolean> { |
|
15 |
|
|
16 |
String url; |
|
17 |
|
|
18 |
public UrlLoaded(String url) { |
|
19 |
this.url = url; |
|
20 |
} |
|
21 |
|
|
22 |
/* (non-Javadoc) |
|
23 |
* @see com.google.common.base.Function#apply(java.lang.Object) |
|
24 |
*/ |
|
25 |
public Boolean apply(WebDriver driver) { |
|
26 |
return driver.getCurrentUrl().equals(url); |
|
27 |
} |
|
28 |
|
|
29 |
} |
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/selenium/VisibilityOfElementLocated.java | ||
---|---|---|
12 | 12 |
* @author andreas |
13 | 13 |
* |
14 | 14 |
*/ |
15 |
public class VisibilityOfElementLocated implements Function<WebDriver, Object> {
|
|
15 |
public class VisibilityOfElementLocated implements Function<WebDriver, Boolean> {
|
|
16 | 16 |
|
17 | 17 |
By findCondition; |
18 | 18 |
|
Also available in: Unified diff
improved waiting