コード例 #1
0
def test_success_message_is_disappeared_after_adding_product_to_basket(
        browser):
    page = ProductPage(browser, product_link_base)
    page.open()
    page.add_item_to_cart()
    page = BasketPage(browser)
    page.message_is_disappeared()
コード例 #2
0
def test_guest_cant_see_success_message_after_adding_product_to_basket(
        browser):
    link = 'http://selenium1py.pythonanywhere.com/ru/catalogue/hacking-exposed-wireless_208/'
    product_page = ProductPage(browser, link)
    product_page.open()
    product_page.add_item_to_cart()
    product_page.success_message_is_not_present_after_adding_product_to_basket(
    )
コード例 #3
0
def test_message_disappeared_after_adding_product_to_basket(browser): 
    #Открываем страницу товара
    page = ProductPage(browser, link)
    page.open()
    #Добавляем товар в корзину
    page.add_item_to_cart()
    #Проверяем, что нет сообщения об успехе с помощью is_disappeared
    page.should_disappear()
コード例 #4
0
def test_guest_cant_see_success_message_after_adding_product_to_basket(browser): 
    #Открываем страницу товара
    page = ProductPage(browser, link)
    page.open()
    #Добавляем товар в корзину
    page.add_item_to_cart()
    #Проверяем, что нет сообщения об успехе с помощью is_not_element_present
    page.should_not_be_success_message()
コード例 #5
0
def test_guest_can_add_product_to_cart(browser, product_link):
    product_page = ProductPage(browser, product_link)
    product_page.open()
    product_page.should_have_add_to_cart_button()
    product_page.add_item_to_cart()
    product_page.solve_quiz_and_get_code()
    product_page.should_have_correct_item_title_in_message()
    product_page.should_have_correct_total_price_in_message()
コード例 #6
0
def test_guest_can_see_added_product_in_basket_after_adding_one_item_and_clicking_on_view_basket(
        browser):
    page = ProductPage(browser, product_link_base)
    page.open()
    page.add_item_to_cart()
    page.open_basket()
    page = BasketPage(browser)
    page.added_item_is_shown_on_basket_page()
コード例 #7
0
 def test_user_can_add_product_to_basket(self, browser):
     page = ProductPage(browser, product_link_base)
     page.open()
     input_name = page.input_item_name()
     input_price = page.input_item_price()
     page.add_item_to_cart()
     page.item_should_be_in_cart_with_correct_name(input_name)
     page.item_price_should_be_correct(input_price)
コード例 #8
0
def test_guest_can_add_product_to_basket(browser, promo_offer):
    link = f"http://selenium1py.pythonanywhere.com/catalogue/coders-at-work_207/?promo=offer{promo_offer}"
    product_page = ProductPage(browser, link)
    product_page.open()
    product_page.add_item_to_cart()
    product_page.solve_quiz_and_get_code()
    time.sleep(10)
    product_page.product_price_is_displayed_correctly()
    product_page.product_is_added_with_correct_message()
コード例 #9
0
def test_guest_can_add_product_to_basket(browser, link):
    page = ProductPage(browser, link)
    page.open()
    input_name = page.input_item_name()
    input_price = page.input_item_price()
    page.add_item_to_cart()
    page.solve_quiz_and_get_code()
    page.item_should_be_in_cart_with_correct_name(input_name)
    page.item_price_should_be_correct(input_price)
コード例 #10
0
 def test_user_can_add_product_to_cart(self, browser):
     link = "http://selenium1py.pythonanywhere.com/catalogue/coders-at-work_207/?promo=newYear2019"
     product_page = ProductPage(browser, link)
     product_page.open()
     product_page.should_have_add_to_cart_button()
     product_page.add_item_to_cart()
     product_page.solve_quiz_and_get_code()
     product_page.should_have_correct_item_title_in_message()
     product_page.should_have_correct_total_price_in_message()
コード例 #11
0
    def test_user_can_add_product_to_cart(self, browser):
        link = 'http://selenium1py.pythonanywhere.com/catalogue/coders-at-work_207/?promo=newYear2019'

        page = ProductPage(browser, link)
        page.open()
        item_name = page.get_item_name()
        item_price = page.get_item_price()
        page.add_item_to_cart()
        page.solve_quiz_and_get_code()
        page.should_be_item_name(item_name)
        page.should_be_basket_total(item_price)
コード例 #12
0
def test_customer_can_add_item_to_cart(browser):
    link = "http://automationpractice.com/index.php"
    page = ProductPage(browser, link)
    page.open()
    page.go_to_item_page()
    page.report_allure()  # allure report
    page.selecting_item_size()  # If need select item size
    page.add_item_to_cart()
    page.registration_new_customer()
    page.shipping_confirm()
    page.is_order_complete()
    page.report_allure()
コード例 #13
0
 def test_user_can_add_product_to_cart(self, browser):
     link = ProductPageLocators.PRODUCT_PAGE_LINK
     # инициализируем Page Object, передаем в конструктор экземпляр драйвера и url адрес
     # берем функции со страницы product_page	
     page = ProductPage(browser, link)
     # открываем страницу
     page.open()
     page.should_be_authorized_user()
     bookToCompare = page.find_book_name()
     priceToCompare = page.find_book_price()
     # добавляем товар в корзину
     page.add_item_to_cart()
     #проверка цены и наименования товара в корзине
     page.right_book_and_right_price_message(bookToCompare, priceToCompare)
コード例 #14
0
def test_guest_can_add_product_to_cart(browser):
    link = ProductPageLocators.PRODUCT_PAGE_PROMO

    page = ProductPage(browser, link)

    page.open()

    bookToCompare = page.find_book_name()
    priceToCompare = page.find_book_price()

    page.add_item_to_cart()

    page.solve_quiz_and_get_code()
    page.right_book_and_right_price_message(bookToCompare, priceToCompare)
コード例 #15
0
class Application:

    def __init__(self):
        self.driver = webdriver.Chrome()
        self.wait = WebDriverWait(self.driver, 5)
        self.main_page = MainPage(self.driver)
        self.cart_page = CartPage(self.driver)
        self.product_page = ProductPage(self.driver)

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

    def add_few_items_to_cart(self, count):

        i = 1

        while i < count + 1:
            self.main_page.open()
            self.main_page.get_first_product().click()

            self.product_page.add_item_to_cart()
            self.product_page.wait_cart_count_increase(i)

            i += 1

    def delete_items_from_cart(self):
        self.product_page.get_cart_link().click()
        while True:
            # remember current table locator
            summary_block_element = self.cart_page.get_summary_block_element()

            # stop the carousel if we have one
            if self.cart_page.check_item_presence():
                self.cart_page.click_on_carousel()

            # remember current DOM locator
            current_cart_locator = self.cart_page.get_current_cart()

            # remove the item
            self.cart_page.remove_item_from_cart()

            # waiting for DOM to change
            self.cart_page.wait_dom_to_change(current_cart_locator)

            # check table
            self.cart_page.wait_table_to_update(summary_block_element)

            # stop cycle if cart is empty
            if not self.cart_page.check_cart_not_empty():
                break
コード例 #16
0
def test_guest_can_add_product_to_cart(browser, offer_num):
    #link = 'http://selenium1py.pythonanywhere.com/catalogue/the-shellcoders-handbook_209/?promo=newYear'
    #link = 'http://selenium1py.pythonanywhere.com/catalogue/coders-at-work_207/?promo=newYear2019'
    link = f'http://selenium1py.pythonanywhere.com/catalogue/coders-at-work_207/?promo=offer{offer_num}'

    page = ProductPage(browser, link)
    page.open()
    # Add vars with item and price
    item_name = page.get_item_name()
    item_price = page.get_item_price()
    page.add_item_to_cart()
    page.solve_quiz_and_get_code()
    page.should_be_item_name(item_name)
    page.should_be_basket_total(item_price)
コード例 #17
0
def test_guest_can_add_product_to_basket(browser):
    #Первая ссылка на которой проверяли
    #link = "http://selenium1py.pythonanywhere.com/catalogue/coders-at-work_207/?promo=newYear2019"
    #Вторая ссылка, чтоб проверить независимость данных
    link="http://selenium1py.pythonanywhere.com/catalogue/the-shellcoders-handbook_209/?promo=newYear"
    page = ProductPage(browser, link)
    #Открываем браузер
    page.open()
    #Смотрим что название и цену
    Bookname=page.find_book_name()
    Bookprice=page.find_book_price()
    #Добавляем в корзинку и решаем задачку
    page.add_item_to_cart()
    page.solve_quiz_and_get_code()
    #Проверяем, что правильно добавили
    page.right_book_and_right_price_message(Bookname,Bookprice)
コード例 #18
0
    def test_user_can_add_product_to_cart(self, browser):
        link = ProductPageLocators.PRODUCT_PAGE_PROMO
    
        # инициализируем Page Object, передаем в конструктор экземпляр драйвера и url адрес	
        page = ProductPage(browser, link)

        # открываем нужную страницу
        page.open()

        bookToCompare = page.find_book_name()
        priceToCompare = page.find_book_price()

        # добавляем товар в корзину
        page.add_item_to_cart()

        page.solve_quiz_and_get_code()
        page.right_book_and_right_price_message(bookToCompare, priceToCompare)
コード例 #19
0
 def test_user_can_add_product_to_basket(self, browser):
     link = 'http://selenium1py.pythonanywhere.com/ru/catalogue/hacking-exposed-wireless_208/'
     product_page = ProductPage(browser, link)
     product_page.open()
     product_page.add_item_to_cart()
コード例 #20
0
def test_guest_cant_see_success_message_after_adding_product_to_basket(
        browser):
    page = ProductPage(browser, product_link_base)
    page.open()
    page.add_item_to_cart()
    page.should_not_be_success_message()
コード例 #21
0
def test_message_disappeared_after_adding_product_to_cart(browser):
    link = "http://selenium1py.pythonanywhere.com/catalogue/coders-at-work_207/"
    product_page = ProductPage(browser, link)
    product_page.open()
    product_page.add_item_to_cart()
    product_page.should_disappear_success_message()