Project

General

Profile

Download (5.92 KB) Statistics
| Branch: | Tag: | Revision:
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 static org.junit.Assert.assertEquals;
12
import static org.junit.Assert.assertNotNull;
13
import static org.junit.Assert.assertNull;
14
import static org.junit.Assert.assertTrue;
15

    
16
import java.net.MalformedURLException;
17
import java.util.List;
18
import java.util.UUID;
19

    
20
import org.junit.After;
21
import org.junit.Before;
22
import org.junit.Test;
23
import org.openqa.selenium.By;
24
import org.openqa.selenium.WebElement;
25

    
26
import eu.etaxonomy.dataportal.DataPortalContext;
27
import eu.etaxonomy.dataportal.elements.BaseElement;
28
import eu.etaxonomy.dataportal.elements.FeatureBlock;
29
import eu.etaxonomy.dataportal.elements.ImgElement;
30
import eu.etaxonomy.dataportal.elements.LinkElement;
31
import eu.etaxonomy.dataportal.junit.CdmDataPortalTestBase;
32
import eu.etaxonomy.dataportal.junit.DataPortalContextSuite.DataPortalContexts;
33
import eu.etaxonomy.dataportal.pages.TaxonProfilePage;
34

    
35
/**
36
 * @author a.kohlbecker
37
 *
38
 */
39

    
40
@DataPortalContexts( { DataPortalContext.cyprus })
41
public class Allium_guttatum_subsp_guttatum_TaxonProfileTest extends CdmDataPortalTestBase{
42

    
43
    static UUID taxonUuid = UUID.fromString("6d04598b-3852-4038-91c9-13c7581b21a6");
44

    
45
    TaxonProfilePage p = null;
46

    
47
    @Before
48
    public void setUp() throws MalformedURLException {
49

    
50
        p = new TaxonProfilePage(driver, getContext(), taxonUuid);
51

    
52
    }
53

    
54
    @After
55
    public void tearDown(){
56
        logger.debug("@After");
57
    }
58

    
59

    
60
    @Test
61
    public void testPage() {
62

    
63
        assertEquals(getContext().prepareTitle("Allium guttatum subsp. guttatum"), p.getTitle());
64
        assertNull("Authorship information should be hidden", p.getAuthorInformationText());
65

    
66
        List<LinkElement> primaryTabs = p.getPrimaryTabs();
67
        assertEquals("Expecting 3 tabs", 3, primaryTabs.size());
68
        assertEquals("General\n(active tab)", primaryTabs.get(0).getText());
69
        assertEquals("Synonymy", primaryTabs.get(1).getText());
70
        assertEquals("Images", primaryTabs.get(2).getText());
71

    
72
        ImgElement profileImage = p.getProfileImage();
73
        assertNotNull("Expecting profile images to be switched on", profileImage);
74
//		assertEquals("http://media.bgbm.org/erez/erez?src=EditWP6/zypern/photos/Allium_guttatum_guttatum_A1.jpg", profileImage.getUrl().toString());
75
//		assertEquals(400, profileImage.getDimension().getHeight(), 0.5);
76
//		assertEquals(250, profileImage.getDimension().getWidth(), 0.5);
77

    
78
        assertEquals("Content", p.getTableOfContentHeader());
79
        List<LinkElement> links = p.getTableOfContentLinks();
80
        assertNotNull("Expecting a list of TOC links in the profile page.", links);
81
        p.testTableOfContentEntry(0, "Status", "status");
82
        p.testTableOfContentEntry(1, "Endemism", "endemism");
83
        p.testTableOfContentEntry(2, "Red Data Book category", "red_data_book_category");
84
        p.testTableOfContentEntry(3, "Systematics", "systematics");
85
        p.testTableOfContentEntry(4, "Distribution", "distribution");
86

    
87
        FeatureBlock featureBlock;
88

    
89
        featureBlock = p.getFeatureBlockAt(0, "status", "div", "div");
90
        assertEquals("Status\nIndigenous (IN)", featureBlock.getText());
91

    
92
        featureBlock = p.getFeatureBlockAt(2, "endemism", "div", "div");
93
        assertEquals("Endemism\nnot endemic", featureBlock.getText());
94

    
95
        featureBlock = p.getFeatureBlockAt(2, "red-data-book-category", "div", "div");
96
        assertEquals("Red Data Book category\nData deficient (DD)", featureBlock.getText());
97

    
98
        //FIXME
99
//		featureBlock = p.getFeatureBlockAt(3, "systematics", "div", null);
100
//		assertEquals("Systematics\nTaxonomy and nomenclature follow Mathew (1996).\nMathew B. 1996: A review of Allium section Allium . - Kew.", featureBlock.getText());
101

    
102
//
103

    
104
        featureBlock = p.getFeatureBlockAt(4, "distribution", "div", "span");
105

    
106
        assertEquals("Distribution\nDivision 2A,B\nA. R. D. Meikle, Flora of Cyprus 2. 1985, B. R. Hand, Supplementary notes to the flora of Cyprus VI. in Willdenowia 39. 2009", featureBlock.getText());
107
        assertEquals("Distribution", featureBlock.getHeader());
108
        assertEquals("expecting two footnote keys", 2, featureBlock.countFootNoteKeys());
109

    
110
//        ------- prepared for  bibliography ---------
111
//        FeatureBlock bibliography = p.getFeatureBlockAt(5, "bibliography", "div", "div");
112
//        List<BaseElement> bibliographyEntries = bibliography.getFootNotes();
113
//        assertEquals("A. R. D. Meikle, Flora of Cyprus 2. 1985", bibliographyEntries.get(1));
114
//        assertEquals("B. R. Hand, Supplementary notes to the flora of Cyprus VI. in Willdenowia 39. 2009", bibliographyEntries.get(1));
115

    
116
        LinkElement footNoteKey_1 = featureBlock.getFootNoteKey(0);
117
        BaseElement footNote_1 = featureBlock.getFootNote(0);
118
        assertNotNull(footNoteKey_1);
119
        assertNotNull(footNote_1);
120
        assertTrue("expecting one footnote 0 to be the footnote for key 0",footNote_1.getText().startsWith(footNoteKey_1.getText()));
121

    
122
        p.hover(footNoteKey_1.getElement());
123
        assertEquals("rgba(255, 255, 0, 1)", footNoteKey_1.getElement().getCssValue("background-color"));
124
        assertEquals("rgba(255, 255, 0, 1)", footNote_1.getElement().getCssValue("background-color"));
125

    
126
        assertEquals("A. R. D. Meikle, Flora of Cyprus 2. 1985", footNote_1.getText());
127

    
128
        WebElement distributionMapImage = featureBlock.getElement().findElement(By.className("distribution_map"));
129
//		assertEquals("http://edit.br.fgov.be/edit_wp5/v1.1/rest_gen.php?title=a:indigenous&ad=cyprusdivs:bdcode:a:2&as=z:ffffff,606060,,|y:1874CD,,|a:339966,,0.1,&l=background_gis:y,cyprusdivs:z&ms=500,380&bbox=32,34,35,36&label=1&img=true&legend=1&mlp=3&mc_s=Georgia,15,blue&mc=&recalculate=false", distributionMapImage.getAttribute("src"));
130

    
131
    }
132

    
133
}
(1-1/6)