Revision f6612783
Added by Andreas Kohlbecker over 12 years ago
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/test/java/eu/etaxonomy/dataportal/selenium/tests/cichorieae/CichorieaeSearchTest.java | ||
---|---|---|
9 | 9 |
*/ |
10 | 10 |
package eu.etaxonomy.dataportal.selenium.tests.cichorieae; |
11 | 11 |
|
12 |
import static org.junit.Assert.assertEquals; |
|
12 | 13 |
import junit.framework.Assert; |
13 | 14 |
|
15 |
import org.junit.Before; |
|
14 | 16 |
import org.junit.Test; |
15 | 17 |
import org.openqa.selenium.By; |
16 | 18 |
import org.openqa.selenium.WebElement; |
17 | 19 |
|
18 | 20 |
import eu.etaxonomy.dataportal.DataPortalContext; |
21 |
import eu.etaxonomy.dataportal.elements.TaxonListElement; |
|
19 | 22 |
import eu.etaxonomy.dataportal.junit.CdmDataPortalTestBase; |
20 | 23 |
import eu.etaxonomy.dataportal.junit.DataPortalContextSuite.DataPortalContexts; |
24 |
import eu.etaxonomy.dataportal.pages.GenericPortalPage; |
|
25 |
import eu.etaxonomy.dataportal.pages.PortalPage; |
|
26 |
import eu.etaxonomy.dataportal.pages.TaxonSearchResultPage; |
|
21 | 27 |
|
22 | 28 |
@DataPortalContexts( { DataPortalContext.cichorieae }) |
23 | 29 |
public class CichorieaeSearchTest extends CdmDataPortalTestBase { |
24 | 30 |
|
31 |
private GenericPortalPage homePage; |
|
32 |
|
|
33 |
@Before |
|
34 |
public void setUp() throws Exception { |
|
35 |
|
|
36 |
driver.get(getContext().getBaseUri().toString()); |
|
37 |
homePage = new GenericPortalPage(driver, getContext()); |
|
38 |
|
|
39 |
} |
|
40 |
|
|
25 | 41 |
@Test |
26 | 42 |
public void testSearchLCommunis() throws Exception { |
27 |
driver.get(getBaseUrl() |
|
28 |
+ "?query=Lapsana+com*&search[tree]=534e190f-3339-49ba-95d9-fa27d5493e3e&q=cdm_dataportal%2Fsearch%2Ftaxon&search[pageSize]=25&search[pageNumber]=0&search[doTaxa]=1&search[doSynonyms]=1&search[doTaxaByCommonNames]=0"); |
|
29 |
WebElement taxonElement = driver.findElement(By |
|
30 |
.xpath("/html/body/div/div/div[2]/div[2]/div/div/div/ul/li/span[@ref='/name/f280f79f-5903-47b0-8352-53e4204c6cf1']")); |
|
31 | 43 |
|
32 |
WebElement nameElement = taxonElement.findElement(By.className("BotanicalName")); |
|
44 |
TaxonSearchResultPage searchResultPage = homePage.submitQuery("Lapsana com*"); |
|
45 |
|
|
46 |
assertEquals(getContext().prepareTitle("Search results"), searchResultPage.getTitle()); |
|
47 |
|
|
48 |
TaxonListElement lapsanaCommunnis = searchResultPage.getResultItem(1); |
|
49 |
|
|
50 |
assertEquals("Lapsana communis L. Sp. Pl.: 811. 1753", lapsanaCommunnis.getFullTaxonName()); |
|
51 |
|
|
52 |
WebElement nameElement = lapsanaCommunnis.getElement().findElement(By.className("BotanicalName")); |
|
33 | 53 |
|
34 | 54 |
WebElement namePart1 = nameElement.findElement(By.xpath("span[1]")); |
35 | 55 |
Assert.assertEquals("Lapsana", namePart1.getText()); |
... | ... | |
43 | 63 |
Assert.assertEquals("L.", authorPart.getText()); |
44 | 64 |
Assert.assertEquals("normal", authorPart.getCssValue("font-style")); |
45 | 65 |
|
46 |
WebElement referenceElement = taxonElement.findElement(By.className("reference"));
|
|
66 |
WebElement referenceElement = lapsanaCommunnis.getElement().findElement(By.className("reference"));
|
|
47 | 67 |
Assert.assertEquals("Sp. Pl.: 811. 1753", referenceElement.findElement((By.className("reference"))).getText()); |
68 |
|
|
69 |
PortalPage taxonProfilLapsanaCommunnis = searchResultPage.clickTaxonName(lapsanaCommunnis); |
|
48 | 70 |
} |
49 | 71 |
|
50 | 72 |
} |
Also available in: Unified diff
using pageObjects for test