1
|
/**
|
2
|
* Copyright (C) 2019 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.reference;
|
10
|
|
11
|
import java.io.UnsupportedEncodingException;
|
12
|
import java.net.MalformedURLException;
|
13
|
import java.util.List;
|
14
|
import java.util.UUID;
|
15
|
|
16
|
import org.junit.Before;
|
17
|
import org.junit.Test;
|
18
|
|
19
|
import eu.etaxonomy.dataportal.DataPortalSite;
|
20
|
import eu.etaxonomy.dataportal.elements.BaseElement;
|
21
|
import eu.etaxonomy.dataportal.elements.LinkElement;
|
22
|
import eu.etaxonomy.dataportal.elements.RegistrationItemFull;
|
23
|
import eu.etaxonomy.dataportal.junit.CdmDataPortalTestBase;
|
24
|
import eu.etaxonomy.dataportal.junit.DataPortalContextSuite.DataPortalContexts;
|
25
|
import eu.etaxonomy.dataportal.pages.NamePage;
|
26
|
import eu.etaxonomy.dataportal.pages.RegistrationPage;
|
27
|
|
28
|
/**
|
29
|
* @author a.kohlbecker
|
30
|
* @since Feb 5, 2019
|
31
|
*
|
32
|
*/
|
33
|
@DataPortalContexts( { DataPortalSite.reference })
|
34
|
public class FootnoteTest extends CdmDataPortalTestBase {
|
35
|
|
36
|
|
37
|
private static final String nodosilinea_radiophila_regid = "http://testbank.org/100004";
|
38
|
|
39
|
private static final String ramsaria_regid = "http://testbank.org/100005";
|
40
|
|
41
|
private static final UUID nodosilinea_radiophila_name_UUID = UUID.fromString("e97cc25b-ec11-4bb8-88d7-ab40a023f3fb");
|
42
|
|
43
|
private static final UUID ramsaria_name_UUID = UUID.fromString("3a6d4bf2-5c89-4525-9e87-0bacac96990b");
|
44
|
|
45
|
|
46
|
String titleSuffix = " | Integration test reference";
|
47
|
|
48
|
|
49
|
|
50
|
@Before
|
51
|
public void setUp() throws Exception {
|
52
|
driver.get(getContext().getSiteUri().toString());
|
53
|
}
|
54
|
|
55
|
@Test
|
56
|
public void registationPageFieldUnitAnnotation() throws MalformedURLException, UnsupportedEncodingException{
|
57
|
|
58
|
RegistrationPage p = new RegistrationPage(driver, getContext(), nodosilinea_radiophila_regid);
|
59
|
|
60
|
assertEquals("Registration Id: http://testbank.org/100004" + titleSuffix, driver.getTitle());
|
61
|
RegistrationItemFull regItem = p.getRegistrationItem();
|
62
|
assertNotNull(regItem);
|
63
|
|
64
|
List<LinkElement> footnoteKeys = regItem.getFootNoteKeys();
|
65
|
assertEquals(5, footnoteKeys.size());
|
66
|
// check footnote keys are in right order
|
67
|
assertEquals("1", footnoteKeys.get(0).getText());
|
68
|
assertEquals("2", footnoteKeys.get(1).getText());
|
69
|
assertEquals("3", footnoteKeys.get(2).getText());
|
70
|
assertEquals("4", footnoteKeys.get(3).getText());
|
71
|
assertEquals("5", footnoteKeys.get(4).getText());
|
72
|
|
73
|
// check content of footnotes
|
74
|
List<BaseElement> footnotes = regItem.getFootNotes();
|
75
|
assertEquals(5, footnotes.size());
|
76
|
assertEquals("1. Editorial note on Nodosilinea radiophila", footnotes.get(0).getText());
|
77
|
assertEquals("2. editorial note on the fieldunit", footnotes.get(1).getText());
|
78
|
assertEquals("3. Art. 77.7 Turland, N.J., Wiersema, J.H., Barrie, F.R. & al., International Code of Nomenclature for algae, fungi, and plants (Shenzhen Code) adopted by the Nineteenth International Botanical Congress Shenzhen, China, July 2017: 22",
|
79
|
footnotes.get(2).getText());
|
80
|
assertEquals("4. Art. 99.9 Turland, N.J., Wiersema, J.H., Barrie, F.R. & al., International Code of Nomenclature for algae, fungi, and plants (Shenzhen Code) adopted by the Nineteenth International Botanical Congress Shenzhen, China, July 2017: 11",
|
81
|
footnotes.get(3).getText());
|
82
|
assertEquals("5. Editorial annotation on Nodosilinea sensensia (Blanco) Heidari & Hauer ex Lem",
|
83
|
footnotes.get(4).getText());
|
84
|
}
|
85
|
|
86
|
@Test
|
87
|
public void namePageFieldUnitAnnotation() throws MalformedURLException{
|
88
|
|
89
|
NamePage p = new NamePage(driver, getContext(), nodosilinea_radiophila_name_UUID);
|
90
|
|
91
|
assertEquals("Nodosilinea radiophila Heidari & Hauer in Fottea 18(2): 142. fig. 5C, D. 1 Nov 2018, nom. illeg." + titleSuffix, driver.getTitle());
|
92
|
BaseElement pageContent = p.getDataPortalContent();
|
93
|
assertNotNull(pageContent);
|
94
|
|
95
|
List<LinkElement> footnoteKeys = pageContent.getFootNoteKeys();
|
96
|
assertEquals(6, footnoteKeys.size());
|
97
|
// check footnote keys are in right order
|
98
|
assertEquals("1", footnoteKeys.get(0).getText());
|
99
|
assertEquals("2", footnoteKeys.get(1).getText());
|
100
|
assertEquals("3", footnoteKeys.get(2).getText());
|
101
|
assertEquals("4", footnoteKeys.get(3).getText());
|
102
|
assertEquals("5", footnoteKeys.get(4).getText());
|
103
|
assertEquals("6", footnoteKeys.get(5).getText());
|
104
|
|
105
|
// check content of footnotes
|
106
|
List<BaseElement> footnotes = pageContent.getFootNotes();
|
107
|
assertEquals(6, footnotes.size());
|
108
|
assertEquals("1. Editorial note on Nodosilinea radiophila",
|
109
|
footnotes.get(0).getText());
|
110
|
assertEquals("2. Art. 77.7 Turland, N.J., Wiersema, J.H., Barrie, F.R. & al., International Code of Nomenclature for algae, fungi, and plants (Shenzhen Code) adopted by the Nineteenth International Botanical Congress Shenzhen, China, July 2017: 22",
|
111
|
footnotes.get(1).getText());
|
112
|
assertEquals("3. Art. 99.9 Turland, N.J., Wiersema, J.H., Barrie, F.R. & al., International Code of Nomenclature for algae, fungi, and plants (Shenzhen Code) adopted by the Nineteenth International Botanical Congress Shenzhen, China, July 2017: 11",
|
113
|
footnotes.get(2).getText());
|
114
|
assertEquals("4. Editorial annotation on Nodosilinea sensensia (Blanco) Heidari & Hauer ex Lem",
|
115
|
footnotes.get(3).getText());
|
116
|
BaseElement footnote5 = footnotes.get(4);
|
117
|
assertEquals("5. Heidari, F. & Hauer, T. - in Heidari, F., Zima, J., Riahi, H. & al., New simple trichal cyanobacterial taxa isolated from radioactive thermal springs in Fottea 18(2): 137–149. 2018 Registration: http://testbank.org/100004, 2019-02-06",
|
118
|
footnote5.getText());
|
119
|
List<LinkElement> linksInFootnote5 = footnote5.getLinksInElement();
|
120
|
assertEquals(2, linksInFootnote5.size());
|
121
|
assertTrue(linksInFootnote5.get(0).getUrl().endsWith("cdm_dataportal/reference/f2e43411-2564-42c7-816e-7e6046adbefa"));
|
122
|
assertEquals("", linksInFootnote5.get(0).getText());
|
123
|
assertEquals("http://testbank.org/100004", linksInFootnote5.get(1).getText());
|
124
|
assertTrue("unexpected url in footnote: " + linksInFootnote5.get(1).getUrl(), linksInFootnote5.get(1).getUrl().endsWith("cdm_dataportal/registration?identifier=http%3A//testbank.org/100004"));
|
125
|
assertEquals("6. editorial note on the fieldunit", footnotes.get(5).getText());
|
126
|
}
|
127
|
|
128
|
@Test
|
129
|
public void registationPageTypeNameAnnotation() throws MalformedURLException, UnsupportedEncodingException{
|
130
|
|
131
|
RegistrationPage p = new RegistrationPage(driver, getContext(), ramsaria_regid);
|
132
|
|
133
|
RegistrationItemFull regItem = p.getRegistrationItem();
|
134
|
assertNotNull(regItem);
|
135
|
|
136
|
List<LinkElement> footnoteKeys = regItem.getFootNoteKeys();
|
137
|
assertEquals(1, footnoteKeys.size());
|
138
|
// check footnote keys are in right order
|
139
|
assertEquals("1", footnoteKeys.get(0).getText());
|
140
|
|
141
|
// check content of footnotes
|
142
|
List<BaseElement> footnotes = regItem.getFootNotes();
|
143
|
assertEquals(1, footnotes.size());
|
144
|
assertEquals("1. editorial note on the type name of Ramsaria", footnotes.get(0).getText());
|
145
|
|
146
|
}
|
147
|
|
148
|
@Test
|
149
|
public void namePageTypeNameAnnotation() throws MalformedURLException{
|
150
|
|
151
|
NamePage p = new NamePage(driver, getContext(), ramsaria_name_UUID);
|
152
|
|
153
|
assertEquals("Ramsaria Heidari & Hauer in Fottea 18(2): 146. 1 Nov 2018" + titleSuffix, driver.getTitle());
|
154
|
BaseElement pageContent = p.getDataPortalContent();
|
155
|
assertNotNull(pageContent);
|
156
|
|
157
|
List<LinkElement> footnoteKeys = pageContent.getFootNoteKeys();
|
158
|
assertEquals(2, footnoteKeys.size());
|
159
|
// check footnote keys are in right order
|
160
|
assertEquals("1", footnoteKeys.get(0).getText());
|
161
|
assertEquals("2", footnoteKeys.get(1).getText());
|
162
|
|
163
|
// check content of footnotes
|
164
|
List<BaseElement> footnotes = pageContent.getFootNotes();
|
165
|
assertEquals(2, footnotes.size());
|
166
|
BaseElement footnote1 = footnotes.get(1);
|
167
|
assertEquals("1. editorial note on the type name of Ramsaria", footnotes.get(0).getText());
|
168
|
assertEquals("2. Species solaris", footnote1.getText());
|
169
|
List<LinkElement> linksInFootnote3 = footnote1.getLinksInElement();
|
170
|
assertEquals(1, linksInFootnote3.size());
|
171
|
assertTrue(linksInFootnote3.get(0).getUrl().endsWith("cdm_dataportal/reference/5e5d9d08-8c28-4b22-b30a-6214c8641163"));
|
172
|
}
|
173
|
|
174
|
}
|