def setup(self, browser):
        link = "http://selenium1py.pythonanywhere.com/catalogue/coders-at-work_207/"
        self.page = PageObject(browser, link)
        self.page.open()

        self.page.go_to_login_page()
        password = str(time.time())
        email = str(time.time()) + "@fakemail.org"
        self.login = LoginPage(browser,link)
        self.login.register_new_user(email,password)
        self.page.should_be_authorized_user()
Esempio n. 2
0
def test_guest_cant_see_product_in_basket_opened_from_product_page(browser):
    # Гость открывает страницу товара
    link = link_207
    page = PageObject(browser, link)
    page.open()
    # Переходит в корзину по кнопке в шапке
    basket_page = page.go_to_basket()
    basket_page = BasketPage(browser, browser.current_url)
    # Ожидаем, что в корзине нет товаров
    basket_page.should_be_basket_is_empty()
    # Ожидаем, что есть текст о том что корзина пуста
    basket_page.basket_text_empty()
Esempio n. 3
0
def test_guest_cant_see_success_message_after_adding_product_to_basket(
        browser):
    link = link_207
    page = PageObject(browser, link)
    # Открываем страницу товара
    page.open()
    # Добавляем товар в корзину
    page.click_to_add()
    # !!! Проверяем, что нет сообщения об успехе с помощью is_not_element_present / сообщение есть = фолс
    page.should_not_be_success_message()
def test_message_disappeared_after_adding_product_to_basket(browser):

    link = "http://selenium1py.pythonanywhere.com/catalogue/coders-at-work_207/"
    page = PageObject(browser,link)
    page.open()
    page.add_to_basket()
    assert page.should_not_be_disappeared()== True
Esempio n. 5
0
def test_guest_cant_see_success_message(browser):
    link = link_207
    # Открываем страницу товара
    page = PageObject(browser, link)
    page.open()
    # Проверяем, что нет сообщения об успехе с помощью is_not_element_present
    page.should_not_be_success_message()
Esempio n. 6
0
def test_message_disappeared_after_adding_product_to_basket(browser):
    link = link_207
    page = PageObject(browser, link)
    page.open()
    # 	# Добавляем товар в корзину
    page.click_to_add()
    # 	# Проверяем, что нет сообщения об успехе с помощь is_disappeared (элемент не исчезнет)
    # тру, если эл-т исчезнет или не было. Эл-т есть и не исчезает = фолс
    page.should_not_be_success_message()

    def test_user_cant_see_success_message(self, browser):
        link = link_207
        page = PageObject(browser, link)
        page.open()
        # Проверяем, что нет сообщения об успехе с помощью is_not_element_present
        page.should_not_be_success_message()
class TestUserAddToBasketFromProductPage(object):
    @pytest.fixture(scope="function",  autouse=True)
    def setup(self, browser):
        link = "http://selenium1py.pythonanywhere.com/catalogue/coders-at-work_207/"
        self.page = PageObject(browser, link)
        self.page.open()

        self.page.go_to_login_page()
        password = str(time.time())
        email = str(time.time()) + "@fakemail.org"
        self.login = LoginPage(browser,link)
        self.login.register_new_user(email,password)
        self.page.should_be_authorized_user()

    #@pytest.mark.skip
    #@pytest.mark.xfail
    #@pytest.mark.skip
    def test_user_cant_see_success_message(self, browser):
        link = "http://selenium1py.pythonanywhere.com/catalogue/coders-at-work_207/"
        page = PageObject(browser, link)
        page.open()
        page.should_not_be_success_message()


    @pytest.mark.need_review
    #@pytest.mark.skip
    def test_user_can_add_product_to_basket(self, browser):
        link = "http://selenium1py.pythonanywhere.com/catalogue/coders-at-work_207/"
        page = PageObject(browser, link)
        page.open()

        expected_name_book = page.expected_name_book()
        expected_prise = page.expected_prise()

        page.add_to_basket()
        # page.solve_quiz_and_get_code()  # расчет


        name_book = page.fined_name_book()
        prise = page.fined_prise()

        page.should_be_name_book_equivalent_expected_name_book(name_book, expected_name_book)
        page.should_be_prise_equivalent_expected_prise(prise, expected_prise)
def test_guest_can_add_product_to_basket(browser,link):
    #link = "http: // selenium1py.pythonanywhere.com / catalogue / coders - at - work_207 /?promo = newYear2019"
    #link = "http://selenium1py.pythonanywhere.com/catalogue/the-shellcoders-handbook_209/?promo=newYear"
    #link = "http://selenium1py.pythonanywhere.com/catalogue/coders-at-work_207/"
    page = PageObject(browser, link)
    page.open()

    expected_name_book = page.expected_name_book()
    expected_prise = page.expected_prise()

    page.add_to_basket()
    page.solve_quiz_and_get_code()  # расчет
    time.sleep(1)

    name_book = page.fined_name_book()
    prise = page.fined_prise()

    page.should_be_name_book_equivalent_expected_name_book(name_book, expected_name_book)
    page.should_be_prise_equivalent_expected_prise(prise, expected_prise)
def test_guest_cant_see_success_message(browser):
    link = "http://selenium1py.pythonanywhere.com/catalogue/coders-at-work_207/"
    page = PageObject(browser, link)
    page.open()
    assert page.should_not_be_success_message() == True
    def test_user_can_add_product_to_basket(self, browser):
        link = "http://selenium1py.pythonanywhere.com/catalogue/coders-at-work_207/"
        page = PageObject(browser, link)
        page.open()

        expected_name_book = page.expected_name_book()
        expected_prise = page.expected_prise()

        page.add_to_basket()
        # page.solve_quiz_and_get_code()  # расчет


        name_book = page.fined_name_book()
        prise = page.fined_prise()

        page.should_be_name_book_equivalent_expected_name_book(name_book, expected_name_book)
        page.should_be_prise_equivalent_expected_prise(prise, expected_prise)
Esempio n. 11
0
 def test_user_can_add_product_to_basket(self, browser):
     link = link_2019
     page = PageObject(browser, link)
     page.open()
     page.shoud_be_btn()
     name = browser.find_element(*ProductPageLocators.NAME_BOOK)
     price = browser.find_element(*ProductPageLocators.PRICE_BOOK)
     name = name.text
     price = price.text
     page.click_to_add()
     page.solve_quiz_and_get_code()
     page.add_is_ok(name, price)
Esempio n. 12
0
def test_guest_can_go_to_login_page_from_product_page(browser):
    link = link_95
    page = PageObject(browser, link)
    page.open()
    page.go_to_login_page()
Esempio n. 13
0
def test_guest_should_see_login_link_on_product_page(browser):
    link = link_95
    page = PageObject(browser, link)
    page.open()
    page.should_be_login_link()
Esempio n. 14
0
def test_guest_can_add_product_to_basket(browser, promo_offer):
    link = link_2019
    link = f"http://selenium1py.pythonanywhere.com/catalogue/coders-at-work_207/?promo=offer{promo_offer}"
    page = PageObject(browser, link)
    page.open()
    page.shoud_be_btn()
    name = browser.find_element(*ProductPageLocators.NAME_BOOK)
    price = browser.find_element(*ProductPageLocators.PRICE_BOOK)
    name = name.text
    price = price.text
    page.click_to_add()
    page.solve_quiz_and_get_code()
    time.sleep(10)
    page.add_is_ok(name, price)
Esempio n. 15
0
 def test_user_cant_see_success_message(self, browser):
     link = link_207
     page = PageObject(browser, link)
     page.open()
     # Проверяем, что нет сообщения об успехе с помощью is_not_element_present
     page.should_not_be_success_message()