|
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 |
* @author a.kohlbecker
|
|
35 |
*
|
|
36 |
*/
|
|
37 |
|
|
38 |
@DataPortalContexts( { DataPortalContext.cyprus })
|
|
39 |
public class Bassia_indica_TaxonProfileTest extends CdmDataPortalTestBase{
|
|
40 |
|
|
41 |
static UUID taxonUuid = UUID.fromString("5250a30a-9e6f-4f2f-9663-93127a1a3829");
|
|
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("Bassia indica"), p.getTitle());
|
|
62 |
assertNull("Authorship information should be hidden", p.getAuthorInformationText());
|
|
63 |
|
|
64 |
List<LinkElement> primaryTabs = p.getPrimaryTabs();
|
|
65 |
assertEquals("Expecting 2 tabs", 2, primaryTabs.size());
|
|
66 |
assertEquals("General\n(active tab)", primaryTabs.get(0).getText());
|
|
67 |
assertEquals("Synonymy", primaryTabs.get(1).getText());
|
|
68 |
|
|
69 |
assertEquals("Content", p.getTableOfContentHeader());
|
|
70 |
List<LinkElement> links = p.getTableOfContentLinks();
|
|
71 |
assertNotNull("Expecting a list of TOC links in the profile page.", links);
|
|
72 |
p.testTableOfContentEntry(0, "Status", "status");
|
|
73 |
p.testTableOfContentEntry(1, "Endemism", "endemism");
|
|
74 |
p.testTableOfContentEntry(2, "Distribution", "distribution");
|
|
75 |
|
|
76 |
FeatureBlock featureBlock;
|
|
77 |
|
|
78 |
featureBlock = p.getFeatureBlockAt(0, "status", "div", "div");
|
|
79 |
assertEquals("Status\nNaturalized invasive (NA)", featureBlock.getText());
|
|
80 |
|
|
81 |
featureBlock = p.getFeatureBlockAt(1, "endemism", "div", "div");
|
|
82 |
assertEquals("Endemism\nnot endemic", featureBlock.getText());
|
|
83 |
|
|
84 |
featureBlock = p.getFeatureBlockAt(2, "distribution", "div", "span");
|
|
85 |
|
|
86 |
assertEquals("Distribution\nDivision 41 Division 52 Division 63\nThe record for division 5 may refer to division 6.\n1. J. Chrtek & B. SlavĂk, Contribution to the flora of Cyprus. 4. in Fl. Medit. 10. 2001, 2. A. Della & G. Iatrou, New plant records from Cyprus in Kew Bull. 50. 1995, 3. R. Hand, Supplementary notes to the flora of Cyprus III. in Willdenowia 33. 2003", featureBlock.getText());
|
|
87 |
assertEquals("Distribution", featureBlock.getHeader());
|
|
88 |
assertEquals("expecting two footnote keys", 3, featureBlock.getFootNoteKeys().size());
|
|
89 |
|
|
90 |
// ------- prepared for bibliography ---------
|
|
91 |
// FeatureBlock bibliography = p.getFeatureBlockAt(5, "bibliography", "div", "div");
|
|
92 |
// List<BaseElement> bibliographyEntries = bibliography.getFootNotes();
|
|
93 |
// assertEquals("A. R. D. Meikle, Flora of Cyprus 2. 1985", bibliographyEntries.get(1));
|
|
94 |
// assertEquals("B. R. Hand, Supplementary notes to the flora of Cyprus VI. in Willdenowia 39. 2009", bibliographyEntries.get(1));
|
|
95 |
|
|
96 |
|
|
97 |
}
|
|
98 |
|
|
99 |
}
|
additional test