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.NoSuchElementException;
|
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
|
* @author a.kohlbecker
|
30
|
*
|
31
|
*/
|
32
|
|
33
|
@DataPortalContexts( { DataPortalSite.palmae })
|
34
|
public class Iriartea_deltoidea_UsesTest extends CdmDataPortalTestBase{
|
35
|
|
36
|
static UUID taxonUuid = UUID.fromString("ce870eca-0422-4a3c-b849-0f5ca0370b1f");
|
37
|
|
38
|
static TaxonProfilePage p = null;
|
39
|
|
40
|
@Before
|
41
|
public void setUp() throws MalformedURLException {
|
42
|
|
43
|
if(p == null){
|
44
|
p = new TaxonProfilePage(driver, getContext(), taxonUuid);
|
45
|
}
|
46
|
|
47
|
}
|
48
|
|
49
|
|
50
|
@Test
|
51
|
public void testTitleAndTabs() {
|
52
|
|
53
|
assertEquals(getContext().prepareTitle("Iriartea deltoidea Ruiz & Pav., Syst. Veg. Fl. Peruv. Chil. : 298 (1798)"), driver.getTitle());
|
54
|
assertNull("Authorship information should be hidden", p.getAuthorInformationText());
|
55
|
|
56
|
List<LinkElement> primaryTabs = p.getPrimaryTabs();
|
57
|
int tabId = 0;
|
58
|
assertEquals("General\n(active tab)", primaryTabs.get(tabId++).getText());
|
59
|
assertEquals("Synonymy", primaryTabs.get(tabId++).getText());
|
60
|
assertEquals("Images", primaryTabs.get(tabId++).getText());
|
61
|
assertEquals("Expecting " + tabId + " tabs", tabId, primaryTabs.size());
|
62
|
|
63
|
}
|
64
|
|
65
|
|
66
|
@Test
|
67
|
public void testFeatureToc() {
|
68
|
|
69
|
assertEquals("Content", p.getTableOfContentHeader());
|
70
|
List<LinkElement> links = p.getTableOfContentLinks();
|
71
|
assertEquals("Expecting 7 entries in the TOC of the profile page.", 7, links.size());
|
72
|
}
|
73
|
|
74
|
@Test
|
75
|
public void testFeatureDistribution() {
|
76
|
|
77
|
int featureId = 0;
|
78
|
|
79
|
int descriptionElementFontSize = 11;
|
80
|
String expectedListStyleType = "none";
|
81
|
String expectedCssDisplay = "inline";
|
82
|
String expectedListStylePosition = "outside";
|
83
|
String expectedListStyleImage = "none";
|
84
|
int indent = 23;
|
85
|
|
86
|
/* distribution */
|
87
|
String featureClass = "distribution";
|
88
|
String featureLabel = "Distribution";
|
89
|
String blockTextFull = "Map uses TDWG level 3 distributions (http://www.nhm.ac.uk/hosted_sites/tdwg/geogrphy.html)\n"
|
90
|
+ "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"
|
91
|
+ "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)";
|
92
|
|
93
|
p.testTableOfContentEntry(featureId, featureLabel, featureClass);
|
94
|
FeatureBlock featureBlockDistribution = p.getFeatureBlockAt(featureId, featureClass, "div", "span");
|
95
|
|
96
|
assertEquals(featureLabel, featureBlockDistribution.getTitle().getText());
|
97
|
|
98
|
|
99
|
String distributionContentText = featureBlockDistribution.getContentText().trim();
|
100
|
WebElement openLayersErrorMessages = null;
|
101
|
try {
|
102
|
openLayersErrorMessages = featureBlockDistribution.getElement().findElement(By.id("OpenLayers_Control_ErrorMessages"));
|
103
|
distributionContentText = distributionContentText.replace(openLayersErrorMessages.getText(), "").trim(); // remove error text
|
104
|
} catch(NoSuchElementException e) {
|
105
|
// IGNORE
|
106
|
}
|
107
|
assertEquals(blockTextFull, distributionContentText);
|
108
|
|
109
|
featureBlockDistribution.testDescriptionElementLayout(0, indent, descriptionElementFontSize, expectedCssDisplay, expectedListStyleType, expectedListStylePosition, expectedListStyleImage);
|
110
|
|
111
|
assertNotNull("Expecting an OpenLayers map", featureBlockDistribution.getElement().findElement(By.id("openlayers-map-distribution")));
|
112
|
String mapText = featureBlockDistribution.getElement().findElement(By.className("distribution_map_caption")).getText();
|
113
|
assertTrue(mapText.equals("Map uses TDWG level 3 distributions (http://www.nhm.ac.uk/hosted_sites/tdwg/geogrphy.html)")
|
114
|
// OR error text which is shown when the map server is absent
|
115
|
|| mapText.equals("The map is currently broken due to problems with the map server."));
|
116
|
}
|
117
|
|
118
|
@Test
|
119
|
public void testUses() {
|
120
|
|
121
|
int featureId = 2;
|
122
|
int descriptionElementFontSize = 11;
|
123
|
String expectedCssDisplay = "inline";
|
124
|
String expectedListStyleType = "none";
|
125
|
String expectedListStylePosition = "outside";
|
126
|
String expectedListStyleImage = "none";
|
127
|
int indent = 23;
|
128
|
|
129
|
/* Biology And Ecology */
|
130
|
String featureClass = "uses";
|
131
|
String featureLabel = "Uses";
|
132
|
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 Monographs 53)";
|
133
|
expectedCssDisplay = "list-item";
|
134
|
expectedListStyleType = "none";
|
135
|
|
136
|
p.testTableOfContentEntry(featureId,featureLabel, featureClass);
|
137
|
FeatureBlock featureBlockBibliography = p.getFeatureBlockAt(featureId, featureClass, "ul", "li");
|
138
|
|
139
|
assertEquals(blockTextFull, featureBlockBibliography.getText());
|
140
|
featureBlockBibliography.testDescriptionElementLayout(0, indent, descriptionElementFontSize, expectedCssDisplay, expectedListStyleType, expectedListStylePosition, expectedListStyleImage);
|
141
|
|
142
|
}
|
143
|
|
144
|
@Test
|
145
|
public void testFeatureUseRecord() {
|
146
|
|
147
|
int featureId = 5;
|
148
|
|
149
|
String featureClass = "use-record";
|
150
|
String featureLabel = "Use Record";
|
151
|
|
152
|
p.testTableOfContentEntry(featureId,featureLabel, featureClass);
|
153
|
FeatureBlock featureBlockBioEco = p.getFeatureBlockAt(featureId, featureClass, "ul", "li");
|
154
|
|
155
|
List<WebElement> listItems = featureBlockBioEco.getElement().findElements(By.tagName("li"));
|
156
|
assertEquals(95, listItems.size());
|
157
|
|
158
|
String item14UseRecordText =
|
159
|
"Use Category Use Sub Category Plant Part Human Group Ethnic Group Country\n"
|
160
|
+ "Construction Thatch Entire leaf Indigenous Tsimane/Mosetene Bolivia\n"
|
161
|
+ "Utensils and Tools Domestic Stem Indigenous Tsimane/Mosetene Bolivia\n"
|
162
|
+ "Utensils and Tools Domestic Leaf sheath Indigenous Tsimane/Mosetene Bolivia\n"
|
163
|
+ "Human Food Food Palm heart Indigenous Tsimane/Mosetene Bolivia\n"
|
164
|
+ "Cultural Personal adornment Seeds Indigenous Tsimane/Mosetene Bolivia\n"
|
165
|
+ "Construction Houses Stem Indigenous Tsimane/Mosetene Bolivia";
|
166
|
|
167
|
|
168
|
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. 2006: Usos de las palmeras (Arecaceae),en la Reserva de la Biosfera-Tierra Comunitaria de Orígen Pilón Lajas, (Bolivia))\n"
|
169
|
+ item14UseRecordText,
|
170
|
listItems.get(0).getText());
|
171
|
// tabular
|
172
|
assertEquals(item14UseRecordText,
|
173
|
listItems.get(0).findElement(By.className("use-records")).getText());
|
174
|
// synonym
|
175
|
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 2000: Los Tacana- datos sobre la historia de su civilización (as Iriartea ventricosa Mart.))",
|
176
|
listItems.get(81).getText());
|
177
|
}
|
178
|
|
179
|
@Test
|
180
|
public void testBibliography() {
|
181
|
|
182
|
int featureId = 6;
|
183
|
int descriptionElementFontSize = 11;
|
184
|
String expectedCssDisplay = "block";
|
185
|
String expectedListStyleType = "none";
|
186
|
String expectedListStylePosition = "outside";
|
187
|
String expectedListStyleImage = "none";
|
188
|
int indent = 0;
|
189
|
|
190
|
String featureClass = "bibliography";
|
191
|
String featureLabel = "Bibliography";
|
192
|
String blockTextFull = featureLabel + "\n"
|
193
|
+ " 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"
|
194
|
+ " World Checklist of Arecaceae\n"
|
195
|
+ " Henderson, A. 1990. Introduction and the Iriarteinae. Flora Neotropica Monograph 53.";
|
196
|
|
197
|
p.testTableOfContentEntry(featureId,featureLabel, featureClass);
|
198
|
FeatureBlock featureBlockBibliography = p.getFeatureBlockAt(featureId, featureClass, "ul", "div");
|
199
|
|
200
|
// assertEquals(blockTextFull, featureBlockBibliography.getText());
|
201
|
// featureBlockBibliography.testDescriptionElementLayout(0, indent, descriptionElementFontSize, expectedCssDisplay, expectedListStyleType, expectedListStylePosition, expectedListStyleImage);
|
202
|
|
203
|
}
|
204
|
|
205
|
}
|