def test_message_disappeared_after_adding_product_to_basket(browser): link = "http://selenium1py.pythonanywhere.com/catalogue/coders-at-work_207/?promo=offer0" page = ProductPage(browser, link) page.open() page.add_to_basket_button() page.solve_quiz_and_get_code() page.should_disappear_success_message()
def test_guest_can_add_product_to_basket(browser, link): page = ProductPage(browser, link) page.open() page.add_to_basket_button() page.solve_quiz_and_get_code() page.should_be_message_about_adding() page.should_be_message_basket_total()
class TestUserAddToBasketFromProductPage: @pytest.fixture(autouse=True) def setup(self, browser): browser.implicitly_wait(5) self.lgpage = LoginPage( browser, "http://selenium1py.pythonanywhere.com/accounts/login/") self.lgpage.open() fake = faker.Faker() self.lgpage.register_new_user(fake.email(), fake.password(9, special_chars=False)) self.lgpage.should_be_authorized_user() def test_user_cant_see_success_message(self, browser): self.page = ProductPage(browser, url) self.page.open() self.page.should_not_be_success_message() @pytest.mark.need_review def test_user_can_add_product_to_basket(self, browser): self.page = ProductPage(browser, link) self.page.open() self.page.add_to_basket_button() self.page.should_be_message_about_adding() self.page.should_be_message_basket_total()
def test_guest_can_add_product_to_basket(browser): link = "http://selenium1py.pythonanywhere.com/catalogue/visual-guide-to-lock-picking_206/" page = ProductPage(browser, link) page.open() page.add_to_basket_button() page.should_be_add_to_basket_message()
def test_message_disappeared_after_adding_product_to_basket(browser): page = ProductPage(browser, url) page.open() page.add_to_basket_button() page.should_be_disappear()
def test_guest_cant_see_success_message_after_adding_product_to_basket( browser): page = ProductPage(browser, url) page.open() page.add_to_basket_button() page.should_not_be_success_message()