Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package core.tests;
- import core.configuration.IntegrationBase;
- import core.pagemodels.*;
- import core.utility.Retry;
- import org.testng.annotations.BeforeMethod;
- import org.testng.annotations.Test;
- import ru.yandex.qatools.allure.annotations.*;
- import ru.yandex.qatools.allure.model.SeverityLevel;
- public class CheckoutFlowTests extends IntegrationBase {
- //--static variables
- private static String EMAIL = "ind.test.acc@gmail.com";
- private static String POSTAL_CODE = "957 97";
- private static String ID_NUMBER = "950529-9058";
- private static String NAME = "Henning";
- private static String SURNAME = "Lindqvist";
- private static String STREET = "Bgottna Knutsård";
- private static String CITY = "Dingle";
- private static String PHONE = "0927-68 45 23";
- private static String CREDIT_CARD_NUMBER = "4111111111111111";
- private static String EXPIRY_DATE = "122026";
- private static String CSV_CODE = "123";
- private static String PRODUCT_ID = "1000003638438";
- private static int CLICK_ONE = 1;
- private static String ZIP_CODE = "12061";
- private HomePage homePage;
- private ProductDetailPage productDetailPage;
- private CheckoutPage checkoutPage;
- private ConfirmationPage confirmationPage;
- private SearchResultsPage searchResultsPage;
- private MiniCartPopUp miniCartPopUp;
- public CheckoutFlowTests(String browser) {
- super(browser);
- }
- @BeforeMethod
- public void setupHomePage() {
- homePage = new HomePage(driver);
- productDetailPage = new ProductDetailPage(driver);
- checkoutPage = new CheckoutPage(driver);
- confirmationPage = new ConfirmationPage(driver);
- searchResultsPage = new SearchResultsPage(driver);
- miniCartPopUp = new MiniCartPopUp(driver);
- openBasicHomePage();
- }
- @Title("Checkout flow using credit card")
- @Features("Checkout flow")
- @Description("Order placement with the payment option 'Credit card'")
- @Severity(SeverityLevel.CRITICAL)
- @Stories("HU-262")
- @Test(retryAnalyzer = Retry.class)
- public void checkoutFlowWithCreditCard() {
- accessCheckoutPage(PRODUCT_ID);
- checkoutPage.selectCreditCardOption();
- enterCreditCardDetails();
- checkoutPage.clickPayButton();
- confirmationPage.waitForPageToLoad();
- confirmationPage.checkIfCheckoutInformationIsDisplayed(true);
- }
- @Title("Checkout flow using invoice")
- @Features("Checkout flow")
- @Description("Order placement with the payment option'Invoice'")
- @Severity(SeverityLevel.CRITICAL)
- @Stories("HU-262")
- @Test(retryAnalyzer = Retry.class)
- public void checkoutFlowWithInvoice() {
- accessCheckoutPage(PRODUCT_ID);
- checkoutPage.clickPayLaterOption();
- checkoutPage.selectInvoiceOption();
- checkoutPage.clickPayButton();
- confirmationPage.waitForPageToLoad();
- confirmationPage.checkIfCheckoutInformationIsDisplayed(true);
- }
- @Title("Checkout flow using account")
- @Features("Checkout flow")
- @Description("Order placement with the payment option'Account'")
- @Severity(SeverityLevel.CRITICAL)
- @Stories("HU-262")
- @Test(retryAnalyzer = Retry.class)
- public void checkoutFlowWithAccount() {
- accessCheckoutPage(PRODUCT_ID);
- checkoutPage.clickPayLaterOption();
- checkoutPage.selectAccountOption();
- checkoutPage.clickPayButton();
- confirmationPage.waitForPageToLoad();
- confirmationPage.checkIfCheckoutInformationIsDisplayed(true);
- }
- @Title("Checkout flow using direct bank")
- @Features("Checkout flow")
- @Description("Order placement with the payment option 'Direct Bank Payment'")
- @Severity(SeverityLevel.CRITICAL)
- @Stories("HU-262")
- @Test(retryAnalyzer = Retry.class, enabled = false)
- public void checkoutFlowWithDirectBank() {
- accessCheckoutPage(PRODUCT_ID);
- checkoutPage.selectDirectBankOption();
- checkoutPage.clickPayButton();
- checkoutPage.checkIfListOfBanksAvailable();
- }
- @Title("Checkout flow using invoice split ")
- @Features("Checkout flow")
- @Description("Order placement with the payment option 'Invoice split'")
- @Severity(SeverityLevel.CRITICAL)
- @Stories("HU-262")
- @Test(retryAnalyzer = Retry.class)
- public void checkoutFlowWithInvoiceSplit() {
- accessCheckoutPage(PRODUCT_ID);
- checkoutPage.selectInvoiceSplitOption();
- checkoutPage.clickPayButton();
- confirmationPage.waitForPageToLoad();
- confirmationPage.checkIfCheckoutInformationIsDisplayed(true);
- }
- private void enterCreditCardDetails() {
- checkoutPage.fillCardNumberField(CREDIT_CARD_NUMBER);
- checkoutPage.fillExpiryDateField(EXPIRY_DATE);
- checkoutPage.fillCvcField(CSV_CODE);
- }
- private void accessCheckoutPage(String productID) {
- homePage.waitForPageToLoad();
- homePage.searchProduct(productID);
- searchResultsPage.selectProductFromSearchResults();
- productDetailPage.waitForPageToLoad();
- //productDetailPage.selectAvailableSize();
- productDetailPage.clickAddToCart(CLICK_ONE);
- miniCartPopUp.clickCheckoutButton();
- checkoutPage.enterZipCode(ZIP_CODE);
- checkoutPage.clickChooseDeliveryOptionButton();
- checkoutPage.selectPickupPoint();
- checkoutPage.clickChoosePaymentOptionButton();
- checkoutPage.fillEmailField(EMAIL);
- checkoutPage.fillPostalCodeField(POSTAL_CODE);
- checkoutPage.fillIdNumberField(ID_NUMBER);
- checkoutPage.fillNameField(NAME);
- checkoutPage.fillSurnameField(SURNAME);
- checkoutPage.fillStreetField(STREET);
- checkoutPage.fillCityField(CITY);
- checkoutPage.fillPhoneField(PHONE);
- checkoutPage.clickConfirmButton();
- checkoutPage.confirmIdentity();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement