Project

General

Profile

Download (3.91 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.FeatureBlock;
26
import eu.etaxonomy.dataportal.elements.LinkElement;
27
import eu.etaxonomy.dataportal.junit.CdmDataPortalTestBase;
28
import eu.etaxonomy.dataportal.junit.DataPortalContextSuite.DataPortalContexts;
29
import eu.etaxonomy.dataportal.pages.TaxonProfilePage;
30

    
31
/**
32
 *
33
 * @author a.kohlbecker
34
 *
35
 */
36

    
37
@DataPortalContexts( { DataPortalContext.cyprus })
38
public class Cyprus_OriginalSourceTest extends CdmDataPortalTestBase{
39

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

    
43
	TaxonProfilePage p = null;
44

    
45
	@Before
46
	public void setUp() throws MalformedURLException {
47

    
48
		p = new TaxonProfilePage(driver, getContext(), taxonUuid);
49

    
50
	}
51

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

    
57

    
58
	@Test
59
	public void testPage() {
60

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

    
64
		List<LinkElement> primaryTabs = p.getPrimaryTabs();
65
		int tabIndex = 0;
66
		assertEquals("General", primaryTabs.get(tabIndex++).getText());
67
		assertEquals("Synonymy", primaryTabs.get(tabIndex++).getText());
68
		assertEquals("Images", primaryTabs.get(tabIndex++).getText());
69
		assertEquals("Expecting " + tabIndex + " tabs", tabIndex++, primaryTabs.size());
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
		int tocIndex = 0;
75
		p.testTableOfContentEntry(tocIndex++, "Status", "status");
76
		p.testTableOfContentEntry(tocIndex++, "Endemism", "endemism");
77
		p.testTableOfContentEntry(tocIndex++, "Systematics", "systematics");
78
		p.testTableOfContentEntry(tocIndex++, "Chromosome numbers", "chromosome_numbers");
79
		p.testTableOfContentEntry(tocIndex++, "Distribution", "distribution");
80

    
81
		FeatureBlock featureBlock = p.getFeatureBlockAt(2, "chromosome_numbers", "div", "li"); //FIXME <div><li> bug in portal
82
		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());
83
		assertEquals("Chromosome numbers", featureBlock.getHeader());
84
		assertEquals("expecting no footnote keys", 0, featureBlock.getFootNoteKeys().size());
85
		List<WebElement> linksInFeatureBlock = featureBlock.getElement().findElements(By.tagName("a"));
86
		assertEquals("Expecting 4 anchor tags in \"Chromosome Numbers\"", 4, linksInFeatureBlock.size());
87
		assertEquals("chromosome_numbers", linksInFeatureBlock.get(0).getAttribute("name"));
88
		assertTrue(linksInFeatureBlock.get(1).getAttribute("href").endsWith("?q=cdm_dataportal/name/a1dfcc80-2121-46bb-b8b2-c267a9e0725b"));
89
		assertTrue(linksInFeatureBlock.get(2).getAttribute("href").endsWith("?q=cdm_dataportal/reference/863b9b1b-6c2a-4066-af90-ea9a3775598c"));
90
		assertTrue(linksInFeatureBlock.get(3).getAttribute("href").endsWith("?q=cdm_dataportal/reference/07a97be7-b3fa-4f76-838d-ac7e1e6e9d70"));
91
	}
92

    
93
}
(4-4/4)