Example #1
0
 def open_product_catalog(driver):
     """
     Open product catalog combobox
     :param driver: browser web driver
     """
     BasePage.click_on_object(driver,
                              locator=Locators.product_catalog_locator)
Example #2
0
 def save_new_product_button_click(driver):
     """
     Click on save new product button
     :param driver: browser web driver
     """
     BasePage.click_on_object(
         driver, locator=Locators.save_new_product_button_locator)
Example #3
0
 def click_product_button(driver):
     """
     Click on product button in the catalog
     :param driver: browser web driver
     """
     BasePage.click_on_object(driver,
                              locator=Locators.product_button_locator)
Example #4
0
 def click_on_image(driver):
     """
     Click on image in create new product menu
     :param driver: browser web driver
     """
     BasePage.click_on_object(driver,
                              locator=Locators.product_image_locator)
Example #5
0
 def click_on_edit_image_button(driver):
     """
     Click on image edit button in new product menu
     :param driver: browser web driver
     """
     BasePage.click_on_object(driver,
                              locator=Locators.image_edit_button_locator)
Example #6
0
 def click_delete_all_products_button(driver):
     """
     Delete all choosed products
     :param driver: browser web driver
     """
     BasePage.click_on_object(driver,
                              locator=Locators.delete_products_locator)
Example #7
0
 def click_on_image_tab(driver):
     """
     Click on image tab in create new product menu
     :param driver: browser web driver
     """
     BasePage.click_on_object(driver,
                              locator=Locators.image_tab_button_locator)
Example #8
0
 def click_filter_button(driver):
     """
     Click on filter assert button
     :param driver: browser web driver
     """
     BasePage.click_on_object(driver,
                              locator=Locators.filter_button_locator)
Example #9
0
 def click_menu_constructor(driver):
     """
     Click on menu constructor in main menu
     :param driver: browser web driver
     """
     BasePage.click_on_object(driver,
                              locator=Locators.menu_constructor_locator)
Example #10
0
 def message_close_button_click(driver):
     """
     Click on close button of the message
     :param driver: browser web driver
     """
     BasePage.click_on_object(driver,
                              locator=Locators.message_close_button_locator)
Example #11
0
 def click_downloads_button(driver):
     """
     Click on downloads button in the catalog
     :param driver: browser web driver
     """
     BasePage.click_on_object(
         driver, locator=Locators.downloads_menu_products_locator)
Example #12
0
 def delete_selected_file(driver):
     """
     Delete file that was selected by checkbox
     :param driver: browser web driver
     """
     BasePage.click_on_object(driver, Locators.delete_file_button_locator)
     alert_message = "Are you sure?"
     wait_for_alert(driver, alert_message, delay=3)
     BasePage.alert_accept_click(driver)
Example #13
0
 def delete_selected_images(driver):
     """
     Delete selected images from opencart
     :param driver: browser web driver
     """
     BasePage.click_on_object(driver,
                              locator=Locators.delete_images_button_locator)
     wait_for_alert(driver, alert_message="Are you sure?", delay=2)
     BasePage.alert_accept_click(driver)
     wait_for_alert(
         driver,
         alert_message="Success: Your file or directory has been deleted!")
     BasePage.alert_accept_click(driver)
Example #14
0
    def add_images_to_product(driver, *file_names):
        """
        Add images to product from opencart store
        :param driver: browser web driver
        :param file_names: names of images that we loaded before it
        """

        if len(file_names) == 1:
            ProductPage.click_on_image(driver)
            ProductPage.click_on_edit_image_button(driver)
            BasePage.click_on_object(driver,
                                     locator=(By.XPATH, '//*[@title="%s"]',
                                              str(file_names)))
            ProductPage.close_add_image_menu()
        if len(file_names) > 1:
            ProductPage.click_on_image(driver)
            ProductPage.click_on_edit_image_button(driver)
            BasePage.click_on_object(driver,
                                     locator=(By.XPATH, '//*[@title="%s"]',
                                              str(file_names[0])))
            ProductPage.close_add_image_menu()
            thumb_image_number = 0
            for name in range(1, len(file_names)):
                ProductPage.click_on_add_image_button(driver)
                BasePage.click_on_object(driver,
                                         locator=(By.ID, 'thumb-image%s',
                                                  thumb_image_number))
                thumb_image_number += 1
                ProductPage.click_on_edit_image_button(driver)
                BasePage.click_on_object(driver,
                                         locator=(By.XPATH, '//*[@title="%s"]',
                                                  str(file_names[name])))
        else:
            log.error('Number of file names out of >= 1 - %s', file_names)
Example #15
0
 def download_file(driver, file_url):
     """
     Download file
     :param file_url: full url to downloadable file
     :param driver: browser web driver
     """
     wait_for_element(driver, Locators.file_upload_button_locator, delay=3)
     driver.find_element(*Locators.file_upload_button_locator).click()
     keyboard = Controller()
     keyboard.press(Key.esc)
     keyboard.release(Key.esc)
     driver.find_element(*Locators.file_download_dynamic_locator).send_keys(file_url)
     alert_message = "Your file was successfully uploaded!"
     wait_for_alert(driver, alert_message, delay=3)
     BasePage.alert_accept_click(driver)
     BasePage.click_on_object(driver, Locators.save_downloaded_file)
Example #16
0
 def click_add_new_file(driver):
     """
     Click on add new file button
     :param driver: browser web driver
     """
     BasePage.click_on_object(driver, Locators.add_new_downloads_file_locator)
Example #17
0
 def accept_button_click(driver):
     """
     Click on accept button
     :param driver: browser web driver
     """
     BasePage.click_on_object(driver, locator=Locators.login_button_locator)
Example #18
0
 def click_design_menu(driver):
     """
     Open design menu combobox
     :param driver: browser web driver
     """
     BasePage.click_on_object(driver, locator=Locators.design_menu_locator)
Example #19
0
 def data_tab_click(driver):
     """
     Click on data tag for new product
     :param driver: browser web driver
     """
     BasePage.click_on_object(driver, locator=Locators.data_tab_locator)