Project

General

Profile

Download (2.77 KB) Statistics
| Branch: | Tag: | Revision:
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.Test;
15
import org.openqa.selenium.By;
16
import org.openqa.selenium.RenderedWebElement;
17
import org.openqa.selenium.WebElement;
18

    
19
import eu.etaxonomy.dataportal.DataPortalContext;
20
import eu.etaxonomy.dataportal.junit.DataPortalContextSuite.DataPortalContexts;
21

    
22
@SuppressWarnings("deprecation")
23
@DataPortalContexts( { DataPortalContext.cichorieae })
24
public class ExampleTest extends CdmDataPortalSeleniumRCTestBase {
25

    
26
	@Test
27
	public void testSearchLCommunis() throws Exception {
28
		driver.get(getBaseUrl()
29
						+ "?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");
30
		WebElement taxonElement = driver.findElement(By
31
				.xpath("/html/body/div/div/div[2]/div[2]/div/div/div/ul/li/span[@ref='/name/f280f79f-5903-47b0-8352-53e4204c6cf1']"));
32

    
33
		WebElement nameElement = taxonElement.findElement(By.className("BotanicalName"));
34

    
35
		RenderedWebElement namePart1 = (RenderedWebElement) nameElement.findElement(By.xpath("span[1]"));
36
		Assert.assertEquals("Lapsana", namePart1.getText());
37
		Assert.assertEquals("italic", namePart1.getValueOfCssProperty("font-style"));
38

    
39
		RenderedWebElement namePart2 = (RenderedWebElement) nameElement.findElement(By.xpath("span[2]"));
40
		Assert.assertEquals("communis", namePart2.getText());
41
		Assert.assertEquals("italic", namePart2.getValueOfCssProperty("font-style"));
42

    
43
		RenderedWebElement authorPart = (RenderedWebElement) nameElement.findElement(By.xpath("span[3]"));
44
		Assert.assertEquals("L.", authorPart.getText());
45
		Assert.assertEquals("normal", authorPart.getValueOfCssProperty("font-style"));
46

    
47
		RenderedWebElement referenceElement = (RenderedWebElement) taxonElement.findElement(By.className("reference"));
48
		Assert.assertEquals("Sp. Pl.: 811. 1753", referenceElement.findElement((By.className("reference"))).getText());
49
	}
50

    
51
	/**
52
	 * This test emulates the Selenium RC API
53
	 *
54
	 * @throws Exception
55
	 */
56
	@Test
57
	public void testSearchLCommunisUsingSeleniumRC() throws Exception {
58
		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");
59
		selenium.isTextPresent("Lapsana");
60
		selenium.isTextPresent("communis");
61
		selenium.isTextPresent("L.");
62
		selenium.isTextPresent("Sp. Pl.: 811. 1753");
63
	}
64

    
65
}
(3-3/3)