1
|
/**
|
2
|
* Copyright (C) 2009 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
package eu.etaxonomy.dataportal.selenium.tests.cichorieae;
|
10
|
|
11
|
import java.net.MalformedURLException;
|
12
|
import java.util.UUID;
|
13
|
|
14
|
import org.junit.Test;
|
15
|
import org.openqa.selenium.By;
|
16
|
import org.openqa.selenium.WebElement;
|
17
|
|
18
|
import eu.etaxonomy.dataportal.DataPortalSite;
|
19
|
import eu.etaxonomy.dataportal.elements.FeatureBlock;
|
20
|
import eu.etaxonomy.dataportal.junit.CdmDataPortalTestBase;
|
21
|
import eu.etaxonomy.dataportal.junit.DataPortalContextSuite.DataPortalContexts;
|
22
|
import eu.etaxonomy.dataportal.pages.TaxonProfilePage;
|
23
|
|
24
|
/**
|
25
|
*
|
26
|
* @author a.kohlbecker
|
27
|
*
|
28
|
*/
|
29
|
|
30
|
@DataPortalContexts( { DataPortalSite.cichorieae })
|
31
|
public class Cichorieae_CommonNamesTest extends CdmDataPortalTestBase{
|
32
|
|
33
|
|
34
|
static UUID lactuca_serriola_uuid = UUID.fromString("85176c77-e4b6-4899-a08b-e257ab09350a");
|
35
|
|
36
|
|
37
|
/**
|
38
|
* regression test for issue ##3160 (Cichorieae Portal: Common names not correctly ordered)
|
39
|
*
|
40
|
*/
|
41
|
@Test
|
42
|
public void lactuca_serriola() throws MalformedURLException {
|
43
|
TaxonProfilePage p = new TaxonProfilePage(driver, getContext(), lactuca_serriola_uuid);
|
44
|
String expectedName = "Lactuca serriola";
|
45
|
assertEquals(getContext().prepareTitle(expectedName), driver.getTitle());
|
46
|
|
47
|
FeatureBlock distributionBlock = p.getFeatureBlockAt(2, "distribution", "div", "dd");
|
48
|
assertNotNull(distributionBlock);
|
49
|
|
50
|
assertTrue("footnotes must not be empty", distributionBlock.countFootNotes() > 0);
|
51
|
// testing for the duplicate footnotes named below in the FIXME (related to #4383 )
|
52
|
|
53
|
/* expecting the sources of "North Caucasus AN,AO,AP,AQ,AR" to be sorted
|
54
|
* alphabetically, by the citation titleCache:
|
55
|
*
|
56
|
* class="descriptionElement617733b9-d59d-4215-9e77-728a5f60e627 level_index_1"
|
57
|
*
|
58
|
* AN. Galuško, A. I., Flora severnogo Kavkaza 3. 1980,
|
59
|
* AO. Galuško, A. I., Flora severnogo Kavkaza 3. 1980 (as Lactuca altaica),
|
60
|
* AP. Grossgejm, A. A., Flora kavkaza 4. 1934,
|
61
|
* AQ. Komarov, V. L., Flora SSSR 29. 1964 (as Lactuca altaica),
|
62
|
* AR. Komarov, V. L., Flora SSSR 29. 1964,
|
63
|
*/
|
64
|
WebElement northCaucasus = distributionBlock.getElement().findElement(By.className("descriptionElement617733b9-d59d-4215-9e77-728a5f60e627"));
|
65
|
assertEquals("North CaucasusAN,AO,AP,AQ,AR", northCaucasus.getText());
|
66
|
assertEquals("AN. Galuško, A. I. 1980: Flora severnogo Kavkaza 3", distributionBlock.getFootNote(39).getText());
|
67
|
assertEquals("AO. Galuško, A. I. 1980: Flora severnogo Kavkaza 3 (as Lactuca altaica)", distributionBlock.getFootNote(40).getText());
|
68
|
assertEquals("AP. Grossgejm, A. A. 1934: Flora kavkaza 4", distributionBlock.getFootNote(41).getText());
|
69
|
assertEquals("AQ. Komarov, V. L. 1964: Flora SSSR 29", distributionBlock.getFootNote(42).getText());
|
70
|
assertEquals("AR. Komarov, V. L. 1964: Flora SSSR 29 (as Lactuca altaica)", distributionBlock.getFootNote(43).getText());
|
71
|
|
72
|
|
73
|
FeatureBlock commonNamesBlock = p.getFeatureBlockAt(3, "common_names", "div", "span");
|
74
|
assertNotNull(commonNamesBlock);
|
75
|
|
76
|
// no longer valid since 2012-11-19: String expected = "Common names\nlechuguilla145, escariola145; Albanian (Albania): Ogrisht146; Arabic (Lebanon): خَسّ الزَّيْت147; Arabic (Saudi Arabia): Khass-al-Hammar148; Arabic (Syria): خَسّ الزَّيْت149; Armenian (Armenia): Կաթնուկ կողմնացույց150; Bulgarian (Bulgaria): Компасна салата151; Czech (Czech Republic): Locika kompasová152; Danish (Denmark): Tornet Salat153; English (Australia): compass plant154, Prickly Lettuce155, Prickly Lettuce156, Prickly Lettuce157, Prickly Lettuce158, compass plant159";
|
77
|
// no longer valid since 2013-06-27, sorting and merging implemented: String expected = "Common names\nlechuguilla144, escariola144; Albanian (Albania): Ogrisht145; Arabic (Lebanon): خَسّ الزَّيْت146; Arabic (Saudi Arabia): Khass-al-Hammar147; Arabic (Syria): خَسّ الزَّيْت148; Armenian (Armenia): Կաթնուկ կողմնացույց149; Bulgarian (Bulgaria): Компасна салата150; Czech (Czech Republic): Locika kompasová151; Danish (Denmark): Tornet Salat152; English (Australia): compass plant153, Prickly Lettuce154, Prickly Lettuce155, Prickly Lettuce156, Prickly Lettuce157, compass plant158";
|
78
|
// no longer valid since 2013-10-08, display of nameUsedInSource implemented, leads to semi-duplication of footnotes since some are without name in source data other are with: String expected = "Common names\n(Mexico): escariola144, lechuguilla144; Albanian (Albania): Ogrisht145; Arabic (Lebanon): خَسّ الزَّيْت146; Arabic (Saudi Arabia): Khass-al-Hammar147; Arabic (Syria): خَسّ الزَّيْت148; Armenian (Armenia): Կաթնուկ կողմնացույց149; Bulgarian (Bulgaria): Компасна салата150; Czech (Czech Republic): Locika kompasová151; Danish (Denmark): Tornet Salat152; English (Australia): Prickly Lettuce153,154,155,156,157,158,159, Prickly lettuce160,161, compass plant160,161, milk thistle160,161" +
|
79
|
// no longer valid since 2013-11-21 (#3475 fixed) String expected = "Common names\n(Mexico): escariola150, lechuguilla150; Albanian (Albania): Ogrisht151; Arabic (Lebanon): خَسّ الزَّيْت152; Arabic (Saudi Arabia): Khass-al-Hammar153; Arabic (Syria): خَسّ الزَّيْت154; Armenian (Armenia): Կաթնուկ կողմնացույց155; Bulgarian (Bulgaria): Компасна салата156; Czech (Czech Republic): Locika kompasová157; Danish (Denmark): Tornet Salat158; English (Australia): Prickly Lettuce159,160,161,162,163,164,165, Prickly lettuce166,167, compass plant166,167, milk thistle166,167";
|
80
|
// no longer valid since 2013-12-06 implementing rule 2 and 3 for #3904 String expected = "Common names\n(Mexico): escariola156, lechuguilla156; Albanian (Albania): Ogrisht157; Arabic (Lebanon): خَسّ الزَّيْت158; Arabic (Saudi Arabia): Khass-al-Hammar159; Arabic (Syria): خَسّ الزَّيْت160; Armenian (Armenia): Կաթնուկ կողմնացույց161; Bulgarian (Bulgaria): Компасна салата162; Czech (Czech Republic): Locika kompasová163; Danish (Denmark): Tornet Salat164; English (Australia): Prickly Lettuce165,166,167,168,169,170,171, Prickly lettuce172,173, compass plant172,173, milk thistle172,173";
|
81
|
// no longer valid since 2014-08-27 fixing #3915 String expected = "Common names\n(Mexico): escariola153, lechuguilla153; Albanian (Albania): Ogrisht154; Arabic (Lebanon): خَسّ الزَّيْت155; Arabic (Saudi Arabia): Khass-al-Hammar156; Arabic (Syria): خَسّ الزَّيْت157; Armenian (Armenia): Կաթնուկ կողմնացույց158; Bulgarian (Bulgaria): Компасна салата159; Czech (Czech Republic): Locika kompasová160; Danish (Denmark): Tornet Salat161; English (Australia): Prickly Lettuce162,163,164,165,166,167,168, Prickly lettuce169,170, compass plant169,170, milk thistle169,170";
|
82
|
|
83
|
// FIXME the distribution entries have duplicate foonote key for source references, see #4383 (references in bibliography need de-duplication)
|
84
|
// for example "40. Komarov, V. L., Flora SSSR 29. 1964", and "43. Komarov, V. L., Flora SSSR 29. 1964 (as Lactuca altaica)"
|
85
|
// this is why the Common name footnote keys are having an offset, the below out-commented string should be the correct one:
|
86
|
// String expected = "Common names\n(Mexico): escariola155, lechuguilla155; Albanian (Albania): Ogrisht156,157; Arabic (Lebanon): خَسّ الزَّيْت156,158; Arabic (Saudi Arabia): Khass-al-Hammar159; Arabic (Syria): خَسّ الزَّيْت156,160; Armenian (Armenia): Կաթնուկ կողմնացույց156,161; Bulgarian (Bulgaria): Компасна салата156,162; Czech (Czech Republic): Locika kompasová156,163; Danish (Denmark): Tornet Salat156,164; English (Australia): Prickly Lettuce165,166,167,168,169,170,171, Prickly lettuce172,173, compass plant";
|
87
|
//String expected = "Common names\n(Mexico): escariola168, lechuguilla168; Albanian (Albania): Ogrisht169,170; Arabic (Lebanon): خَسّ الزَّيْت169,171; Arabic (Saudi Arabia): Khass-al-Hammar172; Arabic (Syria): خَسّ الزَّيْت169,173; Armenian (Armenia): Կաթնուկ կողմնացույց169,174; Bulgarian (Bulgaria): Компасна салата169,175; Czech (Czech Republic): Locika kompasová169,176; Danish (Denmark): Tornet Salat169,177; English (Australia): Prickly Lettuce178,179,180,181,182,183,184, Prickly lettuce185,186, compass plant";
|
88
|
String expected = "Common names\n(Mexico): escariolaFJ, lechuguillaFJ; Albanian (Albania): OgrishtFK,4; Arabic (Lebanon): خَسّ الزَّيْتFL,4; Arabic (Saudi Arabia): Khass-al-HammarFM; Arabic (Syria): خَسّ الزَّيْتFN,4; Armenian (Armenia): Կաթնուկ կողմնացույցFO,4; Bulgarian (Bulgaria): Компасна салатаFP,4; Czech (Czech Republic): Locika kompasováFQ,4; Danish (Denmark): Tornet SalatFR,4; English (Australia): Prickly LettuceFS,FT,FU,FV,FW,FX,FY, Prickly lettuceFZ,GA, compass plantFZ,GA, milk thistleFZ,GA; English";
|
89
|
String firstChars = commonNamesBlock.getText().substring(0, expected.length());
|
90
|
|
91
|
assertEquals(expected, firstChars);
|
92
|
}
|
93
|
|
94
|
}
|