Project

General

Profile

Download (2.69 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.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 ExampleTest extends CdmDataPortalSeleniumRCTestBase {
26

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

    
35
		WebElement nameElement = taxonElement.findElement(By.className("BotanicalName"));
36

    
37
		WebElement namePart1 = nameElement.findElement(By.xpath("span[1]"));
38
		Assert.assertEquals("Lapsana", namePart1.getText());
39
		Assert.assertEquals("italic", namePart1.getCssValue("font-style"));
40

    
41
		WebElement namePart2 = nameElement.findElement(By.xpath("span[2]"));
42
		Assert.assertEquals("communis", namePart2.getText());
43
		Assert.assertEquals("italic", namePart2.getCssValue("font-style"));
44

    
45
		WebElement authorPart = nameElement.findElement(By.xpath("span[3]"));
46
		Assert.assertEquals("L.", authorPart.getText());
47
		Assert.assertEquals("normal", authorPart.getCssValue("font-style"));
48

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

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

    
68
}
    (1-1/1)