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.util.List;
|
12
|
import java.util.UUID;
|
13
|
|
14
|
import org.junit.Assert;
|
15
|
import org.junit.Test;
|
16
|
|
17
|
import eu.etaxonomy.dataportal.DataPortalSite;
|
18
|
import eu.etaxonomy.dataportal.elements.BaseElement;
|
19
|
import eu.etaxonomy.dataportal.junit.CdmDataPortalTestBase;
|
20
|
import eu.etaxonomy.dataportal.junit.DataPortalContextSuite.DataPortalContexts;
|
21
|
import eu.etaxonomy.dataportal.pages.PolytomousKeyPage;
|
22
|
import eu.etaxonomy.dataportal.pages.PolytomousKeyPage.KeyLineData;
|
23
|
import eu.etaxonomy.dataportal.pages.PolytomousKeyPage.LinkClass;
|
24
|
import eu.etaxonomy.dataportal.pages.PortalPage;
|
25
|
|
26
|
/**
|
27
|
* @author a.kohlbecker
|
28
|
*
|
29
|
*/
|
30
|
|
31
|
@DataPortalContexts({ DataPortalSite.cyprus })
|
32
|
public class CyprusPolytomousKeyTest extends CdmDataPortalTestBase {
|
33
|
|
34
|
|
35
|
@Test
|
36
|
public void key_to_Achillea() throws Exception {
|
37
|
|
38
|
UUID keyUuid = UUID.fromString("55527688-92b4-4750-85ed-5808ff0a265e");
|
39
|
|
40
|
PolytomousKeyPage p = new PolytomousKeyPage(driver, getContext(), keyUuid);
|
41
|
|
42
|
PortalPage targetPage;
|
43
|
KeyLineData keyLineData;
|
44
|
|
45
|
|
46
|
Assert.assertEquals(getContext().prepareTitle("Achillea"), driver.getTitle());
|
47
|
|
48
|
Assert.assertEquals("but modified, supplemented and names used differing", p.getKeyAnnotationsText());
|
49
|
|
50
|
List<BaseElement> sourceRefs = p.getSources();
|
51
|
|
52
|
Assert.assertEquals( "G. N. Hadjikyriakou, Aromatic and spicy plants in Cyprus. 2007", sourceRefs.get(0).getText());
|
53
|
Assert.assertEquals(1, sourceRefs.get(0).getLinksInElement().size());
|
54
|
|
55
|
Assert.assertEquals("R. D. Meikle, Flora of Cyprus 2. 1985", sourceRefs.get(1).getText());
|
56
|
Assert.assertEquals(1, sourceRefs.get(1).getLinksInElement().size());
|
57
|
|
58
|
// -------- //
|
59
|
keyLineData = new KeyLineData("1",
|
60
|
"Capitula without ligulate ray-florets; leaves entire or subentire",
|
61
|
LinkClass.nodeLinkToTaxon, "Achillea maritima subsp. maritima");
|
62
|
targetPage = p.followPolytomousKeyLine(0, keyLineData);
|
63
|
Assert.assertEquals(getContext().prepareTitle(keyLineData.getLinkText()), driver.getTitle());
|
64
|
// This page should also have a key tab
|
65
|
Assert.assertEquals("Keys", targetPage.getPrimaryTabs().get(2).getText());
|
66
|
p.get();
|
67
|
|
68
|
// -------- //
|
69
|
keyLineData = new KeyLineData("1'", "Capitula with ligulate ray-florets; leaves pinnatisect",
|
70
|
LinkClass.nodeLinkToNode, "2");
|
71
|
// targetPage = p.followPolytomousKeyLine(1, keyLineData);
|
72
|
// Assert.assertEquals(p.getPageURL().getPath(), targetPage.getPageURL().getPath()); // TODO
|
73
|
// p.get();
|
74
|
|
75
|
|
76
|
keyLineData = new KeyLineData("2", "Ray-florets yellow", LinkClass.nodeLinkToNode, "3");
|
77
|
keyLineData = new KeyLineData("2'", "Ray-florets white", LinkClass.nodeLinkToNode, "4");
|
78
|
|
79
|
|
80
|
}
|
81
|
|
82
|
}
|