1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2009 EDIT
|
4
|
* European Distributed Institute of Taxonomy
|
5
|
* http://www.e-taxonomy.eu
|
6
|
*
|
7
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
8
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
9
|
*/
|
10
|
package eu.etaxonomy.dataportal.selenium.tests.cichorieae;
|
11
|
|
12
|
import static org.junit.Assert.assertEquals;
|
13
|
import junit.framework.Assert;
|
14
|
|
15
|
import org.junit.Before;
|
16
|
import org.junit.Test;
|
17
|
import org.openqa.selenium.By;
|
18
|
import org.openqa.selenium.WebElement;
|
19
|
|
20
|
import eu.etaxonomy.dataportal.DataPortalContext;
|
21
|
import eu.etaxonomy.dataportal.elements.TaxonListElement;
|
22
|
import eu.etaxonomy.dataportal.junit.CdmDataPortalTestBase;
|
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;
|
27
|
|
28
|
@DataPortalContexts( { DataPortalContext.cichorieae })
|
29
|
public class CichorieaeSearchTest extends CdmDataPortalTestBase {
|
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
|
|
41
|
@Test
|
42
|
public void testSearchLCommunis() throws Exception {
|
43
|
|
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"));
|
53
|
|
54
|
WebElement namePart1 = nameElement.findElement(By.xpath("span[1]"));
|
55
|
Assert.assertEquals("Lapsana", namePart1.getText());
|
56
|
Assert.assertEquals("italic", namePart1.getCssValue("font-style"));
|
57
|
|
58
|
WebElement namePart2 = nameElement.findElement(By.xpath("span[2]"));
|
59
|
Assert.assertEquals("communis", namePart2.getText());
|
60
|
Assert.assertEquals("italic", namePart2.getCssValue("font-style"));
|
61
|
|
62
|
WebElement authorPart = nameElement.findElement(By.xpath("span[3]"));
|
63
|
Assert.assertEquals("L.", authorPart.getText());
|
64
|
Assert.assertEquals("normal", authorPart.getCssValue("font-style"));
|
65
|
|
66
|
WebElement referenceElement = lapsanaCommunnis.getElement().findElement(By.className("reference"));
|
67
|
Assert.assertEquals("Sp. Pl.: 811. 1753", referenceElement.findElement((By.className("reference"))).getText());
|
68
|
|
69
|
PortalPage taxonProfilLapsanaCommunnis = searchResultPage.clickTaxonName(lapsanaCommunnis);
|
70
|
}
|
71
|
|
72
|
}
|