Revision d2a09415
Added by Andreas Kohlbecker over 8 years ago
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/test/java/eu/etaxonomy/dataportal/selenium/tests/cyprus/Cyprus_OriginalSourceTest.java | ||
---|---|---|
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.cyprus; |
|
11 |
|
|
12 |
import static org.junit.Assert.assertEquals; |
|
13 |
import static org.junit.Assert.assertFalse; |
|
14 |
import static org.junit.Assert.assertNotNull; |
|
15 |
import static org.junit.Assert.assertNull; |
|
16 |
import static org.junit.Assert.assertTrue; |
|
17 |
|
|
18 |
import java.net.MalformedURLException; |
|
19 |
import java.util.List; |
|
20 |
import java.util.UUID; |
|
21 |
|
|
22 |
import org.junit.After; |
|
23 |
import org.junit.Before; |
|
24 |
import org.junit.Test; |
|
25 |
import org.openqa.selenium.By; |
|
26 |
import org.openqa.selenium.WebElement; |
|
27 |
|
|
28 |
import eu.etaxonomy.dataportal.DataPortalContext; |
|
29 |
import eu.etaxonomy.dataportal.elements.FeatureBlock; |
|
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 |
* |
|
37 |
* @author a.kohlbecker |
|
38 |
* |
|
39 |
*/ |
|
40 |
|
|
41 |
@DataPortalContexts( { DataPortalContext.cyprus }) |
|
42 |
public class Cyprus_OriginalSourceTest extends CdmDataPortalTestBase{ |
|
43 |
|
|
44 |
// Taxon Cistus creticus subsp. creticus |
|
45 |
static UUID taxonUuid = UUID.fromString("2e58b1ab-03a9-4693-bcec-3b8e7f04b572"); |
|
46 |
|
|
47 |
TaxonProfilePage p = null; |
|
48 |
|
|
49 |
@Before |
|
50 |
public void setUp() throws MalformedURLException { |
|
51 |
|
|
52 |
p = new TaxonProfilePage(driver, getContext(), taxonUuid); |
|
53 |
|
|
54 |
} |
|
55 |
|
|
56 |
@After |
|
57 |
public void tearDown(){ |
|
58 |
logger.debug("@After"); |
|
59 |
} |
|
60 |
|
|
61 |
|
|
62 |
@Test |
|
63 |
public void testPage() { |
|
64 |
|
|
65 |
assertEquals(getContext().prepareTitle("Cistus creticus subsp. creticus"), p.getTitle()); |
|
66 |
assertNull("Authorship information should be hidden", p.getAuthorInformationText()); |
|
67 |
|
|
68 |
List<LinkElement> primaryTabs = p.getPrimaryTabs(); |
|
69 |
int tabIndex = 0; |
|
70 |
assertEquals("General\n(active tab)", primaryTabs.get(tabIndex++).getText()); |
|
71 |
assertEquals("Synonymy", primaryTabs.get(tabIndex++).getText()); |
|
72 |
assertEquals("Images", primaryTabs.get(tabIndex++).getText()); |
|
73 |
assertEquals("Expecting " + tabIndex + " tabs", tabIndex++, primaryTabs.size()); |
|
74 |
|
|
75 |
assertEquals("Content", p.getTableOfContentHeader()); |
|
76 |
List<LinkElement> tocLinks = p.getTableOfContentLinks(); |
|
77 |
assertNotNull("Expecting a list of TOC links in the profile page.", tocLinks); |
|
78 |
int tocIndex = 0; |
|
79 |
p.testTableOfContentEntry(tocIndex++, "Status", "status"); |
|
80 |
p.testTableOfContentEntry(tocIndex++, "Endemism", "endemism"); |
|
81 |
p.testTableOfContentEntry(tocIndex++, "Systematics", "systematics"); |
|
82 |
p.testTableOfContentEntry(tocIndex++, "Chromosome numbers", "chromosome_numbers"); |
|
83 |
p.testTableOfContentEntry(tocIndex++, "Distribution", "distribution"); |
|
84 |
|
|
85 |
FeatureBlock featureBlock = p.getFeatureBlockAt(2, "chromosome-numbers", "ul", "li"); |
|
86 |
assertEquals("Chromosome numbers", featureBlock.getHeader()); |
|
87 |
|
|
88 |
// see #2288 (Cyprus: ChromosomeNumbers: formating nameInSource) |
|
89 |
assertEquals("Chromosome numbers\n2n = 18 (B. Slavík & V. Jarolímová & J. Chrtek, Chromosome counts of some plants from Cyprus in Candollea 48. 1993 (as Cistus creticus L.)) (B. Slavík & V. Jarolímová & J. Chrtek, Chromosome counts of some plants from Cyprus. 2 in Acta Univ. Carol., Biol. 46. 2002 (as Cistus creticus L.))", featureBlock.getText()); |
|
90 |
|
|
91 |
assertFalse("expecting no footnote keys", featureBlock.hasFootNoteKeys()); |
|
92 |
List<WebElement> linksInFeatureBlock = featureBlock.getElement().findElements(By.tagName("a")); |
|
93 |
assertEquals("Expecting 3 anchor tags in \"Chromosome Numbers\"", 5, linksInFeatureBlock.size()); |
|
94 |
assertEquals("chromosome_numbers", linksInFeatureBlock.get(0).getAttribute("name")); |
|
95 |
assertTrue(linksInFeatureBlock.get(1).getAttribute("href").endsWith("?q=cdm_dataportal/reference/863b9b1b-6c2a-4066-af90-ea9a3775598c")); |
|
96 |
assertTrue(linksInFeatureBlock.get(2).getAttribute("href").endsWith("?q=cdm_dataportal/name/a1dfcc80-2121-46bb-b8b2-c267a9e0725b")); |
|
97 |
assertTrue(linksInFeatureBlock.get(3).getAttribute("href").endsWith("?q=cdm_dataportal/reference/07a97be7-b3fa-4f76-838d-ac7e1e6e9d70")); |
|
98 |
assertTrue(linksInFeatureBlock.get(4).getAttribute("href").endsWith("?q=cdm_dataportal/name/a1dfcc80-2121-46bb-b8b2-c267a9e0725b")); |
|
99 |
} |
|
100 |
|
|
101 |
} |
|
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.cyprus; |
|
11 |
|
|
12 |
import static org.junit.Assert.assertEquals; |
|
13 |
import static org.junit.Assert.assertFalse; |
|
14 |
import static org.junit.Assert.assertNotNull; |
|
15 |
import static org.junit.Assert.assertNull; |
|
16 |
import static org.junit.Assert.assertTrue; |
|
17 |
|
|
18 |
import java.net.MalformedURLException; |
|
19 |
import java.util.List; |
|
20 |
import java.util.UUID; |
|
21 |
|
|
22 |
import org.junit.After; |
|
23 |
import org.junit.Before; |
|
24 |
import org.junit.Test; |
|
25 |
import org.openqa.selenium.By; |
|
26 |
import org.openqa.selenium.WebElement; |
|
27 |
|
|
28 |
import eu.etaxonomy.dataportal.DataPortalContext; |
|
29 |
import eu.etaxonomy.dataportal.elements.FeatureBlock; |
|
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 |
* |
|
37 |
* @author a.kohlbecker |
|
38 |
* |
|
39 |
*/ |
|
40 |
|
|
41 |
@DataPortalContexts( { DataPortalContext.cyprus }) |
|
42 |
public class Cyprus_OriginalSourceTest extends CdmDataPortalTestBase{ |
|
43 |
|
|
44 |
// Taxon Cistus creticus subsp. creticus |
|
45 |
static UUID taxonUuid = UUID.fromString("2e58b1ab-03a9-4693-bcec-3b8e7f04b572"); |
|
46 |
|
|
47 |
TaxonProfilePage p = null; |
|
48 |
|
|
49 |
@Before |
|
50 |
public void setUp() throws MalformedURLException { |
|
51 |
|
|
52 |
p = new TaxonProfilePage(driver, getContext(), taxonUuid); |
|
53 |
|
|
54 |
} |
|
55 |
|
|
56 |
@After |
|
57 |
public void tearDown(){ |
|
58 |
logger.debug("@After"); |
|
59 |
} |
|
60 |
|
|
61 |
|
|
62 |
@Test |
|
63 |
public void testPage() { |
|
64 |
|
|
65 |
assertEquals(getContext().prepareTitle("Cistus creticus subsp. creticus"), p.getTitle()); |
|
66 |
assertNull("Authorship information should be hidden", p.getAuthorInformationText()); |
|
67 |
|
|
68 |
List<LinkElement> primaryTabs = p.getPrimaryTabs(); |
|
69 |
int tabIndex = 0; |
|
70 |
assertEquals("General\n(active tab)", primaryTabs.get(tabIndex++).getText()); |
|
71 |
assertEquals("Synonymy", primaryTabs.get(tabIndex++).getText()); |
|
72 |
assertEquals("Images", primaryTabs.get(tabIndex++).getText()); |
|
73 |
assertEquals("Expecting " + tabIndex + " tabs", tabIndex++, primaryTabs.size()); |
|
74 |
|
|
75 |
assertEquals("Content", p.getTableOfContentHeader()); |
|
76 |
List<LinkElement> tocLinks = p.getTableOfContentLinks(); |
|
77 |
assertNotNull("Expecting a list of TOC links in the profile page.", tocLinks); |
|
78 |
int tocIndex = 0; |
|
79 |
p.testTableOfContentEntry(tocIndex++, "Status", "status"); |
|
80 |
p.testTableOfContentEntry(tocIndex++, "Endemism", "endemism"); |
|
81 |
p.testTableOfContentEntry(tocIndex++, "Systematics", "systematics"); |
|
82 |
p.testTableOfContentEntry(tocIndex++, "Chromosome numbers", "chromosome_numbers"); |
|
83 |
p.testTableOfContentEntry(tocIndex++, "Distribution", "distribution"); |
|
84 |
|
|
85 |
FeatureBlock featureBlock = p.getFeatureBlockAt(2, "chromosome-numbers", "ul", "li"); |
|
86 |
assertEquals("Chromosome numbers", featureBlock.getHeader()); |
|
87 |
|
|
88 |
// see #2288 (Cyprus: ChromosomeNumbers: formating nameInSource) |
|
89 |
assertEquals("Chromosome numbers\n2n = 18 (B. Slavík & V. Jarolímová & J. Chrtek, Chromosome counts of some plants from Cyprus in Candollea 48. 1993 (as Cistus creticus L.)) (B. Slavík & V. Jarolímová & J. Chrtek, Chromosome counts of some plants from Cyprus. 2 in Acta Univ. Carol., Biol. 46. 2002 (as Cistus creticus L.))", featureBlock.getText()); |
|
90 |
|
|
91 |
assertFalse("expecting no footnote keys", featureBlock.hasFootNoteKeys()); |
|
92 |
List<WebElement> linksInFeatureBlock = featureBlock.getElement().findElements(By.tagName("a")); |
|
93 |
assertEquals("Expecting 3 anchor tags in \"Chromosome Numbers\"", 5, linksInFeatureBlock.size()); |
|
94 |
assertEquals("chromosome_numbers", linksInFeatureBlock.get(0).getAttribute("name")); |
|
95 |
assertTrue(linksInFeatureBlock.get(1).getAttribute("href").endsWith("?q=cdm_dataportal/reference/863b9b1b-6c2a-4066-af90-ea9a3775598c")); |
|
96 |
assertTrue(linksInFeatureBlock.get(2).getAttribute("href").endsWith("?q=cdm_dataportal/name/a1dfcc80-2121-46bb-b8b2-c267a9e0725b")); |
|
97 |
assertTrue(linksInFeatureBlock.get(3).getAttribute("href").endsWith("?q=cdm_dataportal/reference/07a97be7-b3fa-4f76-838d-ac7e1e6e9d70")); |
|
98 |
assertTrue(linksInFeatureBlock.get(4).getAttribute("href").endsWith("?q=cdm_dataportal/name/a1dfcc80-2121-46bb-b8b2-c267a9e0725b")); |
|
99 |
} |
|
100 |
|
|
101 |
} |
Also available in: Unified diff
CRLF will be replaced by LF issues