def test_guest_can_add_product_to_basket_promo(browser, link):
    page = ProductPage(browser, link)
    page.open()
    page.add_to_cart_item()
    page.solve_quiz_and_get_code()
    page.check_product_name_with_main_message()
    page.check_price_with_price_message()
def test_guest_cant_see_product_in_cart_opened_from_product_page(browser):
    page = ProductPage(browser, link_without_promo)
    page.open()
    page.go_to_cart_page()
    cart_page = CartPage(browser, browser.current_url)
    cart_page.should_not_be_products_in_basket()
    cart_page.should_be_message_empty_basket()
def test_guest_can_add_product_to_basket(browser):
    link = "http://selenium1py.pythonanywhere.com/catalogue/the-shellcoders-handbook_209/"
    page = ProductPage(browser, link)
    page.open()
    page.add_to_cart_item()
    page.check_product_name_with_main_message()
    page.check_price_with_price_message()
 def test_negative_user_cant_see_success_message_after_adding_product_to_basket(
         self, browser):
     link = "http://selenium1py.pythonanywhere.com/en-gb/catalogue/the-girl-who-played-with-non-fire_203/"
     page = ProductPage(browser, link)
     page.open()
     page.add_to_cart_item()
     page.check_main_message_not_present()
def test_guest_can_go_to_login_page_from_product_page(browser):
    page = ProductPage(browser, link_without_promo)
    page.open()
    page.go_to_login_page()
    login_page = LoginPage(browser, browser.current_url)
    login_page.should_be_login_page()
    page.should_be_login_link()
def test_guest_cant_see_product_in_basket_opened_from_product_page(browser):
    link = "http://selenium1py.pythonanywhere.com/en-gb/catalogue/the-city-and-the-stars_95/"
    page = ProductPage(browser, link)
    page.open()
    page.go_to_basket_page_by_button_in_header()
    basket_page = BasketPage(browser, browser.current_url)
    basket_page.check_basket_is_empty()
    basket_page.check_there_is_message_basket_is_empty()
 def test_user_can_add_product_to_cart(self):
     page = ProductPage(self.browser, link)
     page.open()
     product_title = page.get_product_title()
     product_price = page.get_product_price()
     page.add_product_to_basket()
     page.should_be_success_adding_product_message()
     page.should_be_product_title_in_success_adding_product_message(product_title)
     page.should_be_basket_price_message()
     page.should_be_product_price_in_basket_message(product_price)
def test_negative_message_disappeared_after_adding_product_to_basket(browser):
    link = "http://selenium1py.pythonanywhere.com/en-gb/catalogue/the-girl-who-played-with-non-fire_203/"
    page = ProductPage(browser, link)
    page.open()
    page.add_to_cart_item()
    page.check_main_message_disappeared()
def test_guest_can_go_to_login_page_from_product_page(browser):
    link = "http://selenium1py.pythonanywhere.com/en-gb/catalogue/the-city-and-the-stars_95/"
    page = ProductPage(browser, link)
    page.open()
    page.go_to_login_page_by_link()
def test_guest_should_see_login_link_on_product_page(browser):
    link = "http://selenium1py.pythonanywhere.com/en-gb/catalogue/the-city-and-the-stars_95/"
    page = ProductPage(browser, link)
    page.open()
    page.should_be_login_link()
def test_positive_guest_cant_see_success_message(browser):
    link = "http://selenium1py.pythonanywhere.com/en-gb/catalogue/the-girl-who-played-with-non-fire_203/"
    page = ProductPage(browser, link)
    page.open()
    page.check_main_message_not_present()
 def test_user_can_add_product_to_basket(self, browser):
     link = "http://selenium1py.pythonanywhere.com/catalogue/the-shellcoders-handbook_209/?promo=newYear"
     page = ProductPage(browser, link)
     page.open()
     page.add_to_cart_item()
 def test_user_cant_see_success_message(self):
     page = ProductPage(self.browser, link)
     page.open()
     page.should_not_be_success_message()
def test_guest_should_see_login_link_on_product_page(browser):
    page = ProductPage(browser, link_without_promo)
    page.open()
    page.should_be_login_link()
def test_guest_cant_see_success_message(browser):
    page = ProductPage(browser, link)
    page.open()
    page.should_not_be_success_message()