Project

General

Profile

Revision 720edc33

ID720edc338cc8a965cd2a21825b65fbc432624559
Parent f5396e17
Child e33dc21e, 27499fee

Added by Andreas Kohlbecker almost 2 years ago

ref #8051 more tests for specimen types in the registration page

View differences:

src/main/java/eu/etaxonomy/dataportal/ElementUtils.java
51 51
    }
52 52

  
53 53
    /**
54
     * @param webElement the element containing the media gallery. The gallery must have the class attribute <code>media_gallery</code>.
54 55
     * @return a two dimensional array representing the media items in the gallery, or null if no gallery exists.
55 56
     */
56 57
    public static List<List<GalleryImage>> getGalleryImages(WebElement webElement, WebDriverWait wait) {
src/main/java/eu/etaxonomy/dataportal/elements/RegistrationItem.java
8 8
*/
9 9
package eu.etaxonomy.dataportal.elements;
10 10

  
11
import java.util.ArrayList;
11 12
import java.util.List;
12 13

  
13 14
import org.openqa.selenium.By;
......
32 33
    }
33 34

  
34 35
    protected Style style = null;
35
    protected List<WebElement> specimenTypeDesignations;
36
    protected List<WebElement> nameTypeDesignations;
36
    protected List<BaseElement> specimenTypeDesignations;
37
    protected List<BaseElement> nameTypeDesignations;
37 38
    protected WebElement citation;
38 39
    protected WebElement metadata;
39 40
    protected WebElement identifier;
......
67 68
                }
68 69
            }
69 70
            try{
70
                specimenTypeDesignations = containerElement.findElements(By.cssSelector(".specimen_type_designation"));
71
                List<WebElement> std = containerElement.findElements(By.cssSelector(".specimen_type_designation"));
72
                specimenTypeDesignations = new ArrayList<BaseElement>(std.size());
73
                for(WebElement we : std){
74
                    specimenTypeDesignations.add(new BaseElement(we));
75
                }
71 76
            } catch (Exception e) { /* IGNORE */}
72 77
            try {
73
                nameTypeDesignations = containerElement.findElements(By.cssSelector(".name_type_designation"));
78
                List<WebElement> ntd = containerElement.findElements(By.cssSelector(".name_type_designation"));
79
                nameTypeDesignations = new ArrayList<BaseElement>(ntd.size());
80
                for(WebElement we : ntd){
81
                    nameTypeDesignations.add(new BaseElement(we));
82
                }
74 83
            } catch (Exception e) { /* IGNORE */}
75 84
            try {
76 85
                citation = containerElement.findElement(By.cssSelector(".citation"));
src/main/java/eu/etaxonomy/dataportal/elements/RegistrationItemFull.java
34 34
        return typifiedNameElement;
35 35
    }
36 36

  
37
    public List<WebElement> getSpecimenTypeDesignations() {
37
    public List<BaseElement> getSpecimenTypeDesignations() {
38 38
        return specimenTypeDesignations;
39 39
    }
40 40

  
41
    public List<WebElement> getNameTypeDesignations() {
41
    public List<BaseElement> getNameTypeDesignations() {
42 42
        return nameTypeDesignations;
43 43
    }
44 44

  
src/test/java/eu/etaxonomy/dataportal/selenium/tests/reference/RegistrationPageTest.java
10 10

  
11 11
import java.io.UnsupportedEncodingException;
12 12
import java.net.MalformedURLException;
13
import java.util.List;
13 14

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

  
18 19
import eu.etaxonomy.dataportal.DataPortalSite;
20
import eu.etaxonomy.dataportal.ElementUtils;
21
import eu.etaxonomy.dataportal.elements.GalleryImage;
19 22
import eu.etaxonomy.dataportal.elements.RegistrationItemFull;
20 23
import eu.etaxonomy.dataportal.junit.CdmDataPortalTestBase;
21 24
import eu.etaxonomy.dataportal.junit.DataPortalContextSuite.DataPortalContexts;
......
42 45

  
43 46
    private static final String ramsaria_avicennae_id = "http://testbank.org/100006";
44 47

  
48
    private static final String glenodinium_apiculatum_types_id = "http://testbank.org/100008";
49

  
45 50
    String titleSuffix = " | Integration test reference";
46 51

  
47 52

  
......
179 184

  
180 185

  
181 186

  
187
    @Test
188
    public void test100008() throws MalformedURLException, UnsupportedEncodingException{
189

  
190
        RegistrationPage p = new RegistrationPage(driver, getContext(),  glenodinium_apiculatum_types_id);
191

  
192
        assertEquals("Registration Id: http://testbank.org/100008" + titleSuffix, driver.getTitle());
193
        RegistrationItemFull regItem = p.getRegistrationItem();
194
        assertNotNull(regItem);
195
        assertEquals(
196
                "Lectotype: [icon] (BHUPM 671).\nopen media",
197
                regItem.getSpecimenTypeDesignations().get(0).getText());
198
        List<List<GalleryImage>> galleryImages = ElementUtils.getGalleryImages(regItem.getSpecimenTypeDesignations().get(0).getElement(), p.getWait());
199
        assertEquals("Expecting one row of images", 1, galleryImages.size());
200
        assertEquals("Expecting 1 image in row", 1, galleryImages.get(0).size());
201
        assertEquals(
202
                "http://download.naturkundemuseum-berlin.de/Ehrenberg/Ec%20Drawings/Ec%20draw%20001-999/Ec%20draw%20600-699/ECdraw671.jpg",
203
                galleryImages.get(0).get(0).getImageLink().getUrl());
204
        assertEquals(
205
                "Isolectotype: (M M-0289351). http://herbarium.bgbm.org/object/B400042045",
206
                regItem.getSpecimenTypeDesignations().get(1).getText());
207
        assertEquals(
208
                "http://herbarium.bgbm.org/object/B400042045",
209
                regItem.getSpecimenTypeDesignations().get(1).getLinksInElement().get(0).getText());
210
        assertEquals(
211
                "http://herbarium.bgbm.org/object/B400042045",
212
                regItem.getSpecimenTypeDesignations().get(1).getLinksInElement().get(0).getUrl());
213
        assertEquals(
214
                "Epitype: (CEDiT 2017E68).",
215
                regItem.getSpecimenTypeDesignations().get(2).getText());
216
        assertEquals(
217
                "for Glenodinium apiculatum Ehrenb., Infusionsthierchen: 258, pl. XXII. 24.7.1838-8.1838",
218
                regItem.getTypifiedNameElement().getText());
219
        assertEquals(
220
                "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) in Systematics and Biodiversity. 2017",
221
                regItem.getCitation().getText());
222
        assertEquals(
223
                "Registration on 2019-02-12 09:08:29",
224
                regItem.getMetadata().getText());
225
    }
226

  
227

  
228

  
182 229

  
183 230
}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)