Revision c22027c0
Added by Andreas Kohlbecker almost 13 years ago
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/pages/PortalPage.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import java.net.MalformedURLException; |
4 | 4 |
import java.net.URL; |
5 |
import java.util.ArrayList; |
|
6 |
import java.util.List; |
|
5 | 7 |
|
6 | 8 |
import org.apache.log4j.Logger; |
9 |
import org.openqa.selenium.By; |
|
7 | 10 |
import org.openqa.selenium.RenderedWebElement; |
8 | 11 |
import org.openqa.selenium.WebDriver; |
12 |
import org.openqa.selenium.WebElement; |
|
9 | 13 |
import org.openqa.selenium.support.CacheLookup; |
10 | 14 |
import org.openqa.selenium.support.FindBy; |
15 |
import org.openqa.selenium.support.FindBys; |
|
11 | 16 |
import org.openqa.selenium.support.PageFactory; |
12 | 17 |
|
13 | 18 |
import eu.etaxonomy.dataportal.TestConfiguration; |
19 |
import eu.etaxonomy.dataportal.elements.LinkElement; |
|
14 | 20 |
import eu.etaxonomy.dataportal.selenium.JUnitWebDriverWait; |
15 | 21 |
|
16 | 22 |
public class PortalPage { |
... | ... | |
21 | 27 |
protected final JUnitWebDriverWait wait; |
22 | 28 |
protected URL initialUrl; |
23 | 29 |
|
24 |
@FindBy(id= "cdm_dataportal.node")
|
|
30 |
@FindBy(id="cdm_dataportal.node") |
|
25 | 31 |
@CacheLookup |
26 | 32 |
private RenderedWebElement portalContent; |
27 | 33 |
|
28 |
@FindBy(tagName= "title")
|
|
34 |
@FindBy(tagName="title") |
|
29 | 35 |
@CacheLookup |
30 | 36 |
private RenderedWebElement title; |
31 | 37 |
|
38 |
//tabs primary |
|
39 |
@FindBys({@FindBy(id="tabs-wrapper"), @FindBy(className="primary")}) |
|
40 |
@CacheLookup |
|
41 |
private RenderedWebElement primaryTabs; |
|
42 |
|
|
32 | 43 |
public PortalPage(WebDriver driver) throws MalformedURLException { |
33 | 44 |
this.driver = driver; |
34 | 45 |
this.initialUrl = new URL(driver.getCurrentUrl()); |
... | ... | |
50 | 61 |
return title.getText(); |
51 | 62 |
} |
52 | 63 |
|
64 |
public List<LinkElement> getPrimaryTabs(){ |
|
65 |
List<LinkElement> tabs = new ArrayList<LinkElement>(); |
|
66 |
List<WebElement> links = primaryTabs.findElements(By.tagName("a")); |
|
67 |
for(WebElement a : links) { |
|
68 |
RenderedWebElement renderedLink = (RenderedWebElement)a; |
|
69 |
if(renderedLink.isDisplayed()){ |
|
70 |
tabs.add(new LinkElement(renderedLink)); |
|
71 |
} |
|
72 |
} |
|
73 |
|
|
74 |
return tabs; |
|
75 |
} |
|
76 |
|
|
53 | 77 |
|
54 | 78 |
/** |
55 | 79 |
* Returns the current URL string from the {@link WebDriver} |
Also available in: Unified diff
first test for taxon profile pages