Fix xpath for DataTable row and tests

This commit is contained in:
mhajas 2015-12-04 14:26:24 +01:00
parent 8589327cdd
commit d3e6b38a8e
2 changed files with 14 additions and 9 deletions

View file

@ -1,13 +1,15 @@
package org.keycloak.testsuite.console.page.fragment;
import java.util.List;
import static org.keycloak.testsuite.util.WaitUtils.pause;
import static org.keycloak.testsuite.util.WaitUtils.waitAjaxForElement;
import org.openqa.selenium.By;
import static org.openqa.selenium.By.xpath;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import java.util.List;
import static org.keycloak.testsuite.util.WaitUtils.pause;
import static org.keycloak.testsuite.util.WaitUtils.waitAjaxForElement;
import static org.openqa.selenium.By.xpath;
/**
*
* @author tkyjovsk
@ -23,7 +25,7 @@ public class DataTable {
private WebElement header;
@FindBy(css = "tbody")
private WebElement body;
@FindBy(css = "tbody tr.ng-scope")
@FindBy(xpath = "(//table)[1]/tbody/tr[@class='ng-scope']")
private List<WebElement> rows;
@FindBy

View file

@ -50,12 +50,15 @@ public class LoginEventsTest extends AbstractConsoleTest {
loginEventsPage.navigateTo();
loginEventsPage.table().filter();
List<WebElement> resultList = loginEventsPage.table().rows();
assertEquals(3, resultList.size());
loginEventsPage.table().filterForm().addEventType("LOGIN");
loginEventsPage.table().update();
List<WebElement> resultList = loginEventsPage.table().rows();
resultList = loginEventsPage.table().rows();
assertEquals(8, resultList.size());
assertEquals(1, resultList.size());
resultList.get(0).findElement(By.xpath("//td[text()='LOGIN']"));
resultList.get(0).findElement(By.xpath("//td[text()='User']/../td[text()='" + testUser.getId() + "']"));
resultList.get(0).findElement(By.xpath("//td[text()='Client']/../td[text()='security-admin-console']"));
@ -67,7 +70,7 @@ public class LoginEventsTest extends AbstractConsoleTest {
resultList = loginEventsPage.table().rows();
assertEquals(2, resultList.size());
assertEquals(1, resultList.size());
resultList.get(0).findElement(By.xpath("//td[text()='LOGOUT']"));
resultList.get(0).findElement(By.xpath("//td[text()='User']/../td[text()='" + testUser.getId() + "']"));
resultList.get(0).findElement(By.xpath("//td[text()='IP Address']/../td[text()='127.0.0.1']"));
@ -78,7 +81,7 @@ public class LoginEventsTest extends AbstractConsoleTest {
resultList = loginEventsPage.table().rows();
assertEquals(6, resultList.size());
assertEquals(1, resultList.size());
resultList.get(0).findElement(By.xpath("//td[text()='LOGIN_ERROR']"));
resultList.get(0).findElement(By.xpath("//td[text()='User']/../td[text()='" + testUser.getId() + "']"));
resultList.get(0).findElement(By.xpath("//td[text()='Client']/../td[text()='security-admin-console']"));