def test_check_help_page_correctly(core_admin_ui): """ test case: C1664 :param core_session: Centrify session :param core_admin_ui: Creates random user and login in browser. """ ui = core_admin_ui ui.navigate("Settings", "Resources", "Password Profiles") # Clicking the 'Learn More' link in the Password profiles page. ui.expect(Anchor(button_text="Learn more"), "expecting a like named 'Learn more'", time_to_wait=20).try_click() logger.info("Clicked the Learn More link in the password profiles page") ui.switch_to_newest_tab() ui.expect(PageWithTitle("Configuring password profiles"), "Page with title 'Configuring password profiles'") logger.info("Verifying the page title appeared") ui.switch_to_main_window() # Clicking the 'Learn More' link in the Security Settings page. ui.navigate("Settings", "Resources", "Security", "Security Settings") ui.expect(Anchor(button_text="Learn more"), "expecting a link named 'Learn more'", time_to_wait=20).try_click( Label("SSH Gateway Banner")) logger.info("Clicked the Learn More link in the Security Settings page") ui.switch_to_newest_tab() ui.expect(PageWithTitle("Setting global security options"), "Page with title 'Setting global security options'") logger.info("Verifying the page title appeared") # Checking the password profile help page. ui.expect(Anchor(href="Password-profiles.htm"), "Expecting password profile page", time_to_wait=20).try_click( Header("Setting global security options")) logger.info("Clicking the password profile help page") ui.switch_to_newest_tab() ui.expect(PageWithTitle("Password profiles"), "Page with title 'Password profiles'") logger.info("Verifying the page title appeared")
def test_login_ui_protected_from_xss(setup_login_strings, core_session_unauthorized, core_tenant, login_ui): document_contents = core_session_unauthorized.get('/login').text logger.info(document_contents) custom_link_title_1, custom_link_title_2, login_sample_text, login_banner_message = setup_login_strings # Checks embedded authdata/serverconfig encoding as well as the eventual dom rendering. # JSON encoding should be \" and html encoding should be " assert document_contents.find( custom_link_title_1 ) == -1, f'Found un-encoded custom link title which can lead to a login attack.' assert document_contents.find( custom_link_title_2 ) == -1, f'Found un-encoded custom link title which can lead to a login attack.' json_encoded_title_1 = custom_link_title_1.replace('"', '\\"') json_encoded_title_2 = custom_link_title_1.replace('"', '\\"') assert document_contents.find( json_encoded_title_1 ) > -1, f'Could not find properly json encoded custom link title which can lead to a login attack.' assert document_contents.find( json_encoded_title_2 ) > -1, f'Could not find properly json encoded custom link title which can lead to a login attack.' # one would think the xpath should have the html encoded entity but apparently not - the browser and Selenium conspire to make that not work, # even though the JavaScript is actually embedding an html entity properly login_ui.expect( Selector(By.XPATH, f"//a[text()='{custom_link_title_1}']"), f'Could not find properly html encoded custom link 1 title') login_ui.expect( Selector(By.XPATH, f"//a[text()='{custom_link_title_2}']"), f'Could not find properly html encoded custom link 2 title') login_ui.expect( Selector(By.XPATH, f"//label[text()='{login_banner_message}']"), f'Could not find login banner message') login_name_field = Selector( By.XPATH, f"//input[contains(@placeholder , '{login_sample_text}')]") continue_button = login_ui.expect( Selector(By.XPATH, f"//button[text()='Continue']"), 'Could not find continue button') continue_button.try_click(login_name_field) terms_of_use_link = login_ui.expect(Anchor(text="Terms of Use"), f'Could not find terms of use link') terms_of_use_link.try_click() fixed_xss_attack = xss_attack_for_urls.replace('JavascripT:', '') fixed_xss_url = f'https://{core_tenant["fqdn"]}/{fixed_xss_attack}' logger.info(f'Expecting de-fanged xss url to be {fixed_xss_url}') login_ui.wait_for_tab_with_url(fixed_xss_url) login_ui.browser.close() login_ui.switch_first_tab() privacy_policy_link = login_ui.expect(Anchor(text="Privacy Policy"), f'Could not find terms of use link') privacy_policy_link.try_click() login_ui.wait_for_tab_with_url(fixed_xss_url)
def test_only_support_select_statement_when_create_report_using_sql_script( core_session, create_report, core_admin_ui): """ TCID: C6368 Cannot create report using other sql statement (delete/update/create...) except "select" :param core_session: Centrify Session :param create_report: To Create the report :param core_admin_ui: To open the browser """ my_report = create_report(core_session, "Select * From Role") core_admin_ui.navigate("Reports") core_admin_ui.check_row(my_report['Name']) core_admin_ui.action("Modify") core_admin_ui.clear_codemirror() core_admin_ui.write_to_codemirror("Delete role") core_admin_ui.expect(Anchor(button_text="Save"), f'Failed to get the save button').try_click() core_admin_ui._waitUntilSettled() core_admin_ui.expect(ErrorModal(), f'Failed to get the error modal') core_admin_ui.switch_context(Modal()) core_admin_ui.expect( Div("Query has failed:"), f'Failed to get expected error "Query has failed:xxx"') logger.info( f'It supports ONLY the "SELECT" SQL statement, and complies to the syntax that SQLite supports.' f' Please refer to http://www.sqlite.org/lang_select.html for the details.' )
def test_cannot_create_folder_with_invalid_name(core_admin_ui): """ TCID: #C6364 Cannot create folder with invalid folder name :param core_admin_ui: To open the browser """ ui = core_admin_ui ui.navigate("Reports") ui.expect_disappear(LoadingMask(), 'Reports page did not load properly') ui.expect(TreeFolder("My Reports"), "Unable to find My Reports Tab under Reports") ui.right_click_action(TreeFolder("My Reports"), "New folder") # 1st Case folder_name = "<new_folder>" ui.switch_context(Modal("Create new folder")) ui.input('file-name', folder_name) ui.expect(Anchor(button_text="Save"), "Folder Name is created").try_click() alert_text = "The report name can include alpha numeric and special characters " ui.expect(InvalidInputAlert(alert_text), "Invalid Input alert tooltip appears") logger.info(f'Invalid file name') # 2nd Case folder_name = ' ' ui.input('file-name', folder_name) ui.expect(Anchor(button_text="Save"), "Failed to find the save button").try_click() ui.expect(WarningModal(), "Folder is created with space") logger.info(f'Invalid file name') ui.switch_context(WarningModal()) ui.button("Close") ui.remove_context() # 3rd Case folder_name = " name" ui.input('file-name', folder_name) ui.expect(Anchor(button_text="Save"), "Failed to find the save button").try_click() ui.expect(WarningModal(), "Folder is created space with name") logger.info(f'Invalid file name') ui.switch_context(WarningModal()) ui.button("Close") ui.remove_context() ui.close_modal("Cancel")
def test_cannot_create_report_with_invalid_name(core_admin_ui): """ TCID: C6363 Cannot create report with invalid report name :param core_admin_ui: To open the browser """ core_admin_ui.navigate("Reports") core_admin_ui.launch_add("New Report", HeaderNameInput()) core_admin_ui.launch_modal("Edit Script", modal_selector=ConfirmModal()) core_admin_ui._waitUntilSettled() core_admin_ui.close_modal('Yes') report_name = "<>" core_admin_ui.input("header-edit-input", report_name) core_admin_ui.write_to_codemirror("Select Server.Name From Server") core_admin_ui.expect(Anchor(button_text="Save"), "Failed to find the save button").try_click() core_admin_ui.expect(WarningModal(), f'Report got saved') logger.info(f'Invalid file name') core_admin_ui.switch_context(WarningModal()) core_admin_ui.button("Close") core_admin_ui.remove_context() report_name = " " core_admin_ui.input("header-edit-input", report_name) core_admin_ui.expect(Anchor(button_text="Save"), "Failed to find the save button").try_click() core_admin_ui.expect(WarningModal(), f'Report got saved') logger.info(f'Invalid file name') core_admin_ui.switch_context(WarningModal()) core_admin_ui.button("Close") core_admin_ui.remove_context() report_name = " name" core_admin_ui.input("header-edit-input", report_name) core_admin_ui.expect(Anchor(button_text="Save"), "Failed to find the save button").try_click() core_admin_ui.expect(WarningModal(), f'Report got saved') logger.info(f'Invalid file name') core_admin_ui.switch_context(WarningModal()) core_admin_ui.button("Close") core_admin_ui.remove_context()
def test_check_safenet(core_admin_ui): """ Test Case ID: C1729 :param core_admin_ui: Authenticates Centrify UI session """ # Navigating to the Password Storage page and checking the tooptip and help pages. ui = core_admin_ui ui.navigate("Settings", "Resources", "Password Storage", check_rendered_tab=False) # Clicking the help tooltip at the begin of the page. ui.expect(Span(text="?"), 'tooltip ? to be enabled').try_click(Span(text="Migrate Passwords")) ui.switch_to_newest_tab() ui.expect(PageWithTitle("Configuring password storage"), "Expecting a new page with title 'Configuring password storage'") logger.info("Title with the page 'Configuring password storage' loaded successfully'") ui.switch_to_main_window() ui.switch_context(ActiveMainContentArea()) # Clicking the Learn more link in the password storage page. ui.expect(Anchor(button_text="Learn more"), "expecting a link named 'Learn more'").try_click( Span(text="Migrate Passwords")) ui.switch_to_newest_tab() ui.expect(PageWithTitle("Configuring password storage"), "Expecting a new page with title 'Configuring password storage'") logger.info("Title with the page 'Configuring password storage' loaded successfully'") ui.switch_to_main_window() ui.navigate("Settings", "Resources", ("SafeNet KeySecure Configuration", "SafeNet KeySecure Configuration")) # Clicking the Learn more link in the SafeNet KeySecure Configuration page. ui.expect(Anchor(button_text="Learn more"), "expecting a link named 'Learn more'").try_click( Div(text="SafeNet KeySecure Configuration")) ui.switch_to_newest_tab() ui.expect(PageWithTitle("Configuring communication with SafeNet KeySecure"), "Expecting a new page with title 'Configuring communication with SafeNet KeySecure'") logger.info("Title with the page 'Configuring communication with SafeNet KeySecure' loaded successfully'")
def test_cannot_copy_report_to_invalid_report_name(core_session, create_report, core_admin_ui, cleanup_reports): """ TCID C6365: Cannot copy report to a invalid report name :param core_session: Centrify Authentication Session :param create_report: Fixture to create the report :param core_admin_ui: To Open the browser :param cleanup_reports: Fixture to clean the reports """ # As per the test case: Need 2 reports my_report = [] for i in range(2): my_report.append(create_report(core_session, "Select Name From Server")) report_1 = my_report[0]['Name'] report_2 = my_report[1]['Name'] logger.info(f'Successfully created reports are:{my_report}') ui = core_admin_ui ui.navigate("Reports") ui.check_row(report_1) ui.check_row(report_2) ui.check_actions(['Delete']) logger.info("No copy action in list (cannot copy two reports one time)") ui.navigate("Reports") ui.check_row(report_1) ui.action("Copy") modal = "Copy : Copy" + ' ' + report_1 move_modal = Modal(modal) ui.switch_context(move_modal) ui.input("file-name", "<>") ui.expect(Anchor(button_text="Save File"), "Failed to find the Save File button").try_click() alert_text = "The report name can " \ "include alpha numeric and special characters " ui.expect(InvalidInputAlert(alert_text), "Did not display warning icon").mouse_hover() ui.expect(WarningModal(), f'Did not populate the warning modal') logger.info("Display warning icon") for i in range(len(my_report)): cleanup_reports.append(my_report[i]['Path'])
def test_cannot_export_report_with_invalid_name(core_session, create_report, core_admin_ui): """ TCID: C6366 Cannot export report with invalid file name :param core_session: Centrify Session :param create_report: To create the report :param core_admin_ui: To Open the browser """ my_report = create_report(core_session, "Select Name From Server") report_name = my_report['Name'] ui = core_admin_ui ui.navigate("Reports") ui.check_row(report_name) ui.action("Export Report") modal = "Export Report" ui.switch_context(Modal(modal)) ui.input("fileName", "<123#") ui.expect(Anchor(button_text="OK"), "Button is not present").try_click() ui.expect(WarningModal(), "No warning message for incorrect file name") logger.info(f'Invalid file name')
def test_cannot_export_report_with_invalid_name(core_session, create_report, core_admin_ui): """ TCID: C6367 Cannot email report to a invalid email address :param core_session: Centrify Session :param create_report: To create the report :param core_admin_ui: To open the browser """ my_report = create_report(core_session, "Select Name From Server") report_name = my_report['Name'] ui = core_admin_ui ui.navigate("Reports") ui.check_row(report_name) ui.action("Email Report") modal = "Email Report" ui.switch_context(Modal(modal)) ui.input("emailTo", "<123#") ui.expect(Anchor(button_text="OK"), "Button is not present").try_click() ui.expect(WarningModal(), "Failed to get any warning message (Modal)") logger.info(f'Email is Invalid')
def test_ui_check_job_details_page(core_session, core_admin_ui, list_of_created_systems): """ Test case: C1674 :param core_session: Returns API session :param core_admin_ui: Centrify admin Ui session :param list_of_created_systems: returns the empty systems list. """ account_name_prefix = f'account_test{guid()}' # adding multiple systems with accounts result = ResourceManager.add_multiple_systems_with_accounts(core_session, 1, 1, list_of_created_systems, user_prefix=account_name_prefix) # arranging the results in the lists all_systems, all_accounts = DataManipulation.aggregate_lists_in_dict_values([result]) # Deleting systems for creating bulk delete scheduled report result_acc, success_acc = ResourceManager.del_multiple_accounts(core_session, all_accounts) assert success_acc, f"Api did not complete successfully for bulk account delete MSG:{result_acc}" # Deleting accounts for creating bulk delete scheduled report result, success = ResourceManager.del_multiple_systems(core_session, all_systems) assert success, f'Delete systems job failed when expected success' logger.info(f"Delete systems job executed successfully {result}") # Going to password storage page and click on migration job status link. ui = core_admin_ui ui.navigate("Settings", "Resources", "Password Storage", check_rendered_tab=False) ui.expect(Anchor("View Migration Job Status and Reports "), "Clicking migration job status").try_click( Span(text="Type")) ui.switch_to_newest_tab() ui._waitUntilSettled() ui.click_row(GridRowByGuid(result)) ui.expect(Span("Details"), "Clicking migration job status").try_click(Div("Job Details")) ui.expect_value(Div(result), value=None, expected_value=result, wrong_value_message="expected id value is not matched in the report", text=True) logger.info("Id value in the Job description appeared correctly")
def test_check_next_button_on_add_system_wizard(core_admin_ui): """ TC:C2181 Check Next button on Add system wizard. :param core_admin_ui: Return a browser session. """ # UI Launch. ui = core_admin_ui ui.navigate('Resources', 'Systems') sys_name = "test_ui_sys_creation_name" + guid() sys_fqdn = "fqdn" + guid() ui.navigate('Resources', 'Systems') ui.launch_modal('Add System') ui.input("Name", sys_name) ui.input("FQDN", sys_fqdn) ui.step('Next >') ui.step('Next >') ui.check('SetupProxyAccount') proxy_user = "******" + guid() proxy_password = "******" + guid() ui.input("ProxyUser", proxy_user) ui.input("ProxyUserPassword", proxy_password) next_button_enabled = ui.check_exists(Anchor(button_text="Next >")) assert next_button_enabled, "Next button is not Enabled" logger.info("Next button enabled successfully")
def test_check_min_max_hint_messages(core_admin_ui): """ Test case: C1654 :param core_admin_ui: Centrify admin Ui session """ ui = core_admin_ui ui.navigate("Settings", "Resources", "Password Profiles") ui.launch_modal("Add", modal_title="Password Complexity Profile") profile_name = f'testprofilename{guid()}' profile_description = "Test Description" ui.input("Name", profile_name) ui.input("Description", profile_description) ui.input("MinimumPasswordLength", 24) ui.input("MaximumPasswordLength", 12) ui.check("ConsecutiveCharRepeatAllowed") ui.check("undefined") ui.input("MaximumCharOccurrenceCount", 3) ui.check("undefined") ui.check("undefined") ui.input("MinimumAlphabeticCharacterCount", 2) ui.input("MinimumNonAlphabeticCharacterCount", 2) ui.button("Save") expected_password_length_error = "Maximum password length should not be less than minimum password length." ui.expect_value(Div( "Maximum password length should not be less than minimum password length." ), value='value', expected_value=expected_password_length_error, wrong_value_message= "Maximum password length error popup not appeared", text=True) ui.expect(Anchor(button_text="Close"), "Error popup appears").try_click( expected_selector=Span("Password Complexity Profile")) # Checking Minimum Password Length field with Minimum and Maximum values. ui.input("MinimumPasswordLength", 3) min_pass_error = ui.check_tooltip_error( "The minimum value for this field is 4") assert min_pass_error, "Error tooltip not appeared" logger.info( "Hint message appeared as 'The minimum value for this field is 4'") ui.input("MinimumPasswordLength", 129) min_pass_error_len = ui.check_tooltip_error( "The maximum value for this field is 128") assert min_pass_error_len, "Error tooltip not appeared" logger.info( "Hint message appeared as 'The maximum value for this field is 128'") ui.input("MinimumPasswordLength", 4567) min_pass_error_len_max = ui.check_tooltip_error( "The maximum length for this field is 3</li><li>The maximum value for this field is 128" ) assert min_pass_error_len_max, "Error tooltip not appeared" logger.info( "Hint message appeared as 'The maximum length for this field is 3</li><li>The maximum value for this field is 128'" ) ui.input("MinimumPasswordLength", 33) # Checking Maximum Password Length field with Minimum and Maximum values. ui.input("MaximumPasswordLength", 3) max_pass_error = ui.check_tooltip_error( "The minimum value for this field is 8") assert max_pass_error, "Error tooltip not appeared" logger.info( "Hint message appeared as 'The minimum value for this field is 8'") ui.input("MaximumPasswordLength", 129) max_pass_error_len = ui.check_tooltip_error( "The maximum value for this field is 128") assert max_pass_error_len, "Error tooltip not appeared" logger.info( "Hint message appeared as 'The maximum value for this field is 128'") ui.input("MaximumPasswordLength", 4567) max_pass_error_len_max = ui.check_tooltip_error( "The maximum length for this field is 3</li><li>The maximum value for this field is 128" ) assert max_pass_error_len_max, "Error tooltip not appeared" logger.info( "Hint message appeared as 'The maximum length for this field is 3</li><li>The maximum value for this field is 128'" ) ui.input("MaximumPasswordLength", 45) # Checking Special Characters with Valid and Invalid values ui.input("SpecialCharSet", r"!#$%&()*+,-./:;<=>?@[\]^_{|}~") ui.input("SpecialCharSet", "`") special_char_error = ui.check_tooltip_error( r"Special characters are limited to the following: !#$%&()*+,-./:;<=>?@[\]^_{|}~ and characters cannot be repeated" ) assert special_char_error, "Error tooltip not appeared" logger.info( r"Hint message appeared as 'Special characters are limited to the following: {!#$%&()*+,-./:;<=>?@[\]^_{|}~} and characters cannot be repeated'" ) ui.input("SpecialCharSet", r"!#$%&()*+,-./:;<=>?@[\]^_{|}~!#") special_char_repeate_error = ui.check_tooltip_error( r"Special characters are limited to the following: !#$%&()*+,-./:;<=>?@[\]^_{|}~ and characters cannot be repeated" ) assert special_char_repeate_error, "Error tooltip not appeared" logger.info( r"Hint message appeared for repeate as 'Special characters are limited to the following: {!#$%&()*+,-./:;<=>?@[\]^_{|}~} and characters cannot be repeated'" ) ui.input("SpecialCharSet", r"!#$%&()*+,-./:;<=>?@[\]^_{|}~") # Checking Minimum number of Alpha characters count ui.input("MinimumAlphabeticCharacterCount", 0) min_alpha_char = ui.check_tooltip_error( "The minimum value for this field is 1") assert min_alpha_char, "Error tooltip not appeared" logger.info( "Hint message appeared as 'The minimum value for this field is 1'") ui.input("MinimumAlphabeticCharacterCount", 129) min_alpha_char_len = ui.check_tooltip_error( "The maximum value for this field is 128") assert min_alpha_char_len, "Error tooltip not appeared" logger.info( "Hint message appeared as 'The maximum value for this field is 128'") ui.input("MinimumAlphabeticCharacterCount", 1294) min_alpha_char_len_max = ui.check_tooltip_error( "The maximum length for this field is 3</li><li>The maximum value for this field is 128" ) assert min_alpha_char_len_max, "Error tooltip not appeared" logger.info( "Hint message appeared as 'The maximum length for this field is 3</li><li>The maximum value for this field is 128'" ) ui.input("MinimumAlphabeticCharacterCount", 12) # Checking Minimum number of non Alpha characters count values ui.input("MinimumNonAlphabeticCharacterCount", 0) min_non_alpha_char = ui.check_tooltip_error( "The minimum value for this field is 1") assert min_non_alpha_char, "Error tooltip not appeared" logger.info( "Hint message appeared as 'The minimum value for this field is 1'") ui.input("MinimumNonAlphabeticCharacterCount", 129) min_non_alpha_char_len = ui.check_tooltip_error( "The maximum value for this field is 128") assert min_non_alpha_char_len, "Error tooltip not appeared" logger.info( "Hint message appeared as 'The maximum value for this field is 128'") ui.input("MinimumNonAlphabeticCharacterCount", 1294) min_non_alpha_char_len_max = ui.check_tooltip_error( "The maximum length for this field is 3</li><li>The maximum value for this field is 128" ) assert min_non_alpha_char_len_max, "Error tooltip not appeared" logger.info( "Hint message appeared as 'The maximum value for this field is 128'") ui.input("MinimumNonAlphabeticCharacterCount", 12) # Checking Maximum Character Occurrence Count values ui.input("MaximumCharOccurrenceCount", 0) max_char_occurence = ui.check_tooltip_error( "The minimum value for this field is 1") assert max_char_occurence, "Error tooltip not appeared" logger.info( "Hint message appeared as 'The minimum value for this field is 1'") ui.input("MaximumCharOccurrenceCount", 129) max_char_occurence_len = ui.check_tooltip_error( "The maximum value for this field is 128") assert max_char_occurence_len, "Error tooltip not appeared" logger.info( "Hint message appeared as 'The maximum value for this field is 128'") ui.input("MaximumCharOccurrenceCount", 1294) max_char_occurence_len_max = ui.check_tooltip_error( "The maximum length for this field is 3</li><li>The maximum value for this field is 128" ) assert max_char_occurence_len_max, "Error tooltip not appeared" logger.info( "Hint message appeared as 'The maximum length for this field is 3</li><li>The maximum value for this field is 128'" ) ui.input("MaximumCharOccurrenceCount", 12)
def test_learn_more_help_check_for_secrets(core_admin_ui, added_secrets): """ C2940: test method to login with cloud admin & click on Secrets 1) Settings tab, click "Learn more", check pop-up help page should display 2) Policy tab, click "Learn more", check pop-up help page should display 3) Activity tab, click "Learn more", check pop-up help page should display 4) Permissions tab, click "Learn more", check pop-up help page should display :param core_admin_ui: Fixture to launch the browser with cloud admin :param added_secrets: Fixture to add text type secrets & yields secret related details """ added_text_secret_id, added_text_secret_name = added_secrets ui = core_admin_ui ui.navigate('Resources', 'Secrets') ui.search(added_text_secret_name) ui.expect( Div(added_text_secret_name), expectation_message= 'Expecting to find {added_text_secret_name} but did not ').try_click() link_selector = Anchor(button_text='Learn more') link_clicked = ui.expect(link_selector, expectation_message="Learn more Link to click") link_clicked.try_click() ui.switch_to_pop_up_window() permissions_pop_up = ui.check_exists( Header('Setting secret, folder, and set permissions')) assert permissions_pop_up, f'Failed to verify the {permissions_pop_up}' logger.info(f'Permissions pop up loading successful:{permissions_pop_up}') ui.close_browser() ui.switch_to_main_window() ui.tab('Settings') link_selector = Anchor(button_text='Learn more') link_clicked = ui.expect(link_selector, expectation_message="Learn more Link to click") link_clicked.try_click() ui.switch_to_newest_tab() settings_pop_up = ui.check_exists(Header('Viewing and changing settings')) assert settings_pop_up, f'Failed to verify the {settings_pop_up}' logger.info(f'Settings pop up loading Successful:{settings_pop_up}') ui.close_browser() ui.switch_to_main_window() ui.tab('Policy') link_selector = Anchor(button_text='Learn more') link_clicked = ui.expect(link_selector, expectation_message="Learn more Link to click") link_clicked.try_click() ui.switch_to_newest_tab() policy_pop_up = ui.check_exists( Header('Setting access challenge policies')) assert policy_pop_up, f'Failed to verify the {policy_pop_up}' logger.info(f'Policy pop up loading Successful:{policy_pop_up}') ui.close_browser() ui.switch_to_main_window() ui.tab('Activity') link_selector = Anchor(button_text='Learn more') link_clicked = ui.expect(link_selector, expectation_message="Learn more Link to click") link_clicked.try_click() ui.switch_to_newest_tab() activity_pop_up = ui.check_exists( Header('Viewing activity for a secret or folder')) assert activity_pop_up, f'Failed to verify the {activity_pop_up}' logger.info(f'Activity pop up loading Successful:{activity_pop_up}') ui.close_browser() ui.switch_to_main_window()
def test_check_help_page(add_database_with_account, core_admin_ui): """ Test case: C1162 :param core_session: Centrify authenticated session :param add_database_with_account: fixture to create database with account as optional :param core_admin_ui: Centrify admin ui session """ db_name, db_id, db_account_id, db_data, database_cleaner_list, account_cleaner_list = \ add_database_with_account(db_class='oracle', add_account=False) ui = core_admin_ui ui.navigate('Resources', 'Databases') ui.search(db_name) ui.click_row(GridRowByGuid(db_id)) ui.tab('Settings') ui.switch_context(ActiveMainContentArea()) ui.expect(Anchor(button_text='Learn more'), expectation_message="Learn more Link to click").try_click() logger.info('Located "Learn More" span and clicked on it.') ui.wait_for_tab_with_name('Changing database settings') ui.switch_context(ActiveMainContentArea()) ui.expect( Header('Changing database settings'), 'Expected to find the header with title ' '"Changing database settings"') logger.info('Changing database settings help page pop up') ui.switch_first_tab() ui.tab('Accounts') ui.switch_context(ActiveMainContentArea()) ui.expect(Anchor(button_text='Learn more'), expectation_message="Learn more Link to click").try_click() logger.info('Located "Learn More" span and clicked on it.') ui.wait_for_tab_with_name('Adding database accounts') ui.switch_context(ActiveMainContentArea()) ui.expect( Header('Adding database accounts'), 'Expected to find the header with title ' '"Adding database accounts"') logger.info('Adding database accounts help page pop up') ui.switch_first_tab() ui.tab('Activity') ui.switch_context(ActiveMainContentArea()) ui.expect(Anchor(button_text='Learn more'), expectation_message="Learn more Link to click").try_click() logger.info('Located "Learn More" span and clicked on it.') ui.wait_for_tab_with_name('Viewing activity for a database') ui.switch_context(ActiveMainContentArea()) ui.expect( Header('Viewing activity for a database'), 'Expected to find the header with title ' '"Viewing activity for a database"') logger.info('Viewing activity for a database help page pop up') ui.switch_first_tab() ui.tab('Permissions') ui.switch_context(ActiveMainContentArea()) ui.expect(Anchor(button_text='Learn more'), expectation_message="Learn more Link to click").try_click() logger.info('Located "Learn More" span and clicked on it.') ui.wait_for_tab_with_name('Setting database-specific permissions') ui.switch_context(ActiveMainContentArea()) ui.expect( Header('Setting database-specific permissions'), 'Expected to find the header with title ' '"Setting database-specific permissions"') logger.info('Setting database-specific permissions help page pop up')
def test_ui_check_job_details_page_values(core_session, core_admin_ui, list_of_created_systems): """ Test case: C1670 :param core_session: Returns API session :param core_admin_ui: Centrify admin Ui session :param list_of_created_systems: returns the empty systems list. """ account_name_prefix = f'account_test{guid()}' # adding multiple systems with accounts result = ResourceManager.add_multiple_systems_with_accounts(core_session, 1, 1, list_of_created_systems, user_prefix=account_name_prefix) # arranging the results in the lists all_systems, all_accounts = DataManipulation.aggregate_lists_in_dict_values([result]) # Deleting systems for creating bulk delete scheduled report result_acc, success_acc = ResourceManager.del_multiple_accounts(core_session, all_accounts) assert success_acc, f"Api did not complete successfully for bulk account delete MSG:{result_acc}" # Deleting accounts for creating bulk delete scheduled report result_sys, success = ResourceManager.del_multiple_systems(core_session, all_systems) assert success, f'Delete systems job failed when expected success' logger.info(f"Delete systems job executed successfully {result_sys}") # Going to password storage page and click on migration job status link. ui = core_admin_ui ui.navigate("Settings", "Resources", "Password Storage", check_rendered_tab=False) ui.expect(Anchor("View Migration Job Status and Reports "), "Clicking migration job status").try_click() ui.switch_to_newest_tab() ui._waitUntilSettled() ui.click_row(GridRowByGuid(result_sys)) ui.expect(Span("Details"), "Clicking migration job status").try_click(Div("Job Details")) # Checking the Job Id of system. ui.expect_value(Div(result_sys), value=None, expected_value=result_sys, wrong_value_message="expected id value is not matched in the report", text=True) logger.info("Id value in the Job description appeared correctly") # List of the Expected text from Job Details list_of_text = ['Job Information', 'Type', 'ID', 'Description', 'Submitted', 'Started', 'Completed', 'Retry Count', 'Items Synced', 'Items Failed'] # Getting the Job history job_history = JobManager.get_job_history(core_session) # Validating the Job history expected title appeared correctly on UI. for label in list_of_text: ui.expect_value(Label(label), value=None, expected_value=label, wrong_value_message=f"expected {label} value is not matched in the report", text=True) logger.info(f"expected {label} value is matched in the report") delete_scheduled_job = [] check_text = [] if job_history[1]['JobName'] == 'BulkSystemDelete': account_bulk_delete_schedule_id = job_history[0]['ID'] System_bulk_delete_schedule_id = job_history[1]['ID'] System_jobdescription = job_history[1]['JobDescription'] System_jobName = job_history[1]['JobName'] check_text.append(System_bulk_delete_schedule_id) check_text.append(System_jobdescription) check_text.append(System_jobName) check_text.append(account_bulk_delete_schedule_id) delete_scheduled_job.append(System_bulk_delete_schedule_id) ui.switch_context(RenderedTab("Job Details")) # Validating the Job history results from API appeared correctly on UI. for text in check_text: ui.expect_value(Div(text), value=None, expected_value=text, wrong_value_message=f"expected {text} value is not matched in the report", text=True) logger.info(f"expected {text} value is matched in the report") # Deleting the Scheduled jobs of Bulk System's and Account's for delete in delete_scheduled_job: result_account_delete, success, response = Discovery.delete_job_history(core_session, delete) assert success, f"Failed to delete Job history profile {result_account_delete}" logger.info(f"delete Job history profile with id {delete} successful {success}")