def test_check_save_advanced_without_set_value(core_session, core_admin_ui): """ C1578 : Check save advanced without set value :param core_session: Authenticated Centrify Session. :param core_admin_ui: Authenticated Centrify Browser Session. :return: """ # Navigating to Advanced tab domain_details = ResourceManager.get_domains(core_session) core_admin_ui.navigate('Resources', 'Domains') core_admin_ui.click_row(GridRow(domain_details[0][0]['DomainName'])) core_admin_ui.tab('Advanced') logger.info("Navigated to Resource -> Domain -> Advanced tab") expected_alert_message = "Please correct the errors in your form before submitting." core_admin_ui.select_option("AllowPasswordRotation", "Yes") logger.info("Changed 'Enable periodic password rotation' field to Yes") core_admin_ui.button('Save') core_admin_ui.switch_context(WarningModal()) assert core_admin_ui.check_exists((Div(expected_alert_message))), f"pop up warning message for periodic password " \ f"rotation is not " \ f"same as : {expected_alert_message}" logger.info( "Correct pop up warning message displayed for Periodic Password Rotation. " ) core_admin_ui.close_modal('Close') core_admin_ui.select_option("AllowPasswordRotation", "--") logger.info("Changed 'Enable periodic password rotation' field to default") core_admin_ui.tab('Accounts') core_admin_ui.tab('Advanced') core_admin_ui.select_option("AllowPasswordHistoryCleanUp", "Yes") logger.info( "Changed 'Enable periodic password history cleanup' field to Yes") core_admin_ui.button('Save') expected_alert_message = "Please correct the errors in your form before submitting." core_admin_ui.switch_context(WarningModal()) assert core_admin_ui.check_exists((Div(expected_alert_message))), \ f"Pop up warning message for periodic password history cleanup is not same as : {expected_alert_message}" logger.info( "Correct pop up warning message displayed for Periodic Password History Cleanup. " ) core_admin_ui.close_modal('Close')
def test_enable_workflow_without_approve(core_session, pas_windows_setup, core_admin_ui): """ TC:C2192 Enable workflow without approver. :param core_session: Returns a API session. :param pas_windows_setup: Returns a fixture. :param core_admin_ui: Return a browser session. """ # Creating a system and account. system_id, account_id, sys_info, connector_id, user_password = pas_windows_setup( ) # Launch UI. ui = core_admin_ui ui.navigate('Resources', 'Systems') ui.search(sys_info[0]) ui.click_row(GridRowByGuid(system_id)) ui.click_row(GridRowByGuid(account_id)) ui.tab('Workflow') ui.select_option('WorkflowEnabled', 'Yes') ui.switch_context(ActiveMainContentArea()) ui.expect(TreeFolder('Permissions'), 'Expect to permission tab but failed to find it.').try_click( Modal()) ui.switch_context(WarningModal()) warning_message = "Please correct the errors before leaving the page." ui.check_exists(Div(warning_message)) logger.info( 'Successfully found warning modal when try to navigate to another page.' ) ui.close_modal('Close') ui.switch_context(RenderedTab('Workflow')) ui.button('Save') ui.switch_context(WarningModal()) save_warning_message = "Please correct the errors in your form before submitting." ui.check_exists(Div(save_warning_message)) logger.info( 'Successfully found warning modal containing "Please correct the errors in your form before ' 'submitting".')
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_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_access_system_not_allow_from_public_network(core_session, pas_windows_setup, core_admin_ui, update_tenant_remote): """ C1573 : 20180720-02:31:59 system Level :param core_session: Authenticated Centrify Session :param pas_windows_setup: Added Windows system with Account associated to it. :param core_admin_ui: Authenticated Centrify Browser Session """ system_id, account_id, sys_info, connector_id, user_password = pas_windows_setup( ) ui = core_admin_ui # Disable 'Allow access from a public network' policy on Global Security Setting page result, success = update_tenant_remote(core_session, False) assert success, f"Not able to disable 'Allow access from a public network' policy on Global Security Setting " \ f"page. API response result: {result}. " logger.info( f"'Allow access from a public network' policy disabled on Global Security Setting page" ) # Navigating Resources - System page ui.navigate("Resources", "Systems") ui.search(sys_info[0]) ui.click_row(GridRowByGuid(system_id)) ui.check_row_by_guid(account_id) ui.switch_context(RenderedTab("Accounts")) # Login to Account using RDP session ui.action('Login') ui.wait_for_tab_with_name(f"Login session {sys_info[0]}") expected_alert_message = "Remote access not allowed. Please enable the 'Allow access from a public network' " \ "policy if web login from a public network is required." core_admin_ui.switch_context(WarningModal()) assert core_admin_ui.check_exists( (Div(expected_alert_message)) ), f"pop up warning message for Remote access is not same as : {expected_alert_message}" logger.info(f"Correct pop up warning message displayed for Remote access.")
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_account_settings_Policy_page(core_session, pas_setup, core_admin_ui, update_tenant_remote): """C2543 Update Account Settings page Steps: Pre: Create system with 1 account hand 1. Try to update description for account -Assert Failure """ ui = core_admin_ui # Disable 'Allow access from a public network' policy on Global Security Setting page result, success = update_tenant_remote(core_session, False) assert success, f"Not able to disable 'Allow access from a public network' policy on Global Security Setting " \ f"page. API response result: {result}. " logger.info( f"'Allow access from a public network' policy disabled on Global Security Setting page" ) system_id, account_id, sys_info = pas_setup description = f'{sys_info[0]}{guid()}' logger.info( f"System: {sys_info[0]} successfully added with UUID: {system_id} and account: {sys_info[4]} " f"with UUID: {account_id} associated with it.") ui.navigate('Resources', 'Accounts') ui.search(sys_info[0]) ui.click_row(sys_info[0]) ui.tab('Settings') # Step1: Update the description and compare the description. ui.input('Description', description) ui.save() ui.expect(TextArea('Description', description), description, time_to_wait=15) logger.info(f"Update description for this account : {sys_info[4]}") # Step2: Update the description and check weather Unsaved Changes pop is occurred without save. ui.switch_context(ActiveMainContentArea()) ui.input('Description', guid()) ui.action('Update Password') ui.switch_context(ConfirmModal()) ui.button('No') ui.switch_context(Modal('Update Unmanaged Password')) ui.button('Cancel') # Step3: Update the description and check weather Unsaved Changes pop is occurred without save. ui.switch_context(ActiveMainContentArea()) ui.input('Description', guid()) ui.action('Update Password') ui.switch_context(ConfirmModal()) ui.button('Cancel') # Step3: Update the description and check weather Unsaved Changes pop is occurred without save and \ # update unmanaged password pop will occurred. ui.switch_context(ActiveMainContentArea()) ui.input('Description', guid()) ui.action('Update Password') ui.switch_context(ConfirmModal()) ui.button('Yes') ui.switch_context(Modal('Update Unmanaged Password')) ui.button('Cancel') # Step3: Update the description and check weather take rdp tab giving error. ui.switch_context(ActiveMainContentArea()) ui.input('Description', guid()) ui.action('Login') ui.wait_for_tab_with_name(f"Login session {sys_info[0]}") expected_alert_message = "Remote access not allowed. Please enable the 'Allow access from a public network' " \ "policy if web login from a public network is required." ui.switch_to_pop_up_window() ui.switch_context(WarningModal()) assert ui.check_exists((Div(expected_alert_message))), \ f"pop up warning message for Remote access is not same as : {expected_alert_message}" logger.info(f"Correct pop up warning message displayed for Remote access.")