Project

General

Profile

Download (4.42 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2020 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.IOException;
12
import java.net.MalformedURLException;
13
import java.util.List;
14
import java.util.UUID;
15

    
16
import org.apache.log4j.Level;
17
import org.apache.log4j.Logger;
18
import org.junit.Before;
19
import org.junit.Test;
20
import org.openqa.selenium.By;
21
import org.openqa.selenium.WebElement;
22

    
23
import eu.etaxonomy.dataportal.DataPortalSite;
24
import eu.etaxonomy.dataportal.DrupalVars;
25
import eu.etaxonomy.dataportal.elements.BaseElement;
26
import eu.etaxonomy.dataportal.elements.DescriptionList;
27
import eu.etaxonomy.dataportal.elements.Dynabox;
28
import eu.etaxonomy.dataportal.junit.CdmDataPortalTestBase;
29
import eu.etaxonomy.dataportal.junit.DataPortalContextSuite.DataPortalContexts;
30
import eu.etaxonomy.dataportal.pages.TaxonPage;
31
import eu.etaxonomy.drush.DrushExecuter;
32
import eu.etaxonomy.drush.DrushExecutionFailure;
33

    
34
/**
35
 * @author a.kohlbecker
36
 * @since Aug 11, 2020
37
 */
38
@DataPortalContexts( { DataPortalSite.reference })
39
public class SpecimensTopDownViewTest extends CdmDataPortalTestBase {
40

    
41
    private static final UUID glenodinium_apiculatum_t = UUID.fromString("d245083e-3bda-435f-9bb3-bdc2249ff23c");
42

    
43
    @Before
44
    public void switchToView() throws IOException, InterruptedException, DrushExecutionFailure {
45
        Logger.getLogger(DrushExecuter.class).setLevel(Level.DEBUG);
46
        setDrupalVar(DrupalVars.CDM_DATAPORTAL_TAXONPAGE_TABS, "1");
47
        setDrupalVar(DrupalVars.CDM_SPECIMEN_LIST_VIEW_MODE, "derivate_path");
48
    }
49

    
50
    @Test
51
    public void test1() throws MalformedURLException {
52
        TaxonPage p = new TaxonPage(driver, getContext(), glenodinium_apiculatum_t, "specimens");
53
        WebElement specimensTable = p.getDataPortalContent().getElement().findElement(By.cssSelector("#specimens table.specimens"));
54
        List<WebElement> rows = specimensTable.findElements(By.xpath("./tbody/tr"));
55
        assertEquals(4, rows.size());
56
        assertEquals("Epitype: Germany, Berlin, alt. 165 m, 52°31'1.2\"N, 13°21'E (WGS84), 28 Mar 2016, Ehrenberg D047; D. Veloper (CEDiT 2017E68).\nOpen in viewer", rows.get(0).getText());
57
        assertEquals("Isolectotype: Germany, Berlin, alt. 165 m, 52°31'1.2\"N, 13°21'E (WGS84), 28 Mar 2016, Ehrenberg D047 (M M-0289351).\nOpen in viewer", rows.get(1).getText());
58
        assertEquals("Lectotype: BHUPM 671", rows.get(2).getText());
59

    
60
        Dynabox dynabox1 = new Dynabox(rows.get(0).findElement(By.className("dynabox")), driver);
61
        BaseElement dynaboxContent = dynabox1.click();
62
        List<WebElement> contentElements = dynaboxContent.getElement().findElements(By.xpath("./child::div"));
63
        assertEquals(3, contentElements.size());
64
        // 1
65
        DescriptionList dl1 = new DescriptionList(contentElements.get(0).findElement(By.tagName("dl")));
66
        assertEquals("Preserved Specimen", dl1.joinedDescriptionElementText("Record basis:"));
67
        assertEquals("Specimen", dl1.joinedDescriptionElementText("Kind of unit:"));
68
        assertEquals("CEDiT at Botanic Garden and Botanical Museum Berlin-Dahlem (BGBM)", dl1.joinedDescriptionElementText("Collection:"));
69
        assertEquals("2017E68", dl1.joinedDescriptionElementText("Most significant identifier:"));
70
        assertEquals("2017E68", dl1.joinedDescriptionElementText("Accession number:"));
71
        assertEquals("Epitype (designated by Kretschmann, J., Žerdoner ?alasan, A. & Kusber, W.-H. 20172)",
72
                dl1.joinedDescriptionElementText("Specimen type designations:"));
73
        // 2
74
        assertEquals("gathering in-situ from:", contentElements.get(1).getText());
75
        // 3
76
        DescriptionList dl3 = new DescriptionList(contentElements.get(2).findElement(By.tagName("dl")));
77
        assertEquals("Field Unit", dl3.joinedDescriptionElementText("Record basis:"));
78
        assertEquals("D047", dl3.joinedDescriptionElementText("Collecting number:"));
79
        assertEquals("2016-03-28", dl3.joinedDescriptionElementText("Gathering date"));
80
        assertEquals("Germany", dl3.joinedDescriptionElementText("Country:"));
81
        assertEquals("Berlin", dl3.joinedDescriptionElementText("Locality:"));
82
        assertEquals("52°31'1.2\"N, 13°21'E +/-20 m (WGS84)", dl3.joinedDescriptionElementText("Exact location:"));
83

    
84

    
85
    }
86

    
87
}
(13-13/16)