Advertisement
Guest User

Untitled

a guest
Jan 21st, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.91 KB | None | 0 0
  1. package core.tests;
  2.  
  3. import core.configuration.IntegrationBase;
  4. import core.pagemodels.*;
  5. import core.utility.Retry;
  6. import org.testng.annotations.BeforeMethod;
  7. import org.testng.annotations.Test;
  8. import ru.yandex.qatools.allure.annotations.*;
  9. import ru.yandex.qatools.allure.model.SeverityLevel;
  10.  
  11. public class CheckoutFlowTests extends IntegrationBase {
  12.  
  13. //--static variables
  14. private static String EMAIL = "ind.test.acc@gmail.com";
  15. private static String POSTAL_CODE = "957 97";
  16. private static String ID_NUMBER = "950529-9058";
  17. private static String NAME = "Henning";
  18. private static String SURNAME = "Lindqvist";
  19. private static String STREET = "Bgottna Knutsård";
  20. private static String CITY = "Dingle";
  21. private static String PHONE = "0927-68 45 23";
  22. private static String CREDIT_CARD_NUMBER = "4111111111111111";
  23. private static String EXPIRY_DATE = "122026";
  24. private static String CSV_CODE = "123";
  25. private static String PRODUCT_ID = "1000003638438";
  26. private static int CLICK_ONE = 1;
  27. private static String ZIP_CODE = "12061";
  28.  
  29.  
  30. private HomePage homePage;
  31. private ProductDetailPage productDetailPage;
  32. private CheckoutPage checkoutPage;
  33. private ConfirmationPage confirmationPage;
  34. private SearchResultsPage searchResultsPage;
  35. private MiniCartPopUp miniCartPopUp;
  36.  
  37. public CheckoutFlowTests(String browser) {
  38. super(browser);
  39. }
  40.  
  41. @BeforeMethod
  42. public void setupHomePage() {
  43. homePage = new HomePage(driver);
  44. productDetailPage = new ProductDetailPage(driver);
  45. checkoutPage = new CheckoutPage(driver);
  46. confirmationPage = new ConfirmationPage(driver);
  47. searchResultsPage = new SearchResultsPage(driver);
  48. miniCartPopUp = new MiniCartPopUp(driver);
  49. openBasicHomePage();
  50. }
  51.  
  52.  
  53. @Title("Checkout flow using credit card")
  54. @Features("Checkout flow")
  55. @Description("Order placement with the payment option 'Credit card'")
  56. @Severity(SeverityLevel.CRITICAL)
  57. @Stories("HU-262")
  58. @Test(retryAnalyzer = Retry.class)
  59. public void checkoutFlowWithCreditCard() {
  60. accessCheckoutPage(PRODUCT_ID);
  61. checkoutPage.selectCreditCardOption();
  62. enterCreditCardDetails();
  63. checkoutPage.clickPayButton();
  64. confirmationPage.waitForPageToLoad();
  65. confirmationPage.checkIfCheckoutInformationIsDisplayed(true);
  66. }
  67.  
  68. @Title("Checkout flow using invoice")
  69. @Features("Checkout flow")
  70. @Description("Order placement with the payment option'Invoice'")
  71. @Severity(SeverityLevel.CRITICAL)
  72. @Stories("HU-262")
  73. @Test(retryAnalyzer = Retry.class)
  74. public void checkoutFlowWithInvoice() {
  75. accessCheckoutPage(PRODUCT_ID);
  76. checkoutPage.clickPayLaterOption();
  77. checkoutPage.selectInvoiceOption();
  78. checkoutPage.clickPayButton();
  79. confirmationPage.waitForPageToLoad();
  80. confirmationPage.checkIfCheckoutInformationIsDisplayed(true);
  81. }
  82.  
  83. @Title("Checkout flow using account")
  84. @Features("Checkout flow")
  85. @Description("Order placement with the payment option'Account'")
  86. @Severity(SeverityLevel.CRITICAL)
  87. @Stories("HU-262")
  88. @Test(retryAnalyzer = Retry.class)
  89. public void checkoutFlowWithAccount() {
  90. accessCheckoutPage(PRODUCT_ID);
  91. checkoutPage.clickPayLaterOption();
  92. checkoutPage.selectAccountOption();
  93. checkoutPage.clickPayButton();
  94. confirmationPage.waitForPageToLoad();
  95. confirmationPage.checkIfCheckoutInformationIsDisplayed(true);
  96. }
  97.  
  98.  
  99. @Title("Checkout flow using direct bank")
  100. @Features("Checkout flow")
  101. @Description("Order placement with the payment option 'Direct Bank Payment'")
  102. @Severity(SeverityLevel.CRITICAL)
  103. @Stories("HU-262")
  104. @Test(retryAnalyzer = Retry.class, enabled = false)
  105. public void checkoutFlowWithDirectBank() {
  106. accessCheckoutPage(PRODUCT_ID);
  107. checkoutPage.selectDirectBankOption();
  108. checkoutPage.clickPayButton();
  109. checkoutPage.checkIfListOfBanksAvailable();
  110. }
  111.  
  112. @Title("Checkout flow using invoice split ")
  113. @Features("Checkout flow")
  114. @Description("Order placement with the payment option 'Invoice split'")
  115. @Severity(SeverityLevel.CRITICAL)
  116. @Stories("HU-262")
  117. @Test(retryAnalyzer = Retry.class)
  118. public void checkoutFlowWithInvoiceSplit() {
  119. accessCheckoutPage(PRODUCT_ID);
  120. checkoutPage.selectInvoiceSplitOption();
  121. checkoutPage.clickPayButton();
  122. confirmationPage.waitForPageToLoad();
  123. confirmationPage.checkIfCheckoutInformationIsDisplayed(true);
  124. }
  125.  
  126.  
  127. private void enterCreditCardDetails() {
  128. checkoutPage.fillCardNumberField(CREDIT_CARD_NUMBER);
  129. checkoutPage.fillExpiryDateField(EXPIRY_DATE);
  130. checkoutPage.fillCvcField(CSV_CODE);
  131. }
  132.  
  133. private void accessCheckoutPage(String productID) {
  134. homePage.waitForPageToLoad();
  135. homePage.searchProduct(productID);
  136. searchResultsPage.selectProductFromSearchResults();
  137. productDetailPage.waitForPageToLoad();
  138. //productDetailPage.selectAvailableSize();
  139. productDetailPage.clickAddToCart(CLICK_ONE);
  140. miniCartPopUp.clickCheckoutButton();
  141. checkoutPage.enterZipCode(ZIP_CODE);
  142. checkoutPage.clickChooseDeliveryOptionButton();
  143. checkoutPage.selectPickupPoint();
  144. checkoutPage.clickChoosePaymentOptionButton();
  145. checkoutPage.fillEmailField(EMAIL);
  146. checkoutPage.fillPostalCodeField(POSTAL_CODE);
  147. checkoutPage.fillIdNumberField(ID_NUMBER);
  148. checkoutPage.fillNameField(NAME);
  149. checkoutPage.fillSurnameField(SURNAME);
  150. checkoutPage.fillStreetField(STREET);
  151. checkoutPage.fillCityField(CITY);
  152. checkoutPage.fillPhoneField(PHONE);
  153. checkoutPage.clickConfirmButton();
  154. checkoutPage.confirmIdentity();
  155. }
  156. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement