def run(): log = co.logger() testname = "Local_USB_printer_print_test_page" pyautogui.hotkey('ctrl', 'alt', 'end') co.check_resolution() co.check_network_status() if not cp.check_printer_by_system(testname): return if cp.check_printers() > 0: cp.clear_previous_printer() flag = ad.open_window('printer', "./Test_Data/1920x1200/template_file/printers_localhost.png") if flag: flag = ad.add_printer() else: return False if flag: log.logger.info("Printer added successful.") flag = cp.check_printer_added() else: return False if flag: ad.print_page() flag = ad.delete_printer() else: return False if flag: log.logger.info("Printer deleted successful.") ad.close_window("./Test_Data/1920x1200/template_file/printers_localhost.png") return True else: return False
def write_offset_to_startup_yml(): add.open_window('network', "./Test_Data/1920x1200/template_file/control_panel.png") time.sleep(2) switch_to_vpn = NewController('desktop.png', ['system.png'], 'WINDOW', 'control_panel.yml') switch_to_vpn.click_position_tool('vpn.png') edit_dict = {'switch_to_vpn': switch_to_vpn.relative_offset} switch_to_vpn.dump_to_yaml(edit_dict) enable_vpn = NewController('desktop.png', ['system.png'], 'WINDOW', 'control_panel.yml') enable_vpn.click_position_tool('auto_start.png') edit_dict['enable_auto_start'] = enable_vpn.relative_offset enable_vpn.dump_to_yaml(edit_dict) enable_vpn.click_position_tool('vpn_type.png') pyautogui.press('down') pyautogui.press('enter') pyautogui.press('tab') time.sleep(2) apply_vnc_change = NewController('desktop.png', ['control_panel.png'], 'WINDOW', 'control_panel.yml') apply_vnc_change.click_position_tool('control_panel_apply.png') edit_dict['apply_vpn_change'] = apply_vnc_change.relative_offset apply_vnc_change.dump_to_yaml(edit_dict) add.close_window("./Test_Data/1920x1200/template_file/control_panel.png")
def run(): desktop_list = ['citrix_win10.png'] module_name = 'XenDesktop_Storefront_USB_printer_mapping' co.check_resolution() if not co.check_network_status(): fail_report('Network status is not available', module_name) return if not cp.check_printer_by_system(module_name): return if cp.check_printers() > 0: log.info('clear printer') cp.clear_previous_printer() flag = ad.open_window( 'printer', "./Test_Data/1920x1200/template_file/printers_localhost.png") if flag: flag = ad.add_printer() else: return False if flag: ad.cancel_print_page() # ad.close_window("./Test_Data/1920x1200/template_file/printers_localhost.png") log.logger.info("Printer added successful.") flag = cp.check_printer_added() else: return False if flag: script_difference.set_citrix_usbprinter_mapping() flag = script_difference.login_storefront(desktop_list) else: return if flag is not True: fail_report(flag, module_name) delete_printer() close_window( "./Test_Data/1920x1200/template_file/printers_localhost.png") return False mapping = script_difference.usbprinter_mapping() sign_out = script_general.check_succeed_signout() delete_printer() close_window("./Test_Data/1920x1200/template_file/printers_localhost.png") if mapping is not True: fail_report(mapping, module_name) return False if sign_out is not True: fail_report(sign_out, module_name) return False else: pass_report(module_name)
def operate_delete_printer(): if ad.open_window( 'printer', "./Test_Data/1920x1200/template_file/printers_localhost.png"): i = 1 while i <= check_printers(): ad.delete_printer() if ad.close_window( "./Test_Data/1920x1200/template_file/printers_localhost.png"): return True else: return False