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)
Exemple #2
0
 def edit_metadata_empty_usecase(self):
     display_module_page.reset_edit_metadata_from(self.driver)
     display_module_page.fill_edit_metadata_form(self.driver, constants.product_name, constants.product_version,
                                                 constants.default_use_case, constants.url_fragment)
     check_that("Warning displayed", utilities.get_text(self.driver, By.CSS_SELECTOR, locators.WARNING_ALERT_CSS),
                contains_string(constants.edit_metadata_modal_warning))
     utilities.wait(2)
 def setup_suite(self):
     utilities.wait(5)
     # Navigate to search page
     # Select repo and search for the assembly
     # Add metadata and publish the assembly using api endpoints and wait for the unpublish button to display
     utilities.click_element(self.driver, By.LINK_TEXT, "Search")
     utilities.page_reload(self.driver)
     # search_page.search_for_module_and_click(self.driver, constants.published_module)
     search_beta_page.select_repo(self.driver, fixture.repo_name)
     search_beta_page.search_module_and_click(
         self.driver, constants.assembly_new_draft_version)
     display_module_page.add_metadata_and_publish(self.driver)
     utilities.wait_for_element(self.driver, By.ID,
                                locators.MODULE_DISPLAY_UNPUBLISH_BUTTON_ID)
     # Navigate to search page
     # Select repo and search for the module
     # Add metadata and publish the module using api endpoints and wait for the unpublish button to display
     utilities.click_element(self.driver, By.LINK_TEXT, "Search")
     # search_page.search_for_module_and_click(self.driver, constants.published_module)
     search_beta_page.select_repo(self.driver, fixture.repo_name)
     search_beta_page.search_module_and_click(
         self.driver, constants.module_new_draft_version)
     display_module_page.add_metadata_and_publish(self.driver)
     utilities.wait_for_element(self.driver, By.ID,
                                locators.MODULE_DISPLAY_UNPUBLISH_BUTTON_ID)
Exemple #4
0
def get_list_of_recent_modules(driver, last_known_module_uploaded):
    try:
        wait_for_module_to_load(driver, last_known_module_uploaded)
    except TimeoutException as e:
        utilities.wait(15)
        wait_for_module_to_load(driver, last_known_module_uploaded)
    titles_list = driver.find_elements_by_css_selector(locators.MODULE_TITLE_CSS)
    imported_titles = []
    for t in titles_list[:10]:
        imported_titles.append(t.text)
    return imported_titles
Exemple #5
0
 def setup_suite(self):
     # Add metadata
     utilities.wait(5)
     utilities.click_element(self.driver, By.LINK_TEXT, "Search")
     utilities.page_reload(self.driver)
     # search_page.search_for_module_and_click(self.driver, constants.published_module)
     search_beta_page.select_repo(self.driver, fixture.repo_name)
     search_beta_page.search_module_and_click(self.driver,
                                              constants.published_module)
     display_module_page.add_metadata_and_publish(self.driver)
     utilities.wait_for_element(self.driver, By.ID,
                                locators.MODULE_DISPLAY_UNPUBLISH_BUTTON_ID)
 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_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 publish_assembly(self):
     utilities.wait(5)
     utilities.click_element(self.driver, By.ID,
                             locators.MODULE_DISPLAY_PUBLISH_BUTTON_ID)
     check_that(
         "Button",
         utilities.get_text(self.driver, By.CSS_SELECTOR,
                            locators.MODULE_DISPLAY_PREVIEW_BUTTON_CSS),
         contains_string("Preview"))
     check_that(
         "Button",
         utilities.get_text(self.driver, By.ID,
                            locators.MODULE_DISPLAY_UNPUBLISH_BUTTON_ID),
         contains_string("Unpublish"))
Exemple #9
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
Exemple #10
0
    def product_info_on_view_page(self):
        utilities.click_element(self.driver, By.CSS_SELECTOR,
                                locators.MODULE_DISPLAY_PREVIEW_BUTTON_CSS)
        try:
            utilities.switch_to_latest_tab(self.driver)
            utilities.wait(2)
            product_name = utilities.find_shadow_dom_element(
                self.driver, locators.PRODUCT_NAME_ON_PREVIEW_CSS,
                locators.MODULE_BODY_CONTENT_CSS).text
            check_that("Product name reflected on view page", product_name,
                       contains_string(constants.product_name))
            product_version = utilities.find_shadow_dom_element(
                self.driver, locators.PRODUCT_VERSION_ON_PREVIEW_CSS,
                locators.MODULE_BODY_CONTENT_CSS).text
            check_that("Product version reflected on view page",
                       product_version,
                       contains_string(constants.product_version))
            updated_date_view_page = utilities.find_shadow_dom_element(
                self.driver, locators.UPDATED_DATE_ON_PREVIEW_CSS,
                locators.MODULE_BODY_CONTENT_CSS).text.strip("Updated ")
            check_that("updated date reflected on view page",
                       updated_date_view_page,
                       contains_string(self.first_pub_date_details_page))
            published_date_view_page = utilities.find_shadow_dom_element(
                self.driver, locators.PUBLISHED_DATE_ON_PREVIEW_CSS,
                locators.MODULE_BODY_CONTENT_CSS).text.strip("Published ")
            check_that("published date reflected on view page",
                       published_date_view_page,
                       contains_string(self.last_pub_date_details_page))
            legal_notice = utilities.find_shadow_dom_element(
                self.driver, locators.LEGAL_NOTICE_ON_PREVIEW_CSS,
                locators.MODULE_BODY_CONTENT_CSS)
            check_that(
                "legal notice is displayed at the bottom of preview page",
                legal_notice.text,
                contains_string("Legal Notices for Trademarks"))
            legal_notice_href = legal_notice.get_attribute("href")
            check_that("verify legal notice link", legal_notice_href,
                       contains_string(constants.legal_notice_link))

        except (TimeoutException, StaleElementReferenceException,
                NoSuchElementException) as e:
            lcc.log_error("Element could not be located!!!")
            lcc.log_error(e)
        finally:
            if (len(self.driver.window_handles) > 1):
                self.driver.close()
                utilities.switch_to_first_tab(self.driver)
 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 create_product_blank_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 to clear old values
     utilities.page_reload(self.driver)
     utilities.wait(3)
     # 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.find_element(self.driver, By.ID, locators.NEW_PRODUCT_VERSION_TEXTBOX_ID).clear()
     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.click_element(self.driver, By.CSS_SELECTOR, locators.SAVE_PRODUCT_BUTTON_CSS)
     check_that("Warning is displayed", utilities.get_text(self.driver, By.CSS_SELECTOR, locators.WARNING_ALERT_CSS),
                contains_string(constants.blank_product_name_warning))
     utilities.click_element(self.driver, By.CSS_SELECTOR, locators.CLOSE_WARNING_ALERT_CSS)
 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 verify_filter_by_content_type(driver, module_type):
    utilities.click_element(driver, By.LINK_TEXT,
                            locators.MENU_SEARCH_PAGE_LINK_TEXT)
    utilities.page_reload(driver)
    search_beta_page.select_repo(driver, fixture.repo_name)
    lcc.log_info("Verifying filter by module type: %s " % module_type)
    search_beta_page.filter_by_content_type(driver, module_type)
    module_type_title_list = utilities.find_elements_by_css_selector(
        driver, locators.ALL_MODULE_TITLES)
    module_type_list = []
    for i in module_type_title_list:
        module_type_list.append(i.text)
    for i in module_type_list:
        check_that("Module type for all titles", i,
                   contains_string(module_type))
    utilities.wait(10)
Exemple #15
0
 def edit_metadata_blank_data(self):
     utilities.click_element(self.driver, By.LINK_TEXT, "Search")
     utilities.page_reload(self.driver)
     # # Click on the title if it is displayed on the first page
     utilities.wait(5)
     # search_page.search_for_module_and_click(self.driver, constants.module_to_be_published)
     search_beta_page.select_repo(self.driver, fixture.repo_name)
     search_beta_page.search_module_and_click(self.driver, constants.module_to_be_published)
     self.driver.refresh()
     utilities.click_element(self.driver, By.XPATH, locators.ADD_METADATA_BUTTON_XPATH)
     check_that("Edit metadata modal title",
                utilities.get_text(self.driver, By.CSS_SELECTOR, locators.EDIT_METADATA_MODAL_TITLE_CSS),
                contains_string(constants.edit_metadata_modal_title))
     utilities.click_element(self.driver, By.CSS_SELECTOR, locators.EDIT_METADATA_SAVE_CSS)
     check_that("Warning displayed", utilities.get_text(self.driver, By.CSS_SELECTOR, locators.WARNING_ALERT_CSS),
                contains_string(constants.edit_metadata_modal_warning))
     utilities.wait(2)
    def select_repo_filter(self):
        search_beta_page.select_repo(self.driver, self.repo_name)
        utilities.wait(1)
        utilities.find_element(self.driver, By.CSS_SELECTOR,
                               locators.REPOSITORY_CHECKBOX_CSS).is_selected()
        check_that(
            "Repository name displayed correctly on right side panel",
            utilities.get_text(self.driver, By.XPATH,
                               locators.REPOSITORY_NAME_XPATH),
            equal_to(self.repo_name))
        check_that(
            "Modules section has data displayed for selected repo",
            utilities.find_element(self.driver, By.CSS_SELECTOR,
                                   locators.MODULES_CSS).is_displayed(),
            is_true())
        check_that(
            "Assemblies section has data displayed for selected repo",
            utilities.find_element(self.driver, By.CSS_SELECTOR,
                                   locators.ASSEMBLY_CSS).is_displayed(),
            is_true())

        utilities.click_element(self.driver, By.XPATH,
                                locators.MODULES_TOGGLE_BUTTON_XPATH)
        utilities.wait(1)
        check_that(
            "Modules section is collapsible",
            utilities.find_element(
                self.driver, By.XPATH,
                locators.MODULE_ASSEMBLY_TOGGLE_XPATH).is_displayed(),
            is_true())
        utilities.click_element(self.driver, By.XPATH,
                                locators.MODULES_TOGGLE_BUTTON_XPATH)
        utilities.wait(1)
        utilities.click_element(self.driver, By.XPATH,
                                locators.ASSEMBLY_TOGGLE_BUTTON_XPATH)
        utilities.wait(1)
        check_that(
            "Assemblies section is collapsible",
            utilities.find_element(
                self.driver, By.XPATH,
                locators.MODULE_ASSEMBLY_TOGGLE_XPATH).is_displayed(),
            is_true())
        utilities.wait(1)
        utilities.click_element(self.driver, By.XPATH,
                                locators.ASSEMBLY_TOGGLE_BUTTON_XPATH)
def open_module_display_page(driver, title):
    print("Inside open module display page")
    try:
        print("Title::" + title)
        utilities.wait(3)
        ele = utilities.find_element(driver, By.LINK_TEXT, title)
        print(ele.get_attribute("href"))
        ele.click()
        utilities.wait(5)
    except Exception as e:
        print("In except...")
        # If the title is not found on the first page, search for the title and then click
        lcc.log_info(e)
        lcc.log_info(
            "Module not listed on listed in the results after applying module type filter."
        )
        lcc.log_info("Searching for the module title now...")
        search_beta_page.search_module_and_click(driver, title)
 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 add_metadata_and_publish(driver):
    # f = fixture()
    # lcc.log_info("Added following product information to the module::\nProduct name:" + f.product_name +"\nProduct version:"+constants.product_version+"\nUse case:"+constants.use_case)
    string = driver.current_url
    str = string.split("?")
    lcc.log_info(str[0])
    if "module" in str[0]:
        path = (str[0].replace("pantheon/#/module", "content"))
    elif "assembly" in str[0]:
        path = (str[0].replace("pantheon/#/assembly", "content"))
    else:
        lcc.log_info("Invalid url!!!")
    var = str[1].split("=")
    metadata_path = path + "/en_US/variants/" + var[1] + "/draft/metadata"
    product_uuid = fixture.get_product_id()
    body = {
        "productVersion": product_uuid,
        "documentUsecase": "Deploy",
        "urlFragment": "",
        "searchKeywords": ""
    }
    # Add metadata from api
    add_metadata = requests.post(url=metadata_path,
                                 data=body,
                                 auth=(username, api_auth))
    lcc.log_info("Added metadata to::")
    lcc.log_info(path)
    utilities.wait(2)
    # print(add_metadata.content)
    utilities.page_reload(driver)

    # utilities.click_element(driver, By.XPATH, locators.ADD_METADATA_BUTTON_XPATH)
    # fill_edit_metadata_form(driver, constants.product_name, constants.product_version,
    #                                             constants.use_case, constants.url_fragment)
    body = {":operation": "pant:publish", "locale": "en_US", "variant": var[1]}
    publish = requests.post(url=path, data=body, auth=(username, api_auth))
    lcc.log_info(publish.text)
    lcc.log_info("Published document::")
    lcc.log_info(path)
    # utilities.click_element(driver, By.ID, locators.MODULE_DISPLAY_PUBLISH_BUTTON_ID)
    # utilities.wait(10)
    utilities.wait(2)
    # print(publish.content)
    utilities.page_reload(driver)
    utilities.wait(3)
    assert_that(
        "Button contains text",
        utilities.get_text(driver, By.ID,
                           locators.MODULE_DISPLAY_UNPUBLISH_BUTTON_ID),
        contains_string("Unpublish"))
    utilities.wait(5)
 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)
Exemple #21
0
 def no_product_info_publish_module(self):
     utilities.click_element(self.driver, By.LINK_TEXT, "Search")
     utilities.page_reload(self.driver)
     # # Click on the title if it is displayed on the first page
     utilities.wait(5)
     # search_page.search_for_module_and_click(self.driver, constants.unpublished_module)
     search_beta_page.select_repo(self.driver, fixture.repo_name)
     search_beta_page.search_module_and_click(self.driver,
                                              constants.unpublished_module)
     utilities.wait(5)
     tooltip_icon = utilities.find_element(self.driver, By.CSS_SELECTOR,
                                           locators.NO_URL_TOOLTIP_ICON)
     check_that("No url tooltip icon is displayed",
                tooltip_icon.is_displayed(), is_true())
     utilities.click_element(self.driver, By.ID,
                             locators.MODULE_DISPLAY_PUBLISH_BUTTON_ID)
     check_that(
         "Button contains text",
         utilities.get_text(self.driver, By.ID,
                            locators.MODULE_DISPLAY_PUBLISH_BUTTON_ID),
         contains_string("Publish"))
 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))
 def select_product_and_version_filter(self):
     utilities.click_element(self.driver, By.LINK_TEXT, "Search")
     utilities.wait(2)
     utilities.select_value_from_dropdown(self.driver, By.CSS_SELECTOR,
                                          locators.SELECT_PRODUCT_NAME_CSS,
                                          constants.product_name)
     utilities.select_value_from_dropdown(
         self.driver, By.CSS_SELECTOR, locators.SELECT_PRODUCT_VERSION_CSS,
         constants.product_version)
     lcc.log_info(
         "product and version selected and displayed on search page")
     utilities.find_element(
         self.driver, By.XPATH,
         locators.PRODUCT_FILTER_DISPLAY_XPATH).is_displayed()
     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)
     check_that(
         "verify that 'filter by product and version' functionality filters results correctly",
         utilities.get_text(self.driver, By.XPATH,
                            locators.PRODUCT_VERSION_DISPLAY_PAGE_XPATH),
         contains_string(constants.product_name + " " +
                         constants.product_version))
Exemple #24
0
 def product_info_on_customer_portal(self):
     utilities.wait(5)
     utilities.page_reload(self.driver)
     utilities.click_element(self.driver, By.PARTIAL_LINK_TEXT,
                             "View on Customer Portal")
     try:
         utilities.wait(5)
         utilities.switch_to_latest_tab(self.driver)
         utilities.wait(6)
         updated_date_on_portal = utilities.find_shadow_dom_element(
             self.driver, locators.UPDATED_DATE_ON_PORTAL_CSS,
             locators.MODULE_BODY_ON_PORTAL_CSS).get_attribute(
                 "textContent")
         check_that("updated date reflected on view page",
                    updated_date_on_portal,
                    contains_string(self.first_pub_date_details_page))
         published_date_on_portal = utilities.find_shadow_dom_element(
             self.driver, locators.PUBLISHED_DATE_ON_PORTAL_CSS,
             locators.MODULE_BODY_ON_PORTAL_CSS).get_attribute(
                 "textContent")
         check_that("published date reflected on view page",
                    published_date_on_portal,
                    contains_string(self.last_pub_date_details_page))
     except (TimeoutException, StaleElementReferenceException,
             NoSuchElementException) as e:
         lcc.log_error(
             "Some problem accessing the Customer Portal, please check.")
         lcc.log_error(e)
     finally:
         if (len(self.driver.window_handles) > 1):
             self.driver.close()
             utilities.switch_to_first_tab(self.driver)
Exemple #25
0
 def view_on_portal_link_test(self):
     try:
         utilities.wait(5)
         utilities.click_element(self.driver, By.CSS_SELECTOR,
                                 locators.VIEW_ON_PORTAL_LINK_CSS)
         utilities.wait(5)
         utilities.switch_to_latest_tab(self.driver)
         utilities.wait(7)
         lcc.log_info(
             "Find the CP preview in the attachment below for debugging purposes"
         )
         self.driver.save_screenshot("cp_preview_module.png")
         lcc.save_attachment_file("cp_preview_module.png")
         check_that("View on Portal URL path", self.driver.current_url,
                    contains_string(constants.view_on_portal_page_url))
         module_id_regex = re.compile(
             r'^[a-zA-Z0-9]{8}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{12}$'
         )
         current__module_id = self.driver.current_url.split("/topic/")[1]
         check_that("View on Portal URL id", current__module_id,
                    match_pattern(module_id_regex))
         # content_body_on_portal = utilities.find_element(self.driver, By.CSS_SELECTOR, locators.MODULE_BODY_ON_PORTAL_CSS)
     except (TimeoutException, StaleElementReferenceException,
             NoSuchElementException) as e:
         lcc.log_error("Error finding element!!!")
         lcc.log_error(e)
     finally:
         if (len(self.driver.window_handles) > 1):
             self.driver.close()
             utilities.switch_to_first_tab(self.driver)
Exemple #26
0
 def verify_attribute_text(self):
     try:
         utilities.click_element(self.driver, By.LINK_TEXT, "Search")
         # search_page.search_for_module_and_click(self.driver, constants.search_module_with_attribute)
         search_beta_page.select_repo(self.driver, fixture.repo_name)
         search_beta_page.search_module_and_click(
             self.driver, constants.search_module_with_attribute)
         utilities.click_element(self.driver, By.CSS_SELECTOR,
                                 locators.MODULE_DISPLAY_PREVIEW_BUTTON_CSS)
         utilities.wait(2)
         utilities.switch_to_latest_tab(self.driver)
         attribute_text = utilities.find_shadow_dom_element(
             self.driver, locators.ATTRIBUTE_ON_PREVIEW_CSS,
             locators.MODULE_BODY_CONTENT_CSS).text
         check_that(
             "verify attribute is resolving correctly on preview page",
             attribute_text, contains_string(constants.attribute))
     except Exception as e:
         lcc.log_info(e)
     finally:
         if (len(self.driver.window_handles) > 1):
             self.driver.close()
             utilities.switch_to_first_tab(self.driver)
    def blank_product_versions(self):
        utilities.click_element(self.driver, By.XPATH, locators.MENU_PRODUCTS_LINK_XPATH)
        utilities.click_element(self.driver, By.LINK_TEXT, locators.MENU_PRODUCT_LISTING_LINK_TEXT)
        # User clicks on 'Product details' button for the product created above.
        lcc.log_info("Product name to add versions for: %s " % product_name)
        utilities.wait(10)
        products = utilities.find_elements_by_class_name(self.driver, locators.PRODUCT_NAMES_LIST_CLASS_NAME)
        lcc.log_info("Number of products found in the list %s" % str(len(products)))
        for product in products:
            if product_name in product.text:
                lcc.log_info("Adding versions to %s" % product.text)
                product.find_element_by_class_name("pf-c-options-menu").click()
                lcc.log_info("Clicking on the dropdown to add product details")
                product.find_element_by_class_name(locators.PRODUCT_DETAILS_BUTTON_CLASS_NAME).click()
                break

        #Verify blank product version and url fragment
        utilities.find_element(self.driver, By.ID, locators.NEW_PRODUCT_VERSION_TEXTBOX_ID).clear()
        utilities.find_element(self.driver, By.ID, locators.VERSION_URL_FRAGMENT_ID).clear()
        utilities.click_element(self.driver, By.CSS_SELECTOR, locators.PRODUCT_VERSION_SAVE_BUTTON_CSS)
        check_that("Warning is displayed", utilities.get_text(self.driver, By.CSS_SELECTOR, locators.WARNING_ALERT_CSS),
                   contains_string(constants.blank_product_name_warning))
        utilities.click_element(self.driver, By.CSS_SELECTOR, locators.CLOSE_WARNING_ALERT_CSS)
 def add_metadata(self):
     utilities.wait(5)
     utilities.click_element(self.driver, By.LINK_TEXT, "Search")
     utilities.page_reload(self.driver)
     # search_page.search_for_module_and_click(self.driver, constants.assembly_to_be_published)
     search_beta_page.select_repo(self.driver, fixture.repo_name)
     search_beta_page.search_module_and_click(
         self.driver, constants.assembly_to_be_published)
     utilities.click_element(self.driver, By.XPATH,
                             locators.ADD_METADATA_BUTTON_XPATH)
     check_that(
         "Edit metadata modal title",
         utilities.get_text(self.driver, By.CSS_SELECTOR,
                            locators.EDIT_METADATA_MODAL_TITLE_CSS),
         contains_string(constants.edit_metadata_modal_title))
     display_module_page.fill_edit_metadata_form(self.driver,
                                                 constants.product_name,
                                                 constants.product_version,
                                                 constants.use_case,
                                                 constants.url_fragment)
     check_that(
         "Success message displayed",
         utilities.get_text(self.driver, By.CSS_SELECTOR,
                            locators.UPDATE_SUCCESS_MESSAGE_CSS),
         contains_string(constants.success_message))
     check_that(
         "Product name reflected on displayed module page",
         utilities.get_text(self.driver, By.CSS_SELECTOR,
                            locators.PRODUCT_INFO_CSS),
         contains_string(constants.product_name))
     check_that(
         "Product version reflected on displayed module page",
         utilities.get_text(self.driver, By.CSS_SELECTOR,
                            locators.PRODUCT_INFO_CSS),
         contains_string(constants.product_version))
     utilities.wait(2)
def filter_by_content_type(driver, module_type):
    module_type = module_type.upper()
    if module_type == "CONCEPT":
        locator = locators.CONCEPT_CHECKBOX_ID
    elif module_type == "PROCEDURE":
        locator = locators.PROCEDURE_CHECKBOX_ID
    elif module_type == "REFERENCE":
        locator = locators.REFERENCE_CHECKBOX_ID
    else:
        lcc.log_error("Invalid module type!!!")
    utilities.wait(2)
    utilities.click_element(driver, By.CSS_SELECTOR,
                            locators.MODULE_TYPE_DROPDOWN_CSS)
    utilities.click_element(driver, By.ID, locator)
    # utilities.select_value_from_dropdown(driver, By.CSS_SELECTOR, locators.MODULE_TYPE_DROPDOWN_CSS, module_type)
    chips = get_filter_chip_list(driver)
    print(chips)
    print(module_type)
    check_that("Filter chips listed", chips, has_item(module_type))
    poll(lambda: utilities.find_element(driver, By.CSS_SELECTOR, locators.
                                        NO_ASSEMBLY_RESULTS_FOUND_CSS).
         is_displayed() == True,
         step=0.5,
         timeout=10)
 def modules_assemblies_list(self):
     utilities.wait(1)
     module_title_list = utilities.find_elements_by_css_selector(
         self.driver, locators.MODULE_TITLES_CSS)
     modules_count = len(module_title_list)
     modules = modules_count - 1
     lcc.log_info("Modules displayed: %s " % str(modules))
     for i in range(1, modules_count):
         check_that("Modules listed for selected repo",
                    module_title_list[i].text,
                    contains_string(self.module_prefix))
     assembly_title_list = utilities.find_elements_by_css_selector(
         self.driver, locators.ASSEMBLY_TITLES_CSS)
     assembly_count = len(assembly_title_list)
     assemblies = assembly_count - 1
     lcc.log_info("Assemblies displayed: %s" % str(assemblies))
     for i in range(1, assembly_count):
         check_that("Assemblies listed for selected repo",
                    assembly_title_list[i].text,
                    contains_string(self.assembly_prefix))
     lcc.log_info(
         "Find the Search beta page preview in the attachment below:")
     self.driver.save_screenshot("search_beta_repo_selected.png")
     lcc.save_attachment_file("search_beta_repo_selected.png")