Advertisement
Guest User

Untitled

a guest
Feb 13th, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.16 KB | None | 0 0
  1. package edu.ncsu.csc.itrust.cucumber;
  2.  
  3. import org.openqa.selenium.*;
  4.  
  5. import cucumber.api.java.en.Given;
  6. import cucumber.api.java.en.Then;
  7. import cucumber.api.java.en.When;
  8.  
  9.  
  10. public class FitnessNavigationStepDefs {
  11.  
  12. private HtmlUnitDriver driver = null;
  13.  
  14. /*-Given the user is logged in as HCP1
  15. -When the user is on the Patient Overview page
  16. -And the user selects MID 1 and presses submit
  17. -And the user views the data for the day 2/1/17 then presses back
  18. -And the user goes to the edit page for the day 1/24/17 then presses back
  19. -And the user presses back once again
  20. -Then the Select Patient page should be successfully displayed
  21. */
  22.  
  23. @Given("^the user is logged in as HCP1$")
  24. public void login_for_fitness_navigation() throws Throwable {
  25. driver = new HtmlUnitDriver();
  26. driver.get("http://localhost:8080/iTrust/")
  27. WebElement user = driver.findElement(By.name("j_username"));
  28. WebElement pass = driver.findElement(By.name("j_password"));
  29. user.sendKeys("9000000000");
  30. pass.sendKeys("pw");
  31. pass.submit();
  32.  
  33. assertEquals("iTrust - HCP Home", driver.getTitle());
  34.  
  35. }
  36.  
  37. @When("^the user is on the Patient Overview page$")
  38. public void move_to_patient_overview_navigation() throws Throwable {
  39.  
  40. driver.findElement(By.linkText("Patient Overview")).click();
  41. assertEquals("iTrust - Patient Overview", driver.getTitle());
  42.  
  43. }
  44.  
  45. @And("^the user selects MID 1 and presses submit$")
  46. public void select_patient_fitness_navigation() throws Throwable {
  47.  
  48. //assuming we use a text box with text entering. May have to be changed with actual implementation
  49. WebElement patient = driver.findElement(By.name("patient"));
  50. patient.sendKeys("1");
  51. patient.submit();
  52.  
  53. }
  54.  
  55. @And("^the user views the data for the day 2/1/17 then presses back")
  56. public void view_data_fitness_navigation() throws Throwable {
  57.  
  58. //TODO add assert for what view page will be named
  59. //Assumptions on implementation naming
  60. WebElement calendarDate = driver.findElement(By.name("date"));
  61. calendarDate.clear();
  62. calendarDate.sendKeys("02/01/17");
  63.  
  64. driver.findElement(By.name("back-button")).click();
  65.  
  66. }
  67.  
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement