Example #1
0
def print_page():
    print_page_controller = NewController('desktop.png', ['print_page.png'], 'WINDOW')
    flag = print_page_controller.click_position('print_test_page')
    time.sleep(5)
    if flag:
        co.pass_report("Local_USB_printer_print_test_page")
        submit_controller = NewController('desktop.png', ['submited_ok.png'], 'WINDOW')
        flag = submit_controller.click_position('submit')
    else:
        false_return('print test page')
        co.fail_report("Not found print_test_page button.", "Local_USB_printer_print_test_page")
        return False
    if flag:
        printer_properties_controller = NewController('desktop.png', ['printer_properties.png',
                                                                      'printer_properties_italic.png',
                                                                      'printer_properties_italic1.png'], 'WINDOW')
        flag = printer_properties_controller.click_position('printer_properties')
    else:
        false_return('submit')
        return False
    if flag:
        return True
    else:
        false_return('printer properties')
        return False
Example #2
0
def run():
    time.sleep(3)
    execute_main_function()
    try:
        mf.ftp_link_test()
    except Exception:
        comfun.fail_report("The automated server connection may fail due to network failure!!! ")
    mf.execute_testing_program()
    mf.delete_file()
    mf.ftp_upload_report()
    mf.ftp_upload_screenshot()
    mf.ftp_upload_log()
Example #3
0
def run(server_name='pcoip_server_name',
        operation='//15.83.240.98/Automation/Linux/scripts/logoff.exe'):
    test_name = 'VMware_win10_pcoip'
    cer = certificate.Cert('ROOTCA')
    find_cert = cer.check_cert()
    if find_cert is False:
        insert = cer.import_cert()
        if insert is False:
            report.fail_report('import cert fail', test_name)
            return False
    print('cert already exist')
    name, password = '******', 'password'
    case = thinpro_view.View(server_name, name, password)
    case.del_connection()
    case.create_connection()
    username = case.edit_connection()
    if username != gc.get_config(name):
        report.fail_report(username, test_name)
        return
    case.start_connection()
    connect = case.log_on_desktop()
    if connect is not True:
        report.fail_report(connect, test_name)
        return
    confirm_result = view_ftp.confirm_username(username)
    if confirm_result is False:
        case.logon_fail()
        report.fail_report('not find username.txt', test_name)
        return
Example #4
0
def get_screenshot():
    time.sleep(1)
    s = str(datetime.datetime.today())
    s1 = s.replace(' ', '-')[:19]
    s2 = s1.replace(':', '-')
    pyautogui.screenshot('./Test_Report/screenshot/SystermInfo-' + s2 + '.png')
    time.sleep(3)
    log.info("Get the screen shot named as SystemInfo"+s2+".png.")
    if os.path.exists('./Test_Report/screenshot/SystermInfo-' + s2 + '.png'):
        co.pass_report("Check_System_information")
        return True
    else:
        co.fail_report("Screenshot save failed", "Check_System_information")
        return
Example #5
0
def check_printer_by_system(testname):
    # get the /dev/usb/lp* character devices's number
    printer_path = '/dev/usb/lp*'
    for i in range(1, 5):
        if glob.glob(printer_path):
            printer_num = glob.glob(printer_path)
            for p in printer_num:
                log.info("Pass: Detect USB printer {} by system".format(p))
            return True
        else:
            if i < 4:
                disable_usb_ports()
                enable_usb_ports()
            else:
                log.info("Fail: No USB Printer have been detected by system.")
                co.fail_report("No USB Printer have been detected by system.",
                               testname)
Example #6
0
def run():
    test_case_name = "FreeRDP_with_spec"
    # create list for specusers
    profile_list = [
        'RDP_Logon_SpecUser1', 'RDP_Logon_SpecUser2', 'RDP_Logon_SpecUser3',
        'RDP_Logon_SpecUser4', 'RDP_Logon_SpecUser5', 'RDP_Logon_SpecUser6'
    ]
    pass_box = 0
    for item in profile_list:
        common_connection.clear_connections(
            'freerdp')  # Delete rdp connections if there exist.
        if run_single(item) is True:
            pass_box = pass_box + 1
    if pass_box == 6:
        common_function.pass_report(test_case_name)
    else:
        common_function.fail_report("RDP test for special user is failed.",
                                    test_case_name)
Example #7
0
def run():
    test_case_name = "vmware_spec"
    credentials = {
        'spec_username1': 'spec_password1',
        'spec_username2': 'spec_password2',
        'spec_username3': 'spec_password3',
        'spec_username4': 'spec_password4',
        'spec_username5': 'spec_password5',
        'spec_username6': 'spec_password6'
    }
    list_fail = []
    index = 1
    for name, password in credentials.items():
        # common_connection.clear_connections("view")    # Delete vmware viewer connections if exist
        result = run_single('spec_server_name_%s' % index, '//15.83.240.98/Automation/Linux/scripts/logoff.exe', name,
                            password)
        if result is not True:
            # If previous user doesn't logoff normally, exit the iteration and stop testing.
            if result == 'logoff_fail':
                report.fail_report(
                    'Previous user %s is not logoff normally, please check whether the remote desktop is '
                    'available or not. Testing stops.' % name, test_case_name)
                return
            elif result == 'desktop_unavailable':
                report.fail_report('Remote desktop is unavailable now. Please check the environment. Testing will '
                                   'stop.', test_case_name)
                return
            list_fail.append(result)
        time.sleep(30)  # Waif sometime for next login to avoid resource unavailable issue.
        index = index + 1
    if len(list_fail) == 0:
        report.pass_report(test_case_name)
    else:
        report.fail_report(list_fail, test_case_name)
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)
Example #9
0
def run():
    test_case_name = "Connect_Cisco_VPN"
    # Read VPN configuration from yaml -- To be optimized
    vpn_cisco_gw = wired_common.get_config("./Test_Data/WiredNetwork/", "wired_configuration.yml", "vpn_cisco_gw")
    vpn_cisco_gn = wired_common.get_config("./Test_Data/WiredNetwork/", "wired_configuration.yml", "vpn_cisco_gn")
    vpn_cisco_gp = wired_common.get_config("./Test_Data/WiredNetwork/", "wired_configuration.yml", "vpn_cisco_gp")
    vpn_cisco_un = wired_common.get_config("./Test_Data/WiredNetwork/", "wired_configuration.yml", "vpn_cisco_un")
    vpn_cisco_up = wired_common.get_config("./Test_Data/WiredNetwork/", "wired_configuration.yml", "vpn_cisco_up")
    target_type = wired_common.get_config("./Test_Data/WiredNetwork/", "wired_configuration.yml", "target_type")
    vpn_auto_start = wired_common.get_config("./Test_Data/WiredNetwork/", "wired_configuration.yml", "vpn_auto_start")
    vpn_destination = wired_common.get_config("./Test_Data/WiredNetwork/", "wired_configuration.yml", "vpn_destination")
    # Check current network status.
    if common_function.check_network_status() is False:
        common_function.fail_report("Failed to check network status.", test_case_name)
        return
    # Set VPN as Cisco.
    if wired_vpn.set_vpn_as_cisco(target_type, vpn_cisco_gw, vpn_cisco_gn, vpn_cisco_gp, vpn_cisco_un, vpn_cisco_up) \
            is not True:
        common_function.fail_report("Failed to set vpn settings as cisco", test_case_name)
        return
    # Wait some while for vpn settings taking effect
    time.sleep(60)
    # Check vpn settings
    if wired_vpn.check_cisco_settings(target_type, vpn_auto_start, vpn_cisco_gw, vpn_cisco_gn, vpn_cisco_un) is False:
        common_function.fail_report("Fail to check cisco settings.", test_case_name)
        return
    # Ping
    if wired_common.destination_ping_check("VPN", vpn_destination) is False:
        common_function.fail_report("Fail to ping destination.", test_case_name)
        return
    # Disable Cisco VPN setings to restore the testing environment
    vpn_info_reg = wired_vpn.get_value_from_reg()
    if vpn_info_reg is not False:
        wired_vpn.disable_cisco_vpn(vpn_info_reg[3], vpn_info_reg[0])
    # else:
    #     return
    # Print pass report
    common_function.pass_report(test_case_name)
def run():
    module_name = 'XenDesktop_Storefront_connect_to_win10'
    desktop_list = ['citrix_win10.png']
    comfun.check_resolution()
    if not comfun.check_network_status():
        fail_report('Network status is not available', module_name)
        return
    flag = script_difference.login_storefront(desktop_list)
    if flag is not True:
        fail_report(flag, module_name)
        return False
    flag = script_difference.logoff()
    if flag is not True:
        fail_report(flag, module_name)
        return False
    else:
        pass_report(module_name)
def run():
    username = get_config.get_config(cert_name)
    cert = certificate.Cert('ROOTCA')
    find_cert = cert.check_cert()
    if find_cert is False:
        insert = cert.import_cert()
        if insert is False:
            report.fail_report('import cert fail', connect_with_cert)
            return False
    print('cert already exist')
    if create_connection() is False:
        return False
    warning = logon(username)
    if warning is not True:
        test_report('select security to be warning:' + warning + '-------')
    edit_connection('allow')
    allow = logon(username)
    if allow is not True:
        test_report('select security to be allow:' + allow + '-------')
    edit_connection('refuse')
    refuse = logon(username)
    if refuse is not True:
        test_report('select security to be refuse:' + refuse + '-------')
    if cert.delete_cert() is False:
        test_report('del cert fail,end refuse test without cert test')
        a = ''
        with open('./Test_Report/%s.txt' % connect_with_cert, 'r') as file:
            for line in file.readlines():
                a += line
        report.fail_report(a, connect_with_cert)
        os.remove('./Test_Report/%s.txt' % connect_with_cert)
        return
    if refuse_connect() is False:
        test_report('not find refuse window after delete cert')
    a = ''
    try:
        with open('./Test_Report/%s.txt' % connect_with_cert, 'r') as file:
            for line in file.readlines():
                a += line
        report.fail_report(a, connect_with_cert)
        os.remove('./Test_Report/%s.txt' % connect_with_cert)
    except:
        report.pass_report(connect_with_cert)
Example #12
0
def run(cert='ROOTCA'):
    test_name = 'Verify_can_add_certificate'
    cer = certificate.Cert(cert)
    find_cert = cer.check_cert()
    if find_cert is True:
        delete = cer.delete_cert()
        if delete is False:
            report.fail_report('Fail:remove cert fail before execute test',
                               test_name)
            return False
    insert = cer.import_cert()
    if insert is False:
        report.fail_report('Fail:import cert fail', test_name)
        return False
    delete = cer.delete_cert()
    if delete is False:
        report.fail_report('Fail:remove cert fail', test_name)
        return False
    report.pass_report(test_name)
    return True
def run():
    file_name = 'Connectivity_static_wireless'
    log = report.logger()
    wire = wireless.Wireless('R1_TC_5G_n', 'static_wireless_password')
    check_wireless = wire.check_wireless()
    if check_wireless is not True:
        report.fail_report('Fail:%s' % check_wireless, file_name)
        return False
    try:
        with open('test.txt', 'r') as test:
            wire.switch_root()
            if test.readlines()[0] == 'pass':
                os.remove('test.txt')
                return True
            else:
                os.remove('test.txt')
                return False
    except:
        print('continue')
    boot_times = wire.read_boot_time()
    if boot_times is False:
        wire.switch_wired('1', 'down')
        boot_times = 1
    wire.switch_root()
    if boot_times == '1':
        wire.clear_profiles()
        wire.open_wireless()
        add_wireless = wire.add_wireless()
        if add_wireless is not True:
            report.fail_report('Fail:%s' % add_wireless, file_name)
            write()
            wire.switch_wired('remove', 'up')
            return False
        apply_settings = wire.apply_settings()
        if apply_settings is not True:
            report.fail_report('Fail:%s' % apply_settings, file_name)
            write()
            wire.switch_wired('remove', 'up')
            return False
        if wire.check_profile() is False:
            report.fail_report('Fail:add profile fail', file_name)
            write()
            wire.switch_wired('remove', 'up')
            return False
        time.sleep(25)
        if wire.static_method() is not True:
            report.fail_report('Fail:not find IPv4 option', file_name)
            write()
            wire.switch_wired('remove', 'up')
            return False
        time.sleep(25)
        if wire.ping() is False:
            report.fail_report(
                'Fail:ping to static wireless fail after change method to static',
                file_name)
            write()
            wire.switch_wired('remove', 'up')
            pag.hotkey('ctrl', 'alt', 'f4')
            return False
        wire.write_boot_time('2')
        wire.reboot()
    if boot_times == '2':
        time.sleep(5)
        if wire.ping() is False:
            report.fail_report(
                'Fail:ping to static wireless fail after reboot', file_name)
            write()
            wire.switch_wired('remove', 'up')
            return False
        wire.open_wireless()
        delete_profile = wire.delete_profiles()
        if delete_profile is not True:
            report.fail_report('Fail:%s' % delete_profile, file_name)
            pag.hotkey('ctrl', 'alt', 'f4')
            write()
            wire.switch_wired('remove', 'up')
            return False
        time.sleep(10)
        if wire.ping() is False:
            log.info('delete profile,ping test success')
            report.pass_report(file_name)
            write('pass')
            wire.switch_wired('remove', 'up')
        else:
            report.fail_report(
                'Fail:delete profile complete,but can ping to network,check time delay os connection',
                file_name)
            write()
            wire.switch_wired('remove', 'up')
            return False
def run():
    # path = os.path.dirname(os.getcwd())
    # load yaml
    log.info('load yaml')
    f = open(r'./Test_Data/config.yml')
    info = yaml.load(f)
    server_address = info['telnet_server_address']
    user_name = info['telnet_user_name']
    pass_word = info['telnet_pass_word']
    # write log
    # f2 = open(path+r'/Test_Report/telnet_result.txt','w')
    # pyautogui setting
    log.info('default settings')
    pyautogui.FAILSAFE = True
    pyautogui.PAUSE = (0.5)
    # auto steps start
    log.info('auto steps start')
    screen_width, screen_height = pyautogui.size()
    pyautogui.hotkey('ctrlleft', 'alt', 's')
    time.sleep(1)
    pyautogui.typewrite('create telnet')
    pyautogui.hotkey('enter')
    time.sleep(1)
    pyautogui.click(0.5 * screen_width, 0.5 * screen_height, duration=1)
    # image locate on screen
    #address
    address_pos = pyautogui.locateOnScreen(
        r'./Test_Data/1920x1200/template_file/telnet_address.png')
    # time.sleep(1)
    if address_pos is None:
        print('fail1 ')
        log.error('fail1')
        # f2.write('fail1 ')
    pyautogui.click(address_pos.left + 2 * address_pos.width,
                    address_pos.top + 0.5 * address_pos.height,
                    duration=1)
    pyautogui.typewrite(server_address)
    # image locate on screen
    #finish
    finish_pos = pyautogui.locateCenterOnScreen(
        r'./Test_Data/1920x1200/template_file/ssh_telnet_finish.png')
    # time.sleep(1)
    if finish_pos is None:
        print('fail2 ')
        log.error('fail2')
        # f2.write('fail2 ')
    pyautogui.click(finish_pos.x, finish_pos.y, duration=1)
    time.sleep(3)
    pyautogui.hotkey('ctrlleft', 'alt', 's')
    pyautogui.typewrite('new telnet')
    pyautogui.hotkey('enter')
    time.sleep(20)
    pyautogui.click(0.5 * screen_width, 0.5 * screen_height, duration=1)
    pyautogui.typewrite(user_name)
    pyautogui.hotkey('enter')
    time.sleep(1)
    pyautogui.typewrite(pass_word)
    pyautogui.hotkey('enter')
    time.sleep(2)
    log.info('auto steps finish,checking result...please wait')
    is_pass = pyautogui.locateOnScreen(
        r'./Test_Data/1920x1200/template_file/ssh_telnet_pass.png')
    if is_pass is not None:
        co.pass_report("Connect_to_Telnet_Server")
        log.info('the resule is pass,please check the log file for detail')
        # f2.write('pass ')
        pyautogui.hotkey('ctrlleft', 'd')
        return
    else:
        co.fail_report("Connect failed", "Connect_to_Telnet_Server")
        log.error('fail3')
        # f2.write('fail3 ')
        pyautogui.hotkey('ctrlleft', 'd')
        return
Example #15
0
     return
 case.start_connection()
 connect = case.log_on_desktop()
 if connect is not True:
     report.fail_report(connect, test_name)
     return
 confirm_result = view_ftp.confirm_username(username)
 if confirm_result is False:
     case.logon_fail()
     report.fail_report('not find username.txt', test_name)
     return
 view_ftp.upload_test(operation)
 result = view_ftp.confirm_result()
 if result is False:
     case.logon_fail()
     report.fail_report('not find test_result.txt', test_name)
     return
 elif result.lower() == 'pass':
     if case.check_logoff() is True:
         report.pass_report(test_name)
         return
     else:
         report.fail_report('VDI test success,logoff fail', test_name)
         return
 else:
     if case.check_logoff() is True:
         report.fail_report('VDI test fail:%s' % result, test_name)
         return
     else:
         report.fail_report('VDI test fail:%s,and logoff fail' % result,
                            test_name)
def run():
    desktop_list = ['citrix_win10.png']
    module_name = 'XenDesktop_Storefront_win10_USB_key_mapping'
    comfun.check_resolution()
    if not comfun.check_network_status():
        fail_report('Network status is not available', module_name)
        return
    flag = script_general.check_localusb_exist()
    if flag:
        script_general.remove_usb_file()
        script_difference.set_citrix_usbkey_mapping()
    else:
        fail_report('can not find local usb key', module_name)
        return False
    flag = script_difference.login_storefront(desktop_list)
    if flag is not True:
        fail_report(flag, module_name)
        return False
    mapping = script_difference.xen_usbkey_mapping()
    sign_out = script_general.check_succeed_signout()
    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
    flag = script_difference.confirm_usbkeymapping_file()
    if flag is not True:
        fail_report(flag, module_name)
        return False
    else:
        pass_report(module_name)
Example #17
0
def run(server_name='blast_server_name'):
    file_name = 'VMware_win10_USB_key_USBR_blast'
    local_usb = check_usb()
    if local_usb is not True:
        report.fail_report(local_usb, file_name)
        return False
    operation = '//15.83.240.98/Automation/Linux/scripts/usbkey_redirection.exe'
    cer = certificate.Cert('ROOTCA')
    find_cert = cer.check_cert()
    if find_cert is False:
        insert = cer.import_cert()
        if insert is False:
            report.fail_report('import cert fail', file_name)
            return False
        blast_usbr_log.info('import cert success for %s' % file_name)
    name, password = '******', 'password'
    case = thinpro_view.View(server_name, name, password)
    case.del_connection()
    case.create_connection()
    username = case.edit_connection()
    if username != gc.get_config(name):
        report.fail_report(username, file_name)
        return False
    enable_usbr = edit_connection(case)
    if enable_usbr is not True:
        report.fail_report(enable_usbr, file_name)
        return False
    case.start_connection()
    connect = case.log_on_desktop()
    if connect is not True:
        report.fail_report(connect, file_name)
        return False
    confirm_result = view_ftp.confirm_username(username)
    if confirm_result is False:
        case.logon_fail()
        report.fail_report('not confirm username', file_name)
        return False
Example #18
0
 case.start_connection()
 connect = case.log_on_desktop()
 if connect is not True:
     report.fail_report(connect, file_name)
     return False
 confirm_result = view_ftp.confirm_username(username)
 if confirm_result is False:
     case.logon_fail()
     report.fail_report('not confirm username', file_name)
     return False
 view_ftp.upload_test(operation)
 result = view_ftp.confirm_result()
 time.sleep(10)
 if result is False:
     case.logon_fail()
     report.fail_report('not find test_result.txt', file_name)
     return
 elif result.lower() == 'pass':
     if case.check_logoff() is True:
         file_check = check_file()
         if file_check is not True:
             report.fail_report('VDI test success,%s' % file_check,
                                file_name)
             return False
         report.pass_report(file_name)
         return True
     else:
         file_check = check_file()
         if file_check is not True:
             report.fail_report(
                 'VDI test success,logoff fail,%s' % file_check, file_name)
            return True
        else:
            return 'VDI test success,logoff fail'
    else:
        if case.check_logoff() is True:
            return 'VDI test fail:%s' % result
        else:
            return 'VDI test fail:%s,and logoff fail' % result


def create_connection():
    case.del_connection()
    case.create_connection()
    username = case.edit_connection()
    if username != get_config.get_config(cert_name):
        report.fail_report(username, connect_with_cert)
        return False


def edit_connection(policy):
    max_loc = case.image_match('view_icon', 3)
    pag.rightClick(max_loc)
    pag.press('down', presses=2, interval=0.1)
    pag.press('enter')
    time.sleep(5)
    max_loc = case.image_match('Security', 3)
    pag.click(max_loc)
    time.sleep(1)
    pag.press('tab', presses=9, interval=0.1)
    pag.press('space')
    if policy == 'allow':
Example #20
0
def run():
    test_case_name = "Static_IP_Mode_works"
    # Check current network status
    if common_function.check_network_status() is False:
        common_function.fail_report("Check current network status failed.", test_case_name)
        return
    # If vpn is set, disable it.
    if wired_common.disable_vpn() is False:
        common_function.fail_report("Disable vpn failed.", test_case_name)
        return
    # Check the network method, if it is Automatic, change the network to static and return the ip.
    ip = wired_static_ip.check_method_for_static("Wired")
    if ip is False:
        common_function.fail_report("Check method for static failed.", test_case_name)
        return
    time.sleep(5)
    # Check the network setting result. If checking for Static, it compares the runtime ip, registry ip and \
    # transferring ip.
    if wired_common.setting_check_for("Static", ip[0], ip[1], ip[2]) is False:
        common_function.fail_report("Setting check for static is failed.", test_case_name)
        return
    # Check current network status
    if common_function.check_network_status() is False:
        common_function.fail_report("Check network status failed after network setting.", test_case_name)
        return
    # Ping the default gateway.
    if wired_common.destination_ping_check("Normal", ip[2]) is False:
        common_function.fail_report("Ping default gateway failed.", test_case_name)
        return
    # Enable left click menu for wired icon from registry.
    wired_common.enable_left_click_nt()
    # Stop network from the wired tray icon at desktop
    if wired_common.stop_network() is False:
        common_function.fail_report("Stop Network failed.", test_case_name)
        return
    # Start network from the wired tray icon at desktop.
    if wired_common.start_network() is False:
        common_function.fail_report("Start network failed.", test_case_name)
        return
    time.sleep(5)
    # Check the network setting result after stopping then starting network.
    if wired_common.setting_check_for("Static", ip[0], ip[1], ip[2]) is False:
        common_function.fail_report("Setting check for static is failed after stopping then starting network.",
                                    test_case_name)
        return
    # Ping the default gateway after stopping and restarting network.
    if wired_common.destination_ping_check("Normal", ip[2]) is False:
        common_function.fail_report("Ping default gateway failed after stopping then starting network.", test_case_name)
        return
    # Restart network.
    if wired_common.restart_network() is False:
        common_function.fail_report("Restart network failed.", test_case_name)
    time.sleep(5)
    # Check the network setting result after restarting network.
    if wired_common.setting_check_for("Static", ip[0], ip[1], ip[2]) is False:
        common_function.fail_report("Setting check for static is failed after restarting network.",
                                    test_case_name)
        return
    # Ping the default gateway after restarting network.
    if wired_common.destination_ping_check("Normal", ip[2]) is False:
        common_function.fail_report("Ping default gateway failed after restarting network.", test_case_name)
        return
    # Restore to Auto network.
    wired_common.set_method_as("Automatic")
    # Restore the registry settings for network left click menu
    wired_common.disable_left_click_nt()
    # Print pass result
    common_function.pass_report(test_case_name)
Example #21
0
def run():
    test_case_name = "Dynamic_IP_Mode"
    # Check current network status
    if common_function.check_network_status() is False:
        common_function.fail_report("Check current network status failed.",
                                    test_case_name)
        return
    # If vpn is set, disable it.
    if wired_common.disable_vpn() is False:
        common_function.fail_report("Disable vpn failed.", test_case_name)
        return
    # Check the network method, if it is Automatic, return the ip address. If it is Static, change the network to \
    # Auto then get the ip.
    if wired_dhcp_ip.check_method_for_auto('Wired') is False:
        common_function.fail_report("Check method for auto failed.",
                                    test_case_name)
        return
    # Check the format of ip, all the four address should be in [0, 255].
    if wired_dhcp_ip.check_ip() is False:
        common_function.fail_report("Check ip failed.", test_case_name)
        return
    # Check current network status in case of changing network to Automatic from Static.
    if common_function.check_network_status() is False:
        common_function.fail_report(
            "Check network status is failed after checking method.",
            test_case_name)
        return
    # Check the network setting result.
    if wired_common.setting_check_for("Automatic") is False:
        common_function.fail_report("Setting check for Automatic failed.",
                                    test_case_name)
        return
    # Ping the destination.
    if wired_common.destination_ping_check("Normal", "15.83.240.98") is False:
        common_function.fail_report(
            "Destination ping failed after network setting for preparation.",
            test_case_name)
        return
    # Enable left click menu for wired icon from registry.
    wired_common.enable_left_click_nt()
    # Stop network from the wired tray icon at desktop
    if wired_common.stop_network() is False:
        common_function.fail_report("Stop network failed.", test_case_name)
        return
    # Start network from the wired tray icon at desktop.
    if wired_common.start_network() is False:
        common_function.fail_report("Start network failed.", test_case_name)
    # Check the format of ip after regaining the dynamic IP, all the four address should be in [0, 255].
    if wired_dhcp_ip.check_ip() is False:
        common_function.fail_report("Check ip failed after starting network.",
                                    test_case_name)
        return
    # Ping the destination after stopping then starting network.
    if wired_common.destination_ping_check("Normal", "15.83.240.98") is False:
        common_function.fail_report(
            "Destination ping failed after stopping then starting network.",
            test_case_name)
        return
    # Restart network from the wired tray icon at desktop
    if wired_common.restart_network() is False:
        common_function.fail_report("Restarting network fails.",
                                    test_case_name)
        return
    # Check the network setting result after restarting network.
    wired_common.setting_check_for("Automatic")
    # Check the format of ip after restarting network then get the ip, all the four address should be in [0, 255].
    if wired_dhcp_ip.check_ip() is False:
        common_function.fail_report(
            "Check ip failed after restarting network.", test_case_name)
        return
    # Ping the destination after restarting network.
    if wired_common.destination_ping_check("Normal", "15.83.240.98") is False:
        common_function.fail_report(
            "Destination ping failed after restarting network.",
            test_case_name)
        return
    # Restore the registry settings for network left click menu
    wired_common.disable_left_click_nt()
    # Print pass report
    common_function.pass_report(test_case_name)
Example #22
0
def run():
    file_name = 'Connectivity_WPA2P'
    log = report.logger()
    wire = wireless.Wireless('R1_TC_2.4G_n_WPA2P', 'WPA2P_password')
    check_wireless = wire.check_wireless()
    if check_wireless is not True:
        report.fail_report('Fail:%s' % check_wireless, file_name)
        return False
    try:
        with open('test.txt', 'r') as test:
            wire.switch_root()
            if test.readlines()[0] == 'pass':
                os.remove('test.txt')
                return True
            else:
                os.remove('test.txt')
                return False
    except:
        print('continue')
    boot_times = wire.read_boot_time()
    if boot_times is False:
        wire.switch_wired('1', 'down')
        boot_times = '1'
    wire.switch_root()
    if boot_times == '1':
        wire.clear_profiles()
        wire.open_wireless()
        add_wireless = wire.add_wireless()
        if add_wireless is not True:
            report.fail_report('Fail:%s' % add_wireless, file_name)
            write()
            wire.switch_wired('remove', 'up')
            return False
        connect_wpa2a = wire.connect_with_security()
        if connect_wpa2a is not True:
            report.fail_report('Fail:%s' % connect_wpa2a, file_name)
            write()
            wire.switch_wired('remove', 'up')
            return False
        if wire.check_profile() is False:
            pag.hotkey('ctrl', 'alt', 'f4')
            report.fail_report('Fail:not found wireless profile', file_name)
            write()
            wire.switch_wired('remove', 'up')
            return False
        time.sleep(25)
        if wire.ping() is False:
            report.fail_report('Fail:ping to network fail,check if the wifi is or not available, or delay too short',
                               file_name)
            write()
            wire.switch_wired('remove', 'up')
            return False
        log.info('connect wireless success')
        check_connect = wire.check_auto_connect()
        if check_connect is not True:
            pag.hotkey('ctrl', 'alt', 'tab')
            time.sleep(1)
            pag.hotkey('ctrl', 'alt', 'f4')
            report.fail_report('Fail:%s' % check_connect, file_name)
            write()
            wire.switch_wired('remove', 'up')
            return False
        if wire.del_profile() is not True:
            report.fail_report('Fail:delete profile fail', file_name)
            write()
            wire.switch_wired('remove', 'up')
            return False
        time.sleep(10)
        if wire.ping() is False:
            pag.hotkey('ctrl', 'alt', 'f4')
            log.info('delete profile,ping test success')
            report.pass_report(file_name)
            write('pass')
            wire.switch_wired('remove', 'up')
        else:
            pag.hotkey('ctrl', 'alt', 'f4')
            report.fail_report('Fail:delete profile complete,but can ping to network,check time delay os connection',
                               file_name)
            write()
            wire.switch_wired('remove', 'up')
            return False
Example #23
0
def run():
    desktop_list = ['citrix_win10_pnagent.png']
    module_name = 'XenDesktop_PNagent_USB_key_USBR'
    comfun.check_resolution()
    if not comfun.check_network_status():
        fail_report('Network status is not available', module_name)
        return
    flag = script_general.check_localusb_exist()
    if flag:
        script_general.remove_usb_file()
        script_difference.set_citrix_usbkey_usbr()
    else:
        fail_report('can not find local usb key', module_name)
        return False
    flag = script_difference.login_pnagent(desktop_list)
    if flag is not True:
        fail_report(flag, module_name)
        return False
    usbr = script_difference.xen_usbkey_redirection()
    sign_out = script_general.check_succeed_signout()
    if usbr is not True:
        fail_report(usbr, module_name)
        return False
    if sign_out is not True:
        fail_report(sign_out, module_name)
        return False
    flag = script_difference.confirm_usbkeyredirection_file()
    if flag is not True:
        fail_report(flag, module_name)
        return False
    else:
        pass_report(module_name)