Revision 32023451
Added by Andreas Kohlbecker over 11 years ago
7.x/modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/DataPortalContext.java | ||
---|---|---|
21 | 21 |
*/ |
22 | 22 |
public enum DataPortalContext { |
23 | 23 |
|
24 |
cichorieae, |
|
25 |
palmae, |
|
26 |
diptera, |
|
27 |
cyprus, |
|
28 |
floramalesiana; |
|
29 |
|
|
30 |
URI baseUri; |
|
31 |
URI cdmServerUri; |
|
32 |
UUID classificationUUID; |
|
33 |
String siteName; //TODO could be read with drush: $ drush vget site_name |
|
34 |
String themeName; |
|
35 |
|
|
36 |
|
|
37 |
public final Logger logger = Logger.getLogger(DataPortalContext.class); |
|
38 |
|
|
39 |
private DataPortalContext() { |
|
40 |
|
|
41 |
try { |
|
42 |
this.baseUri = TestConfiguration.getProperty(composePropertyKey("baseUri"), URI.class, true); |
|
43 |
this.cdmServerUri = TestConfiguration.getProperty(composePropertyKey("cdmServerUri"), URI.class, false); |
|
44 |
this.classificationUUID = TestConfiguration.getProperty(composePropertyKey("classificationUUID"), UUID.class, true); |
|
45 |
this.siteName = TestConfiguration.getProperty(composePropertyKey("siteName")); |
|
46 |
} catch (TestConfigurationException e) { |
|
47 |
logger.error("Configuration Error: ", e); |
|
48 |
System.exit(-1); |
|
49 |
} |
|
50 |
} |
|
51 |
|
|
52 |
private String composePropertyKey(String fieldName) { |
|
53 |
String key = this.getClass().getSimpleName().substring(0, 1).toLowerCase() + this.getClass().getSimpleName().substring(1) + "." + this.name() + "." + fieldName; |
|
54 |
return key; |
|
55 |
} |
|
56 |
|
|
57 |
public URI getBaseUri() { |
|
58 |
return baseUri; |
|
59 |
} |
|
60 |
|
|
61 |
public URI getCdmServerUri() { |
|
62 |
return cdmServerUri; |
|
63 |
} |
|
64 |
|
|
65 |
public UUID getClassificationUUID() { |
|
66 |
return classificationUUID; |
|
67 |
} |
|
68 |
|
|
69 |
public String getSiteName() { |
|
70 |
return siteName; |
|
71 |
} |
|
72 |
|
|
73 |
public String prepareTitle(String pageHeader) { |
|
74 |
return pageHeader + " | " + getSiteName(); |
|
75 |
} |
|
24 |
cichorieae, |
|
25 |
palmae, |
|
26 |
cyprus, |
|
27 |
floramalesiana; |
|
28 |
|
|
29 |
URI baseUri; |
|
30 |
URI cdmServerUri; |
|
31 |
UUID classificationUUID; |
|
32 |
String siteName; //TODO could be read with drush: $ drush vget site_name |
|
33 |
String themeName; |
|
34 |
|
|
35 |
|
|
36 |
public final Logger logger = Logger.getLogger(DataPortalContext.class); |
|
37 |
|
|
38 |
private DataPortalContext() { |
|
39 |
|
|
40 |
try { |
|
41 |
this.baseUri = TestConfiguration.getProperty(composePropertyKey("baseUri"), URI.class, true); |
|
42 |
this.cdmServerUri = TestConfiguration.getProperty(composePropertyKey("cdmServerUri"), URI.class, false); |
|
43 |
this.classificationUUID = TestConfiguration.getProperty(composePropertyKey("classificationUUID"), UUID.class, true); |
|
44 |
this.siteName = TestConfiguration.getProperty(composePropertyKey("siteName")); |
|
45 |
} catch (TestConfigurationException e) { |
|
46 |
logger.error("Configuration Error: ", e); |
|
47 |
System.exit(-1); |
|
48 |
} |
|
49 |
} |
|
50 |
|
|
51 |
private String composePropertyKey(String fieldName) { |
|
52 |
String key = this.getClass().getSimpleName().substring(0, 1).toLowerCase() + this.getClass().getSimpleName().substring(1) + "." + this.name() + "." + fieldName; |
|
53 |
return key; |
|
54 |
} |
|
55 |
|
|
56 |
public URI getBaseUri() { |
|
57 |
return baseUri; |
|
58 |
} |
|
59 |
|
|
60 |
public URI getCdmServerUri() { |
|
61 |
return cdmServerUri; |
|
62 |
} |
|
63 |
|
|
64 |
public UUID getClassificationUUID() { |
|
65 |
return classificationUUID; |
|
66 |
} |
|
67 |
|
|
68 |
public String getSiteName() { |
|
69 |
return siteName; |
|
70 |
} |
|
71 |
|
|
72 |
public String prepareTitle(String pageHeader) { |
|
73 |
return pageHeader + " | " + getSiteName(); |
|
74 |
} |
|
76 | 75 |
|
77 | 76 |
} |
7.x/modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/pages/TaxonSynonymyPage.java | ||
---|---|---|
150 | 150 |
*/ |
151 | 151 |
public WebElement getHomotypicalGroupSynonym(Integer synonymIndex) { |
152 | 152 |
WebElement synonym = synonymy.findElement( |
153 |
By.xpath("./ul[contains(@class,'homotypicSynonyms')]/li[" + synonymIndex + "]") |
|
153 |
By.xpath("./div[contains(@class,'homotypic-synonymy-group')]/ul[contains(@class,'homotypicSynonyms')]/li[" + synonymIndex + "]")
|
|
154 | 154 |
); |
155 | 155 |
return synonym; |
156 | 156 |
} |
157 | 157 |
|
158 | 158 |
public List<LinkElement> getHomotypicalGroupFootNoteKeys() { |
159 | 159 |
List<WebElement> fnkListElements = synonymy.findElements( |
160 |
By.xpath("./ul[contains(@class,'homotypicSynonyms')]/*/span[contains(@class, 'footnote-key')]/a") |
|
160 |
By.xpath("./div[contains(@class,'homotypic-synonymy-group')]/ul[contains(@class,'homotypicSynonyms')]/*/span[contains(@class, 'footnote-key')]/a")
|
|
161 | 161 |
); |
162 | 162 |
return ElementUtils.linkElementsFromFootNoteKeyListElements(fnkListElements); |
163 | 163 |
} |
164 | 164 |
|
165 | 165 |
public List<BaseElement> getHomotypicalGroupFootNotes() { |
166 | 166 |
List<WebElement> fnListElements = synonymy.findElements( |
167 |
By.xpath("./ul[contains(@class,'homotypicSynonyms')]/li[contains(@class, 'footnotes')]/span[contains(@class, 'footnote')]")
|
|
167 |
By.xpath("./div[contains(@class,'homotypic-synonymy-group')]/ul[contains(@class,'footnotes')]/li[contains(@class, 'footnotes')]/span[contains(@class, 'footnote')]")
|
|
168 | 168 |
); |
169 | 169 |
return ElementUtils.baseElementsFromFootNoteListElements(fnListElements); |
170 | 170 |
|
... | ... | |
197 | 197 |
* @return |
198 | 198 |
*/ |
199 | 199 |
public WebElement getHeterotypicalGroupSynonym(Integer heterotypicalGroupIndex, Integer synonymIndex) { |
200 |
WebElement synonym = synonymy.findElement(By.xpath("./ul[contains(@class,'heterotypicSynonymyGroup')][" + heterotypicalGroupIndex + "]/li[" + synonymIndex + "]"));
|
|
200 |
WebElement synonym = synonymy.findElement(By.xpath("./div[contains(@class,'heterotypic-synonymy-group')][" + heterotypicalGroupIndex + "]/ul/li[" + synonymIndex + "]"));
|
|
201 | 201 |
return synonym; |
202 | 202 |
} |
203 | 203 |
|
... | ... | |
208 | 208 |
*/ |
209 | 209 |
public List<LinkElement> getHeterotypicalGroupFootNoteKeys(Integer heterotypicalGroupIndex) { |
210 | 210 |
List<WebElement> fnkListElements = synonymy.findElements( |
211 |
By.xpath("./ul[contains(@class,'heterotypicSynonymyGroup')][" + heterotypicalGroupIndex + "]/*/*/span[contains(@class, 'footnote-key')]/a")
|
|
211 |
By.xpath("./div[contains(@class,'heterotypic-synonymy-group')][" + heterotypicalGroupIndex + "]/ul/*/*/span[contains(@class, 'footnote-key')]/a")
|
|
212 | 212 |
); |
213 | 213 |
return ElementUtils.linkElementsFromFootNoteKeyListElements(fnkListElements); |
214 | 214 |
} |
... | ... | |
220 | 220 |
*/ |
221 | 221 |
public List<BaseElement> getHeterotypicalGroupFootNotes(Integer heterotypicalGroupIndex) { |
222 | 222 |
List<WebElement> fnListElements = synonymy.findElements( |
223 |
By.xpath("./ul[contains(@class,'heterotypicSynonymyGroup')][" + heterotypicalGroupIndex + "]/li[contains(@class, 'footnotes')]/span[contains(@class, 'footnote')]")
|
|
223 |
By.xpath("./div[contains(@class,'heterotypic-synonymy-group')][" + heterotypicalGroupIndex + "]/ul/li[contains(@class, 'footnotes')]/span[contains(@class, 'footnote')]")
|
|
224 | 224 |
); |
225 | 225 |
return ElementUtils.baseElementsFromFootNoteListElements(fnListElements); |
226 | 226 |
} |
7.x/modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/test/java/eu/etaxonomy/dataportal/selenium/tests/cichorieae/Crepis_tectorum_Synonymy.java | ||
---|---|---|
37 | 37 |
TaxonSynonymyPage p = new TaxonSynonymyPage(driver, getContext(), crepis_tectorum_Uuid); |
38 | 38 |
assertEquals(getContext().prepareTitle("Crepis tectorum"), p.getTitle()); |
39 | 39 |
assertEquals("Crepis tectorum L., Sp. Pl.: 807. 1753", p.getAcceptedNameText()); |
40 |
assertEquals("≡ Crepis varia Moench, Methodus: 534. 1794, nom. illeg.", p.getHomotypicalGroupSynonymName(4));
|
|
40 |
assertEquals("≡ Crepis varia Moench, Methodus: 534. 1794, nom. illeg.", p.getHomotypicalGroupSynonymName(2));
|
|
41 | 41 |
assertEquals("≡ Crepis stricta Schultz, Prodr. Fl. Starg. Suppl.: 41. 1819 [non Crepis stricta Scop. 1772]", p.getHeterotypicalGroupSynonymName(1, 2)); |
42 | 42 |
assertEquals("= Crepis lanceolata Kit. [non Crepis lanceolata Sch. Bip. 1854]", p.getHeterotypicalGroupSynonymName(9, 1)); |
43 | 43 |
} |
Also available in: Unified diff
adapting tests to new DOM structure