1
|
/**
|
2
|
* Copyright (C) 2009 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
package eu.etaxonomy.dataportal.selenium.tests.cyprus;
|
10
|
|
11
|
import java.net.MalformedURLException;
|
12
|
import java.util.List;
|
13
|
import java.util.UUID;
|
14
|
|
15
|
import org.junit.After;
|
16
|
import org.junit.Before;
|
17
|
import org.junit.Test;
|
18
|
import org.openqa.selenium.By;
|
19
|
import org.openqa.selenium.WebElement;
|
20
|
|
21
|
import eu.etaxonomy.dataportal.DataPortalSite;
|
22
|
import eu.etaxonomy.dataportal.elements.FeatureBlock;
|
23
|
import eu.etaxonomy.dataportal.elements.LinkElement;
|
24
|
import eu.etaxonomy.dataportal.junit.CdmDataPortalTestBase;
|
25
|
import eu.etaxonomy.dataportal.junit.DataPortalContextSuite.DataPortalContexts;
|
26
|
import eu.etaxonomy.dataportal.pages.TaxonProfilePage;
|
27
|
|
28
|
/**
|
29
|
*
|
30
|
* @author a.kohlbecker
|
31
|
*
|
32
|
*/
|
33
|
|
34
|
@DataPortalContexts( { DataPortalSite.cyprus })
|
35
|
public class Cyprus_OriginalSourceTest extends CdmDataPortalTestBase{
|
36
|
|
37
|
// Taxon Cistus creticus subsp. creticus
|
38
|
static UUID taxonUuid = UUID.fromString("2e58b1ab-03a9-4693-bcec-3b8e7f04b572");
|
39
|
|
40
|
TaxonProfilePage p = null;
|
41
|
|
42
|
@Before
|
43
|
public void setUp() throws MalformedURLException {
|
44
|
|
45
|
p = new TaxonProfilePage(driver, getContext(), taxonUuid);
|
46
|
|
47
|
}
|
48
|
|
49
|
@After
|
50
|
public void tearDown(){
|
51
|
logger.debug("@After");
|
52
|
}
|
53
|
|
54
|
|
55
|
@Test
|
56
|
public void testPage() {
|
57
|
|
58
|
assertEquals(getContext().prepareTitle("Cistus creticus subsp. creticus"), p.getTitle());
|
59
|
assertNull("Authorship information should be hidden", p.getAuthorInformationText());
|
60
|
|
61
|
List<LinkElement> primaryTabs = p.getPrimaryTabs();
|
62
|
int tabIndex = 0;
|
63
|
assertEquals("General\n(active tab)", primaryTabs.get(tabIndex++).getText());
|
64
|
assertEquals("Synonymy", primaryTabs.get(tabIndex++).getText());
|
65
|
assertEquals("Images", primaryTabs.get(tabIndex++).getText());
|
66
|
assertEquals("Expecting " + tabIndex + " tabs", tabIndex++, primaryTabs.size());
|
67
|
|
68
|
assertEquals("Content", p.getTableOfContentHeader());
|
69
|
List<LinkElement> tocLinks = p.getTableOfContentLinks();
|
70
|
assertNotNull("Expecting a list of TOC links in the profile page.", tocLinks);
|
71
|
int tocIndex = 0;
|
72
|
p.testTableOfContentEntry(tocIndex++, "Status", "status");
|
73
|
p.testTableOfContentEntry(tocIndex++, "Endemism", "endemism");
|
74
|
p.testTableOfContentEntry(tocIndex++, "Systematics", "systematics");
|
75
|
p.testTableOfContentEntry(tocIndex++, "Chromosome numbers", "chromosome_numbers");
|
76
|
p.testTableOfContentEntry(tocIndex++, "Distribution", "distribution");
|
77
|
|
78
|
FeatureBlock featureBlock = p.getFeatureBlockAt(2, "chromosome-numbers", "ul", "li");
|
79
|
assertEquals("Chromosome numbers", featureBlock.getHeaderText());
|
80
|
|
81
|
// see #2288 (Cyprus: ChromosomeNumbers: formating nameInSource)
|
82
|
assertEquals("Chromosome numbers\n2n = 18 (B. Slavík & V. Jarolímová & J. Chrtek, Chromosome counts of some plants from Cyprus in Candollea 48. 1993 (as Cistus creticus L.)) (B. Slavík & V. Jarolímová & J. Chrtek, Chromosome counts of some plants from Cyprus. 2 in Acta Univ. Carol., Biol. 46. 2002 (as Cistus creticus L.))", featureBlock.getText());
|
83
|
|
84
|
assertFalse("expecting no footnote keys", featureBlock.hasFootNoteKeys());
|
85
|
List<WebElement> linksInFeatureBlock = featureBlock.getElement().findElements(By.tagName("a"));
|
86
|
assertEquals("Expecting 3 anchor tags in \"Chromosome Numbers\"", 5, linksInFeatureBlock.size());
|
87
|
assertEquals("chromosome_numbers", linksInFeatureBlock.get(0).getAttribute("name"));
|
88
|
assertTrue(linksInFeatureBlock.get(1).getAttribute("href").endsWith("cdm_dataportal/reference/863b9b1b-6c2a-4066-af90-ea9a3775598c"));
|
89
|
assertTrue(linksInFeatureBlock.get(2).getAttribute("href").contains("cdm_dataportal/name/a1dfcc80-2121-46bb-b8b2-c267a9e0725b"));
|
90
|
assertTrue(linksInFeatureBlock.get(3).getAttribute("href").endsWith("cdm_dataportal/reference/07a97be7-b3fa-4f76-838d-ac7e1e6e9d70"));
|
91
|
assertTrue(linksInFeatureBlock.get(4).getAttribute("href").contains("cdm_dataportal/name/a1dfcc80-2121-46bb-b8b2-c267a9e0725b"));
|
92
|
}
|
93
|
|
94
|
}
|