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.*;
|
13
|
|
14
|
import java.net.MalformedURLException;
|
15
|
import java.util.List;
|
16
|
import java.util.UUID;
|
17
|
|
18
|
import org.junit.Test;
|
19
|
|
20
|
import eu.etaxonomy.dataportal.DataPortalContext;
|
21
|
import eu.etaxonomy.dataportal.elements.BaseElement;
|
22
|
import eu.etaxonomy.dataportal.elements.FeatureBlock;
|
23
|
import eu.etaxonomy.dataportal.junit.CdmDataPortalTestBase;
|
24
|
import eu.etaxonomy.dataportal.junit.DataPortalContextSuite.DataPortalContexts;
|
25
|
import eu.etaxonomy.dataportal.pages.TaxonProfilePage;
|
26
|
|
27
|
/**
|
28
|
*
|
29
|
* @author a.kohlbecker
|
30
|
*
|
31
|
*/
|
32
|
|
33
|
@DataPortalContexts( { DataPortalContext.cichorieae })
|
34
|
public class Cichorieae_CommonNamesTest extends CdmDataPortalTestBase{
|
35
|
|
36
|
|
37
|
static UUID lactuca_serriola_uuid = UUID.fromString("85176c77-e4b6-4899-a08b-e257ab09350a");
|
38
|
|
39
|
|
40
|
/**
|
41
|
* regression test for issue ##3160 (Cichorieae Portal: Common names not correctly ordered)
|
42
|
*
|
43
|
* @throws MalformedURLException
|
44
|
*/
|
45
|
@Test
|
46
|
public void lactuca_serriola() throws MalformedURLException {
|
47
|
TaxonProfilePage p = new TaxonProfilePage(driver, getContext(), lactuca_serriola_uuid);
|
48
|
String expectedName = "Lactuca serriola";
|
49
|
assertEquals(getContext().prepareTitle(expectedName), p.getTitle());
|
50
|
|
51
|
FeatureBlock distributionBlock = p.getFeatureBlockAt(2, "distribution", "div", "dd");
|
52
|
assertNotNull(distributionBlock);
|
53
|
|
54
|
List<BaseElement> footnotes = distributionBlock.getFootNotes();
|
55
|
assertTrue("footnotes must not be empty", footnotes.size() > 0);
|
56
|
// testing for the duplicate footnotes named below in the FIXME (related to #4383 )
|
57
|
assertEquals("40. Komarov, V. L., Flora SSSR 29. 1964", footnotes.get(39).getText());
|
58
|
assertEquals("43. Komarov, V. L., Flora SSSR 29. 1964 (as Lactuca altaica)", footnotes.get(42).getText());
|
59
|
|
60
|
|
61
|
FeatureBlock commonNamesBlock = p.getFeatureBlockAt(3, "common_names", "div", "span");
|
62
|
assertNotNull(commonNamesBlock);
|
63
|
|
64
|
// 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";
|
65
|
// 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";
|
66
|
// 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" +
|
67
|
// 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";
|
68
|
// 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";
|
69
|
// 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";
|
70
|
|
71
|
// FIXME the distribution entries have duplicate foonote key for source references, see #4383 (references in bibliography need de-duplication)
|
72
|
// for example "40. Komarov, V. L., Flora SSSR 29. 1964", and "43. Komarov, V. L., Flora SSSR 29. 1964 (as Lactuca altaica)"
|
73
|
// this is why the Common name footnote keys are having an offset, the below out-commented string should be the correct one:
|
74
|
// 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";
|
75
|
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";
|
76
|
String firstChars = commonNamesBlock.getText().substring(0, expected.length());
|
77
|
|
78
|
assertEquals(expected, firstChars);
|
79
|
}
|
80
|
|
81
|
}
|