Example #1
0
def test_guest_cant_see_success_message_after_adding_product_to_cart(browser): 
    """
    Открываем страницу товара 
    Добавляем товар в корзину 
    Проверяем, что нет сообщения об успехе с помощью is_not_element_present
    """
    link = "http://selenium1py.pythonanywhere.com/ru/catalogue/the-shellcoders-handbook_209/?promo=newYear"
    page = ProductPage(browser, link, 0)
    page.open()
    page.click_add_to_basket()
    page.get_code()
    page.should_not_be_success_message()  #is_not_element_present()
Example #2
0
def test_message_disappeared_after_adding_product_to_cart(browser): 
    """
    Открываем страницу товара
    Добавляем товар в корзину
    по совету time.sleep(1)
    Проверяем, что нет сообщения об успехе с помощью is_disappeared
    """
    link = "http://selenium1py.pythonanywhere.com/ru/catalogue/the-shellcoders-handbook_209/?promo=newYear"
    page = ProductPage(browser, link, 0)
    page.open()
    page.click_add_to_basket()
    page.get_code()
    time.sleep(2)
    page.should_be_disappeared() 
Example #3
0
    def test_leasing_request(self):
        main_page = ProductPage(self.driver)
        leasing_page = LeasingPage(self.driver)

        main_page.select_leasing()
        leasing_page.set_kaufprice(100)
        leasing_page.set_objekttyp()
        leasing_page.set_unterkategorie()
        leasing_page.check_laufzeit()
        leasing_page.set_laufzeit()
        leasing_page.click_continue()
        leasing_page.input_company_name("FinCompare")
        leasing_page.select_company("FinCompare GmbH")
        # show page before quit()
        time.sleep(10)
Example #4
0
class Aplication:
    def __init__(self):
        self.driver = webdriver.Chrome()
        self.start_pg = StartPage(self.driver)
        self.product_pg = ProductPage(self.driver)
        self.cart_pg = CartPage(self.driver)

    def quit(self):
        self.driver.quit()

    def st_open(self):
        self.start_pg.op_start()

    def add_duck(self, dk_s):
        self.start_pg.find_duck(dk_s)
        self.product_pg.add_duck_pg(dk_s)
        self.product_pg.go_start()

    def d_all_duck(self):
        self.start_pg.go_cart()
        self.cart_pg.dl_dick()
Example #5
0
def test_guest_cant_see_product_in_cart_opened_from_product_page(browser):
    """
    pytest -s (-m step10 | -k product_in_cart) --tb=line test_product_page.py

    Гость открывает страницу товара
    Переходит в корзину по кнопке в шапке 
    Ожидаем, что в корзине нет товаров
    Ожидаем, что есть текст о том что корзина пуста 
    """
    link = "http://selenium1py.pythonanywhere.com/en-gb/catalogue/the-city-and-the-stars_95/"
    page = ProductPage(browser, link)
    page.open()
    page.click_go_to_basket()
    cart_page = CartPage(browser, browser.current_url)
    cart_page.should_not_be_goods_in_cart()
    cart_page.should_be_text_basket_is_empty()
Example #6
0
 def __init__(self):
     self.driver = webdriver.Chrome()
     self.start_pg = StartPage(self.driver)
     self.product_pg = ProductPage(self.driver)
     self.cart_pg = CartPage(self.driver)
Example #7
0
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()
Example #8
0
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()
Example #9
0
def test_guest_can_add_product_to_cart(browser, link):
    #link = "http://selenium1py.pythonanywhere.com/ru/catalogue/the-shellcoders-handbook_209/?promo=newYear"
    #link = "http://selenium1py.pythonanywhere.com/catalogue/coders-at-work_207/?promo=newYear2019"
    page = ProductPage(browser, link, 5)
    page.open()
    page.click_add_to_basket()
    page.get_code()
    #time.sleep(50)
    page.should_be_goods_add_basket()
    page.should_be_message_cost_equal_price()
    page.should_be_name_equal()
Example #10
0
    def test_navigation(self):
        driver = self.driver  # shortcut

        homepage_navigation = HomePage(driver)

        homepage_navigation.click_tab()
        homepage_navigation.wait()
        homepage_navigation.click_product()

        productpage_navigation = ProductPage(driver)

        productpage_navigation.wait()
        productpage_navigation.enter_quantity()
        productpage_navigation.pick_color()
        productpage_navigation.select_size()
        productpage_navigation.click_submit()
        productpage_navigation.wait_2()
        productpage_navigation.click_checkout()

        checkout_page = CheckOut(driver)

        checkout_page.wait()
        checkout_page.click_checkout()
        checkout_page.wait_2()
        checkout_page.enter_email()
        checkout_page.enter_passwd()
        checkout_page.click_submit()

        self.driver.get_screenshot_as_file(
            "/Users/Abraham/Pictures/googleshot.png")
        print(self.driver.title)
Example #11
0
def test_add_and_remove_products(driver):
    main_page = MainPage(driver)
    product_page = ProductPage(driver)
    cart_page = CartPage(driver)
    put_products_into_cart(main_page, product_page)
    remove_products_from_cart(main_page, cart_page)
Example #12
0
 def load_page(self, url):
     self.browser.get(url)
     return ProductPage(self.browser)
Example #13
0
def test_guest_can_go_to_home_page_from_product_page(browser):
    link = 'http://selenium1py.pythonanywhere.com/ru/catalogue/coders-at-work_207/'
    page = ProductPage(browser, link)
    page.open()
    page.go_to_home_page_from_heading()
Example #14
0
def test_guest_can_go_to_review_page(browser):
    link = 'http://selenium1py.pythonanywhere.com/ru/catalogue/hacking-exposed-wireless_208/'
    page = ProductPage(browser, link)
    page.open()
    page.write_a_review()
Example #15
0
def test_guest_can_delete_product_from_cart(browser):
    link = 'http://selenium1py.pythonanywhere.com/catalogue/the-shellcoders-handbook_209/'
    page = ProductPage(browser, link)
    page.open()
    page.add_to_card()
    page.delete_from_basket()