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)
예제 #2
0
 def authenticated_user_view_unpublished_module(self):
     utilities.click_element(self.driver, By.LINK_TEXT, "Search")
     utilities.page_reload(self.driver)
     # 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)
     check_that(
         "Button",
         utilities.get_text(self.driver, By.ID,
                            locators.MODULE_DISPLAY_PUBLISH_BUTTON_ID),
         contains_string("Publish"))
     check_that(
         "Button",
         utilities.get_text(self.driver, By.CSS_SELECTOR,
                            locators.MODULE_DISPLAY_PREVIEW_BUTTON_CSS),
         contains_string("Preview"))
     check_that(
         "First Published date",
         utilities.get_text(self.driver, By.CSS_SELECTOR,
                            locators.MODULE_DISPLAY_FIRST_PUBLISHED_CSS),
         contains_string("--"))
     check_that(
         "Last Published date",
         utilities.get_text(self.driver, By.CSS_SELECTOR,
                            locators.MODULE_DISPLAY_LAST_PUBLISHED_CSS),
         contains_string("--"))
     check_that(
         "Module display page title",
         utilities.get_text(self.driver, By.CSS_SELECTOR,
                            locators.MODULE_DISPLAY_TITLE_CSS),
         contains_string(constants.unpublished_module))
 def verify_module_type_from_backend_module_type_inside_file_con(self):
     utilities.click_element(self.driver, By.LINK_TEXT,
                             locators.MENU_SEARCH_PAGE_LINK_TEXT)
     search_beta_page.select_repo(self.driver, fixture.repo_name)
     search_beta_page.filter_by_content_type(self.driver, "Concept")
     # search_page.filter_by_module_type(self.driver, "Concept")
     open_module_display_page(self.driver, constants.con_module_title1)
     verify_module_type_from_backend(self.driver, "Concept")
예제 #4
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 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)
예제 #6
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)
예제 #7
0
 def authenticated_user_view_published_module(self):
     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.published_module)
     # utilities.find_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"))
    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)
예제 #9
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 verify_no_module_type(self):
     utilities.click_element(self.driver, By.LINK_TEXT,
                             locators.MENU_SEARCH_PAGE_LINK_TEXT)
     utilities.page_reload(self.driver)
     # try:
     #     search_page.search_for_module_and_click(self.driver, constants.no_module_type_title)
     # except (TimeoutException, StaleElementReferenceException) as e:
     #     lcc.log_error("Module not listed on listed in the results after applying module type filter.")
     #     utilities.wait(2)
     #     search_page.search_for_module_and_click(self.driver, constants.no_module_type_title)
     search_beta_page.select_repo(self.driver, fixture.repo_name)
     search_beta_page.search_module_and_click(
         self.driver, constants.no_module_type_title)
     lcc.log_info(
         "Verifying no module type is displayed for modules with invalid type mentioned inside "
         "the asciidoc file")
     # Once landed on the module display page, get path to adoc from the module display page url
     path_to_adoc_file = display_module_page.get_path_to_adoc(self.driver)
     path = path_to_adoc_file + constants.path_for_module_type
     response = requests.get(url=url + path,
                             auth=(fixture.username, fixture.api_auth))
     check_that("Module type node in backend", response.status_code,
                equal_to(404))
예제 #11
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 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 filters_on_search_page(self):
     utilities.click_element(self.driver, By.CLASS_NAME,
                             locators.STATUS_FILTER_CLASS_NAME)
     utilities.click_element(self.driver, By.CLASS_NAME,
                             locators.DRAFT_STATUS_CLASS_NAME)
     check_that(
         "Draft Status filter chip is displayed on search page",
         utilities.find_element(
             self.driver, By.CLASS_NAME,
             locators.STATUS_TOOLBAR_CHIP_CLASS_NAME).is_displayed(),
         is_true())
     last_published_date_list = utilities.find_elements_by_XPATH(
         self.driver, locators.LAST_PUBLISHED_DATE_XPATH)
     published_date_list = []
     for i in last_published_date_list:
         published_date_list.append(i.text)
     for i in published_date_list:
         check_that(
             "Published date for all titles should be '-' when draft status filter is selected",
             i, contains_string("-"))
     utilities.click_element(self.driver, By.CSS_SELECTOR,
                             locators.CLEAR_ALL_FILTER_CSS)
     utilities.wait(1)
     search_beta_page.search_module_and_click(self.driver,
                                              constants.publish_module)
     utilities.wait(1)
     display_module_page.add_metadata_and_publish(self.driver)
     utilities.wait(2)
     utilities.click_element(self.driver, By.LINK_TEXT, "Search")
     search_beta_page.select_repo(self.driver, self.repo_name)
     utilities.wait(2)
     utilities.click_element(self.driver, By.CLASS_NAME,
                             locators.STATUS_FILTER_CLASS_NAME)
     utilities.click_element(self.driver, By.CLASS_NAME,
                             locators.PUBLISHED_STATUS_CLASS_NAME)
     utilities.wait(2)
     check_that(
         "Published module is filtered",
         utilities.get_text(self.driver, By.CSS_SELECTOR,
                            locators.FIRST_MODULE_LISTED_CSS),
         contains_string(constants.publish_module))
     check_that(
         "Green check is displayed for published module",
         utilities.find_element(
             self.driver, By.CLASS_NAME,
             locators.GREEN_CHECK_CLASS_NAME).is_displayed(), is_true())
     utilities.wait(3)
     utilities.click_element(self.driver, By.CSS_SELECTOR,
                             locators.CLEAR_ALL_FILTER_CSS)
     utilities.wait(1)
     utilities.click_element(self.driver, By.CLASS_NAME,
                             locators.CONTENT_TYPE_CLASS_NAME)
     utilities.click_element(
         self.driver, By.CLASS_NAME,
         locators.CONCEPT_CONTENT_TYPE_FILTER_CLASS_NAME)
     check_that(
         "Content Type filter chip is displayed on search page",
         utilities.find_element(
             self.driver, By.CLASS_NAME,
             locators.STATUS_TOOLBAR_CHIP_CLASS_NAME).is_displayed(),
         is_true())
     utilities.wait(3)
     check_that(
         "'Concept' content type filter is selected",
         utilities.get_text(self.driver, By.CSS_SELECTOR,
                            locators.FIRST_MODULE_LISTED_CSS),
         contains_string("Concept"))
     utilities.wait(1)
     utilities.click_element(
         self.driver, By.CLASS_NAME,
         locators.CONCEPT_CONTENT_TYPE_FILTER_CLASS_NAME)
     utilities.click_element(
         self.driver, By.CLASS_NAME,
         locators.PROCEDURE_CONTENT_TYPE_FILTER_CLASS_NAME)
     utilities.wait(3)
     check_that(
         "'Procedure' content type filter is selected",
         utilities.get_text(self.driver, By.CSS_SELECTOR,
                            locators.FIRST_MODULE_LISTED_CSS),
         contains_string("Procedure"))
     utilities.wait(1)
     utilities.click_element(
         self.driver, By.CLASS_NAME,
         locators.PROCEDURE_CONTENT_TYPE_FILTER_CLASS_NAME)
     utilities.click_element(
         self.driver, By.CLASS_NAME,
         locators.REFERENCE_CONTENT_TYPE_FILTER_CLASS_NAME)
     utilities.wait(3)
     check_that(
         "'Reference' content type filter is selected",
         utilities.get_text(self.driver, By.CSS_SELECTOR,
                            locators.FIRST_MODULE_LISTED_CSS),
         contains_string("Reference"))
     utilities.wait(2)
예제 #14
0
 def view_content_on_cp(self):
     # # try:
     test_repo_name = base.config_reader('test_repo', 'repo_name')
     utilities.click_element(self.driver, By.LINK_TEXT, "Search")
     utilities.wait(5)
     # 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)
     utilities.wait(5)
     try:
         adoc_file_path = display_module_page.get_path_to_adoc(self.driver)
         utilities.click_element(self.driver, By.CSS_SELECTOR,
                                 locators.VIEW_ON_PORTAL_LINK_CSS)
         utilities.switch_to_latest_tab(self.driver)
         utilities.wait(6)
         content_body_on_portal = self.driver.find_element_by_css_selector(
             locators.MODULE_BODY_ON_PORTAL_CSS)
         # Verify content displayed on CP
         check_that(
             "Module title is displayed",
             utilities.find_shadow_dom_element(
                 self.driver, locators.MODULE_TITLE_ON_PORTAL_CSS,
                 locators.MODULE_BODY_ON_PORTAL_CSS).get_attribute(
                     "textContent"), equal_to(constants.published_module))
         check_that(
             "Product name displayed on Customer Portal",
             utilities.find_shadow_dom_element(
                 self.driver, locators.CP_PRODUCT_NAME_CSS,
                 locators.MODULE_BODY_ON_PORTAL_CSS).get_attribute(
                     "textContent"), equal_to(constants.product_name))
         check_that(
             "Product version displayed on Customer Portal",
             utilities.find_shadow_dom_element(
                 self.driver, locators.CP_PRODUCT_VERSION_CSS,
                 locators.MODULE_BODY_ON_PORTAL_CSS).get_attribute(
                     "textContent"), equal_to(constants.product_version))
         legal_notice = utilities.find_shadow_dom_element(
             self.driver, locators.LEGAL_NOTICE_ON_PORTAL_CSS,
             locators.MODULE_BODY_ON_PORTAL_CSS)
         check_that(
             "legal notice is displayed at the bottom of preview page",
             legal_notice.get_attribute("textContent"),
             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))
         image = utilities.find_shadow_dom_element(
             self.driver, locators.IMAGE_CSS,
             locators.MODULE_BODY_ON_PORTAL_CSS)
         src = image.get_attribute("src")
         imageasset = urlparse(src)
         imageasset = imageasset.path.split("/")[2]
         cmd = "echo " + imageasset + "|base64 -d"
         try:
             # subprocess.check_call(cmd, shell=True)
             path = subprocess.getoutput(cmd)
             print("Image file path::", path)
             print("File name::", constants.image_file_name)
             print("Path to adoc::", adoc_file_path)
             p1 = os.path.split(adoc_file_path)
             image_file = "/" + p1[
                 0] + "/images/" + constants.image_file_name
             # image_file = "/content/repositories/" + test_repo_name + "/entities/enterprise/modules/images/" + constants.image_file_name
             check_that("Path to image1", path, equal_to(image_file))
         except subprocess.CalledProcessError as e:
             lcc.log_info("Unable to decode imageasset")
     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 upload_repo_again(self):
        lcc.log_info("Uploaded the repo again")
        os.chdir(fixture.project_dir_git)
        repo = Repo(fixture.project_dir_git)
        git = repo.git
        git.checkout("at-uploader2")
        subprocess.check_call(
            ('pantheon --user={} --password={} --server={} push'.format(
                uploader_username, uploader_password, url)),
            shell=True)
        # 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 + " 2")
        check_that(
            "Draft card is displayed",
            utilities.find_element(self.driver, By.CSS_SELECTOR,
                                   locators.DRAFT_CARD).is_displayed(),
            is_true())
        check_that(
            "Published card is displayed",
            utilities.find_element(self.driver, By.CSS_SELECTOR,
                                   locators.PUBLISHED_CARD).is_displayed(),
            is_true())

        # Modify the datetime string to be in same format as datetime.now()
        draft_date1 = (utilities.find_element(
            self.driver, By.CSS_SELECTOR,
            locators.UPLOAD_TIME_ON_DRAFT_CARD).text)
        draft_date2 = draft_date1.split("GMT")
        pub_date1 = (utilities.find_element(
            self.driver, By.CSS_SELECTOR,
            locators.UPLOAD_TIME_ON_PUBLISHED_CARD).text)
        pub_date2 = pub_date1.split("GMT")
        print("Date time now::", self.now)
        draft_date = datetime.strptime(draft_date2[0].strip(),
                                       '%a %b %d %Y %H:%M:%S')
        draft_date = draft_date.replace(tzinfo=pytz.utc)
        pub_date = datetime.strptime(pub_date2[0].strip(),
                                     '%a %b %d %Y %H:%M:%S')
        pub_date = pub_date.replace(tzinfo=pytz.utc)
        print("Type of date is now::", draft_date)
        lcc.log_info("pub_date::%s" % pub_date)
        lcc.log_info("draft_date::%s" % draft_date)

        check_that(
            "Draft text displayed on card",
            utilities.get_text(self.driver, By.CSS_SELECTOR,
                               locators.DRAFT_CARD_TITLE), equal_to("Draft"))
        check_that(
            "Published text displayed on card",
            utilities.get_text(self.driver, By.CSS_SELECTOR,
                               locators.PUBLISHED_CARD_TITLE),
            equal_to("Published"))
        check_that("Draft upload date in expected range",
                   self.check_date_in_range(draft_date), is_true())
        check_that("Uploaded date for published card in expected range",
                   self.check_date_in_range(pub_date), is_true())
        check_that(
            "Uploaded date for published card should be less than draft uploaded date",
            pub_date < draft_date, is_true())
        draft_card = utilities.find_element(self.driver, By.CSS_SELECTOR,
                                            locators.DRAFT_CARD)
        published_card = utilities.find_element(self.driver, By.CSS_SELECTOR,
                                                locators.PUBLISHED_CARD)
        check_that(
            "Add metadata link present of draft card",
            draft_card.find_element(
                By.XPATH, locators.ADD_METADATA_BUTTON_XPATH).is_displayed(),
            is_true())
        check_that(
            "Add metadata link present of published card",
            published_card.find_element(
                By.XPATH, locators.ADD_METADATA_BUTTON_XPATH).is_displayed(),
            is_true())
        check_that(
            "Preview link present of draft card",
            draft_card.find_element(
                By.CSS_SELECTOR,
                locators.MODULE_DISPLAY_PREVIEW_BUTTON_CSS).is_displayed(),
            is_true())
        check_that(
            "Preview link present of published card",
            published_card.find_element(
                By.CSS_SELECTOR,
                locators.MODULE_DISPLAY_PREVIEW_BUTTON_CSS).is_displayed(),
            is_true())
        check_that(
            "Publish button displayed on draft card",
            draft_card.find_element(
                By.ID,
                locators.MODULE_DISPLAY_PUBLISH_BUTTON_ID).is_displayed(),
            is_true())
        check_that(
            "Unpublish button displayed on published card",
            published_card.find_element(
                By.ID,
                locators.MODULE_DISPLAY_UNPUBLISH_BUTTON_ID).is_displayed(),
            is_true())
        check_that(
            "Attributes file path on draft card",
            draft_card.find_element(By.CSS_SELECTOR,
                                    locators.ATTRIBUTE_FILE_CSS).text,
            equal_to("enterprise/meta/attributes.adoc"))
        check_that(
            "Attributes file path on published card",
            published_card.find_element(By.CSS_SELECTOR,
                                        locators.ATTRIBUTE_FILE_CSS).text,
            equal_to("enterprise/meta/attributes.adoc"))
예제 #16
0
    def publish_module(self):
        utilities.click_element(self.driver, By.LINK_TEXT, "Search")
        utilities.page_reload(self.driver)
        # 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)
        utilities.wait(10)

        pre_live_url = utilities.find_element(self.driver, By.LINK_TEXT,
                                              "Pre-live Customer Portal URL")
        print(pre_live_url.get_attribute('href'))
        check_that("Pre-live URL link is displayed",
                   pre_live_url.is_displayed(), is_true())
        copy_pre_live_url = utilities.find_element(self.driver, By.LINK_TEXT,
                                                   "Copy pre-live URL")
        check_that("Copy Pre-live URL is displayed",
                   copy_pre_live_url.is_displayed(), is_true())

        utilities.click_element(self.driver, By.ID,
                                locators.MODULE_DISPLAY_PUBLISH_BUTTON_ID)
        utilities.wait(20)
        print("Clicked publish")
        # The page needs a refresh because of an existing bug about the "View on Customer Portal not appearing"
        self.driver.refresh()
        utilities.find_element(self.driver, By.PARTIAL_LINK_TEXT,
                               "View on Customer Portal")
        check_that(
            "Button contains text",
            utilities.get_text(self.driver, By.ID,
                               locators.MODULE_DISPLAY_UNPUBLISH_BUTTON_ID),
            contains_string("Unpublish"))
        check_that(
            "Button contains text",
            utilities.get_text(self.driver, By.CSS_SELECTOR,
                               locators.MODULE_DISPLAY_PREVIEW_BUTTON_CSS),
            contains_string("Preview"))
        check_that(
            "Copy permanent url link is displayed",
            utilities.get_text(self.driver, By.CSS_SELECTOR,
                               locators.COPY_URL_LINK_CSS),
            contains_string(constants.copy_url_link))
        check_that(
            "View on portal link is displayed",
            utilities.get_text(self.driver, By.CSS_SELECTOR,
                               locators.VIEW_ON_PORTAL_LINK_CSS),
            contains_string(constants.view_on_portal_link))

        # get UPLOADED date in variable and covert into desired format- (DD Month YYYY)
        self.first_pub_date_details_page = (utilities.get_text(
            self.driver, By.CSS_SELECTOR,
            locators.FIRST_PUB_DATE_MODULE_PAGE_CSS))
        lcc.log_info("captured 1st published date from module info page : " +
                     self.first_pub_date_details_page)

        # get published date in variable and convert into desired format-(DD Month YYYY)
        self.last_pub_date_details_page = (utilities.get_text(
            self.driver, By.CSS_SELECTOR,
            locators.LAST_PUB_DATE_MODULE_PAGE_CSS))
        lcc.log_info("captured last published date from module info page : " +
                     test_publish_module.last_pub_date_details_page)

        # adding checks if the module is displayed on the UI
        utilities.click_element(self.driver, By.CSS_SELECTOR,
                                locators.VIEW_ON_PORTAL_LINK_CSS)
        utilities.wait(5)
        try:
            utilities.switch_to_latest_tab(self.driver)
            utilities.wait(10)
            check_that("View on Portal URL path", self.driver.current_url,
                       contains_string(constants.view_on_portal_page_url))
        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 modules_bulk_edit_metadata(self):
     utilities.click_element(self.driver, By.LINK_TEXT,
                             locators.MENU_SEARCH_PAGE_LINK_TEXT)
     utilities.page_reload(self.driver)
     search_beta_page.select_repo(self.driver, fixture.repo_name)
     search_beta_page.search_titles(self.driver,
                                    constants.bulk_operations_modules)
     poll(lambda: len(
         utilities.find_elements_by_css_selector(self.driver, locators.
                                                 MODULES_LIST_CSS)) == 4,
          ignore_exceptions=[NoSuchElementException],
          timeout=5,
          step=0.5)
     utilities.click_element(self.driver, By.XPATH,
                             locators.MODULES_SELECT_ALL_TITLE_XPATH)
     bulk_edit_metadata = utilities.find_element(
         self.driver, By.XPATH, locators.BULK_EDIT_METADATA_XPATH)
     bulk_publish = utilities.find_element(self.driver, By.CSS_SELECTOR,
                                           locators.BULK_PUBLISH_CSS)
     bulk_unpublish = utilities.find_element(self.driver, By.CSS_SELECTOR,
                                             locators.BULK_UNPUBLISH_CSS)
     check_that("Edit metadata button is enabled after selecting modules",
                bulk_edit_metadata.get_attribute("aria-disabled"),
                equal_to("false"))
     check_that("Publish button is enabled after selecting modules",
                bulk_publish.get_attribute("aria-disabled"),
                equal_to("false"))
     check_that("Unpublish button is enabled after selecting modules",
                bulk_unpublish.get_attribute("aria-disabled"),
                equal_to("false"))
     bulk_edit_metadata.click()
     check_that(
         "Edit metadata modal title",
         utilities.get_text(self.driver, By.CSS_SELECTOR,
                            locators.EDIT_METADATA_MODAL_TITLE),
         equal_to("Edit Metadata"))
     check_that(
         "Count of selected titles",
         utilities.get_text(self.driver, By.ID,
                            locators.SELECTED_MODULES_COUNT_ID),
         contains_string("4"))
     search_beta_page.add_bulk_metadata(self.driver)
     poll(lambda: utilities.get_text(self.driver, By.CSS_SELECTOR, locators.
                                     PROGRESS_SUCCESS_STATUS) == "100%",
          ignore_exceptions=[NoSuchElementException],
          timeout=20,
          step=1)
     utilities.wait(3)
     utilities.click_element(self.driver, By.XPATH,
                             locators.VIEW_DETAILS_LINK)
     utilities.wait(3)
     modules_updated = utilities.find_elements_by_css_selector(
         self.driver, locators.UPDATED_TITLES_LIST_CSS)
     check_that("Count of successfully updated modules",
                len(modules_updated), equal_to(4))
     check_that(
         "Skipped modules section text",
         utilities.get_text(self.driver, By.CSS_SELECTOR,
                            locators.SKIPPED_TITLE_LIST_CSS),
         equal_to("n/a"))
     check_that(
         "Failed modules section text",
         utilities.get_text(self.driver, By.CSS_SELECTOR,
                            locators.FAILED_TITLES_LIST_CSS),
         equal_to("n/a"))
     utilities.click_element(self.driver, By.XPATH,
                             locators.CLOSE_DETAILS_XPATH)
     utilities.click_element(self.driver, By.CSS_SELECTOR,
                             locators.CLOSE_STATUS_ALERT)