Project

General

Profile

Download (5.09 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.cyprus;
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
 * @author a.kohlbecker
35
 *
36
 */
37

    
38
@DataPortalContexts( { DataPortalContext.cyprus })
39
public class Allium_guttatum_subsp_guttatum_TaxonProfileTest extends CdmDataPortalTestBase{
40

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

    
43
	TaxonProfilePage p = null;
44

    
45
	@Before
46
	public void setUp() throws MalformedURLException {
47

    
48
		p = new TaxonProfilePage(driver, getContext(), taxonUuid);
49

    
50
	}
51

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

    
57

    
58
	@Test
59
	public void testPage() {
60

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

    
64
		List<LinkElement> primaryTabs = p.getPrimaryTabs();
65
		assertEquals("Expecting 3 tabs", 3, primaryTabs.size());
66
		assertEquals("General", primaryTabs.get(0).getText());
67
		assertEquals("Synonymy", primaryTabs.get(1).getText());
68
		assertEquals("Images", primaryTabs.get(2).getText());
69

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

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

    
85
		FeatureBlock featureBlock;
86

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

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

    
93
		featureBlock = p.getFeatureBlockAt(2, "red_data_book_category", "div", "div");
94
		assertEquals("Red Data Book category\nData deficient (DD)", featureBlock.getText());
95

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

    
100
		featureBlock = p.getFeatureBlockAt(4, "distribution", "div", "span");
101
		assertEquals("Distribution\nDivision 21,2\n1. R. D. Meikle, Flora of Cyprus 1. 1977, 2. R. Hand, Supplementary notes to the flora of Cyprus VI. in Willdenowia 39. 2009", featureBlock.getText());
102
		assertEquals("Distribution", featureBlock.getHeader());
103
		assertEquals("expecting two footnote keys", 2, featureBlock.getFootNoteKeys().size());
104

    
105
		LinkElement footNoteKey_1 = featureBlock.getFootNoteKeys().get(0);
106
		BaseElement footNote_1 = featureBlock.getFootNotes().get(0);
107
		assertTrue("expecting one footnote 0 to be the footnote for key 0",footNote_1.getText().startsWith(footNoteKey_1.getText()));
108

    
109
		p.hover(footNoteKey_1.getElement());
110
		assertEquals("#ffff00", footNoteKey_1.getElement().getCssValue("background-color"));
111
		assertEquals("#ffff00", footNote_1.getElement().getCssValue("background-color"));
112

    
113
		assertEquals("1. R. D. Meikle, Flora of Cyprus 1. 1977", footNote_1.getText());
114

    
115
		WebElement distributionMapImage = featureBlock.getElement().findElement(By.className("distribution_map"));
116
//		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"));
117

    
118
	}
119

    
120
}
(1-1/3)