Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package edu.ncsu.csc.itrust.cucumber;
- import org.openqa.selenium.*;
- import cucumber.api.java.en.Given;
- import cucumber.api.java.en.Then;
- import cucumber.api.java.en.When;
- public class FitnessNavigationStepDefs {
- private HtmlUnitDriver driver = null;
- /*-Given the user is logged in as HCP1
- -When the user is on the Patient Overview page
- -And the user selects MID 1 and presses submit
- -And the user views the data for the day 2/1/17 then presses back
- -And the user goes to the edit page for the day 1/24/17 then presses back
- -And the user presses back once again
- -Then the Select Patient page should be successfully displayed
- */
- @Given("^the user is logged in as HCP1$")
- public void login_for_fitness_navigation() throws Throwable {
- driver = new HtmlUnitDriver();
- driver.get("http://localhost:8080/iTrust/")
- WebElement user = driver.findElement(By.name("j_username"));
- WebElement pass = driver.findElement(By.name("j_password"));
- user.sendKeys("9000000000");
- pass.sendKeys("pw");
- pass.submit();
- assertEquals("iTrust - HCP Home", driver.getTitle());
- }
- @When("^the user is on the Patient Overview page$")
- public void move_to_patient_overview_navigation() throws Throwable {
- driver.findElement(By.linkText("Patient Overview")).click();
- assertEquals("iTrust - Patient Overview", driver.getTitle());
- }
- @And("^the user selects MID 1 and presses submit$")
- public void select_patient_fitness_navigation() throws Throwable {
- //assuming we use a text box with text entering. May have to be changed with actual implementation
- WebElement patient = driver.findElement(By.name("patient"));
- patient.sendKeys("1");
- patient.submit();
- }
- @And("^the user views the data for the day 2/1/17 then presses back")
- public void view_data_fitness_navigation() throws Throwable {
- //TODO add assert for what view page will be named
- //Assumptions on implementation naming
- WebElement calendarDate = driver.findElement(By.name("date"));
- calendarDate.clear();
- calendarDate.sendKeys("02/01/17");
- driver.findElement(By.name("back-button")).click();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement