Project

General

Profile

Download (12.6 KB) Statistics
| Branch: | Tag: | Revision:
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

    
15
import org.junit.Before;
16
import org.junit.Test;
17
import org.openqa.selenium.NoSuchElementException;
18

    
19
import eu.etaxonomy.dataportal.DataPortalSite;
20
import eu.etaxonomy.dataportal.ElementUtils;
21
import eu.etaxonomy.dataportal.elements.BaseElement;
22
import eu.etaxonomy.dataportal.elements.GalleryImage;
23
import eu.etaxonomy.dataportal.elements.LinkElement;
24
import eu.etaxonomy.dataportal.elements.RegistrationItemFull;
25
import eu.etaxonomy.dataportal.junit.CdmDataPortalTestBase;
26
import eu.etaxonomy.dataportal.junit.DataPortalContextSuite.DataPortalContexts;
27
import eu.etaxonomy.dataportal.pages.PortalPage.MessageType;
28
import eu.etaxonomy.dataportal.pages.RegistrationPage;
29

    
30
/**
31
 * @author a.kohlbecker
32
 * @since Feb 5, 2019
33
 *
34
 */
35
@DataPortalContexts( { DataPortalSite.reference })
36
public class RegistrationPageTest extends CdmDataPortalTestBase {
37

    
38
    private static final String planothidium_victori_id = "http://testbank.org/100001";
39

    
40
    private static final String planothidium_victori_epitype_id = "http://testbank.org/100002";
41

    
42
    private static final String nodosilinea_id = "http://testbank.org/100003"; // in preparation!
43

    
44
    private static final String nodosilinea_radiophila_id = "http://testbank.org/100004";
45

    
46
    private static final String ramsaria_id = "http://testbank.org/100005";
47

    
48
    private static final String ramsaria_avicennae_id = "http://testbank.org/100006";
49

    
50
    private static final String glenodinium_apiculatum_types_id = "http://testbank.org/100008";
51

    
52
    String titleSuffix = " | Integration test reference";
53

    
54

    
55

    
56
    @Before
57
    public void setUp() throws Exception {
58
        driver.get(getContext().getSiteUri().toString());
59
    }
60

    
61

    
62
    @Test
63
    public void test100001() throws MalformedURLException, UnsupportedEncodingException{
64

    
65
        RegistrationPage p = new RegistrationPage(driver, getContext(), planothidium_victori_id);
66

    
67
        assertEquals("Registration Id: http://testbank.org/100001" + titleSuffix, driver.getTitle());
68
        RegistrationItemFull regItem = p.getRegistrationItem();
69
        assertNotNull(regItem);
70
        assertEquals(
71
                "Planothidium victori Novis, Braidwood & Kilroy in Phytotaxa 64. 20121",
72
                regItem.getNameElement().getText());
73
        assertEquals(
74
                "published in: Novis, P. M., Braidwood, J. & Kilroy, C., Small diatoms (Bacillariophyta) in cultures from the Styx River, New Zealand, including descriptions of three new species. – Phytotaxa 64: 11-45. 2012",
75
                regItem.getCitation().getText());
76
        assertEquals(
77
                "Registration on 2019-02-06 14:21:52",
78
                regItem.getMetadata().getText());
79
        List<LinkElement> fkeys = regItem.getFootNoteKeys();
80
        assertEquals("1", fkeys.get(0).getText());
81
        List<BaseElement> fns = regItem.getFootNotes();
82
        assertEquals(1, fns.size());
83
        assertEquals("1. Please check reference detail", fns.get(0).getText());
84
    }
85

    
86
    @Test
87
    public void test100002() throws MalformedURLException, UnsupportedEncodingException{
88

    
89
        RegistrationPage p = new RegistrationPage(driver, getContext(), planothidium_victori_epitype_id);
90

    
91
        assertEquals("Registration Id: http://testbank.org/100002" + titleSuffix, driver.getTitle());
92
        RegistrationItemFull regItem = p.getRegistrationItem();
93
        assertNotNull(regItem);
94
        assertEquals(
95
                "Epitype: Berlin, small river Wuhle, 52°31'14.844\"N, 13°34'40.116\"E, Skibbe - collector number D06 (B 40 0040871).1",
96
                regItem.getSpecimenTypeDesignations().get(0).getText());
97
        BaseElement typifiedNameElement = new BaseElement(regItem.getTypifiedNameElement());
98
        assertEquals(
99
                "for Planothidium victori Novis, Braidwood & Kilroy in Phytotaxa 64. 20122",
100
                typifiedNameElement.getText());
101
        assertEquals("2", typifiedNameElement.getFootNoteKeys().get(0).getText());
102
        assertEquals("2. Please check reference detail", p.getDataPortalContent().getFootNoteForKey(typifiedNameElement.getFootNoteKeys().get(0)).getText());
103
        assertEquals(
104
                "published in: Jahn, R., Abarca, N., Gemeinholzer, B. & al., Planothidium lanceolatum and Planothicium frequentissimum reinvestigated wieht molecular methods and morphology: four new species and the taxonomic importance of the sinus and cavum. – Diatom Research 32: 75-107. 2017",
105
                regItem.getCitation().getText());
106
        assertEquals(
107
                "Registration on 2019-02-06 14:20:51",
108
                regItem.getMetadata().getText());
109
    }
110

    
111
    @Test
112
    public void test100003() throws MalformedURLException, UnsupportedEncodingException{
113

    
114
        RegistrationPage p = new RegistrationPage(driver, getContext(), nodosilinea_id);
115

    
116
        assertEquals("Registration in preparation" + titleSuffix, driver.getTitle());
117
        RegistrationItemFull regItem = null;
118
        try {
119
            regItem = p.getRegistrationItem();
120
        } catch(NoSuchElementException e) {/* IGNORE */}
121
        assertNull(regItem);
122

    
123
        List<String> statusMessageItems = p.getMessageItems(MessageType.status);
124
        assertEquals(
125
                "Status message\nA registration with the identifier http://testbank.org/100003 is in preparation",
126
                statusMessageItems.get(0));
127
    }
128

    
129

    
130
    @Test
131
    public void test100004() throws MalformedURLException, UnsupportedEncodingException{
132

    
133
        RegistrationPage p = new RegistrationPage(driver, getContext(), nodosilinea_radiophila_id);
134

    
135
        assertEquals("Registration Id: http://testbank.org/100004" + titleSuffix, driver.getTitle());
136
        RegistrationItemFull regItem = p.getRegistrationItem();
137
        assertNotNull(regItem);
138
        assertEquals(
139
                "Nodosilinea radiophila Heidari & Hauer in Fottea 18(2): 142. fig. 5C, D. 1 Nov 2018, nom. illeg.1",
140
                regItem.getNameElement().getText());
141
        assertEquals(
142
                "Holotype: Iran, Islamic Republic of, Talesh Mahalleh, Ramsar., alt. 20 m, 36°52'58.8\"N, 50°40'58.8\"E (CBFS A–83–1).2",
143
                regItem.getSpecimenTypeDesignations().get(0).getText());
144
        assertEquals(
145
                "published in: Heidari, F., Zima, J., Riahi, H. & al., New simple trichal cyanobacterial taxa isolated from radioactive thermal springs. – Fottea 18(2): 137–149. 2018",
146
                regItem.getCitation().getText());
147
        assertEquals(
148
                "Registration on 2019-02-06 14:16:45",
149
                regItem.getMetadata().getText());
150
    }
151

    
152
    @Test
153
    public void test100005() throws MalformedURLException, UnsupportedEncodingException{
154

    
155
        RegistrationPage p = new RegistrationPage(driver, getContext(), ramsaria_id);
156

    
157
        assertEquals("Registration Id: http://testbank.org/100005" + titleSuffix, driver.getTitle());
158
        RegistrationItemFull regItem = p.getRegistrationItem();
159
        assertNotNull(regItem);
160
        assertEquals(
161
                "Ramsaria Heidari & Hauer in Fottea 18(2): 146. 1 Nov 2018",
162
                regItem.getNameElement().getText());
163
        assertEquals(
164
                "Orig. des.: Ramsaria avicennae Heidari & Hauer designated by Heidari & Hauer 2018: 1461",
165
                regItem.getNameTypeDesignations().get(0).getText());
166
        assertEquals(
167
                "published in: Heidari, F., Zima, J., Riahi, H. & al., New simple trichal cyanobacterial taxa isolated from radioactive thermal springs. – Fottea 18(2): 137–149. 2018",
168
                regItem.getCitation().getText());
169
        assertEquals(
170
                "Registration on 2019-02-06 13:54:35",
171
                regItem.getMetadata().getText());
172
        List<LinkElement> footnoteKeys = regItem.getFootNoteKeys();
173
        assertEquals(1,  footnoteKeys.size());
174
        assertEquals("1", footnoteKeys.get(0).getText());
175
        List<BaseElement> footnotes = regItem.getFootNotes();
176
        assertEquals(1, footnotes.size());
177
        assertEquals("1. editorial note on the type name of Ramsaria", footnotes.get(0).getText());
178

    
179
    }
180

    
181
    @Test
182
    public void test100006() throws MalformedURLException, UnsupportedEncodingException{
183

    
184
        RegistrationPage p = new RegistrationPage(driver, getContext(), ramsaria_avicennae_id);
185

    
186
        assertEquals("Registration Id: http://testbank.org/100006" + titleSuffix, driver.getTitle());
187
        RegistrationItemFull regItem = p.getRegistrationItem();
188
        assertNotNull(regItem);
189
        assertEquals(
190
                "Ramsaria avicennae Heidari & Hauer in Fottea 18(2): 146, fig. 3F, G. 1 Nov 2018",
191
                regItem.getNameElement().getText());
192
        assertEquals(
193
                "Holotype: Iran, Islamic Republic of, Ramsar, alt. 20 m, 36°52'58.8\"N, 50°40'58.8\"E (CBFS A–087–1).",
194
                regItem.getSpecimenTypeDesignations().get(0).getText());
195
        assertEquals(
196
                "published in: Heidari, F., Zima, J., Riahi, H. & al., New simple trichal cyanobacterial taxa isolated from radioactive thermal springs. – Fottea 18(2): 137–149. 2018",
197
                regItem.getCitation().getText());
198
        assertEquals(
199
                "Registration on 2019-02-06 13:54:29",
200
                regItem.getMetadata().getText());
201
    }
202

    
203

    
204

    
205
    @Test
206
    public void test100008() throws MalformedURLException, UnsupportedEncodingException{
207

    
208
        RegistrationPage p = new RegistrationPage(driver, getContext(),  glenodinium_apiculatum_types_id);
209

    
210
        assertEquals("Registration Id: http://testbank.org/100008" + titleSuffix, driver.getTitle());
211
        RegistrationItemFull regItem = p.getRegistrationItem();
212
        assertNotNull(regItem);
213

    
214
        assertEquals(
215
                "for Glenodinium apiculatum Ehrenb., Infusionsthierchen: 258, pl. XXII. 24 Jul–Aug 1838",
216
                regItem.getTypifiedNameElement().getText());
217
        assertEquals(
218
                "published in: Kretschmann, J., Žerdoner ?alasan, A. & Kusber, W.-H., Still curling after all these years: Glenodinium apiculatum Ehrenb. (Peridiniales, Dinophyceae) repeatedly found at its type locality in Berlin (Germany). – Systematics and Biodiversity. 2017",
219
                regItem.getCitation().getText());
220
        assertEquals(
221
                "Registration on 2019-02-12 09:08:29",
222
                regItem.getMetadata().getText());
223

    
224
        // type designations in defined order
225
        // 1. Epitype
226
        assertEquals(
227
                "Epitype: Germany, Berlin, alt. 165 m, 52°31'1.2\"N, 13°21'E (WGS84), 28 Mar 2016, Ehrenberg D047; D. Veloper (CEDiT 2017E68). http://testid.org/2017E68",
228
                regItem.getSpecimenTypeDesignations().get(0).getText());
229

    
230
        // 2. Lectotype
231
        assertTrue(
232
                regItem.getSpecimenTypeDesignations().get(1).getText().startsWith("Lectotype: Germany, Berlin, 2 Apr 1835 (BHUPM 671). Naturkundemuseum Berlin (MFN) - Ehrenberg Collection"));
233
        assertEquals(
234
                "BHUPM 671",
235
                regItem.getSpecimenTypeDesignations().get(1).getLinksInElement().get(0).getText());
236
        assertTrue(
237
                regItem.getSpecimenTypeDesignations().get(1).getLinksInElement().get(1).getUrl().endsWith("cdm_dataportal/reference/c5d980ff-8766-4322-9acb-7b0a499de707"));
238
        List<List<GalleryImage>> galleryImages = ElementUtils.getGalleryImages(regItem.getSpecimenTypeDesignations().get(1).getElement(), p.getWait());
239
        assertEquals("Expecting one row of images", 1, galleryImages.size());
240
        assertEquals("Expecting 1 image in row", 1, galleryImages.get(0).size());
241
        assertEquals(
242
                "http://download.naturkundemuseum-berlin.de/Ehrenberg/Ec%20Drawings/Ec%20draw%20001-999/Ec%20draw%20600-699/ECdraw671.jpg",
243
                galleryImages.get(0).get(0).getImageLink().getUrl());
244

    
245
        // 3. Isolectotype
246
        assertEquals(
247
                "Isolectotype: Germany, Berlin, alt. 165 m, 52°31'1.2\"N, 13°21'E (WGS84), 28 Mar 2016, Ehrenberg D047 (M M-0289351). http://herbarium.bgbm.org/object/B400042045",
248
                regItem.getSpecimenTypeDesignations().get(2).getText());
249
        assertEquals(
250
                "M M-0289351",
251
                regItem.getSpecimenTypeDesignations().get(2).getLinksInElement().get(0).getText());
252
        assertEquals(
253
                "http://herbarium.bgbm.org/object/B400042045",
254
                regItem.getSpecimenTypeDesignations().get(2).getLinksInElement().get(1).getText());
255

    
256

    
257
    }
258

    
259

    
260

    
261

    
262
}
(10-10/15)