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;
|
11
|
|
12
|
import junit.framework.Assert;
|
13
|
|
14
|
import org.junit.Ignore;
|
15
|
import org.junit.Test;
|
16
|
import org.openqa.selenium.By;
|
17
|
import org.openqa.selenium.WebElement;
|
18
|
|
19
|
import eu.etaxonomy.dataportal.DataPortalContext;
|
20
|
import eu.etaxonomy.dataportal.junit.CdmDataPortalSeleniumRCTestBase;
|
21
|
import eu.etaxonomy.dataportal.junit.DataPortalContextSuite.DataPortalContexts;
|
22
|
|
23
|
@SuppressWarnings("deprecation")
|
24
|
@DataPortalContexts( { DataPortalContext.cichorieae })
|
25
|
public class TestExample extends CdmDataPortalSeleniumRCTestBase {
|
26
|
|
27
|
// @Test
|
28
|
public void testSearchLCommunis() throws Exception {
|
29
|
driver.get(getBaseUrl()
|
30
|
+ "?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");
|
31
|
WebElement taxonElement = driver.findElement(By
|
32
|
.xpath("/html/body/div/div/div[2]/div[2]/div/div/div/ul/li/span[@ref='/name/f280f79f-5903-47b0-8352-53e4204c6cf1']"));
|
33
|
|
34
|
WebElement nameElement = taxonElement.findElement(By.className("BotanicalName"));
|
35
|
|
36
|
WebElement namePart1 = nameElement.findElement(By.xpath("span[1]"));
|
37
|
Assert.assertEquals("Lapsana", namePart1.getText());
|
38
|
Assert.assertEquals("italic", namePart1.getCssValue("font-style"));
|
39
|
|
40
|
WebElement namePart2 = nameElement.findElement(By.xpath("span[2]"));
|
41
|
Assert.assertEquals("communis", namePart2.getText());
|
42
|
Assert.assertEquals("italic", namePart2.getCssValue("font-style"));
|
43
|
|
44
|
WebElement authorPart = nameElement.findElement(By.xpath("span[3]"));
|
45
|
Assert.assertEquals("L.", authorPart.getText());
|
46
|
Assert.assertEquals("normal", authorPart.getCssValue("font-style"));
|
47
|
|
48
|
WebElement referenceElement = taxonElement.findElement(By.className("reference"));
|
49
|
Assert.assertEquals("Sp. Pl.: 811. 1753", referenceElement.findElement((By.className("reference"))).getText());
|
50
|
}
|
51
|
|
52
|
/**
|
53
|
* This test emulates the Selenium RC API
|
54
|
*
|
55
|
* @throws Exception
|
56
|
*/
|
57
|
// @Test
|
58
|
public void testSearchLCommunisUsingSeleniumRC() throws Exception {
|
59
|
selenium.open("?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");
|
60
|
selenium.isTextPresent("Lapsana");
|
61
|
selenium.isTextPresent("communis");
|
62
|
selenium.isTextPresent("L.");
|
63
|
selenium.isTextPresent("Sp. Pl.: 811. 1753");
|
64
|
}
|
65
|
|
66
|
}
|