def test_user_can_add_product_to_basket(self, browser): page = ProductPage(browser, ProductPage.LINK) page.open() page.add_to_basket() page.check_specific_product_was_added_to_basket() page.check_basket_and_product_costs_are_equal()
def test_guest_can_add_product_to_basket(self, browser, promo_offer): product_link = f"{link}/?promo={promo_offer}" page = ProductPage(browser, product_link) page.open() page.add_to_basket() page.solve_quiz_and_get_code() page.should_be_correct_product_in_basket()
def test_guest_can_find_product_by_name(self, browser, product_name): # Arrange page = ProductPage(browser, page_link) page.open() # Act page.search_product_by_name(product_name) page.open_found_product() # Assert page.should_be_correct_product_found(product_name)
def test_message_disappeared_after_adding_product_to_basket(self, browser): page = ProductPage(browser, ProductPage.LINK) page.open() page.add_to_basket() page.check_success_message_disappeared()
def test_guest_cant_see_success_message_after_adding_product_to_basket(self, browser): page = ProductPage(browser, link) page.open() page.add_to_basket() page.should_not_be_success_message()
def test_click_button_add_to_basket(self, browser, link_parametrize): # Arrange product_page = ProductPage(browser, link_parametrize) product_page.open() # Act product_page.click_button_add_to_basket() # Assert product_page.alert_should_added_your_basket()
def test_guest_can_open_product_review_form_with_button(self, browser): # Arrange page = ProductPage(browser, page_link) page.open() # Act page.open_review_form_with_button() # Assert page.should_be_correct_review_form()
def test_account_address_prefills_in_checkout(self): page = AccountPage() page.go_to_address_book() # should_be_add_addres_button page.create_account_address() page = ProductPage(browser, ProductPage.LINK) page.open() page.add_to_basket() page.checkout_product() page.should_be_prefilled_account_address()
def test_guest_can_go_to_login_page_from_product_page(self, browser): page = ProductPage(browser, ProductPage.LINK) page.open() page.go_to_login_page() login_page = LoginPage(browser, browser.current_url) login_page.should_be_login_page()
def test_guest_cant_see_product_in_basket_opened_from_product_page(self, browser): page = ProductPage(browser, link) page.open() page.go_to_basket_page() basket_page = BasketPage(browser, browser.current_url) basket_page.should_be_empty_basket()
def setup(self, browser): # Data test_user_email = "*****@*****.**" test_user_password = "******" # Arrange login_page = LoginPage(browser) login_page.open() login_page.user_login(test_user_email, test_user_password) basket_page = BasketPage(browser) basket_page.open() basket_page.user_clear_basket() product_page = ProductPage(browser, self.test_product_link) product_page.open() product_page.click_button_add_to_basket() product_page.click_button_view_basket()
def test_guest_cant_see_product_in_basket_opened_from_product_page( self, browser): page = ProductPage(browser, ProductPage.LINK) page.open() page.go_to_basket_page() basket_page = BasketPage(browser, browser.current_url) basket_page.should_be_no_products_in_basket() basket_page.should_be_text_basket_is_empty()
def test_guest_should_see_login_link_on_product_page(self, browser): page = ProductPage(browser, ProductPage.LINK) page.open() page.should_be_login_link()
def test_guest_can_add_product_to_basket(self, browser, promo_offer): full_promo_link = ProductPage.LINK + '?promo=' + promo_offer page = ProductPage(browser, full_promo_link) page.open() page.add_to_basket() page.solve_quiz_and_get_code() page.check_specific_product_was_added_to_basket() page.check_basket_and_product_costs_are_equal()
def setup(self, browser): # Arrange product_page = ProductPage(browser, self.test_product_link) product_page.open() product_page.click_button_add_to_basket() product_page.click_button_view_basket()
def test_user_cant_see_success_message(self, browser): page = ProductPage(browser, ProductPage.LINK) page.open() page.should_not_be_success_message()
def test_guest_cant_see_success_message(self, browser): page = ProductPage(browser, link) page.open() page.should_not_be_success_message()
def test_user_can_add_product_to_basket(self, browser): page = ProductPage(browser, link) page.open() page.open_math_alert() page.solve_quiz_and_get_code() page.should_be_equal_product_name_in_basket() page.should_be_equal_amount_in_basket()
def test_unavaliable_product_can_be_added_to_product_alerts(self, browser): page = ProductPage(browser, "unavailable_product_link") # url page.click_notify_me() # inside should_be_no_added_to_basket_button() ... + alert success page.go_to_ap() page = AccountPage() page.go_to_product_alerts() # page = ProductAlertsPage() page.check_specific_product_was_added_to_product_alerts()