Revision d3548cc6
Added by Andreas Kohlbecker over 12 years ago
.gitattributes | ||
---|---|---|
257 | 257 |
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/Browser.java -text |
258 | 258 |
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/DataPortalContext.java -text |
259 | 259 |
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/DataPortalManager.java -text |
260 |
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/ElementUtils.java -text |
|
260 | 261 |
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/SystemUtils.java -text |
261 | 262 |
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/TestConfiguration.java -text |
262 | 263 |
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/TestConfigurationException.java -text |
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/ElementUtils.java | ||
---|---|---|
1 |
// $Id$ |
|
2 |
/** |
|
3 |
* Copyright (C) 2011 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; |
|
11 |
|
|
12 |
import java.util.ArrayList; |
|
13 |
import java.util.List; |
|
14 |
|
|
15 |
import org.openqa.selenium.By; |
|
16 |
import org.openqa.selenium.WebElement; |
|
17 |
|
|
18 |
import eu.etaxonomy.dataportal.elements.BaseElement; |
|
19 |
import eu.etaxonomy.dataportal.elements.LinkElement; |
|
20 |
|
|
21 |
/** |
|
22 |
* @author andreas |
|
23 |
* @date Sep 16, 2011 |
|
24 |
* |
|
25 |
*/ |
|
26 |
public class ElementUtils { |
|
27 |
|
|
28 |
/** |
|
29 |
* @param fnListElements |
|
30 |
* @return |
|
31 |
*/ |
|
32 |
public static List<BaseElement> baseElementsFromFootNoteListElements(List<WebElement> fnListElements) { |
|
33 |
List<BaseElement> footNotes = new ArrayList<BaseElement>(); |
|
34 |
for(WebElement fn : fnListElements) { |
|
35 |
footNotes.add(new BaseElement(fn)); |
|
36 |
} |
|
37 |
return footNotes; |
|
38 |
} |
|
39 |
|
|
40 |
/** |
|
41 |
* @param fnkListElements |
|
42 |
* @return |
|
43 |
*/ |
|
44 |
public static List<LinkElement> linkElementsFromFootNoteKeyListElements(List<WebElement> fnkListElements) { |
|
45 |
List<LinkElement> footNoteKeys = new ArrayList<LinkElement>(); |
|
46 |
for(WebElement fnk : fnkListElements) { |
|
47 |
footNoteKeys.add(new LinkElement(fnk)); |
|
48 |
} |
|
49 |
return footNoteKeys; |
|
50 |
} |
|
51 |
|
|
52 |
} |
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/pages/TaxonSynonymyPage.java | ||
---|---|---|
28 | 28 |
import org.openqa.selenium.support.FindBy; |
29 | 29 |
|
30 | 30 |
import eu.etaxonomy.dataportal.DataPortalContext; |
31 |
import eu.etaxonomy.dataportal.ElementUtils; |
|
32 |
import eu.etaxonomy.dataportal.elements.BaseElement; |
|
31 | 33 |
import eu.etaxonomy.dataportal.elements.FeatureBlock; |
32 | 34 |
import eu.etaxonomy.dataportal.elements.ImgElement; |
33 | 35 |
import eu.etaxonomy.dataportal.elements.LinkElement; |
... | ... | |
93 | 95 |
* @return The Url of the profile image or null if the image is not visible. |
94 | 96 |
*/ |
95 | 97 |
public String getAcceptedName() { |
96 |
WebElement acceptedName = synonymy.findElement(By.xpath("./span[contains(@class,'accepted-name')]")); |
|
98 |
WebElement acceptedName = synonymy.findElement( |
|
99 |
By.xpath("./span[contains(@class,'accepted-name')]") |
|
100 |
); |
|
97 | 101 |
return acceptedName.getText(); |
98 | 102 |
} |
99 | 103 |
|
104 |
public List<LinkElement> getAcceptedNameFootNoteKeys() { |
|
105 |
List<WebElement> fnkListElements = synonymy.findElements( |
|
106 |
By.xpath("./span[contains(@class,'accepted-name')]/following-sibling::span[contains(@class, 'footnote-key')]/a") |
|
107 |
); |
|
108 |
return ElementUtils.linkElementsFromFootNoteKeyListElements(fnkListElements); |
|
109 |
} |
|
110 |
|
|
100 | 111 |
/** |
101 | 112 |
* @param synonymIndex |
102 | 113 |
* the 1-based position of the synonym in the list of homotypical |
... | ... | |
105 | 116 |
* and all information rendered after the name. All whitespace is |
106 | 117 |
* normalized to the SPACE character. |
107 | 118 |
*/ |
108 |
public String getHomotypicalSynonymName(Integer synonymIndex) { |
|
109 |
WebElement acceptedName = synonymy.findElement(By.xpath("./ul[contains(@class,'homotypicSynonyms')]/li[" + synonymIndex + "]")); |
|
119 |
public String getHomotypicalGroupSynonymName(Integer synonymIndex) { |
|
120 |
WebElement acceptedName = synonymy.findElement( |
|
121 |
By.xpath("./ul[contains(@class,'homotypicSynonyms')]/li[" + synonymIndex + "]") |
|
122 |
); |
|
110 | 123 |
return acceptedName.getText().replaceAll("\\s", " "); |
111 | 124 |
} |
112 | 125 |
|
126 |
public List<LinkElement> getHomotypicalGroupFootNoteKeys() { |
|
127 |
List<WebElement> fnkListElements = synonymy.findElements( |
|
128 |
By.xpath("./ul[contains(@class,'homotypicSynonyms')]/*/span[contains(@class, 'footnote-key')]/a") |
|
129 |
); |
|
130 |
return ElementUtils.linkElementsFromFootNoteKeyListElements(fnkListElements); |
|
131 |
} |
|
132 |
|
|
133 |
public List<BaseElement> getHomotypicalGroupFootNotes() { |
|
134 |
List<WebElement> fnListElements = synonymy.findElements( |
|
135 |
By.xpath("./ul[contains(@class,'homotypicSynonyms')]/li[contains(@class, 'footnotes')]/span[contains(@class, 'footnote')]") |
|
136 |
); |
|
137 |
return ElementUtils.baseElementsFromFootNoteListElements(fnListElements); |
|
138 |
|
|
139 |
} |
|
140 |
|
|
141 |
|
|
142 |
|
|
113 | 143 |
/** |
114 | 144 |
* @param heterotypicalGroupIndex |
115 | 145 |
* the 0-based index of the heterotypical group |
... | ... | |
120 | 150 |
* and all information rendered after the name. All whitespace is |
121 | 151 |
* normalized to the SPACE character. |
122 | 152 |
*/ |
123 |
public String getHeterotypicalSynonymName(Integer heterotypicalGroupIndex, Integer synonymIndex) { |
|
124 |
WebElement acceptedName = synonymy.findElement(By.xpath("./ul[contains(@class,'heterotypicSynonymyGroup')]/li[" + synonymIndex + "]")); |
|
153 |
public String getHeterotypicalGroupSynonymName(Integer heterotypicalGroupIndex, Integer synonymIndex) {
|
|
154 |
WebElement acceptedName = synonymy.findElement(By.xpath("./ul[contains(@class,'heterotypicSynonymyGroup')][" + heterotypicalGroupIndex + "]/li[" + synonymIndex + "]"));
|
|
125 | 155 |
return acceptedName.getText().replaceAll("\\s", " "); |
126 | 156 |
} |
157 |
|
|
158 |
public List<LinkElement> getHeterotypicalGroupFootNoteKeys(Integer heterotypicalGroupIndex) { |
|
159 |
List<WebElement> fnkListElements = synonymy.findElements( |
|
160 |
By.xpath("./ul[contains(@class,'heterotypicSynonymyGroup')][" + heterotypicalGroupIndex + "]/*/span[contains(@class, 'footnote-key')]/a") |
|
161 |
); |
|
162 |
return ElementUtils.linkElementsFromFootNoteKeyListElements(fnkListElements); |
|
163 |
} |
|
164 |
|
|
165 |
public List<BaseElement> getHeterotypicalGroupFootNotes(Integer heterotypicalGroupIndex) { |
|
166 |
List<WebElement> fnListElements = synonymy.findElements( |
|
167 |
By.xpath("./ul[contains(@class,'heterotypicSynonymyGroup')][" + heterotypicalGroupIndex + "]/li[contains(@class, 'footnotes')]/span[contains(@class, 'footnotes')]") |
|
168 |
); |
|
169 |
return ElementUtils.baseElementsFromFootNoteListElements(fnListElements); |
|
170 |
} |
|
171 |
|
|
127 | 172 |
} |
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/test/java/eu/etaxonomy/dataportal/selenium/tests/cichorieae/Cichorieae_HybridTest.java | ||
---|---|---|
53 | 53 |
TaxonSynonymyPage p = new TaxonSynonymyPage(driver, getContext(), lactuca_favratii_Uuid); |
54 | 54 |
assertEquals(getContext().prepareTitle("Lactuca ×\"favratii\""), p.getTitle()); |
55 | 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)); |
|
56 |
assertEquals("≡ Cicerbita ×favratii Wilczek in Bull. Soc. Vaud. Sci. Nat. 51: 333. 1917", p.getHomotypicalGroupSynonymName(1));
|
|
57 | 57 |
} |
58 | 58 |
|
59 | 59 |
@Test |
... | ... | |
61 | 61 |
TaxonSynonymyPage p = new TaxonSynonymyPage(driver, getContext(), crepis_oenipontana_Uuid); |
62 | 62 |
assertEquals(getContext().prepareTitle("Crepis ×oenipontana"), p.getTitle()); |
63 | 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)); |
|
64 |
assertEquals("= Crepis alpestris f. pseudalpestris Murr in Allg. Bot. Z. Syst. 14: 9. 1908", p.getHeterotypicalGroupSynonymName(1, 1));
|
|
65 |
assertEquals("≡ Crepis alpestris var. pseudalpestris (Murr) Murr in Allg. Bot. Z. Syst. 14: 9. 1908", p.getHeterotypicalGroupSynonymName(1, 2));
|
|
66 |
assertEquals("≡ Crepis ×pseudalpestris (Murr) Murr in Allg. Bot. Z. Syst. 22: 66. 1916", p.getHeterotypicalGroupSynonymName(1, 3));
|
|
67 | 67 |
} |
68 | 68 |
|
69 | 69 |
@Test |
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/test/java/eu/etaxonomy/dataportal/selenium/tests/cichorieae/Cichorieae_TechnicalAnnnotationsTest.java | ||
---|---|---|
9 | 9 |
*/ |
10 | 10 |
package eu.etaxonomy.dataportal.selenium.tests.cichorieae; |
11 | 11 |
|
12 |
import static org.junit.Assert.*; |
|
12 | 13 |
import static org.junit.Assert.assertEquals; |
13 | 14 |
|
14 | 15 |
import java.net.MalformedURLException; |
... | ... | |
37 | 38 |
|
38 | 39 |
static UUID soroseris_hookeriana_uuid = UUID.fromString("adaabef1-02f9-41a4-8a39-bf13564559f7"); |
39 | 40 |
|
41 |
static UUID pilosella_uuid = UUID.fromString("f42a07d1-d959-4838-b8ea-192b523ad5cc"); |
|
42 |
|
|
40 | 43 |
|
41 | 44 |
@Test |
42 | 45 |
public void soroseris_hookeriana() throws MalformedURLException { |
... | ... | |
57 | 60 |
assertEquals("expecting no footnotes", 0, creditsBlock.getFootNotes().size()); |
58 | 61 |
} |
59 | 62 |
|
63 |
@Test |
|
64 |
public void pilosella() throws MalformedURLException { |
|
65 |
TaxonSynonymyPage p = new TaxonSynonymyPage(driver, getContext(), pilosella_uuid); |
|
66 |
String expectedName = "Pilosella"; |
|
67 |
assertEquals(getContext().prepareTitle(expectedName), p.getTitle()); |
|
68 |
|
|
69 |
assertEquals("Pilosella Vaill. in Königl. Akad. Wiss. Paris Phys. Abh. 5: 703. 1754", p.getAcceptedName()); |
|
70 |
assertEquals("Expecting one footnote key", 1, p.getAcceptedNameFootNoteKeys().size()); |
|
71 |
assertEquals("Expecting one footnote", 1, p.getHomotypicalGroupFootNotes().size()); |
|
72 |
String expectetToStartWith = "1. As has been discovered by Greuter & al. in Taxon 54: 166 (2005),"; |
|
73 |
assertTrue("Expecting footnote to start with: '" + expectetToStartWith + "' but was '" + p.getHomotypicalGroupFootNotes().get(0).getText() + "'" |
|
74 |
, p.getHomotypicalGroupFootNotes().get(0).getText().startsWith(expectetToStartWith)); |
|
75 |
} |
|
76 |
|
|
60 | 77 |
} |
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/test/java/eu/etaxonomy/dataportal/selenium/tests/cyprus/Cyprus_HybridTest.java | ||
---|---|---|
42 | 42 |
String expectedName = "×Orchiserapias"; |
43 | 43 |
assertEquals(getContext().prepareTitle(expectedName), p.getTitle()); |
44 | 44 |
assertEquals(expectedName, p.getAcceptedName()); |
45 |
assertEquals("≡ Orchis × Serapias", p.getHomotypicalSynonymName(1)); |
|
45 |
assertEquals("≡ Orchis × Serapias", p.getHomotypicalGroupSynonymName(1));
|
|
46 | 46 |
} |
47 | 47 |
|
48 | 48 |
@Test |
... | ... | |
51 | 51 |
String expectedName = "Epilobium ×aschersonianum Hausskn."; |
52 | 52 |
assertEquals(getContext().prepareTitle(expectedName), p.getTitle()); |
53 | 53 |
assertEquals(expectedName, p.getAcceptedName()); |
54 |
assertEquals("≡ Epilobium lanceolatum × parviflorum", p.getHomotypicalSynonymName(1)); |
|
54 |
assertEquals("≡ Epilobium lanceolatum × parviflorum", p.getHomotypicalGroupSynonymName(1));
|
|
55 | 55 |
} |
56 | 56 |
|
57 | 57 |
|
Also available in: Unified diff
regression test for #2561 (allow supressing display of specific annotations)