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;
|
11
|
|
12
|
import java.util.HashMap;
|
13
|
import java.util.List;
|
14
|
import java.util.Map;
|
15
|
|
16
|
import org.junit.Assert;
|
17
|
import org.junit.Test;
|
18
|
import org.openqa.selenium.By;
|
19
|
import org.openqa.selenium.RenderedWebElement;
|
20
|
import org.openqa.selenium.WebElement;
|
21
|
|
22
|
import eu.etaxonomy.dataportal.DataPortalContext;
|
23
|
import eu.etaxonomy.dataportal.junit.CdmDataPortalTestBase;
|
24
|
import eu.etaxonomy.dataportal.junit.DataPortalContextSuite.DataPortalContexts;
|
25
|
import eu.etaxonomy.dataportal.testutils.PolytomousKeyTestTool;
|
26
|
import eu.etaxonomy.dataportal.testutils.PolytomousKeyTestTool.KeyLineData;
|
27
|
import eu.etaxonomy.dataportal.testutils.PolytomousKeyTestTool.LinkClass;
|
28
|
|
29
|
/**
|
30
|
* @author a.kohlbecker
|
31
|
*
|
32
|
*/
|
33
|
|
34
|
@DataPortalContexts( { DataPortalContext.floramalesiana })
|
35
|
public class FloraMalesianaPolytomousKeyTest extends CdmDataPortalTestBase{
|
36
|
|
37
|
/**
|
38
|
* see http://dev.e-taxonomy.eu/trac/ticket/2350
|
39
|
*/
|
40
|
@Test
|
41
|
public void key_to_Malaysian_Sapindaceae_Genera(){
|
42
|
driver.get(getBaseUrl() + "?q=cdm_dataportal/polytomousKey/40cf3253-ce7a-4ad6-9a32-27695c36eb5d");
|
43
|
|
44
|
// Page title
|
45
|
RenderedWebElement element = (RenderedWebElement)driver.findElement(By.xpath(".//*[@id='squeeze']/div/div/h2"));
|
46
|
Assert.assertEquals("Key to Malaysian Sapindaceae Genera (based on vegetative and flower characters)", element.getText());
|
47
|
|
48
|
List<WebElement> keyTableList = driver.findElements(By.className("polytomousKey"));
|
49
|
Assert.assertEquals("Only one polytomousKey table expected", 1, keyTableList.size());
|
50
|
WebElement keyTable = keyTableList.get(0);
|
51
|
|
52
|
List<WebElement> tableRows = keyTable.findElements(By.xpath("tbody/tr"));
|
53
|
|
54
|
Map<Integer, PolytomousKeyTestTool.KeyLineData> keyLineDataMap = new HashMap<Integer, PolytomousKeyTestTool.KeyLineData>();
|
55
|
|
56
|
keyLineDataMap.put(0, new KeyLineData(
|
57
|
"0",
|
58
|
"Trees or shrubs, exceptionally lianas. Leaves simple, unifoliolate, (bi)pinnate or digitate. Inflorescences without basal tendrils",
|
59
|
LinkClass.nodeLinkToNode,
|
60
|
"1"));
|
61
|
|
62
|
keyLineDataMap.put(1, new KeyLineData("0'",
|
63
|
"Herbaceous or woody climbers. Leaves biternate. Inflorescences with basal tendrils",
|
64
|
LinkClass.nodeLinkToTaxon,
|
65
|
"Cardiospermum"));
|
66
|
|
67
|
keyLineDataMap.put(2, new KeyLineData("1",
|
68
|
"Leaves simple, unifoliolate, (im)paripinnate or digitate",
|
69
|
LinkClass.nodeLinkToNode,
|
70
|
"2"));
|
71
|
|
72
|
keyLineDataMap.put(3, new KeyLineData("1'",
|
73
|
"Leaves bipinnate",
|
74
|
LinkClass.nodeLinkToTaxon,
|
75
|
"Tristiropsis"));
|
76
|
|
77
|
keyLineDataMap.put(126, new KeyLineData("116",
|
78
|
"Leaflets entire or crenulate, lower surface without small glands. Inflorescences axillary, sometimes together pseudoterminal; cymes dense, many-flowered",
|
79
|
LinkClass.nodeLinkToTaxon,
|
80
|
"Synima cordierorum"));
|
81
|
|
82
|
keyLineDataMap.put(127, new KeyLineData("116'",
|
83
|
"Leaflets entire, lower surface usually with small glands. Inflorescences axillary, together mostly pseudoterminal, by the shifting aside and suppression of the terminal bud sometimes seemingly truly terminal; cymes lax, 1- or few-flowered",
|
84
|
LinkClass.nodeLinkToTaxon,
|
85
|
"Trigonachras"));
|
86
|
|
87
|
PolytomousKeyTestTool tester = new PolytomousKeyTestTool(tableRows, keyLineDataMap);
|
88
|
tester.runTest();
|
89
|
}
|
90
|
|
91
|
|
92
|
}
|