-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
44 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ | |
|
||
<div class="block mt-3"> | ||
<b-table | ||
id="usersTable" | ||
:items="users" | ||
:fields="fields" | ||
striped | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package io.gaia_app.e2e.pages | ||
|
||
import org.openqa.selenium.By | ||
import org.openqa.selenium.WebDriver | ||
import org.openqa.selenium.WebElement | ||
import org.openqa.selenium.support.ui.ExpectedConditions | ||
import org.openqa.selenium.support.ui.ExpectedConditions.titleIs | ||
import org.openqa.selenium.support.ui.WebDriverWait | ||
|
||
class UsersPage(private val webDriver: WebDriver) { | ||
|
||
private lateinit var usersRows: List<WebElement> | ||
|
||
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")) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,28 @@ | ||
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; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
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); | ||
} | ||
} |