Пример #1
0
def test_delete_product(login_page):
    ProductQueries().add_product("iphone", "11pro")
    login_page.login('user', 'bitnami1')
    admin_page = AdminPage(driver=login_page.driver)
    admin_page.go_to_products()
    products_page = ProductsPage(driver=login_page.driver)
    # products_page.click_add_product_button()
    # products_page.set_new_product_required_fields("iphone", "phones", "11pro")
    # products_page.click_submit_button()
    # assert products_page.success_alert_element
    products_page.check_product_in_table('iphone')
    products_page.delete_product_from_table('iphone')
    products_page.check_product_is_not_in_table('iphone')
Пример #2
0
    def test_correct_order(self):

        login_page = LoginPage(self.driver)
        login_page.input_username("standard_user")
        login_page.input_password("secret_sauce")
        login_page.click_login()

        products_page = ProductsPage(self.driver)
        products_page.click_backpack()

        product_details_page = ProductDetailsPage(self.driver)
        product_details_page.add_to_cart()
        product_details_page.press_back()

        products_page.click_redtshirt()

        product_details_page.add_to_cart()
        product_details_page.press_back()

        products_page.go_to_shoppingcart()

        cart_page = CartPage(self.driver)
        cart_page.continue_shopping()

        products_page.click_redtshirt()

        product_details_page.remove_from_cart()
        product_details_page.press_back()

        products_page.click_bolttshirt()

        product_details_page.add_to_cart()
        product_details_page.press_back()

        products_page.go_to_shoppingcart()

        cart_page.go_to_checkout()

        checkout_page = CheckoutPage(self.driver)
        checkout_page.input_firstname("John")
        checkout_page.input_lastname("Doe")
        checkout_page.input_zipcode("12345")
        checkout_page.checkout_continue()

        checkout_overview_page = CheckoutOverviewPage(self.driver)
        checkout_overview_page.finish_order()

        checkout_complete_page = CheckoutCompletePage(self.driver)
        self.assertEqual(
            checkout_complete_page.thank_you(),
            "Your order has been dispatched, and will arrive just as fast as the pony can get there!"
        )
Пример #3
0
 def search_item_using_search_box(self, searched_item):
     self.element_to_be_clickable(self.search_locator.SEARCH_TEXT_BOX).send_keys(searched_item)
     self.element_to_be_clickable(self.search_locator.SEARCH_SUBMIT_BUTTON).click()
     search_product_results = ProductsPage(self.driver)
     return search_product_results
Пример #4
0
def test_go_to_products(login_page):
    login_page.login('user', 'bitnami1')
    admin_page = AdminPage(driver=login_page.driver)
    admin_page.go_to_products()
    products_page = ProductsPage(driver=login_page.driver)
    assert products_page.main_table_element
Пример #5
0
 def invalid_login(self, user_name, passwd, msg):
     self.input_text(self.user_name, user_name)
     self.input_text(self.password, passwd)
     self.click_element(self.login_btn)
     print(self.error_msg().text, msg)
     return ProductsPage(self.driver)
Пример #6
0
 def login(self, user_name, passwd):
     self.input_text(self.user_name, user_name)
     self.input_text(self.password, passwd)
     self.click_element(self.login_btn)
     return ProductsPage(self.driver)