├── .gitignore ├── pom.xml └── src ├── main └── java │ └── AmazonImplementation │ ├── Product.java │ └── Search.java └── test ├── java ├── MyHooks │ └── AmazonHooks.java ├── stepdefinitions │ ├── AmazonHomePage.java │ ├── AmazonLoginPage.java │ ├── BillingSteps.java │ ├── OrdersSteps.java │ ├── SearchSteps.java │ ├── UberBookingSteps.java │ └── UserRegistrationSteps.java └── testrunners │ ├── AmazonTest.java │ ├── BillingTest.java │ ├── OrderTest.java │ ├── UberTest.java │ └── UserRegTest.java └── resources ├── AppFeatures ├── AmazonHomePage.feature ├── AmazonLogin.feature ├── Order.feature ├── Search.feature ├── Uber.feature ├── billing.feature ├── login.feature ├── notes └── registration.feature └── cucumber.properties /.gitignore: -------------------------------------------------------------------------------- 1 | allure-results/ 2 | screenshots/ 3 | test-output/ 4 | 5 | 6 | ############################## 7 | ## Java 8 | ############################## 9 | .mtj.tmp/ 10 | *.class 11 | *.jar 12 | *.war 13 | *.ear 14 | *.nar 15 | hs_err_pid* 16 | ############################## 17 | ## Maven 18 | ############################## 19 | target/ 20 | pom.xml.tag 21 | pom.xml.releaseBackup 22 | pom.xml.versionsBackup 23 | pom.xml.next 24 | pom.xml.bak 25 | release.properties 26 | dependency-reduced-pom.xml 27 | buildNumber.properties 28 | .mvn/timing.properties 29 | .mvn/wrapper/maven-wrapper.jar 30 | 31 | ############################## 32 | ## IntelliJ 33 | ############################## 34 | out/ 35 | .idea/ 36 | .idea_modules/ 37 | *.iml 38 | *.ipr 39 | *.iws 40 | ############################## 41 | ## Eclipse 42 | ############################## 43 | .settings/ 44 | bin/ 45 | tmp/ 46 | .metadata 47 | .classpath 48 | .project 49 | *.tmp 50 | *.bak 51 | *.swp 52 | *~.nib 53 | local.properties 54 | .loadpath 55 | .factorypath 56 | 57 | ## OS X 58 | ############################## 59 | .DS_Store -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 4.0.0 7 | 8 | CucumberYouTubeSeries 9 | CucumberPractices 10 | 0.0.1-SNAPSHOT 11 | 12 | CucumberPractices 13 | 14 | http://www.example.com 15 | 16 | 17 | UTF-8 18 | 1.8 19 | 4.13.1 20 | 6.9.0 21 | 3.8.1 22 | 2.22.2 23 | 24 | 25 | 26 | 27 | io.cucumber 28 | cucumber-java 29 | ${cucumber.version} 30 | test 31 | 32 | 33 | 34 | io.cucumber 35 | cucumber-junit 36 | ${cucumber.version} 37 | test 38 | 39 | 40 | 41 | junit 42 | junit 43 | ${junit.version} 44 | test 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | org.apache.maven.plugins 55 | maven-compiler-plugin 56 | ${maven.compiler.version} 57 | 58 | UTF-8 59 | ${java.version} 60 | ${java.version} 61 | 62 | 63 | 64 | org.apache.maven.plugins 65 | maven-surefire-plugin 66 | ${maven.surefire.version} 67 | 68 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /src/main/java/AmazonImplementation/Product.java: -------------------------------------------------------------------------------- 1 | package AmazonImplementation; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | public class Product { 7 | 8 | private String productName; 9 | private int price; 10 | 11 | public Product(String productName, int price) { 12 | this.productName = productName; 13 | this.price = price; 14 | } 15 | 16 | public String getProductName() { 17 | return productName; 18 | } 19 | 20 | public void setProductName(String productName) { 21 | this.productName = productName; 22 | } 23 | 24 | public int getPrice() { 25 | return price; 26 | } 27 | 28 | public void setPrice(int price) { 29 | this.price = price; 30 | } 31 | 32 | public List getProductList() { 33 | List productList = new ArrayList<>(); 34 | productList.add("Apple MacBook Pro"); 35 | productList.add("Apple MacBook Air"); 36 | productList.add("Apple iPhone 12"); 37 | return productList; 38 | 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/AmazonImplementation/Search.java: -------------------------------------------------------------------------------- 1 | package AmazonImplementation; 2 | 3 | public class Search { 4 | 5 | public String displayProduct(Product product) { 6 | 7 | if (product.getProductList().contains(product.getProductName())) { 8 | return product.getProductName(); 9 | } 10 | return null; 11 | 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/test/java/MyHooks/AmazonHooks.java: -------------------------------------------------------------------------------- 1 | package MyHooks; 2 | 3 | import io.cucumber.java.After; 4 | import io.cucumber.java.Before; 5 | import io.cucumber.java.Scenario; 6 | 7 | public class AmazonHooks { 8 | 9 | 10 | // @Before("@Smoke") 11 | // public void setup_browser(Scenario sc) { 12 | // System.out.println("launch chrome browser"); 13 | // System.out.println(sc.getName()); 14 | // 15 | // } 16 | // 17 | // @Before(order = 2) 18 | // public void setup_url() { 19 | // System.out.println("launch url"); 20 | // } 21 | // 22 | // @After(order = 2) 23 | // public void tearDown_close(Scenario sc) { 24 | // System.out.println("close the browser"); 25 | // System.out.println(sc.getName()); 26 | // } 27 | // 28 | // @After("@Smoke") 29 | // public void tearDown_logout() { 30 | // System.out.println("logout from application"); 31 | // } 32 | 33 | 34 | // @BeforeStep() 35 | // public void takescreenshot() { 36 | // System.out.println("take the screenshot"); 37 | // } 38 | // 39 | // @AfterStep 40 | // public void refreshPage() { 41 | // System.out.println("refresh the page"); 42 | // } 43 | 44 | 45 | 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/test/java/stepdefinitions/AmazonHomePage.java: -------------------------------------------------------------------------------- 1 | package stepdefinitions; 2 | 3 | import java.util.List; 4 | 5 | import io.cucumber.datatable.DataTable; 6 | import io.cucumber.java.en.Given; 7 | import io.cucumber.java.en.Then; 8 | import io.cucumber.java.en.When; 9 | 10 | public class AmazonHomePage { 11 | 12 | @Given("user is on Amazon home page") 13 | public void user_is_on_amazon_home_page() { 14 | 15 | } 16 | 17 | @Then("user gets a Amazon search field") 18 | public void user_gets_a_amazon_search_field() { 19 | } 20 | 21 | @Then("username is also displayed next to search field") 22 | public void username_is_also_displayed_next_to_search_field() { 23 | } 24 | 25 | @Then("Amazon logo is also displayed") 26 | public void amazon_logo_is_also_displayed() { 27 | 28 | 29 | } 30 | 31 | @Then("Cart link is also displayed") 32 | public void cart_link_is_also_displayed() { 33 | } 34 | 35 | @When("user scrolls down to Todays Deals section") 36 | public void user_scrolls_down_to_todays_deals_section() { 37 | } 38 | 39 | @Then("user gets the list of multiple products") 40 | public void user_gets_the_list_of_multiple_products() { 41 | } 42 | 43 | @Then("user gets product image and price details") 44 | public void user_gets_product_image_and_price_details() { 45 | } 46 | 47 | @Then("user can see more products by clicking on carousel") 48 | public void user_can_see_more_products_by_clicking_on_carousel() { 49 | } 50 | 51 | @When("user scrolls down to footer of the page") 52 | public void user_scrolls_down_to_footer_of_the_page() { 53 | } 54 | 55 | @Then("user gets all Country links") 56 | public void user_gets_all_country_links(DataTable dataTable) { 57 | 58 | List> countryList = dataTable.asLists(); 59 | System.out.println(countryList); 60 | } 61 | 62 | @Then("user gets all amazon services links") 63 | public void user_gets_all_amazon_services_links(DataTable dataTable) { 64 | List> servicesList = dataTable.asLists(); 65 | System.out.println(servicesList); 66 | 67 | } 68 | 69 | @Then("User gets all privacy policy links") 70 | public void user_gets_all_privacy_policy_links(DataTable dataTable) { 71 | List> policyList = dataTable.asLists(); 72 | System.out.println(policyList); 73 | 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /src/test/java/stepdefinitions/AmazonLoginPage.java: -------------------------------------------------------------------------------- 1 | package stepdefinitions; 2 | 3 | import io.cucumber.java.en.Given; 4 | import io.cucumber.java.en.Then; 5 | import io.cucumber.java.en.When; 6 | 7 | public class AmazonLoginPage { 8 | 9 | 10 | @Given("user is on Amazon landing page") 11 | public void user_is_on_amazon_landing_page() { 12 | // Write code here that turns the phrase above into concrete actions 13 | throw new io.cucumber.java.PendingException(); 14 | } 15 | 16 | @Given("Sign in button is present on screen") 17 | public void sign_in_button_is_present_on_screen() { 18 | // Write code here that turns the phrase above into concrete actions 19 | throw new io.cucumber.java.PendingException(); 20 | } 21 | 22 | @When("user clicks on Sign in button") 23 | public void user_clicks_on_sign_in_button() { 24 | // Write code here that turns the phrase above into concrete actions 25 | throw new io.cucumber.java.PendingException(); 26 | } 27 | 28 | @Then("user is displayed login screen") 29 | public void user_is_displayed_login_screen() { 30 | // Write code here that turns the phrase above into concrete actions 31 | throw new io.cucumber.java.PendingException(); 32 | } 33 | 34 | @When("user enters {string} in username field") 35 | public void user_enters_in_username_field(String string) { 36 | // Write code here that turns the phrase above into concrete actions 37 | throw new io.cucumber.java.PendingException(); 38 | } 39 | 40 | @When("user enters {string} in password field") 41 | public void user_enters_in_password_field(String string) { 42 | // Write code here that turns the phrase above into concrete actions 43 | throw new io.cucumber.java.PendingException(); 44 | } 45 | 46 | @When("user clicks Sign in button") 47 | public void user_clicks_sign_in_button() { 48 | // Write code here that turns the phrase above into concrete actions 49 | throw new io.cucumber.java.PendingException(); 50 | } 51 | 52 | @Then("user is on home page") 53 | public void user_is_on_home_page() { 54 | // Write code here that turns the phrase above into concrete actions 55 | throw new io.cucumber.java.PendingException(); 56 | } 57 | 58 | @Then("title of home page is {string}") 59 | public void title_of_home_page_is(String string) { 60 | // Write code here that turns the phrase above into concrete actions 61 | throw new io.cucumber.java.PendingException(); 62 | } 63 | 64 | @Then("Sign in button is not present") 65 | public void sign_in_button_is_not_present() { 66 | // Write code here that turns the phrase above into concrete actions 67 | throw new io.cucumber.java.PendingException(); 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /src/test/java/stepdefinitions/BillingSteps.java: -------------------------------------------------------------------------------- 1 | package stepdefinitions; 2 | 3 | import org.junit.Assert; 4 | 5 | import io.cucumber.datatable.DataTable; 6 | import io.cucumber.java.en.Given; 7 | import io.cucumber.java.en.Then; 8 | import io.cucumber.java.en.When; 9 | 10 | public class BillingSteps { 11 | 12 | double billingAmount; 13 | double taxAmount; 14 | double finalAmount; 15 | 16 | @Given("user is on billing page") 17 | public void user_is_on_billing_page() { 18 | } 19 | 20 | @When("user enters billing amount {string}") 21 | public void user_enters_billing_amount(String billingAmount) { 22 | this.billingAmount = Double.parseDouble(billingAmount); 23 | } 24 | 25 | 26 | @When("user enters tax amount {string}") 27 | public void user_enters_tax_amount(String taxAmount) { 28 | this.taxAmount = Double.parseDouble(taxAmount); 29 | } 30 | 31 | @When("user clicks on calculate button") 32 | public void user_clicks_on_calculate_button() { 33 | } 34 | 35 | @Then("it gives the final amount {string}") 36 | public void it_gives_the_final_amount(String expectedFinalAmount) { 37 | this.finalAmount = this.billingAmount + this.taxAmount; 38 | System.out.println("expected final amount: " + Double.parseDouble(expectedFinalAmount)); 39 | System.out.println("actual final amount: " + this.finalAmount); 40 | 41 | Assert.assertTrue(this.finalAmount == Double.parseDouble(expectedFinalAmount)); 42 | } 43 | 44 | 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/test/java/stepdefinitions/OrdersSteps.java: -------------------------------------------------------------------------------- 1 | package stepdefinitions; 2 | 3 | import io.cucumber.java.en.Given; 4 | import io.cucumber.java.en.Then; 5 | import io.cucumber.java.en.When; 6 | 7 | public class OrdersSteps { 8 | 9 | @Given("a registered user exists") 10 | public void a_registered_user_exists() { 11 | 12 | } 13 | 14 | @Given("user is on Amazon login page") 15 | public void user_is_on_amazon_login_page() { 16 | } 17 | 18 | @When("user enters username") 19 | public void user_enters_username() { 20 | } 21 | 22 | @When("user enters password") 23 | public void user_enters_password() { 24 | } 25 | 26 | @When("user clicks on login button") 27 | public void user_clicks_on_login_button() { 28 | } 29 | 30 | @Then("user navigates to order page") 31 | public void user_navigates_to_order_page() { 32 | } 33 | 34 | @When("user clicks on Order link") 35 | public void user_clicks_on_order_link() { 36 | } 37 | 38 | @Then("user checks the previous order detials") 39 | public void user_checks_the_previous_order_detials() { 40 | } 41 | 42 | @When("user clicks on Open Orders link") 43 | public void user_clicks_on_open_orders_link() { 44 | } 45 | 46 | @Then("user checks the open order details") 47 | public void user_checks_the_open_order_details() { 48 | } 49 | 50 | @When("user clicks on Cancelled Orders link") 51 | public void user_clicks_on_cancelled_orders_link() { 52 | } 53 | 54 | @Then("user checks the cancelled order details") 55 | public void user_checks_the_cancelled_order_details() { 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/test/java/stepdefinitions/SearchSteps.java: -------------------------------------------------------------------------------- 1 | package stepdefinitions; 2 | 3 | import AmazonImplementation.Product; 4 | import AmazonImplementation.Search; 5 | import io.cucumber.java.en.Given; 6 | import io.cucumber.java.en.Then; 7 | import io.cucumber.java.en.When; 8 | import junit.framework.Assert; 9 | 10 | public class SearchSteps { 11 | 12 | Product product; 13 | Search search; 14 | 15 | @Given("I have a search field on Amazon Page") 16 | public void i_have_a_search_field_on_amazon_page() { 17 | System.out.println("Step 1: I am on search page"); 18 | } 19 | 20 | @When("^I search for a product with name \"([^\"]+)\" and price (\\d+)$") 21 | public void i_search_for_a_product_with_name_and_price(String productName, Integer price) { 22 | System.out.println("Step 2: Search the product with name : " + productName + " price: " + price); 23 | product = new Product(productName, price); 24 | } 25 | 26 | @Then("Product with name {string} should be displayed") 27 | public void product_with_name_should_be_displayed(String productName) { 28 | System.out.println("Step 3: product " + productName + " is displayed"); 29 | 30 | search = new Search(); 31 | String name = search.displayProduct(product); 32 | System.out.println("searched product is : " + name); 33 | 34 | } 35 | 36 | @Then("Order id is {int} and username is {string}") 37 | public void order_id_is_and_username_is(Integer int1, String string) { 38 | 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/test/java/stepdefinitions/UberBookingSteps.java: -------------------------------------------------------------------------------- 1 | package stepdefinitions; 2 | 3 | import io.cucumber.java.en.Given; 4 | import io.cucumber.java.en.Then; 5 | import io.cucumber.java.en.When; 6 | 7 | public class UberBookingSteps { 8 | 9 | @Given("User wants to select a car type {string} from uber application") 10 | public void user_wants_to_select_a_car_type_from_uber_app(String carType) { 11 | System.out.println("step 1 : " + carType); 12 | } 13 | 14 | @When("User selects car {string} and pick up point {string} and drop location {string}") 15 | public void user_selects_car_and_pick_up_point_and_drop_location(String carType, String pickUpLocation, 16 | String DropLocation) { 17 | System.out.println("step 2 : " + carType + " " + pickUpLocation + " " + DropLocation); 18 | } 19 | 20 | @Then("Driver starts the journey") 21 | public void driver_starts_the_journey() { 22 | System.out.println("step 3"); 23 | 24 | } 25 | 26 | @Then("Driver ends the journey") 27 | public void driver_ends_the_journey() { 28 | System.out.println("step 4"); 29 | 30 | } 31 | 32 | @Then("User pays {int} USD") 33 | public void user_pays_usd(Integer price) { 34 | System.out.println("step 5 : " + price); 35 | 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/test/java/stepdefinitions/UserRegistrationSteps.java: -------------------------------------------------------------------------------- 1 | package stepdefinitions; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | import io.cucumber.datatable.DataTable; 7 | import io.cucumber.java.en.Given; 8 | import io.cucumber.java.en.Then; 9 | import io.cucumber.java.en.When; 10 | 11 | public class UserRegistrationSteps { 12 | 13 | @Given("User is on registration page") 14 | public void user_is_on_registration_page() { 15 | 16 | System.out.println("user navigates on registration page"); 17 | } 18 | 19 | @When("User enters following user details") 20 | public void user_enters_following_user_details(DataTable dataTable) { 21 | 22 | List> userList = dataTable.asLists(String.class); 23 | 24 | for (List e : userList) { 25 | System.out.println(e); 26 | } 27 | } 28 | 29 | @When("User enters following user details with columns") 30 | public void user_enters_following_user_details_with_columns(DataTable dataTable) { 31 | List> userList = dataTable.asMaps(String.class, String.class); 32 | 33 | // System.out.println(userList); 34 | // System.out.println(userList.get(0).get("firstname")); 35 | 36 | for(Map e : userList) { 37 | System.out.println(e.get("firstname")); 38 | System.out.println(e.get("lastname")); 39 | System.out.println(e.get("email")); 40 | System.out.println(e.get("phone")); 41 | System.out.println(e.get("city")); 42 | } 43 | 44 | } 45 | 46 | @Then("user registration should be successful") 47 | public void user_registration_should_be_successful() { 48 | System.out.println("user registration should be successful"); 49 | 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/test/java/testrunners/AmazonTest.java: -------------------------------------------------------------------------------- 1 | package testrunners; 2 | 3 | import org.junit.runner.RunWith; 4 | 5 | import io.cucumber.junit.Cucumber; 6 | import io.cucumber.junit.CucumberOptions; 7 | 8 | @RunWith(Cucumber.class) 9 | @CucumberOptions( 10 | features = {"src/test/resources/AppFeatures/Search.feature"}, 11 | glue = {"stepdefinitions", "MyHooks"}, 12 | tags = "@Smoke or @Regression", 13 | plugin = {"pretty"} 14 | 15 | ) 16 | public class AmazonTest { 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/test/java/testrunners/BillingTest.java: -------------------------------------------------------------------------------- 1 | package testrunners; 2 | 3 | import org.junit.runner.RunWith; 4 | 5 | import io.cucumber.junit.Cucumber; 6 | import io.cucumber.junit.CucumberOptions; 7 | 8 | 9 | @RunWith(Cucumber.class) 10 | @CucumberOptions( 11 | features = {"src/test/resources/AppFeatures/billing.feature"}, 12 | glue = {"stepdefinitions"}, 13 | plugin = {"pretty"} 14 | 15 | ) 16 | 17 | public class BillingTest { 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/test/java/testrunners/OrderTest.java: -------------------------------------------------------------------------------- 1 | package testrunners; 2 | 3 | import org.junit.runner.RunWith; 4 | 5 | import io.cucumber.junit.Cucumber; 6 | import io.cucumber.junit.CucumberOptions; 7 | 8 | @RunWith(Cucumber.class) 9 | @CucumberOptions( 10 | features = {"src/test/resources/AppFeatures/Order.feature"}, 11 | glue = {"stepdefinitions", "AppHooks"}, 12 | plugin = {"pretty"} 13 | 14 | ) 15 | 16 | public class OrderTest { 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/test/java/testrunners/UberTest.java: -------------------------------------------------------------------------------- 1 | package testrunners; 2 | 3 | 4 | import org.junit.runner.RunWith; 5 | 6 | import io.cucumber.junit.Cucumber; 7 | import io.cucumber.junit.CucumberOptions; 8 | 9 | @RunWith(Cucumber.class) 10 | @CucumberOptions( 11 | features = {"src/test/resources/AppFeatures/Uber.feature"}, 12 | glue = {"stepdefinitions", "MyHooks"}, 13 | tags = "@All", 14 | plugin = {"pretty", 15 | "json:target/MyReports/report.json", 16 | "junit:target/MyReports/report.xml" 17 | }, 18 | monochrome = false, 19 | dryRun = false 20 | //strict = true 21 | 22 | ) 23 | 24 | public class UberTest { 25 | 26 | } 27 | 28 | -------------------------------------------------------------------------------- /src/test/java/testrunners/UserRegTest.java: -------------------------------------------------------------------------------- 1 | package testrunners; 2 | 3 | import org.junit.runner.RunWith; 4 | 5 | import io.cucumber.junit.Cucumber; 6 | import io.cucumber.junit.CucumberOptions; 7 | 8 | @RunWith(Cucumber.class) 9 | @CucumberOptions( 10 | features = {"src/test/resources/AppFeatures/registration.feature"}, 11 | glue = {"stepdefinitions"}, 12 | plugin = {"pretty", 13 | "json:target/MyReports/report.json", 14 | "junit:target/MyReports/report.xml" 15 | }, 16 | monochrome = false, 17 | dryRun = false 18 | //strict = true 19 | 20 | ) 21 | public class UserRegTest { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/test/resources/AppFeatures/AmazonHomePage.feature: -------------------------------------------------------------------------------- 1 | Feature: Amazon Home Page 2 | In order to test Amazon Home Page of application 3 | As a Registered user 4 | I want to specify the features of home page 5 | 6 | Scenario: Home Page Top Panel Section 7 | Given user is on Amazon home page 8 | Then user gets a Amazon search field 9 | And username is also displayed next to search field 10 | And Amazon logo is also displayed 11 | And Cart link is also displayed 12 | 13 | Scenario: Amazon Todays Deals section 14 | Given user is on Amazon home page 15 | When user scrolls down to Todays Deals section 16 | Then user gets the list of multiple products 17 | And user gets product image and price details 18 | And user can see more products by clicking on carousel 19 | 20 | Scenario: Amazon Footer Links section 21 | Given user is on Amazon home page 22 | When user scrolls down to footer of the page 23 | Then user gets all Country links 24 | |Australia| 25 | |Brazil| 26 | |China| 27 | And user gets all amazon services links 28 | |Amazon Business| 29 | |Amazon Web Services| 30 | And User gets all privacy policy links 31 | |Privacy Notice| 32 | |Use & Sale| -------------------------------------------------------------------------------- /src/test/resources/AppFeatures/AmazonLogin.feature: -------------------------------------------------------------------------------- 1 | Feature: login Page 2 | In order to test login page 3 | As a Registered user 4 | I want to specify the login conditions 5 | 6 | 7 | #Scenario: Amazon Login Page 8 | #Given user is on Amazon landing page 9 | #Given Sign in button is present on screen 10 | #When user clicks on Sign in button 11 | #Then user can see login screen 12 | #When user enters "naveen@gmail.com" in username field 13 | #When user enters "test@123" in password field 14 | #When user clicks Sign in button 15 | #Then user is on home page 16 | #Then title of home page is "Amazon" 17 | 18 | 19 | Scenario: Amazon Login Page 20 | Given user is on Amazon landing page 21 | And Sign in button is present on screen 22 | When user clicks on Sign in button 23 | Then user is displayed login screen 24 | When user enters "naveen@gmail.com" in username field 25 | And user enters "test@123" in password field 26 | And user clicks Sign in button 27 | Then user is on home page 28 | And title of home page is "Amazon" 29 | But Sign in button is not present 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /src/test/resources/AppFeatures/Order.feature: -------------------------------------------------------------------------------- 1 | Feature: Home Page 2 | In order to check my order details 3 | As a registered user 4 | I want to specify the features of order details page 5 | 6 | Background: 7 | Given a registered user exists 8 | Given user is on Amazon login page 9 | When user enters username 10 | And user enters password 11 | And user clicks on login button 12 | Then user navigates to order page 13 | 14 | 15 | Scenario: Check Previous Order Details 16 | When user clicks on Order link 17 | Then user checks the previous order detials 18 | 19 | Scenario: Check Open Order Details 20 | When user clicks on Open Orders link 21 | Then user checks the open order details 22 | 23 | Scenario: Check Cancelled Order Details 24 | When user clicks on Cancelled Orders link 25 | Then user checks the cancelled order details -------------------------------------------------------------------------------- /src/test/resources/AppFeatures/Search.feature: -------------------------------------------------------------------------------- 1 | Feature: Amazon Search 2 | 3 | @Smoke 4 | Scenario: Search a Product MacBook air 5 | Given I have a search field on Amazon Page 6 | When I search for a product with name "Apple MacBook Air" and price 200 7 | Then Product with name "Apple MacBook Pro" should be displayed 8 | Then Order id is 12345 and username is "Naveen" 9 | 10 | @Regression 11 | Scenario: Search a Product Iphone 12 | Given I have a search field on Amazon Page 13 | When I search for a product with name "Iphone" and price 1200 14 | Then Product with name "Iphone" should be displayed 15 | Then Order id is 5677 and username is "Naveen automation" -------------------------------------------------------------------------------- /src/test/resources/AppFeatures/Uber.feature: -------------------------------------------------------------------------------- 1 | 2 | @All 3 | Feature: Uber Booking Feature 4 | 5 | @Smoke 6 | Scenario: Booking Cab Sedan 7 | Given User wants to select a car type "sedan" from uber application 8 | When User selects car "sedan" and pick up point "Bangalore" and drop location "Pune" 9 | Then Driver starts the journey 10 | And Driver ends the journey 11 | Then User pays 1000 USD 12 | Then User checks the trip details 13 | 14 | @Smoke @Regression 15 | Scenario: Booking Cab SUV 16 | Given User wants to select a car type "suv" from uber application 17 | When User selects car "sedan" and pick up point "Bangalore" and drop location "Hyderabad" 18 | Then Driver starts the journey 19 | And Driver ends the journey 20 | Then User pays 1000 USD 21 | 22 | @Prod 23 | Scenario: Booking Cab for Mini 24 | Given User wants to select a car type "mini" from uber application 25 | When User selects car "sedan" and pick up point "Pune" and drop location "Mumbai" 26 | Then Driver starts the journey 27 | And Driver ends the journey 28 | Then User pays 1000 USD -------------------------------------------------------------------------------- /src/test/resources/AppFeatures/billing.feature: -------------------------------------------------------------------------------- 1 | 2 | Feature: Calculate billing amount 3 | 4 | Scenario Outline: billing amount 5 | Given user is on billing page 6 | When user enters billing amount "" 7 | When user enters tax amount "" 8 | And user clicks on calculate button 9 | Then it gives the final amount "" 10 | Examples: 11 | | billingamount| taxamount | finalamount| 12 | | 1000 | 10 | 1010 | 13 | | 500 | 20 | 520 | 14 | | 100 | 5.5 | 105.5 | -------------------------------------------------------------------------------- /src/test/resources/AppFeatures/login.feature: -------------------------------------------------------------------------------- 1 | Feature: Login Feature 2 | 3 | Scenario Outline: Login fail - possible combinations 4 | Given user is on Application landing page 5 | When user clicks on Sign in button 6 | Then user is displayed login screen 7 | When user enters "" in username field 8 | And user enters "" in password field 9 | And user clicks Sign in button 10 | Then user gets login failed error message 11 | 12 | Examples: 13 | | UserName | Password | 14 | | incorrectusername | 123456 | 15 | | naveenautomation | incorrectpassword | 16 | | incorrectusername | incorrectpassword | -------------------------------------------------------------------------------- /src/test/resources/AppFeatures/notes: -------------------------------------------------------------------------------- 1 | Two types of REg Expressions in Cucumber: 2 | 3 | 1. Regular Expression --> [0-9]+, (\\d+) 4 | 2. Cucumber Expression (2017) 5 | 6 | rules: 7 | 1. Step def file will be generating cucumber exp by default 8 | 2. But you can use regular exp also in step def file 9 | 3. You can mix both regular and cucumber exp in step definition file 10 | 4. but you can not mix both expressions in a step definition method 11 | 12 | {string} {int} {float}-- cucumber expression 13 | 14 | Regular Expressions: 15 | 16 | ([0-9]) ->capture group --> 0 to 9 digits appear 17 | 18 | Quantifiers in Reg Exp: + * ? {n} 19 | Define -> How many times a character needs to be occurred 20 | https://www.oreilly.com/library/view/java-9-regular/9781787288706/251e3389-2f47-4c59-8ac6-f58a2f24556f.xhtml 21 | 22 | ([0-9]+) -> 0 to 9 digits appear (once or more) 23 | ([0-9]{4}) --> 0000 , 9999, 1212, 3456, 1234, 8888 24 | ([0-9]*) -> zero or more 25 | ([0-9]?) -> zero or once 26 | 27 | Short hand characters: 28 | 29 | \d -- numeric digits 30 | (\d+) 31 | 32 | ([a-zA-Z0-9]+) 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/test/resources/AppFeatures/registration.feature: -------------------------------------------------------------------------------- 1 | Feature: User Regisrtation 2 | 3 | Scenario: user registration with different data 4 | Given User is on registration page 5 | When User enters following user details 6 | | naveen | automation | nav@gmail.com | 99999 | Bangalore | 7 | | tom | peter | tom@gmail.com | 99999 | London | 8 | | lisa | dsouza | lisa@gmail.com | 8887777 | SFO | 9 | Then user registration should be successful 10 | 11 | 12 | Scenario: user registration with different data with columns 13 | Given User is on registration page 14 | When User enters following user details with columns 15 | | firstname | lastname | email | phone | city | 16 | | naveen | automation | nav@gmail.com | 99999 | Bangalore | 17 | | tom | peter | tom@gmail.com | 99999 | London | 18 | | lisa | dsouza | lisa@gmail.com | 8887777 | SFO | 19 | Then user registration should be successful -------------------------------------------------------------------------------- /src/test/resources/cucumber.properties: -------------------------------------------------------------------------------- 1 | cucumber.publish.enabled = true --------------------------------------------------------------------------------