Project

General

Profile

Download (11.1 KB) Statistics
| Branch: | Tag: | Revision:
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.palmae;
10

    
11
import java.net.MalformedURLException;
12
import java.util.List;
13
import java.util.UUID;
14

    
15
import org.junit.Before;
16
import org.junit.Test;
17
import org.openqa.selenium.By;
18
import org.openqa.selenium.WebElement;
19

    
20
import eu.etaxonomy.dataportal.DataPortalSite;
21
import eu.etaxonomy.dataportal.elements.FeatureBlock;
22
import eu.etaxonomy.dataportal.elements.LinkElement;
23
import eu.etaxonomy.dataportal.junit.CdmDataPortalTestBase;
24
import eu.etaxonomy.dataportal.junit.DataPortalContextSuite.DataPortalContexts;
25
import eu.etaxonomy.dataportal.pages.TaxonProfilePage;
26

    
27
/**
28
 * @author a.kohlbecker
29
 *
30
 */
31

    
32
@DataPortalContexts( { DataPortalSite.palmae })
33
public class Iriartea_deltoidea_UsesTest extends CdmDataPortalTestBase{
34

    
35
    static UUID taxonUuid = UUID.fromString("ce870eca-0422-4a3c-b849-0f5ca0370b1f");
36

    
37
    static TaxonProfilePage p = null;
38

    
39
    @Before
40
    public void setUp() throws MalformedURLException {
41

    
42
        if(p == null){
43
            p = new TaxonProfilePage(driver, getContext(), taxonUuid);
44
        }
45

    
46
    }
47

    
48

    
49
    @Test
50
    public void testTitleAndTabs() {
51

    
52
        assertEquals(getContext().prepareTitle("Iriartea deltoidea Ruiz & Pav., Syst. Veg. Fl. Peruv. Chil. : 298 (1798)"), driver.getTitle());
53
        assertNull("Authorship information should be hidden", p.getAuthorInformationText());
54

    
55
        List<LinkElement> primaryTabs = p.getPrimaryTabs();
56
        int tabId = 0;
57
        assertEquals("General\n(active tab)", primaryTabs.get(tabId++).getText());
58
        assertEquals("Synonymy", primaryTabs.get(tabId++).getText());
59
        assertEquals("Images", primaryTabs.get(tabId++).getText());
60
        assertEquals("Expecting " + tabId + " tabs", tabId, primaryTabs.size());
61

    
62
    }
63

    
64

    
65
    @Test
66
    public void testFeatureToc() {
67

    
68
        assertEquals("Content", p.getTableOfContentHeader());
69
        List<LinkElement> links = p.getTableOfContentLinks();
70
        assertEquals("Expecting 7 entries in the TOC of the profile page.", 7, links.size());
71
    }
72

    
73
    @Test
74
    public void testFeatureDistribution() {
75

    
76
        int featureId = 0;
77

    
78
        int descriptionElementFontSize = 11;
79
        String expectedListStyleType = "none";
80
        String expectedCssDisplay = "inline";
81
        String expectedListStylePosition = "outside";
82
        String expectedListStyleImage = "none";
83
        int indent = 23;
84

    
85
        /* distribution */
86
        String featureClass = "distribution";
87
        String featureLabel = "Distribution";
88
        String blockTextFull = "Map uses TDWG level 3 distributions (http://www.nhm.ac.uk/hosted_sites/tdwg/geogrphy.html)\n"
89
                + "Bolivia (World Checklist of Arecaceae), Brazil North (World Checklist of Arecaceae), Colombia (World Checklist of Arecaceae), Costa Rica (World Checklist of Arecaceae), Ecuador (World Checklist of Arecaceae), Nicaragua (World Checklist of Arecaceae), Panamá (World Checklist of Arecaceae), Peru (World Checklist of Arecaceae), Venezuela (World Checklist of Arecaceae)\n"
90
                + "Central America to Ecuador W of the Andes, and in the W part of the Amazon region from Venezuela to Bolivia. Perhaps the most common native tree species in Ecuador, occurring in all provinces that include moist lowland areas. (Borchsenius F., Borgtoft-Pedersen H. and Baslev H. 1998. Manual to the Palms of Ecuador. AAU Reports 37. Department of Systematic Botany, University of Aarhus, Denmark in collaboration with Pontificia Universidad Catalica del Ecuador)";
91

    
92
        p.testTableOfContentEntry(featureId, featureLabel, featureClass);
93
        FeatureBlock featureBlockDistribution = p.getFeatureBlockAt(featureId, featureClass, "div", "span");
94

    
95
        assertEquals(featureLabel, featureBlockDistribution.getTitle().getText());
96
        assertEquals(blockTextFull, featureBlockDistribution.getContentText().trim());
97

    
98
        featureBlockDistribution.testDescriptionElementLayout(0, indent, descriptionElementFontSize, expectedCssDisplay, expectedListStyleType, expectedListStylePosition, expectedListStyleImage);
99

    
100
        assertNotNull("Expecting an OpenLayers map", featureBlockDistribution.getElement().findElement(By.id("openlayers-map-distribution")));
101
        assertEquals("Map uses TDWG level 3 distributions (http://www.nhm.ac.uk/hosted_sites/tdwg/geogrphy.html)", featureBlockDistribution.getElement().findElement(By.className("distribution_map_caption")).getText());
102

    
103
    }
104

    
105
    @Test
106
    public void testUses() {
107

    
108
        int featureId = 2;
109
        int descriptionElementFontSize = 11;
110
        String expectedCssDisplay = "inline";
111
        String expectedListStyleType = "none";
112
        String expectedListStylePosition = "outside";
113
        String expectedListStyleImage = "none";
114
        int indent = 23;
115

    
116
        /* Biology And Ecology */
117
        String featureClass = "uses";
118
        String featureLabel = "Uses";
119
        String blockTextFull = featureLabel + "\nThe outer part of the stems are used throughout its range for building purposes, e.g., floors, posts, poles; also for blowguns, bows, harpoons and arrow points; and also for firewood. The leaves are used for thatching and basketry. The heart and seeds are occasionally eaten. The inside layer of the leaf sheath is used to give women strength in labor (Shemluck & Ness 163, Ecuador). Hollowed-out stems are used as coffins by Embera Indians in Colombia (R. Bernal, pers. comm.). Steven King (pers. comm.) reports that in northern Peru Angotere-Secoya and Quechua people use the stems of I. deltoidea as canoes. Large specimens are selected and carefully felled. The soft central ground tissue is removed from the center of the stem, and base and apex fashioned into bow and stern. The canoes are widely used for shortening trips, especially long overland trips where short-cuts can be made by river. Canoes last about two or three months. Such is the demand for these temporary canoes that many of the larger specimens of Iriartea have been felled in this area. Rodrigo Bernal (pers. comm.) reports that in Colombia the Embera Indians of the Choco tie the stems together and use them as rafts. Since these are so heavy they are only used for downstream travel. (Henderson, A. 1990. Introduction and the Iriarteinae. Flora Neotropica Monograph 53.)";
120
        expectedCssDisplay = "list-item";
121
        expectedListStyleType = "none";
122

    
123
        p.testTableOfContentEntry(featureId,featureLabel, featureClass);
124
        FeatureBlock featureBlockBibliography = p.getFeatureBlockAt(featureId, featureClass, "ul", "li");
125

    
126
        assertEquals(blockTextFull, featureBlockBibliography.getText());
127
        featureBlockBibliography.testDescriptionElementLayout(0, indent, descriptionElementFontSize, expectedCssDisplay, expectedListStyleType, expectedListStylePosition, expectedListStyleImage);
128

    
129
    }
130

    
131
    @Test
132
    public void testFeatureUseRecord() {
133

    
134
        int featureId = 5;
135

    
136
        String featureClass = "use-record";
137
        String featureLabel = "Use Record";
138

    
139
        p.testTableOfContentEntry(featureId,featureLabel, featureClass);
140
        FeatureBlock featureBlockBioEco = p.getFeatureBlockAt(featureId, featureClass, "ul", "li");
141

    
142
        List<WebElement> listItems = featureBlockBioEco.getElement().findElements(By.tagName("li"));
143
        assertEquals(95, listItems.size());
144

    
145
        String item14UseRecordText =
146
                "Use Category Use Sub Category Plant Part Human Group Ethnic Group Country\n"
147
                + "Construction Thatch Entire leaf Indigenous Tsimane/Mosetene Bolivia\n"
148
                + "Utensils and Tools Domestic Stem Indigenous Tsimane/Mosetene Bolivia\n"
149
                + "Utensils and Tools Domestic Leaf sheath Indigenous Tsimane/Mosetene Bolivia\n"
150
                + "Human Food Food Palm heart Indigenous Tsimane/Mosetene Bolivia\n"
151
                + "Cultural Personal adornment Seeds Indigenous Tsimane/Mosetene Bolivia\n"
152
                + "Construction Houses Stem Indigenous Tsimane/Mosetene Bolivia";
153

    
154

    
155
        assertEquals("Iriartea deltoidea Ruiz & Pav.: Alimentación humana. Palmito. Cuando es tierno, se corta y pela para consumir crudo en ensalada. Comercial. Semilla. Es utilizada en la elaboración de collares. Construcción. Estípite. Construcción de viviendas, en postes y vigas transversales. La parte externa es cortada el segmentos longitudinales, secada, y empleada en las paredes, suelo, y como cuerda natural. Construcción. Hoja. Techado de campamentos temporales. Utensilios y herr. de uso doméstico. Estípite. Elaboración de \"guarachas\" (estantes para depositar objetos). Utensilios y herr. de uso doméstico. Hoja (vaina). La vaina seca de la hoja se utiliza para hacer recipientes. (Armesilla, P.J., Usos de las palmeras (Arecaceae),en la Reserva de la Biosfera-Tierra Comunitaria de Orígen Pilón Lajas, (Bolivia). 2006)\n"
156
                + item14UseRecordText,
157
                listItems.get(0).getText());
158
        // tabular
159
        assertEquals(item14UseRecordText,
160
                listItems.get(0).findElement(By.className("use-records")).getText());
161
        // synonym
162
        assertEquals("Iriartea ventricosa Mart.: De las líneas de la hoja de esta palmera que crece en forma silvestre, los tacana elaboran recipientes de diferentes tamaños. (…). Para la elaboración de cercos , (…), los tacana utilizan los troncos de las palmeras chonta, motacú, copa, assai, majillo, pachiuva, tola y tuana. (…). Para la elaboración de cercos , (…), los tacana utilizan los troncos de las palmeras chonta, motacú, copa, assai, majillo, pachiuva, tola y tuana. (Hissink, K., and A. Hahn, Los Tacana- datos sobre la historia de su civilización. 2000 (as Iriartea ventricosa Mart.))",
163
            listItems.get(81).getText());
164

    
165
    }
166

    
167
    @Test
168
    public void testBibliography() {
169

    
170
        int featureId = 6;
171
        int descriptionElementFontSize = 11;
172
        String expectedCssDisplay = "block";
173
        String expectedListStyleType = "none";
174
        String expectedListStylePosition = "outside";
175
        String expectedListStyleImage = "none";
176
        int indent = 0;
177

    
178
        String featureClass = "bibliography";
179
        String featureLabel = "Bibliography";
180
        String blockTextFull = featureLabel + "\n"
181
                + " Borchsenius F., Borgtoft-Pedersen H. and Baslev H. 1998. Manual to the Palms of Ecuador. AAU Reports 37. Department of Systematic Botany, University of Aarhus, Denmark in collaboration with Pontificia Universidad Catalica del Ecuador\n"
182
                + " World Checklist of Arecaceae\n"
183
                + " Henderson, A. 1990. Introduction and the Iriarteinae. Flora Neotropica Monograph 53.";
184

    
185
        p.testTableOfContentEntry(featureId,featureLabel, featureClass);
186
        FeatureBlock featureBlockBibliography = p.getFeatureBlockAt(featureId, featureClass, "div", "div");
187

    
188
        assertEquals(blockTextFull, featureBlockBibliography.getText());
189
        featureBlockBibliography.testDescriptionElementLayout(0, indent, descriptionElementFontSize, expectedCssDisplay, expectedListStyleType, expectedListStylePosition, expectedListStyleImage);
190

    
191
    }
192

    
193
}
(2-2/2)