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.assertEquals;
|
13 |
|
import static org.junit.Assert.assertNotNull;
|
14 |
|
|
15 |
|
import java.net.MalformedURLException;
|
16 |
|
import java.util.List;
|
17 |
|
import java.util.UUID;
|
18 |
|
|
19 |
|
import org.junit.After;
|
20 |
|
import org.junit.Before;
|
21 |
|
import org.junit.Test;
|
22 |
|
|
23 |
|
import eu.etaxonomy.dataportal.DataPortalContext;
|
24 |
|
import eu.etaxonomy.dataportal.elements.LinkElement;
|
25 |
|
import eu.etaxonomy.dataportal.junit.CdmDataPortalTestBase;
|
26 |
|
import eu.etaxonomy.dataportal.junit.DataPortalContextSuite.DataPortalContexts;
|
27 |
|
import eu.etaxonomy.dataportal.pages.TaxonProfilePage;
|
28 |
|
|
29 |
|
/**
|
30 |
|
*
|
31 |
|
* @author a.kohlbecker
|
32 |
|
*
|
33 |
|
*/
|
34 |
|
|
35 |
|
@DataPortalContexts( { DataPortalContext.diptera})
|
36 |
|
public class Diptera_OriginalSourceTest extends CdmDataPortalTestBase{
|
37 |
|
|
38 |
|
// Milichia speciosa
|
39 |
|
static UUID taxonUuid = UUID.fromString("1f1f8356-a172-4f7d-ad98-e8a37489ce9f");
|
40 |
|
|
41 |
|
TaxonProfilePage p = null;
|
42 |
|
|
43 |
|
@Before
|
44 |
|
public void setUp() throws MalformedURLException {
|
45 |
|
|
46 |
|
p = new TaxonProfilePage(driver, getContext(), taxonUuid);
|
47 |
|
|
48 |
|
}
|
49 |
|
|
50 |
|
@After
|
51 |
|
public void tearDown(){
|
52 |
|
logger.debug("@After");
|
53 |
|
}
|
54 |
|
|
55 |
|
|
56 |
|
@Test
|
57 |
|
public void testPage() {
|
58 |
|
|
59 |
|
assertEquals(getContext().prepareTitle("Milichia speciosa"), p.getTitle());
|
60 |
|
// assertNull("Authorship information should be hidden", p.getAuthorInformationText());
|
61 |
|
|
62 |
|
List<LinkElement> primaryTabs = p.getPrimaryTabs();
|
63 |
|
assertEquals("Expecting 3 tabs", 3, primaryTabs.size());
|
64 |
|
assertEquals("General", primaryTabs.get(0).getText());
|
65 |
|
assertEquals("Nomenclature", primaryTabs.get(1).getText());
|
66 |
|
assertEquals("Specimens", primaryTabs.get(2).getText());
|
67 |
|
|
68 |
|
assertEquals("Content", p.getTableOfContentHeader());
|
69 |
|
List<LinkElement> tocLinks = p.getTableOfContentLinks();
|
70 |
|
assertNotNull("Expecting a list of TOC links in the profile page.", tocLinks);
|
71 |
|
|
72 |
|
p.testTableOfContentEntry(0, "Citations", "citation");
|
73 |
|
p.testTableOfContentEntry(1, "Distribution", "distribution");
|
74 |
|
p.testTableOfContentEntry(2, "Occurrence", "occurrence");
|
75 |
|
|
76 |
|
/* no longer compatible with test framework in Drupal 7 branch ignoring
|
77 |
|
* reason_ change of block id naming convention
|
78 |
|
*
|
79 |
|
FeatureBlock featureBlock = p.getFeatureBlockAt(0, "citation", "ul", "li");
|
80 |
|
assertEquals("expecting no footnote keys", 0, featureBlock.getFootNoteKeys().size());
|
81 |
|
|
82 |
|
List<WebElement> listElements = featureBlock.getElement().findElements(By.tagName("li"));
|
83 |
|
assertEquals("Expecting 48 listElements tags in \"Citations\"", 48, listElements.size());
|
84 |
|
|
85 |
|
// ---
|
86 |
|
assertEquals("Argyrites speciosa (Meigen, 1830): Croatia", listElements.get(0).getText());
|
87 |
|
List<WebElement> anchorTags = listElements.get(0).findElements(By.tagName("a"));
|
88 |
|
assertEquals("Expecting one link", 1, anchorTags.size());
|
89 |
|
assertTrue(anchorTags.get(0).getAttribute("href").contains("?q=cdm_dataportal/name/"));
|
90 |
|
|
91 |
|
// ---
|
92 |
|
assertEquals("Milichia speciosa Meigen, 1830: type information (Becker 1902: 314)", listElements.get(2).getText());
|
93 |
|
anchorTags = listElements.get(2).findElements(By.tagName("a"));
|
94 |
|
assertEquals("Expecting two links", 2, anchorTags.size());
|
95 |
|
assertEquals("Milichia speciosa Meigen, 1830", anchorTags.get(0).getText());
|
96 |
|
assertTrue(anchorTags.get(0).getAttribute("href").contains("?q=cdm_dataportal/name/"));
|
97 |
|
assertEquals("Becker 1902", anchorTags.get(1).getText());
|
98 |
|
assertTrue(anchorTags.get(1).getAttribute("href").contains("?q=cdm_dataportal/reference/"));
|
99 |
|
|
100 |
|
// ---
|
101 |
|
assertEquals("Milichia speciosa Meigen, 1830: checklist, Italy (Canzoneri, Gorodkov, Krivosheina, Munari, Nartshuk, Papp & Süss 1995: 25)", listElements.get(9).getText());
|
102 |
|
anchorTags = listElements.get(9).findElements(By.tagName("a"));
|
103 |
|
assertEquals("Expecting two links", 2, anchorTags.size());
|
104 |
|
assertEquals("Milichia speciosa Meigen, 1830", anchorTags.get(0).getText());
|
105 |
|
assertTrue(anchorTags.get(0).getAttribute("href").contains("?q=cdm_dataportal/name/"));
|
106 |
|
assertEquals("Canzoneri, Gorodkov, Krivosheina, Munari, Nartshuk, Papp & Süss 1995", anchorTags.get(1).getText());
|
107 |
|
assertTrue(anchorTags.get(1).getAttribute("href").contains("?q=cdm_dataportal/reference/"));
|
108 |
|
*/
|
109 |
|
}
|
110 |
|
|
111 |
|
}
|
removing selenium tests for diptera portal