def proceed_to_checkout(self, emailSignIn, passwordSignIn): self.click_proceed_to_check_out_summary_process() loginPage = LoginPage(self.driver) loginPage.sign_in(emailSignIn, passwordSignIn) self.click_proceed_to_check_out_address_process() self.click_term_agreement() self.click_proceed_to_check_out_shippingProcess_xpath() self.click_pay_by_bank_wire() self.click_confirm_my_order() return self.get_complete_message()
def test_write_a_comment(self): # Feature: Chi tiết sản phẩm; Title: Write a comment emailSignIn = '*****@*****.**' passwordSignIn = '123456' homePage = HomePage(self.driver) homePage.clickSignIn() loginPage = LoginPage(self.driver) loginPage.sign_in(emailSignIn, passwordSignIn) self.driver.implicitly_wait(10) self.driver.get(self.baseURL) homePage.click_product_image(1) productDetailPage = ProductDetailPage(self.driver) productDetailPage.leave_review('Comment', 'Good') send_review_message = productDetailPage.get_send_review_message() self.assertEqual( 'Your comment has been added and will be available once approved by a moderator', send_review_message, "Send review unsuccessfully")
def test_change_and_order_successfully(self): # Feature: Mua hàng; Title: Thay đổi thông tin mua hàng # Check total price homePage = HomePage(self.driver) for i in range(1, 5): homePage.add_product_and_continue(i) homePage.add_product_and_checkout(5) checkOutPage = CheckOutPage(self.driver) checkOutPage.set_product_quantity(2, 3) checkOutPage.click_delete_product(3) time.sleep(10) price = 0 for i in range(1, 5): price += checkOutPage.get_product_price(i) totalPrice = checkOutPage.get_products_price() self.assertEqual(price, totalPrice, "Total price was not suitable") # Proceed to checkout (without agree term of service) checkOutPage.click_proceed_to_check_out_summary_process() loginPage = LoginPage(self.driver) loginPage.sign_in(self.emailSignIn, self.passwordSignIn) checkOutPage.click_proceed_to_check_out_address_process() checkOutPage.click_proceed_to_check_out_shippingProcess_xpath( ) # Click proceed to checkout without agree terms of service before termsAgreementWarning = checkOutPage.get_terms_agreement_warning() self.assertEqual( 'You must agree to the terms of service before continuing.', termsAgreementWarning, 'Terms Agreement warning is not match!') checkOutPage.close_terms_agreement_warning( ) # Close terms agreement warnings checkOutPage.click_term_agreement() # Click term agreement checkOutPage.click_proceed_to_check_out_shippingProcess_xpath( ) # Click proceed to checkout with agree terms of service before checkOutPage.click_pay_by_bank_wire() checkOutPage.click_confirm_my_order() completeMessage = checkOutPage.get_complete_message( ) # Get complete message self.assertEqual('Your order on My Store is complete.', completeMessage, "Proceed to checkout unsuccesfully")