diff --git a/src/main/client/app/pages/users/users.vue b/src/main/client/app/pages/users/users.vue index 6b1a0a4d7..40744a661 100644 --- a/src/main/client/app/pages/users/users.vue +++ b/src/main/client/app/pages/users/users.vue @@ -13,6 +13,7 @@
+ + init { + val wait = WebDriverWait(webDriver, 10) + wait.until(titleIs("Gaia - Users")) + } + + fun usersCount() = usersRows.size + + fun waitForPageLoaded() { + val wait = WebDriverWait(webDriver, 10) + wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("usersTable"))) + + val usersTable = webDriver.findElement(By.id("usersTable")) + usersRows = usersTable.findElement(By.tagName("tbody")).findElements(By.tagName("tr")) + } + +} diff --git a/src/test/java/io/gaia_app/e2e/stepDefs/UsersStepDefs.java b/src/test/java/io/gaia_app/e2e/stepDefs/UsersStepDefs.java index f8e7b1dfb..edebf7659 100644 --- a/src/test/java/io/gaia_app/e2e/stepDefs/UsersStepDefs.java +++ b/src/test/java/io/gaia_app/e2e/stepDefs/UsersStepDefs.java @@ -1,7 +1,8 @@ package io.gaia_app.e2e.stepDefs; +import io.cucumber.java.en.Then; import io.cucumber.java.en.When; -import io.gaia_app.e2e.pages.JobPage; +import io.gaia_app.e2e.pages.UsersPage; import org.openqa.selenium.support.PageFactory; import org.openqa.selenium.support.pagefactory.AjaxElementLocatorFactory; @@ -9,8 +10,19 @@ public class UsersStepDefs extends StepDefs { + UsersPage page; + @When("I go on the users page") public void iGoOnTheUsersPage() { driver.get(baseUrl()+"/users"); + + page = new UsersPage(driver); + PageFactory.initElements(new AjaxElementLocatorFactory(driver, 10), page); + page.waitForPageLoaded(); + } + + @Then("I can see {int} users") + public void iCanSeeUsers(int expectedUsersCount) { + assertThat(page.usersCount()).isEqualTo(expectedUsersCount); } }