def step_impl(context): table = MacGUIClient().summary_tab.get_summary_table() eslaped_time = 0 sleep_time = 10 while table.get('Next Backup:') == 'in progress' and eslaped_time < 300: time.sleep(sleep_time) eslaped_time += sleep_time table = MacGUIClient().summary_tab.get_summary_table()
def step_impl(context, cre): cre_with_oc = re.sub(r"{oemclient}", RUNNER_CONFIG.get('OEM_CLIENT'), cre) cre_with_oc_env = re.sub(r"{env}", RUNNER_CONFIG.get('ENVIRONMENT'), cre_with_oc) expected_credential = MAC_CONFIG.get('CREDENTIAL').get(cre_with_oc_env) username = expected_credential.get('USERNAME') password = expected_credential.get('PASSWORD') pk = expected_credential.get('PERSONALKEY') if pk: MacGUIClient().login_sh.activate(username, password, keytext=pk) else: MacGUIClient().login_sh.activate(username, password)
def step_impl(context, cre): cre_with_oc = re.sub(r"{oemclient}", RUNNER_CONFIG.get('OEM_CLIENT'), cre) cre_with_oc_env = re.sub(r"{env}", RUNNER_CONFIG.get('ENVIRONMENT'), cre_with_oc) expected_credential = MAC_CONFIG.get('CREDENTIAL').get(cre_with_oc_env) username = expected_credential.get('USERNAME') password = expected_credential.get('PASSWORD') + "suffix" context.username = username MacGUIClient().login_sh.set_credential_with(username, password)
def step_impl(context, expected_cre): MacGUIClient().start_app() username = MacGUIClient().summary_tab.get_current_username() cre_with_oc = re.sub(r"{oemclient}", RUNNER_CONFIG.get('OEM_CLIENT'), expected_cre) cre_with_oc_env = re.sub(r"{env}", RUNNER_CONFIG.get('ENVIRONMENT'), cre_with_oc) expected_credential = MAC_CONFIG.get('CREDENTIAL').get(cre_with_oc_env) expected_username = expected_credential.get('USERNAME') expected_password = expected_credential.get('PASSWORD') personal_key = expected_credential.get('PERSONALKEY') or None user = UserHelper(username=expected_username, password=expected_password, pk=personal_key) context.user = user cre_without_env = re.sub(r"{env}_?", '', cre_with_oc) if username != expected_username: step_str = "When Mac Client is not activated" context.execute_steps(unicode(step_str)) step_str = 'When I launch Mac Client from GUI' context.execute_steps(unicode(step_str)) step_active = 'When I activate with credential "{cre}"'.format( cre=cre_with_oc_env) context.execute_steps(unicode(step_active))
def step_impl(context, backup_set_name): step_str = 'When I visit "Files & Folders" tab' context.execute_steps(unicode(step_str)) # MacCliClient().rule_cmd.remove_all_rules() files_folder_tab = MacGUIClient().files_folder_tab files_folder_tab.click_advance_button() files_folder_tab.show_suggested_backup_sets() matcher = {'AXRole': 'AXTextField'} matcher['AXValue'] = backup_set_name + "*" tr_text_doc = AppUIElement.from_bundle(MacController().spbundleid, matcher) matcher = {'AXRole': 'AXCheckBox'} tr_checkbox_doc = AppUIElement(tr_text_doc.get_native_parent(), matcher) tr_checkbox_doc.left_click() matcher = {'AXRole': 'AXButton', 'AXTitle': 'OK'} btn_ok = AppUIElement(tr_text_doc.get_native_ancestor(level=4), matcher) btn_ok.click() time.sleep(5) files_folder_tab.click_OK_button()
def step_impl(context, field, check_value): step_str = 'When I visit "summary" tab' context.execute_steps(unicode(step_str)) current_value = '' table = MacGUIClient().summary_tab.get_summary_table() current_value = table.get(field) current_time = 0 wait_time = 60 sleep_time = 5 while current_value.find(check_value) < 0 and current_time < wait_time: time.sleep(sleep_time) current_time += sleep_time table = MacGUIClient().summary_tab.get_summary_table() current_value = table.get(field) current_value
def step_impl(context, field): step_str = 'When I visit "summary" tab' context.execute_steps(unicode(step_str)) table = MacGUIClient().summary_tab.get_summary_table() result = True current_value = table.get(field) current_time = 0 wait_time = 120 sleep_time = 5 while current_value.find("0 files") >= 0 and current_time < wait_time: time.sleep(sleep_time) current_time += sleep_time table = MacGUIClient().summary_tab.get_summary_table() current_value = table.get(field) if current_value.find("0 files") >= 0: result = False result.should.equal(True)
def step_impl(context): step_str = 'When I visit "Files & Folders" tab' context.execute_steps(unicode(step_str)) # MacCliClient().rule_cmd.remove_all_rules() files_folder_tab = MacGUIClient().files_folder_tab files_folder_tab.click_advance_button() testdata_root = ConfigAdapter.get_testdata_path() for row in context.table: files_folder_tab.show_add_files_browser() time.sleep(1) files_folder_tab.select_root_dest() time.sleep(1) entity = row.get('include_dirs') or row.get('include_files') backup_full_path = os.path.join(testdata_root, entity) from lib.filehelper import FileHelper w_time = 60 while not FileHelper.dir_exist(backup_full_path) and w_time > 0: w_time -= 5 files_folder_tab.select_backupdir(backup_full_path) files_folder_tab.click_OK_button()
def step_impl(context): MacGUIClient().close_app()
def step_impl(context): step_str = 'When I visit "summary" tab' context.execute_steps(unicode(step_str)) MacGUIClient().summary_tab.backup_now()
def step_impl(context): username = context.user.username password = context.user.password MacGUIClient().login_sh.activate(username, password) pass
def step_impl(context): current_window = MacGUIClient().restart_app() context.current_window = current_window
def __init__(self, oem="mozypro"): self._controller = MacController() self._installer = MacInstaller() #Add oem support self._cli = MacGUIClient() self._gui = MacCliClient()
def step_impl(context): step_str = 'When I visit "summary" tab' context.execute_steps(unicode(step_str)) MacGUIClient().summary_tab.click_history()
def step_impl(context): if not MacController.check_process_by_name("System Preferences"): MacGUIClient().start_app() username = MacGUIClient().summary_tab.get_current_username() username.should.equal(context.username)
def stem_impl(context, tab_name): if tab_name.lower() == 'files & folders': MacGUIClient().files_folder_tab.visit() if tab_name.lower() == 'summary': MacGUIClient().summary_tab.visit()