From 482474d10d1c9878acf0ef6f468a9c7353a64f91 Mon Sep 17 00:00:00 2001 From: Patrick <50352812+Mueller-Patrick@users.noreply.github.com> Date: Sun, 1 Nov 2020 19:07:12 +0100 Subject: [PATCH] BETTERZON-21: Adding .feature for searching Product and began work on stepdefs file --- Betterzon.iml | 3 ++ .../src/test/java/stepdefs/SearchProduct.java | 29 +++++++++++++++++++ CucumberTests/src/test/resource/demo.feature | 2 +- .../src/test/resource/searchProduct.feature | 26 +++++++++++++++++ 4 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 CucumberTests/src/test/java/stepdefs/SearchProduct.java create mode 100644 CucumberTests/src/test/resource/searchProduct.feature diff --git a/Betterzon.iml b/Betterzon.iml index 887f744..d85a06f 100644 --- a/Betterzon.iml +++ b/Betterzon.iml @@ -3,9 +3,12 @@ + + + \ No newline at end of file diff --git a/CucumberTests/src/test/java/stepdefs/SearchProduct.java b/CucumberTests/src/test/java/stepdefs/SearchProduct.java new file mode 100644 index 0000000..40a6568 --- /dev/null +++ b/CucumberTests/src/test/java/stepdefs/SearchProduct.java @@ -0,0 +1,29 @@ +package stepdefs; + +import cucumber.api.PendingException; +import cucumber.api.java.en.And; +import cucumber.api.java.en.Given; +import cucumber.api.java.en.Then; +import cucumber.api.java.en.When; + +public class SearchProduct { + @Given("^the user is on the landing page$") + public void the_user_is_on_the_landing_page() throws Exception { + } + + @When("^the user enters the search term \"([^\"]*)\" and clicks search$") + public void the_user_enters_the_search_term_and_clicks_search(String arg0) throws Exception { + } + + @Then("^the user should see the error page \"([^\"]*)\"$") + public void the_user_should_see_the_error_page(String arg0) throws Exception { + } + + @And("^the user is not logged in$") + public void the_user_is_not_logged_in() throws Exception { + } + + @And("^the user is logged in$") + public void the_user_is_logged_in() throws Exception { + } +} diff --git a/CucumberTests/src/test/resource/demo.feature b/CucumberTests/src/test/resource/demo.feature index 0838f11..5f22326 100644 --- a/CucumberTests/src/test/resource/demo.feature +++ b/CucumberTests/src/test/resource/demo.feature @@ -9,4 +9,4 @@ Feature: Guess the word Scenario: Breaker joins a game Given the Maker has started a game with the word "silky" When the Breaker joins the Maker's game - Then the Breaker must guess a word with 5 characters \ No newline at end of file + Then the Breaker must guess a word with 5 characters diff --git a/CucumberTests/src/test/resource/searchProduct.feature b/CucumberTests/src/test/resource/searchProduct.feature new file mode 100644 index 0000000..67d17f1 --- /dev/null +++ b/CucumberTests/src/test/resource/searchProduct.feature @@ -0,0 +1,26 @@ +Feature: Search a Product + + Scenario: User searches for unknown product + Given the user is on the landing page + When the user enters the search term "iPhone 13" and clicks search + Then the user should see the error page "No products found" + + Scenario: User is not logged in, searches for known product + Given the user is on the landing page + And the user is not logged in + When the user enters the search term "iPhone 12" and clicks search + Then the user should see a list of products + When the user clicks on the first product + Then the user should see the product detail page + And the set price alarm box should show "Log in to continue" + + Scenario: User is logged in, searches for known product + Given the user is on the landing page + And the user is logged in + When the user enters the search term "iPhone 12" and clicks search + Then the user should see a list of products + When the user clicks on the first product + Then the user should see the product detail page + And the set price alarm box should show "Set price alarm" + When the user sets a price alarm + Then the user should receive an email confirming the price alarm