Project

General

Profile

Download (3.76 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.tests.cyprus;
11

    
12
import static org.junit.Assert.*;
13

    
14
import java.net.MalformedURLException;
15
import java.util.List;
16
import java.util.UUID;
17

    
18
import org.junit.After;
19
import org.junit.Before;
20
import org.junit.Test;
21
import org.openqa.selenium.By;
22
import org.openqa.selenium.WebElement;
23

    
24
import eu.etaxonomy.dataportal.DataPortalContext;
25
import eu.etaxonomy.dataportal.elements.BaseElement;
26
import eu.etaxonomy.dataportal.elements.FeatureBlock;
27
import eu.etaxonomy.dataportal.elements.ImgElement;
28
import eu.etaxonomy.dataportal.elements.LinkElement;
29
import eu.etaxonomy.dataportal.junit.CdmDataPortalTestBase;
30
import eu.etaxonomy.dataportal.junit.DataPortalContextSuite.DataPortalContexts;
31
import eu.etaxonomy.dataportal.pages.TaxonProfilePage;
32

    
33
/**
34
 *
35
 * @author a.kohlbecker
36
 *
37
 */
38

    
39
@DataPortalContexts( { DataPortalContext.cyprus })
40
public class Cyprus_OriginalSourceTest extends CdmDataPortalTestBase{
41

    
42
	// Taxon Cistus creticus subsp. creticus
43
	static UUID taxonUuid = UUID.fromString("2e58b1ab-03a9-4693-bcec-3b8e7f04b572");
44

    
45
	TaxonProfilePage p = null;
46

    
47
	@Before
48
	public void setUp() throws MalformedURLException {
49

    
50
		p = new TaxonProfilePage(driver, getContext(), taxonUuid);
51

    
52
	}
53

    
54
	@After
55
	public void tearDown(){
56
		logger.debug("@After");
57
	}
58

    
59

    
60
	@Test
61
	public void testPage() {
62

    
63
		assertEquals(getContext().prepareTitle("Cistus creticus subsp. creticus"), p.getTitle());
64
		assertNull("Authorship information should be hidden", p.getAuthorInformationText());
65

    
66
		List<LinkElement> primaryTabs = p.getPrimaryTabs();
67
		assertEquals("Expecting 2 tabs", 2, primaryTabs.size());
68
		assertEquals("General", primaryTabs.get(0).getText());
69
		assertEquals("Synonymy", primaryTabs.get(1).getText());
70

    
71
		assertEquals("Content", p.getTableOfContentHeader());
72
		List<LinkElement> tocLinks = p.getTableOfContentLinks();
73
		assertNotNull("Expecting a list of TOC links in the profile page.", tocLinks);
74
		p.testTableOfContentEntry(0, "Endemism", "endemism");
75
		p.testTableOfContentEntry(1, "Status", "status");
76
		p.testTableOfContentEntry(2, "Distribution", "distribution");
77
		p.testTableOfContentEntry(3, "Chromosome Numbers", "chromosome_numbers");
78

    
79
		FeatureBlock featureBlock = p.getFeatureBlockAt(4, "chromosome_numbers", "div", "li"); //FIXME <div><li> bug in portal
80
		assertEquals("Chromosome Numbers\nCistus creticus L.: 2n = 18 (B. Slavík & V. Jarolímová & J. Chrtek, Chromosome counts of some plants from Cyprus in Candollea 48. 1993) (B. Slavík & V. Jarolímová & J. Chrtek, Chromosome counts of some plants from Cyprus. 2 in Acta Univ. Carol., Biol. 46. 2002)", featureBlock.getText());
81
		assertEquals("Chromosome Numbers", featureBlock.getHeader());
82
		assertEquals("expecting no footnote keys", 0, featureBlock.getFootNoteKeys().size());
83
		List<WebElement> linksInFeatureBlock = featureBlock.getElement().findElements(By.tagName("a"));
84
		assertEquals("Expecting 4 anchor tags in \"Chromosome Numbers\"", 4, linksInFeatureBlock.size());
85
		assertEquals("chromosome_numbers", linksInFeatureBlock.get(0).getAttribute("name"));
86
		assertTrue(linksInFeatureBlock.get(1).getAttribute("href").endsWith("?q=cdm_dataportal/name/a1dfcc80-2121-46bb-b8b2-c267a9e0725b"));
87
		assertTrue(linksInFeatureBlock.get(2).getAttribute("href").endsWith("?q=cdm_dataportal/reference/863b9b1b-6c2a-4066-af90-ea9a3775598c"));
88
		assertTrue(linksInFeatureBlock.get(3).getAttribute("href").endsWith("?q=cdm_dataportal/reference/07a97be7-b3fa-4f76-838d-ac7e1e6e9d70"));
89
	}
90

    
91
}
(3-3/3)