Revision b9674e73
Added by Andreas Kohlbecker over 12 years ago
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/elements/FeatureBlock.java | ||
---|---|---|
13 | 13 |
import java.util.List; |
14 | 14 |
|
15 | 15 |
import static junit.framework.Assert.*; |
16 |
import static org.junit.Assert.assertEquals; |
|
16 | 17 |
|
17 | 18 |
import org.openqa.selenium.By; |
18 | 19 |
import org.openqa.selenium.WebElement; |
... | ... | |
44 | 45 |
return footNotes; |
45 | 46 |
} |
46 | 47 |
|
47 |
public List<BaseElement> getOriginalSources() { |
|
48 |
public List<BaseElement> getOriginalSourcesSections() {
|
|
48 | 49 |
return originalSources; |
49 | 50 |
} |
50 | 51 |
|
... | ... | |
81 | 82 |
|
82 | 83 |
WebElement descriptionElementsRepresentation = element.findElement(By.className("description")); |
83 | 84 |
featureType = descriptionElementsRepresentation.getAttribute("id"); |
85 |
|
|
86 |
//TODO throw exception instead of making an assetion! selenium should have appropriate exeptions |
|
84 | 87 |
assertEquals("Unexpected tag enclosing description element representations", enclosingTag, descriptionElementsRepresentation.getTagName()); |
85 | 88 |
|
86 | 89 |
for(WebElement el : descriptionElementsRepresentation.findElements(By.tagName(elementTag))){ |
... | ... | |
89 | 92 |
|
90 | 93 |
} |
91 | 94 |
|
95 |
/** |
|
96 |
* @param indent |
|
97 |
* @param computedFontSize |
|
98 |
* @param expectedCssDisplay |
|
99 |
* @param expectedListStyleType only applies if cssDisplay equals list-item |
|
100 |
* @param expectedListStylePosition only applies if cssDisplay equals list-item |
|
101 |
* @param expectedListStyleImage only applies if cssDisplay equals list-item |
|
102 |
*/ |
|
103 |
public void testDescriptionElementLayout(int descriptionElementId, int indent, int computedFontSize |
|
104 |
, String expectedCssDisplay, String expectedListStyleType, String expectedListStylePosition, String expectedListStyleImage) { |
|
105 |
|
|
106 |
DescriptionElementRepresentation firstDescriptionElement = getDescriptionElements().get(descriptionElementId); |
|
92 | 107 |
|
108 |
int parentX = getElement().getLocation().getX(); |
|
109 |
int elementX = firstDescriptionElement.getElement().getLocation().getX(); |
|
110 |
double elementPadLeft = pxSizeToDouble(firstDescriptionElement.getElement().getCssValue("padding-left")); |
|
93 | 111 |
|
112 |
assertEquals(indent, elementX - parentX + elementPadLeft, PIXEL_TOLERANCE); |
|
113 |
assertEquals(computedFontSize, firstDescriptionElement.getComputedFontSize(), 0.5); |
|
114 |
assertEquals(expectedCssDisplay, firstDescriptionElement.getElement().getCssValue("display")); |
|
115 |
|
|
116 |
if(expectedCssDisplay.equals("list-item")){ |
|
117 |
assertEquals(expectedListStylePosition, firstDescriptionElement.getElement().getCssValue("list-style-position")); |
|
118 |
assertEquals(expectedListStyleImage, firstDescriptionElement.getElement().getCssValue("list-style-image")); |
|
119 |
assertEquals(expectedListStyleType, firstDescriptionElement.getElement().getCssValue("list-style-type")); |
|
120 |
} |
|
121 |
} |
|
94 | 122 |
|
95 | 123 |
} |
Also available in: Unified diff
complete test of plamweb taxon profile