Beispiel #1
0
    def forgotten_password_form(self):
        try:
            wait_for_element(self.driver, self.FORGOTTEN_PASSWORD)
            self._click_to_element(self.FORGOTTEN_PASSWORD)
        except NoSuchElementException:
            print('Forgotten password button is not available')

        return self
Beispiel #2
0
    def register_new_user(self):
        try:
            wait_for_element(self.driver, self.CONTINUE)
            self._click_to_element(self.CONTINUE)
        except NoSuchElementException:
            print('Continue button is not available')

        return self
Beispiel #3
0
    def quantity(self, qty):
        """Check input quantity"""
        try:
            wait_for_element(self.driver, self.QUANTITY)
            self._send_keys(qty, self.QUANTITY)
        except NoSuchElementException:
            print('Quantity field is not available')

        return self
Beispiel #4
0
    def add_to_card(self):
        """Check add to card button"""
        try:
            wait_for_element(self.driver, self.ADD_TO_CARD)
            self._click_to_element(self.ADD_TO_CARD)
        except NoSuchElementException:
            print('Add to Card button is not displayed')

        return self
Beispiel #5
0
    def rating(self):
        """Check rating stage"""
        try:
            wait_for_element(self.driver, self.RATING)
            rating = self.driver.find_element(*self.RATING)
            rating.is_displayed()
        except NoSuchElementException:
            print('Rating stage is not displayed')

        return self
Beispiel #6
0
def test_delete_product(browser_driver, get_url, open_admin_dashboard):
    """Test for delete test product"""
    AdminDashboard(browser_driver) \
        .open_product_from_catalog() \
        .copy_element() \
        .remove_element()
    Alert(browser_driver).accept()
    # Check result
    wait_for_element(browser_driver,
                     AdminDashboard.GeneralActions.SUCCESS_TEXT)
    success_text = browser_driver.find_element(
        *AdminDashboard.GeneralActions.SUCCESS_TEXT)

    assert success_text.is_displayed()
Beispiel #7
0
def test_edit_product(browser_driver, get_url, open_admin_dashboard, name, meta_tag, model):
    """Test for Edit one of product"""
    AdminDashboard(browser_driver) \
        .open_product_from_catalog() \
        .edit_element() \
        .input_product_form_general_tab(prod_name=name, meta_tag=meta_tag) \
        .input_product_form_data_tab(model=model) \
        .save_element()

    # Check result
    wait_for_element(browser_driver, AdminDashboard.GeneralActions.SUCCESS_TEXT)
    success_text = browser_driver.find_element(*AdminDashboard.GeneralActions.SUCCESS_TEXT)

    assert success_text.is_displayed()
Beispiel #8
0
def test_add_new_product(browser_driver, get_url, open_admin_dashboard, name,
                         meta_tag, model):
    """Adding new product"""
    AdminDashboard(browser_driver) \
        .open_product_from_catalog() \
        .add_new_element() \
        .input_product_form_general_tab(prod_name=name, meta_tag=meta_tag) \
        .input_product_form_data_tab(model=model) \
        .upload_new_image()\
        .select_image_from_explorer()\
        .close_upload_window()\
        .save_element()

    # Check result
    wait_for_element(browser_driver,
                     AdminDashboard.GeneralActions.SUCCESS_TEXT)
    success_text = browser_driver.find_element(
        *AdminDashboard.GeneralActions.SUCCESS_TEXT)

    assert success_text.is_displayed()