|
| 1 | +package stepDef; |
| 2 | + |
| 3 | +import io.cucumber.java.en.Then; |
| 4 | +import main.Checkout; |
| 5 | + |
| 6 | +public class CheckoutStepDef { |
| 7 | + private Hook hook; |
| 8 | + private Checkout checkout; |
| 9 | + |
| 10 | + public CheckoutStepDef(Hook hook) { |
| 11 | + this.hook = hook; |
| 12 | + this.checkout = new Checkout(this.hook.getSetUpDriver()); |
| 13 | + } |
| 14 | + |
| 15 | + @Then("The user clicks the checkout button") |
| 16 | + public void clickCheckOutButton() { |
| 17 | + this.checkout.clickCheckOutButton(); |
| 18 | + } |
| 19 | + |
| 20 | + @Then("The user should be on the checkout page") |
| 21 | + public void userShouldBeOnCheckoutPage() { |
| 22 | + this.checkout.userShouldBeOnCheckoutPage(); |
| 23 | + } |
| 24 | + |
| 25 | + @Then("The user enters (.*) as the first name$") |
| 26 | + public void userEntersExampleAsFirstName(String firstName) { |
| 27 | + this.checkout.userEntersExampleAsFirstName(firstName); |
| 28 | + } |
| 29 | + |
| 30 | + @Then("The user enters (.*) as the last name$") |
| 31 | + public void userEntersExampleLastNameAsLastName(String lastName) { |
| 32 | + this.checkout.userEntersExampleLastNameAsLastName(lastName); |
| 33 | + } |
| 34 | + |
| 35 | + @Then("The user enters (.*) as the postal code$") |
| 36 | + public void userEntersPostalCode(int postalCode) { |
| 37 | + this.checkout.userEntersPostalCode(postalCode); |
| 38 | + } |
| 39 | + |
| 40 | + @Then("The user clicks the continue button") |
| 41 | + public void userClicksContinueButton() { |
| 42 | + this.checkout.userClicksContinueButton(); |
| 43 | + } |
| 44 | + |
| 45 | + @Then("The user should be redirected to the checkout page step {string}") |
| 46 | + public void userShouldBeRedirectedToCheckoutPageStep(String stepNumber) { |
| 47 | + this.checkout.userShouldBeRedirectedToCheckoutPageStep(stepNumber); |
| 48 | + } |
| 49 | + |
| 50 | + @Then("The user clicks the finish button") |
| 51 | + public void userClicksFinishButton() { |
| 52 | + this.checkout.userClicksFinishButton(); |
| 53 | + } |
| 54 | + |
| 55 | + @Then("The user should be redirected to the checkout complete page") |
| 56 | + public void userShouldBeRedirectedToCheckoutCompletePage() { |
| 57 | + this.checkout.userShouldBeRedirectedToCheckoutCompletePage(); |
| 58 | + } |
| 59 | + |
| 60 | + @Then("The user clicks the back home button") |
| 61 | + public void userClicksBackHomeButton() { |
| 62 | + this.checkout.userClicksBackHomeButton(); |
| 63 | + } |
| 64 | + |
| 65 | + @Then("The number of items in the cart icon should be empty") |
| 66 | + public void numberOfItemsInCartIconShouldBeEmpty() { |
| 67 | + this.checkout.numberOfItemsInCartIconShouldBeEmpty(); |
| 68 | + } |
| 69 | +} |
0 commit comments