Project

General

Profile

« Previous | Next » 

Revision 9da7b3ec

Added by Andreas Kohlbecker over 12 years ago

tests for #386 (Handle hybrids in data portals)

View differences:

.gitattributes
278 278
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/pages/PortalPage.java -text
279 279
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/pages/TaxonProfilePage.java -text
280 280
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/pages/TaxonSearchResultPage.java -text
281
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/pages/TaxonSynonymyPage.java -text
281 282
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/selenium/AllTrue.java -text
282 283
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/selenium/JUnitWebDriverWait.java -text
283 284
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/selenium/PageTitleValidated.java -text
......
288 289
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/resources/log4j.properties -text
289 290
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/test/java/eu/etaxonomy/dataportal/selenium/ExampleTest.java -text
290 291
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/test/java/eu/etaxonomy/dataportal/selenium/tests/cichorieae/CichorieaeSearchTest.java -text
292
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/test/java/eu/etaxonomy/dataportal/selenium/tests/cichorieae/Cichorieae_HybridTest.java -text
291 293
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/test/java/eu/etaxonomy/dataportal/selenium/tests/cyprus/Allium_guttatum_subsp_guttatum_TaxonProfileTest.java -text
292 294
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/test/java/eu/etaxonomy/dataportal/selenium/tests/cyprus/CyprusSearchTest.java -text
295
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/test/java/eu/etaxonomy/dataportal/selenium/tests/cyprus/Cyprus_HybridTest.java -text
293 296
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/test/java/eu/etaxonomy/dataportal/selenium/tests/cyprus/Cyprus_OriginalSourceTest.java -text
294 297
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/test/java/eu/etaxonomy/dataportal/selenium/tests/diptera/Diptera_OriginalSourceTest.java -text
295 298
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/test/java/eu/etaxonomy/dataportal/selenium/tests/flMalesiana/FloraMalesianaPolytomousKeyTest.java -text
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/pages/TaxonSynonymyPage.java
1
// $Id$
2

  
3
/**
4
 * Copyright (C) 2009 EDIT
5
 * European Distributed Institute of Taxonomy
6
 * http://www.e-taxonomy.eu
7
 *
8
 * The contents of this file are subject to the Mozilla Public License Version 1.1
9
 * See LICENSE.TXT at the top of this package for the full license terms.
10
 */
11
package eu.etaxonomy.dataportal.pages;
12

  
13
import static org.junit.Assert.assertEquals;
14
import static org.junit.Assert.assertTrue;
15

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

  
21
import org.apache.log4j.Logger;
22
import org.junit.Assert;
23
import org.openqa.selenium.By;
24
import org.openqa.selenium.NoSuchElementException;
25
import org.openqa.selenium.WebElement;
26
import org.openqa.selenium.WebDriver;
27
import org.openqa.selenium.support.CacheLookup;
28
import org.openqa.selenium.support.FindBy;
29

  
30
import eu.etaxonomy.dataportal.DataPortalContext;
31
import eu.etaxonomy.dataportal.elements.FeatureBlock;
32
import eu.etaxonomy.dataportal.elements.ImgElement;
33
import eu.etaxonomy.dataportal.elements.LinkElement;
34

  
35
/**
36
 * TODO: subpages like /cdm_dataportal/taxon/{uuid}/images are not jet suported, implement means to handle page parts
37
 *
38
 * @author andreas
39
 * @date Jul 1, 2011
40
 *
41
 */
42
public class TaxonSynonymyPage extends PortalPage {
43

  
44
	public static final Logger logger = Logger.getLogger(TaxonSynonymyPage.class);
45

  
46
	private UUID taxonUuid;
47

  
48
	protected static String drupalPagePathBase = "cdm_dataportal/taxon";
49

  
50
	/* (non-Javadoc)
51
	 * @see eu.etaxonomy.dataportal.pages.PortalPage#getDrupalPageBase()
52
	 */
53
	@Override
54
	protected String getDrupalPageBase() {
55
		return drupalPagePathBase;
56
	}
57

  
58
	@FindBy(id = "synonymy")
59
	@CacheLookup
60
	private WebElement synonymy;
61

  
62

  
63

  
64
	/**
65
	 * @param driver
66
	 * @param context
67
	 * @param taxonUuid
68
	 * @throws MalformedURLException
69
	 */
70
	public TaxonSynonymyPage(WebDriver driver, DataPortalContext context, UUID taxonUuid) throws MalformedURLException {
71

  
72
		super(driver, context, taxonUuid.toString() + "/synonymy");
73

  
74
		this.taxonUuid = taxonUuid;
75
	}
76

  
77

  
78
	/**
79
	 * @param driver
80
	 * @param context
81
	 * @throws Exception
82
	 */
83
	public TaxonSynonymyPage(WebDriver driver, DataPortalContext context) throws Exception {
84
		super(driver, context);
85
	}
86

  
87

  
88
	/**
89
	 * Returns the profile image of the taxon profile page. This image is
90
	 * located at the top of the page. The Profile Image can be disabled in the
91
	 * DataPortal settings.
92
	 *
93
	 * @return The Url of the profile image or null if the image is not visible.
94
	 */
95
	public String getAcceptedName() {
96
		WebElement acceptedName = synonymy.findElement(By.xpath("./span[contains(@class,'accepted-name')]"));
97
		return acceptedName.getText();
98
	}
99

  
100
	/**
101
	 * @param synonymIndex
102
	 *            the 1-based position of the synonym in the list of homotypical
103
	 *            synonyms
104
	 * @return the full text line of the synonym including the prepending symbol
105
	 *         and all information rendered after the name. All whitespace is
106
	 *         normalized to the SPACE character.
107
	 */
108
	public String getHomotypicalSynonymName(Integer synonymIndex) {
109
		WebElement acceptedName = synonymy.findElement(By.xpath("./ul[contains(@class,'homotypicSynonyms')]/li[" + synonymIndex + "]"));
110
		return acceptedName.getText().replaceAll("\\s", " ");
111
	}
112

  
113
	/**
114
	 * @param heterotypicalGroupIndex
115
	 *            the 0-based index of the heterotypical group
116
	 * @param synonymIndex
117
	 *            the 1-based position of the synonym in the list specified
118
	 *            group of heterotypical synonyms
119
	 * @return the full text line of the synonym including the prepending symbol
120
	 *         and all information rendered after the name. All whitespace is
121
	 *         normalized to the SPACE character.
122
	 */
123
	public String getHeterotypicalSynonymName(Integer heterotypicalGroupIndex, Integer synonymIndex) {
124
		WebElement acceptedName = synonymy.findElement(By.xpath("./ul[contains(@class,'heterotypicSynonymyGroup')]/li[" + synonymIndex + "]"));
125
		return acceptedName.getText().replaceAll("\\s", " ");
126
	}
127
}
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/selenium/WebDriverFactory.java
76 76

  
77 77
		WebDriver driver;
78 78

  
79
		CdmDataPortalTestBase.logger.info(("firefox binary:" + System.getProperty("webdriver.firefox.bin")));
79
		CdmDataPortalTestBase.logger.info(("fwebdriver.firefox.bin = " + System.getProperty("webdriver.firefox.bin")));
80
		CdmDataPortalTestBase.logger.info(("webdriver.firefox.library.path = " + System.getProperty("webdriver.firefox.library.path")));
80 81

  
81 82
		FirefoxProfile firefoxProfile = new FirefoxProfile();
82 83
		try {
......
89 90

  
90 91
			firefoxProfile.addExtension(CdmDataPortalTestBase.class, "/org/mozilla/addons/firexpath-" + FIREXPATH_VERSION + "-fx.xpi");
91 92

  
92
			firefoxProfile.setEnableNativeEvents(true);
93 93

  
94 94
			// --- allow enabling incompatible addons
95 95
			// firefoxProfile.addExtension(this.getClass(), "/org/mozilla/addons/add_on_compatibility_reporter-0.8.3-fx+tb+sm.xpi");
......
103 103
			CdmDataPortalTestBase.logger.error(e);
104 104
			System.exit(-1);
105 105
		}
106

  
107
		firefoxProfile.setEnableNativeEvents(true);
108

  
106 109
		driver = new FirefoxDriver(firefoxProfile);
107 110

  
108 111

  
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/test/java/eu/etaxonomy/dataportal/selenium/tests/cichorieae/Cichorieae_HybridTest.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.cichorieae;
11

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

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

  
17
import org.junit.Test;
18

  
19
import eu.etaxonomy.dataportal.DataPortalContext;
20
import eu.etaxonomy.dataportal.junit.CdmDataPortalTestBase;
21
import eu.etaxonomy.dataportal.junit.DataPortalContextSuite.DataPortalContexts;
22
import eu.etaxonomy.dataportal.pages.TaxonSynonymyPage;
23

  
24
/**
25
 *
26
 * @author a.kohlbecker
27
 *
28
 */
29

  
30
@DataPortalContexts( { DataPortalContext.cichorieae })
31
public class Cichorieae_HybridTest extends CdmDataPortalTestBase{
32

  
33

  
34
	static UUID crepis_malyi_Uuid = UUID.fromString("a4050699-ace9-45fb-a807-249531da5566");
35

  
36
	static UUID lactuca_favratii_Uuid = UUID.fromString("6027e1fa-9fe5-4ddc-a2de-f72bfa7378c0");
37

  
38
	static UUID crepis_oenipontana_Uuid = UUID.fromString("31b8757f-6acb-4826-ba7f-b2d116dc713c");
39

  
40
	static UUID crepis_artificialis_Uuid = UUID.fromString("3eabdf89-ddeb-461c-b6f8-341bb8deb7bf");
41

  
42

  
43
	@Test
44
	public void crepis_malyi() throws MalformedURLException {
45
		TaxonSynonymyPage p = new TaxonSynonymyPage(driver, getContext(), crepis_malyi_Uuid);
46
		String expectedName = "Crepis ×malyi";
47
		assertEquals(getContext().prepareTitle(expectedName), p.getTitle());
48
		assertEquals("Crepis ×malyi Stadlm. in Oesterr. Bot. Z. 58: 425. 1908", p.getAcceptedName());
49
	}
50

  
51
	@Test
52
	public void lactuca_favratii() throws MalformedURLException {
53
		TaxonSynonymyPage p = new TaxonSynonymyPage(driver, getContext(), lactuca_favratii_Uuid);
54
		assertEquals(getContext().prepareTitle("Lactuca ×\"favratii\""), p.getTitle());
55
	    assertEquals("Lactuca ×\"favratii\" , nom. provis.", p.getAcceptedName());
56
		assertEquals("≡ Cicerbita ×favratii Wilczek in Bull. Soc. Vaud. Sci. Nat. 51: 333. 1917", p.getHomotypicalSynonymName(1));
57
	}
58

  
59
	@Test
60
	public void crepis_oenipontana() throws MalformedURLException {
61
		TaxonSynonymyPage p = new TaxonSynonymyPage(driver, getContext(), crepis_oenipontana_Uuid);
62
		assertEquals(getContext().prepareTitle("Crepis ×oenipontana"), p.getTitle());
63
	    assertEquals("Crepis ×oenipontana Murr in Österr. Bot. Z. 43: 178. 1893", p.getAcceptedName());
64
		assertEquals("= Crepis alpestris f. pseudalpestris Murr in Allg. Bot. Z. Syst. 14: 9. 1908", p.getHeterotypicalSynonymName(1, 1));
65
		assertEquals("≡ Crepis alpestris var. pseudalpestris (Murr) Murr in Allg. Bot. Z. Syst. 14: 9. 1908", p.getHeterotypicalSynonymName(1, 2));
66
		assertEquals("≡ Crepis ×pseudalpestris (Murr) Murr in Allg. Bot. Z. Syst. 22: 66. 1916", p.getHeterotypicalSynonymName(1, 3));
67
	}
68

  
69
	@Test
70
	public void crepis_artificialis() throws MalformedURLException {
71
		TaxonSynonymyPage p = new TaxonSynonymyPage(driver, getContext(), crepis_artificialis_Uuid);
72
		assertEquals(getContext().prepareTitle("Crepis x artificialis"), p.getTitle());
73
	    assertEquals("Crepis x artificialis J. Collins & al. in Genetics 14: 310. 1929", p.getAcceptedName());
74
	}
75

  
76
}
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/test/java/eu/etaxonomy/dataportal/selenium/tests/cyprus/Cyprus_HybridTest.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

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

  
17
import org.junit.Test;
18

  
19
import eu.etaxonomy.dataportal.DataPortalContext;
20
import eu.etaxonomy.dataportal.junit.CdmDataPortalTestBase;
21
import eu.etaxonomy.dataportal.junit.DataPortalContextSuite.DataPortalContexts;
22
import eu.etaxonomy.dataportal.pages.TaxonSynonymyPage;
23

  
24
/**
25
 *
26
 * @author a.kohlbecker
27
 *
28
 */
29

  
30
@DataPortalContexts( { DataPortalContext.cyprus })
31
public class Cyprus_HybridTest extends CdmDataPortalTestBase{
32

  
33

  
34
	static UUID orchiserapias_Uuid = UUID.fromString("0aee7eea-84e7-4b61-8cb6-d17313cc9b80");
35

  
36
	static UUID epilobium_aschersonianum_Uuid = UUID.fromString("e13ea422-5d45-477b-ade3-8dc84dbc9dbc");
37

  
38

  
39
	@Test
40
	public void orchiserapias() throws MalformedURLException {
41
		TaxonSynonymyPage p = new TaxonSynonymyPage(driver, getContext(), orchiserapias_Uuid);
42
		String expectedName = "×Orchiserapias";
43
		assertEquals(getContext().prepareTitle(expectedName), p.getTitle());
44
		assertEquals(expectedName, p.getAcceptedName());
45
		assertEquals("≡ Orchis × Serapias", p.getHomotypicalSynonymName(1));
46
	}
47

  
48
	@Test
49
	public void epilobium_aschersonianum() throws MalformedURLException {
50
		TaxonSynonymyPage p = new TaxonSynonymyPage(driver, getContext(), epilobium_aschersonianum_Uuid);
51
		String expectedName = "Epilobium ×aschersonianum Hausskn.";
52
		assertEquals(getContext().prepareTitle(expectedName), p.getTitle());
53
		assertEquals(expectedName, p.getAcceptedName());
54
		assertEquals("≡ Epilobium lanceolatum × parviflorum", p.getHomotypicalSynonymName(1));
55
	}
56

  
57

  
58
}

Also available in: Unified diff