From 54792e17e3f516c2d428ac2b22b57803f824d4b2 Mon Sep 17 00:00:00 2001 From: Adam Klinkosz Date: Thu, 15 Apr 2021 18:38:40 +0200 Subject: [PATCH] Fix tests --- .../samples/petclinic/integration/StepDefinition.java | 9 ++++++++- src/test/resources/scenarios/FindOwners.feature | 4 ++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/test/java/org/springframework/samples/petclinic/integration/StepDefinition.java b/src/test/java/org/springframework/samples/petclinic/integration/StepDefinition.java index de20de94d..f6273d083 100644 --- a/src/test/java/org/springframework/samples/petclinic/integration/StepDefinition.java +++ b/src/test/java/org/springframework/samples/petclinic/integration/StepDefinition.java @@ -13,11 +13,18 @@ import io.cucumber.java.en.When; public class StepDefinition extends SpringIntegrationTest { + public static final String BASE_URL = "http://localhost:8080"; + private final WebDriver webDriver = Browser.webDriver; @Given("^I go to the main page$") public void mainPage() { - webDriver.navigate().to("http://localhost:8080"); + webDriver.navigate().to(BASE_URL); + } + + @Given("^I go to the find-owners page$") + public void findOwnersPage() { + webDriver.navigate().to(BASE_URL + "/owners/find"); } @When("^I click on the link with title \"([^\"]*)\"$") diff --git a/src/test/resources/scenarios/FindOwners.feature b/src/test/resources/scenarios/FindOwners.feature index 1ca6624b6..9a3525cb0 100644 --- a/src/test/resources/scenarios/FindOwners.feature +++ b/src/test/resources/scenarios/FindOwners.feature @@ -1,14 +1,18 @@ Feature: Find owners Scenario: Find owners page + Given I go to the main page When I click on the link with title "find owners" Then I should see the "Find Owners" page Scenario: Should find an owner When I fill the field named "lastName" with value "Franklin" + And I submit the form "search-owner-form" Then I should see the "Owner Information" page Scenario: Should find multiple owners + Given I go to the find-owners page When I fill the field named "lastName" with value "Davis" + And I submit the form "search-owner-form" Then I should see the "Owners" page # Add additional checks here.