Skip to content
Snippets Groups Projects
Commit af28553c authored by Manuel Leduc's avatar Manuel Leduc
Browse files

[Misc] Test the presence of an icon in a Live Data.

parent 1f56e013
No related branches found
No related tags found
No related merge requests found
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.openqa.selenium.By;
import org.testcontainers.shaded.com.fasterxml.jackson.core.JsonProcessingException; import org.testcontainers.shaded.com.fasterxml.jackson.core.JsonProcessingException;
import org.testcontainers.shaded.com.fasterxml.jackson.databind.ObjectMapper; import org.testcontainers.shaded.com.fasterxml.jackson.databind.ObjectMapper;
import org.testcontainers.shaded.com.fasterxml.jackson.databind.node.ArrayNode; import org.testcontainers.shaded.com.fasterxml.jackson.databind.node.ArrayNode;
...@@ -46,6 +47,7 @@ ...@@ -46,6 +47,7 @@
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
/** /**
* Tests of the Live Data macro, in view and edit modes. * Tests of the Live Data macro, in view and edit modes.
...@@ -100,6 +102,9 @@ class LiveDataIT ...@@ -100,6 +102,9 @@ class LiveDataIT
@Order(1) @Order(1)
void livedataLivetableTableLayout(TestUtils testUtils, TestReference testReference) throws Exception void livedataLivetableTableLayout(TestUtils testUtils, TestReference testReference) throws Exception
{ {
// Make sure an icon theme is configured.
testUtils.setWikiPreference("iconTheme", "IconThemes.Silk");
// Login as super admin because guest user cannot remove pages. // Login as super admin because guest user cannot remove pages.
testUtils.loginAsSuperAdmin(); testUtils.loginAsSuperAdmin();
testUtils.createUser("U1", "U1", null); testUtils.createUser("U1", "U1", null);
...@@ -136,6 +141,12 @@ void livedataLivetableTableLayout(TestUtils testUtils, TestReference testReferen ...@@ -136,6 +141,12 @@ void livedataLivetableTableLayout(TestUtils testUtils, TestReference testReferen
LiveDataElement liveDataElement = new LiveDataElement("test"); LiveDataElement liveDataElement = new LiveDataElement("test");
TableLayoutElement tableLayout = liveDataElement.getTableLayout(); TableLayoutElement tableLayout = liveDataElement.getTableLayout();
// Verify that at least one Live Data icon is displayed to prevent XWIKI-19086 to happen again.
assertTrue(tableLayout.getDropDownButton().findElement(By.tagName("img")).getAttribute("src")
.contains("bullet_arrow_down.png"));
// Test the Live Data content.
assertEquals(3, tableLayout.countRows()); assertEquals(3, tableLayout.countRows());
tableLayout.assertRow(DOC_TITLE_COLUMN, "O1"); tableLayout.assertRow(DOC_TITLE_COLUMN, "O1");
tableLayout.assertRow(DOC_TITLE_COLUMN, "O2 1"); tableLayout.assertRow(DOC_TITLE_COLUMN, "O2 1");
......
...@@ -489,6 +489,18 @@ public Matcher<WebElement> getWebElementCellWithLinkMatcher(String text, String ...@@ -489,6 +489,18 @@ public Matcher<WebElement> getWebElementCellWithLinkMatcher(String text, String
return new CellWithLinkMatcher(text, link); return new CellWithLinkMatcher(text, link);
} }
/**
* Return the {@link WebElement} of the dropdown button.
*
* @return the {@link WebElement} of the dropdown button
* @since 13.10RC1
* @since 13.4.5
*/
public WebElement getDropDownButton()
{
return getRoot().findElement(By.cssSelector("a.dropdown-toggle"));
}
/** /**
* Returns the column index of the given column. The indexes start at {@code 1}, corresponding to the leftest * Returns the column index of the given column. The indexes start at {@code 1}, corresponding to the leftest
* column. * column.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment