def select_repo(driver, title):
    lcc.log_info("Selecting repo::{}".format(title))
    utilities.click_element(driver, By.LINK_TEXT,
                            locators.MENU_SEARCH_PAGE_LINK_TEXT)
    # Poll until all the repos are listed in the filter
    poll(lambda: len(
        driver.find_elements(By.CLASS_NAME, locators.
                             SELECT_REPO_CHECKBOX_CLASS_NAME)) >= 1,
         ignore_exceptions=[NoSuchElementException],
         timeout=15,
         step=1)
    utilities.enter_text(driver, By.XPATH,
                         locators.FILTER_BY_REPO_SEARCH_BAR_XPATH, title)
    # Poll until repo matching the search criteria is listed in the filter
    poll(lambda: len(
        driver.find_elements(By.CLASS_NAME, locators.
                             SELECT_REPO_CHECKBOX_CLASS_NAME)) == 1,
         ignore_exceptions=[NoSuchElementException],
         timeout=15,
         step=1)
    # utilities.wait(7)
    print(
        len(
            driver.find_elements(By.CLASS_NAME,
                                 locators.SELECT_REPO_CHECKBOX_CLASS_NAME)))
    utilities.click_element(driver, By.CLASS_NAME,
                            locators.SELECT_REPO_CHECKBOX_CLASS_NAME)
    utilities.wait(3)
 def search_for_body_of_module(self):
     try:
         utilities.find_elements_by_id(self.driver,
                                       locators.SEARCH_BOX_ID).clear()
         utilities.enter_text(self.driver, By.ID, locators.SEARCH_BOX_ID,
                              constants.body_of_module_search)
         utilities.click_element(self.driver, By.CSS_SELECTOR,
                                 locators.SEARCH_BUTTON_CSS)
         utilities.wait(2)
         utilities.click_element(self.driver, By.XPATH,
                                 locators.SEARCH_MODULE_XPATH)
         utilities.wait(2)
         utilities.click_element(self.driver, By.CSS_SELECTOR,
                                 locators.MODULE_DISPLAY_PREVIEW_BUTTON_CSS)
         utilities.wait(2)
         utilities.switch_to_latest_tab(self.driver)
         body_of_module_on_preview = utilities.find_shadow_dom_element(
             self.driver, locators.SEARCH_BODY_ON_PREVIEW_CSS,
             locators.MODULE_BODY_CSS).text
         check_that("content of module is displayed",
                    body_of_module_on_preview,
                    contains_string(constants.body_of_module_search))
         utilities.wait(2)
     except (TimeoutException, StaleElementReferenceException,
             NoSuchElementException) as e:
         lcc.log_error("Error finding element: %s" % e)
         lcc.log_error(e)
     finally:
         self.driver.close()
         utilities.switch_to_first_tab(self.driver)
 def invalid_product_version_url_fragment(self):
     #Verify invalid input for url fragment
     utilities.enter_text(self.driver, By.ID, locators.NEW_PRODUCT_VERSION_TEXTBOX_ID, constants.product_version_1)
     utilities.enter_text(self.driver, By.ID, locators.VERSION_URL_FRAGMENT_ID, "#")
     check_that("Warning is displayed", utilities.get_text(self.driver, By.CSS_SELECTOR, locators.WARNING_ALERT_CSS),
                contains_string(constants.version_url_fragment_warning))
     utilities.click_element(self.driver, By.CSS_SELECTOR, locators.CLOSE_WARNING_ALERT_CSS)
     utilities.find_element(self.driver, By.ID, locators.NEW_PRODUCT_VERSION_TEXTBOX_ID).clear()
Esempio n. 4
0
def import_git_repo(driver, repo, branch):
    if (repo is not None):
        utilities.enter_text(driver, By.CSS_SELECTOR,
                             locators.GIT_REPO_URL_TEXTBOX_CSS, repo)
        utilities.enter_text(driver, By.CSS_SELECTOR,
                             locators.GIT_REPO_BRANCH_TEXTBOX_CSS, branch)
    utilities.click_element(driver, By.CSS_SELECTOR,
                            locators.GIT_REPO_SUBMIT_BUTTON_CSS)
Esempio n. 5
0
def login(driver):
    # utilities.click_element(driver, By.LINK_TEXT, locators.LOGIN_LINK_TEXT)
    assert_that("Assert sso url", driver.current_url,
                contains_string(fixture.sso_url))
    utilities.enter_text(driver, By.ID, locators.USER_NAME_ID, username)
    utilities.click_element(driver, By.ID, locators.LOGIN_NEXT_BUTTON_ID)
    utilities.enter_text(driver, By.ID, locators.PASSWORD_ID, password)
    utilities.click_element(driver, By.ID, locators.LOGIN_BUTTON_ID)
    driver.get(fixture.url + "pantheon/#/")
def search_titles(driver, title):
    lcc.log_info("Searching for title::{}".format(title))
    try:
        wait_for_modules(driver)
        utilities.enter_text(driver, By.CSS_SELECTOR,
                             locators.SEARCH_TITLE_CSS, title)
    except TimeoutException as e:
        lcc.log_info(
            "It appears that the module was not found, please check your test data."
        )
        raise e
def reset_edit_metadata_from(driver):
    utilities.select_value_from_dropdown(driver, By.CSS_SELECTOR,
                                         locators.PRODUCT_NAME_DROPDOWN_CSS,
                                         "Select a Product")
    utilities.select_value_from_dropdown(driver, By.CSS_SELECTOR,
                                         locators.PRODUCT_VERSION_DROPDOWN_CSS,
                                         "Select a Version")
    utilities.select_value_from_dropdown(driver, By.CSS_SELECTOR,
                                         locators.PRODUCT_USECASE_DROPDOWN_CSS,
                                         "Select Use Case")
    utilities.enter_text(driver, By.CSS_SELECTOR,
                         locators.PRODUCT_URLFRAGMENT_CSS, "")
Esempio n. 8
0
def search_for_module_and_click(driver, title):
    wait_for_search_results(driver)
    lcc.log_info("Searching specific title....")
    try:
        utilities.enter_text(driver, By.ID, locators.SEARCH_BOX_ID, title)
        print("Entered text!")
        utilities.wait(1)
        utilities.click_element(driver, By.CSS_SELECTOR, locators.SEARCH_BUTTON_CSS)
        utilities.wait(1)
        wait_for_module_to_load(driver, title)
        utilities.click_element(driver, By.LINK_TEXT, title)
    except TimeoutException as e:
        lcc.log_info("It appears that the module was not found, please check your test data.")
        raise e
 def search_for_module(self):
     utilities.click_element(self.driver, By.LINK_TEXT, "Search")
     utilities.page_reload(self.driver)
     utilities.wait(2)
     utilities.enter_text(self.driver, By.ID, locators.SEARCH_BOX_ID,
                          constants.module_to_search)
     utilities.click_element(self.driver, By.CSS_SELECTOR,
                             locators.SEARCH_BUTTON_CSS)
     utilities.wait(3)
     check_that(
         "module is found on search page",
         utilities.get_text(self.driver, By.XPATH,
                            locators.SEARCH_MODULE_XPATH),
         contains_string(constants.module_to_search))
 def search_for_random_text(self):
     utilities.find_elements_by_id(self.driver,
                                   locators.SEARCH_BOX_ID).clear()
     utilities.enter_text(self.driver, By.ID, locators.SEARCH_BOX_ID,
                          constants.random_string_search)
     utilities.click_element(self.driver, By.CSS_SELECTOR,
                             locators.SEARCH_BUTTON_CSS)
     utilities.wait(2)
     check_that(
         "warning alert displayed",
         utilities.get_text(self.driver, By.CSS_SELECTOR,
                            locators.ALERT_TITLE_CSS),
         contains_string(constants.no_module_found))
     utilities.click_element(self.driver, By.XPATH,
                             locators.CANCEL_BUTTON_XPATH)
     utilities.wait(2)
 def search_for_repo(self):
     utilities.enter_text(self.driver, By.XPATH,
                          locators.FILTER_BY_REPO_SEARCH_BAR_XPATH,
                          self.repo_name)
     utilities.wait(1)
     repo_list = utilities.find_elements_by_css_selector(
         self.driver, locators.REPOSITORY_CHECKBOX_CSS)
     repo_list_count = len(repo_list)
     for i in range(repo_list_count):
         if repo_list[i].text == self.repo_name:
             check_that("Entered repo name is displayed on search results",
                        repo_list[i].text, equal_to(self.repo_name))
     utilities.click_element(
         self.driver, By.CLASS_NAME,
         locators.CANCEL_BUTTON_ON_REPO_SEARCH_BAR_CLASS_NAME)
     utilities.wait(1)
 def duplicate_product_name_different_version(self):
     # utilities.click_element(self.driver, By.LINK_TEXT, locators.MENU_NEW_PRODUCT_LINK_TEXT)
     lcc.log_info("Product name input: %s " % product_name)
     # Reload new product page to clear old values
     utilities.page_reload(self.driver)
     # Fill new product form
     utilities.enter_text(self.driver, By.ID, locators.PRODUCT_NAME_TEXTBOX_ID, product_name)
     utilities.enter_text(self.driver, By.ID, locators.PRODUCT_URL_FRAGMENT_TEXTBOX_ID, constants.url_fragment)
     utilities.enter_text(self.driver, By.ID, locators.NEW_PRODUCT_VERSION_TEXTBOX_ID, constants.product_version_2)
     utilities.enter_text(self.driver, By.ID, locators.PRODUCT_VERSION_URL_FRAGMENT_ID, constants.product_version_url_fragment_2)
     utilities.enter_text(self.driver, By.ID, locators.PRODUCT_DESCRIPTION_TEXTBOX_ID,
                          constants.new_product_description)
     utilities.click_element(self.driver, By.CSS_SELECTOR, locators.SAVE_PRODUCT_BUTTON_CSS)
     check_that("Duplicate Product warning is displayed",
                utilities.get_text(self.driver, By.CSS_SELECTOR, locators.WARNING_ALERT_CSS),
                contains_string(constants.duplicate_product_name_warning))
     utilities.click_element(self.driver, By.CSS_SELECTOR, locators.CLOSE_WARNING_ALERT_CSS)
 def search_for_module_with_asian_chars(self):
     utilities.find_elements_by_id(self.driver,
                                   locators.SEARCH_BOX_ID).clear()
     utilities.enter_text(self.driver, By.ID, locators.SEARCH_BOX_ID,
                          constants.asian_char_module)
     # module will be searchable once CCS-3754 is fixed
     # verifying warning alert as of now
     utilities.click_element(self.driver, By.CSS_SELECTOR,
                             locators.SEARCH_BUTTON_CSS)
     utilities.wait(2)
     check_that(
         "module with asian character should be found once CCS-3754 is fixed, checking for warning alert as of now..",
         utilities.get_text(self.driver, By.CSS_SELECTOR,
                            locators.ALERT_TITLE_CSS),
         contains_string(constants.no_module_found))
     utilities.click_element(self.driver, By.XPATH,
                             locators.CANCEL_BUTTON_XPATH)
     utilities.wait(2)
def fill_edit_metadata_form(driver, product_name, product_version, usecase,
                            url_fragment):
    utilities.wait(2)
    utilities.select_value_from_dropdown(driver, By.CSS_SELECTOR,
                                         locators.PRODUCT_NAME_DROPDOWN_CSS,
                                         product_name)
    utilities.wait(5)
    utilities.select_value_from_dropdown(driver, By.CSS_SELECTOR,
                                         locators.PRODUCT_VERSION_DROPDOWN_CSS,
                                         product_version)
    utilities.wait(2)
    utilities.select_value_from_dropdown(driver, By.CSS_SELECTOR,
                                         locators.PRODUCT_USECASE_DROPDOWN_CSS,
                                         usecase)
    utilities.wait(2)
    utilities.enter_text(driver, By.CSS_SELECTOR,
                         locators.PRODUCT_URLFRAGMENT_CSS, url_fragment)
    utilities.wait(5)
    utilities.click_element(driver, By.CSS_SELECTOR,
                            locators.EDIT_METADATA_SAVE_CSS)
    utilities.wait(2)
 def create_product(self):
     # utilities.click_element(self.driver, By.LINK_TEXT, locators.MENU_NEW_PRODUCT_LINK_TEXT)
     lcc.log_info("Product name input: %s " % product_name)
     # Reload new product page to clear old values
     utilities.page_reload(self.driver)
     # Fill new product form
     utilities.enter_text(self.driver, By.ID, locators.PRODUCT_NAME_TEXTBOX_ID, product_name)
     utilities.enter_text(self.driver, By.ID, locators.PRODUCT_URL_FRAGMENT_TEXTBOX_ID, constants.url_fragment)
     utilities.enter_text(self.driver, By.ID, locators.NEW_PRODUCT_VERSION_TEXTBOX_ID, constants.product_version)
     utilities.enter_text(self.driver, By.ID, locators.PRODUCT_VERSION_URL_FRAGMENT_ID, constants.product_version)
     utilities.enter_text(self.driver, By.ID, locators.PRODUCT_DESCRIPTION_TEXTBOX_ID,
                          constants.new_product_description)
     utilities.enter_text(self.driver, By.ID, locators.NEW_PRODUCT_VERSION_TEXTBOX_ID, constants.product_version)
     utilities.click_element(self.driver, By.CSS_SELECTOR, locators.SAVE_PRODUCT_BUTTON_CSS)
     utilities.wait(5)
     products = utilities.find_elements_by_css_selector(self.driver, locators.PRODUCT_NAME_LIST_CSS)
     lcc.log_info(str(len(products)))
     products_list = []
     for product in products:
         products_list.append(product.text)
     check_that("Product created is listed successfully", products_list, has_item(product_name), quiet=False)
 def create_product_versions(self):
     # User adds versions to the 'Add Product versions' and verifies if the versions were added successfully.
     utilities.enter_text(self.driver, By.ID, locators.NEW_PRODUCT_VERSION_TEXTBOX_ID, constants.product_version_1)
     utilities.enter_text(self.driver,By.ID,locators.VERSION_URL_FRAGMENT_ID,
                          constants.product_version_url_fragment_1)
     utilities.click_element(self.driver, By.CSS_SELECTOR, locators.PRODUCT_VERSION_SAVE_BUTTON_CSS)
     utilities.wait(3)
     utilities.find_element(self.driver, By.ID, locators.NEW_PRODUCT_VERSION_TEXTBOX_ID).clear()
     utilities.enter_text(self.driver, By.ID, locators.NEW_PRODUCT_VERSION_TEXTBOX_ID, constants.product_version_2)
     utilities.enter_text(self.driver, By.ID, locators.VERSION_URL_FRAGMENT_ID,
                          constants.product_version_url_fragment_2)
     utilities.click_element(self.driver, By.CSS_SELECTOR, locators.PRODUCT_VERSION_SAVE_BUTTON_CSS)
     utilities.wait(3)
     utilities.find_element(self.driver, By.ID,locators.NEW_PRODUCT_VERSION_TEXTBOX_ID).clear()
     utilities.enter_text(self.driver, By.ID, locators.NEW_PRODUCT_VERSION_TEXTBOX_ID, constants.product_version_3)
     utilities.enter_text(self.driver, By.ID, locators.VERSION_URL_FRAGMENT_ID,
                          constants.product_version_url_fragment_3)
     utilities.click_element(self.driver, By.CSS_SELECTOR, locators.PRODUCT_VERSION_SAVE_BUTTON_CSS)
     utilities.wait(3)
     utilities.find_element(self.driver, By.ID, locators.NEW_PRODUCT_VERSION_TEXTBOX_ID).clear()
     versions_ul = utilities.find_element(self.driver, By.CLASS_NAME, locators.PRODUCT_VERSIONS_UL_CLASS_NAME)
     versions_list = versions_ul.find_elements_by_tag_name(locators.PRODUCT_VERSIONS_LI_TAG_NAME)
     versions = []
     for version in versions_list:
         versions.append(version.text)
     lcc.log_info("Versions added: %s" % str(versions))
     check_that("Product version entered is added successfully ", versions, has_item(constants.product_version_1))
     check_that("Product version entered is added successfully ", versions, has_item(constants.product_version_2))
     check_that("Product version entered is added successfully ", versions, has_item(constants.product_version_3))