Example #1
0
    def test_product_img_clickable_assigned_order(self):
        driver = self.driver
        driver.get(var_info.url_product)
        product = ProductPage(driver)
        product.pick_display_order("Price (low to high)")
        #assert order == "Price (low to high)"
        product.click_img(3)
        id = var_info.id_low_to_high[3 - 1]

        print(driver.current_url)
        assert driver.current_url == "https://www.saucedemo.com/inventory-item.html?id=" + id
Example #2
0
    def test_product_img_clickable_default_order(self):
        driver = self.driver
        driver.get(var_info.url_product)
        product = ProductPage(driver)
        order = product.name_display_order()
        assert order == "Name (A to Z)"
        product.click_img(1)
        id = var_info.id_a_to_z[1 - 1]

        print(driver.current_url)
        assert driver.current_url == "https://www.saucedemo.com/inventory-item.html?id=" + id
    def test_click_img_check_return_button(self):
        driver = self.driver
        driver.get(var_info.url_product)
        product = ProductPage(driver)
        product.click_img(2)
        after_click = ProductAfterClickPage(driver)
        cart_sign = after_click.check_cart_sign()
        cart_qty = after_click.check_cart_qty()
        driver.implicitly_wait(5)

        assert cart_sign.is_displayed()
        assert cart_qty == None
    def test_click_img_check_return_button(self):
        driver = self.driver
        driver.get(var_info.url_product)
        product = ProductPage(driver)
        product.click_img(2)
        after_click = ProductAfterClickPage(driver)
        back = after_click.check_back_button()
        back.click()
        driver.delete_all_cookies()

        print(driver.current_url)
        assert driver.current_url == "https://www.saucedemo.com/inventory.html"
    def test_add_items_back_and_forth(self):
        driver = self.driver
        driver.delete_all_cookies()
        driver.get(var_info.url_product)
        #driver.refresh()
        product = ProductPage(driver)
        product.click_product_label("Test.allTheThings() T-Shirt (Red)")
        after_click = ProductAfterClickPage(driver)
        driver.refresh()
        add_to_cart1 = after_click.check_add_to_cart()
        add_to_cart1.click()
        after_click.check_cart_qty()
        back = after_click.check_back_button()
        back.click()
        product.click_img(3)
        add_to_cart2 = after_click.check_add_to_cart()
        add_to_cart2.click()
        check_add_label = after_click.check_add_to_cart()
        cart_qty_total = after_click.check_cart_qty()

        assert cart_qty_total == "2"
        assert check_add_label.text == "REMOVE"