Project

General

Profile

Download (4.65 KB) Statistics
| Branch: | Tag: | Revision:
1
// $Id$
2
/**
3
 * Copyright (C) 2009 EDIT
4
 * European Distributed Institute of Taxonomy
5
 * http://www.e-taxonomy.eu
6
 *
7
 * The contents of this file are subject to the Mozilla Public License Version 1.1
8
 * See LICENSE.TXT at the top of this package for the full license terms.
9
 */
10
package eu.etaxonomy.dataportal.selenium.tests.diptera;
11

    
12
import static org.junit.Assert.*;
13

    
14
import java.net.MalformedURLException;
15
import java.util.List;
16
import java.util.UUID;
17

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

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

    
33
/**
34
 *
35
 * @author a.kohlbecker
36
 *
37
 */
38

    
39
@DataPortalContexts( { DataPortalContext.diptera})
40
public class Diptera_OriginalSourceTest extends CdmDataPortalTestBase{
41

    
42
    // Milichia speciosa
43
    static UUID taxonUuid = UUID.fromString("1f1f8356-a172-4f7d-ad98-e8a37489ce9f");
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("Milichia speciosa"), 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", primaryTabs.get(0).getText());
69
        assertEquals("Nomenclature", primaryTabs.get(1).getText());
70
        assertEquals("Specimens", primaryTabs.get(2).getText());
71

    
72
        assertEquals("Content", p.getTableOfContentHeader());
73
        List<LinkElement> tocLinks = p.getTableOfContentLinks();
74
        assertNotNull("Expecting a list of TOC links in the profile page.", tocLinks);
75

    
76
        p.testTableOfContentEntry(0, "Citations", "citation");
77
        p.testTableOfContentEntry(1, "Distribution", "distribution");
78
        p.testTableOfContentEntry(2, "Occurrence", "occurrence");
79

    
80
        FeatureBlock featureBlock = p.getFeatureBlockAt(0, "citation", "ul", "li");
81
        assertEquals("expecting no footnote keys", 0, featureBlock.getFootNoteKeys().size());
82

    
83
        List<WebElement> listElements = featureBlock.getElement().findElements(By.tagName("li"));
84
        assertEquals("Expecting 48 listElements tags in \"Citations\"", 48, listElements.size());
85

    
86
        // ---
87
        assertEquals("Argyrites speciosa (Meigen, 1830): Croatia", listElements.get(0).getText());
88
        List<WebElement> anchorTags = listElements.get(0).findElements(By.tagName("a"));
89
        assertEquals("Expecting one link", 1, anchorTags.size());
90
        assertTrue(anchorTags.get(0).getAttribute("href").contains("?q=cdm_dataportal/name/"));
91

    
92
        // ---
93
        assertEquals("Milichia speciosa Meigen, 1830: type information (Becker 1902: 314)", listElements.get(2).getText());
94
        anchorTags = listElements.get(2).findElements(By.tagName("a"));
95
        assertEquals("Expecting two links", 2, anchorTags.size());
96
        assertEquals("Milichia speciosa Meigen, 1830", anchorTags.get(0).getText());
97
        assertTrue(anchorTags.get(0).getAttribute("href").contains("?q=cdm_dataportal/name/"));
98
        assertEquals("Becker 1902", anchorTags.get(1).getText());
99
        assertTrue(anchorTags.get(1).getAttribute("href").contains("?q=cdm_dataportal/reference/"));
100

    
101
        // ---
102
        assertEquals("Milichia speciosa Meigen, 1830: checklist, Italy (Canzoneri, Gorodkov, Krivosheina, Munari, Nartshuk, Papp & Süss 1995: 25)", listElements.get(9).getText());
103
        anchorTags = listElements.get(9).findElements(By.tagName("a"));
104
        assertEquals("Expecting two links", 2, anchorTags.size());
105
        assertEquals("Milichia speciosa Meigen, 1830", anchorTags.get(0).getText());
106
        assertTrue(anchorTags.get(0).getAttribute("href").contains("?q=cdm_dataportal/name/"));
107
        assertEquals("Canzoneri, Gorodkov, Krivosheina, Munari, Nartshuk, Papp & Süss 1995", anchorTags.get(1).getText());
108
        assertTrue(anchorTags.get(1).getAttribute("href").contains("?q=cdm_dataportal/reference/"));
109
    }
110

    
111
}
    (1-1/1)