Project

General

Profile

Revision 761340e4

ID761340e471e0296b8ca06d03bb101733b085fbac
Parent 8ebd16d6
Child e8d43aef

Added by Andreas Kohlbecker about 5 years ago

ref #5676 test for correct sensu representation of misapplied names

View differences:

src/main/java/eu/etaxonomy/dataportal/DataPortalContext.java
24 24
    cichorieae,
25 25
    palmae,
26 26
    cyprus,
27
    floramalesiana;
27
    floramalesiana,
28
    reference;
28 29

  
29 30
    URI baseUri;
30 31
    URI cdmServerUri;
src/main/java/eu/etaxonomy/dataportal/ElementUtils.java
20 20
import eu.etaxonomy.dataportal.elements.BaseElement;
21 21
import eu.etaxonomy.dataportal.elements.GalleryImage;
22 22
import eu.etaxonomy.dataportal.elements.LinkElement;
23
import eu.etaxonomy.dataportal.pages.PortalPage;
24 23
import eu.etaxonomy.dataportal.selenium.AllTrue;
25 24
import eu.etaxonomy.dataportal.selenium.ChildElementVisible;
26
import eu.etaxonomy.dataportal.selenium.JUnitWebDriverWait;
27 25

  
28 26
/**
29 27
 * @author andreas
......
112 110
        return galleryImageRows;
113 111
    }
114 112

  
113
    /**
114
     * Expected DOM:
115
     *
116
     * <ul class="footnotes">
117
     *   <li class="footnotes footnotes-taxon_relationships "><span class="footnote footnote-1">...</span></li>
118
     *   <li class="footnotes footnotes-taxon_relationships-annotations ">...</li>
119
     * </ul>
120
     * @param element
121
     * @return
122
     */
123
    public static List<BaseElement> findFootNotes(WebElement element){
124
        List<WebElement> fnListElements = element.findElements(
125
                By.xpath("./ul[contains(@class,'footnotes')]/li[contains(@class, 'footnotes')]/span[contains(@class, 'footnote')]")
126
        );
127
        return ElementUtils.baseElementsFromFootNoteListElements(fnListElements);
128
    }
129

  
115 130

  
116 131
}
src/main/java/eu/etaxonomy/dataportal/junit/CdmDataPortalTestBase.java
5 5

  
6 6
import org.apache.log4j.Logger;
7 7
import org.junit.AfterClass;
8
import org.junit.Assert;
8 9
import org.junit.BeforeClass;
9 10
import org.junit.runner.RunWith;
10 11
import org.openqa.selenium.WebDriver;
......
17 18
 *
18 19
 */
19 20
@RunWith(DataPortalContextSuite.class)
20
public abstract class CdmDataPortalTestBase {
21
public abstract class CdmDataPortalTestBase extends Assert{
21 22

  
22 23
	public static final Logger logger = Logger.getLogger(CdmDataPortalTestBase.class);
23 24

  
src/main/java/eu/etaxonomy/dataportal/pages/TaxonSynonymyPage.java
260 260
        return ElementUtils.baseElementsFromFootNoteListElements(fnListElements);
261 261
    }
262 262

  
263
    public WebElement getTaxonRelationships() {
264
        WebElement taxonRelationships = synonymy.findElement(
265
                By.xpath("./div[contains(@class,'taxon-relationships')]")
266
        );
267
        return taxonRelationships;
268
    }
269

  
270
    /**
271
     * @param heterotypicalGroupIndex
272
     *              the 1-based index of the misapplied names
273
     * @return
274
     */
275
    public WebElement getMisappliedName(Integer misappliedNameIndex) {
276
        WebElement misappliedName = getTaxonRelationships().findElement(
277
                By.xpath("./ul[contains(@class,'misapplied')]/li[" + misappliedNameIndex + "]")
278
        );
279
        return misappliedName;
280
    }
281

  
263 282
}
src/main/resources/eu/etaxonomy/dataportal/DataPortalTest.xml
32 32
  <entry key="dataPortalContext.floramalesiana.classificationUUID">ca4e4bcb-a1d1-4124-a358-a3d3c41dd450</entry>
33 33
  <entry key="dataPortalContext.floramalesiana.themeName"></entry>
34 34
  <entry key="dataPortalContext.floramalesiana.siteName">Flora Malesiana</entry>
35
  
36
  <entry key="dataPortalContext.reference.baseUri">http://int.e-taxonomy.eu/dataportal/integration/reference</entry>
37
  <entry key="dataPortalContext.reference.cdmServerUri">http://127.0.0.1:8080</entry>
38
  <entry key="dataPortalContext.reference.classificationUUID">2ab81d37-125d-47e6-8450-6aafd5f4b043</entry>
39
  <entry key="dataPortalContext.reference.themeName"></entry>
40
  <entry key="dataPortalContext.reference.siteName">Integration test reference</entry>
41
  
35 42
  <!--
36 43

  
37 44
    Selenium WebDriver settings
src/test/java/eu/etaxonomy/dataportal/selenium/tests/reference/MisappliedNamesTest.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.reference;
11

  
12
import java.net.MalformedURLException;
13
import java.util.List;
14
import java.util.UUID;
15

  
16
import org.junit.Before;
17
import org.junit.Test;
18
import org.openqa.selenium.WebElement;
19

  
20
import eu.etaxonomy.dataportal.DataPortalContext;
21
import eu.etaxonomy.dataportal.ElementUtils;
22
import eu.etaxonomy.dataportal.elements.BaseElement;
23
import eu.etaxonomy.dataportal.junit.CdmDataPortalTestBase;
24
import eu.etaxonomy.dataportal.junit.DataPortalContextSuite.DataPortalContexts;
25
import eu.etaxonomy.dataportal.pages.TaxonSynonymyPage;
26

  
27
/**
28
 * @author a.kohlbecker
29
 *
30
 */
31

  
32
@DataPortalContexts( { DataPortalContext.reference })
33
public class MisappliedNamesTest extends CdmDataPortalTestBase{
34

  
35
    static final UUID miconia_cubacinerea_Uuid = UUID.fromString("c6716cee-2039-4ba8-a239-4b1b353f9c84");
36

  
37
    @Before
38
    public void setUp() throws Exception {
39
        driver.get(getContext().getBaseUri().toString());
40
    }
41

  
42
    /**
43
     * Test for correct sensu representation of misapplied names, see #5676
44
     * @throws MalformedURLException
45
     */
46
    @Test
47
    public void testTitleAndTabs() throws MalformedURLException {
48

  
49
        TaxonSynonymyPage p = new TaxonSynonymyPage(driver, getContext(), miconia_cubacinerea_Uuid);
50

  
51
        WebElement misappliedName = p.getMisappliedName(1);
52
        assertNotNull(misappliedName);
53
        assertEquals("–\n\"Ossaea glomerata\" sensu Species solaris; sensu A&S; sensu Lem1", misappliedName.getText());
54
        List<BaseElement> footnotes = ElementUtils.findFootNotes(p.getTaxonRelationships());
55
        assertEquals(1, footnotes.size());
56
        assertEquals("1. sensu Lem, New Species in the solar system", footnotes.get(0).getText());
57

  
58
    }
59

  
60

  
61

  
62
}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)