Ejemplo n.º 1
0
 def test012_Prod_SKU(self):
     FunctionCommon.smartsearch(self,"82016")
     Mutil_Selection.Products_ViewDetail(self)
     Verification.Verify_SKU(self,"82016")
     AddCart.AddCart(self)
     PublicFunctions.my_wait_text_present(self,"Your Shopping Cart")
     AddCart.CheckOut(self) 
Ejemplo n.º 2
0
 def test022_Brand_Name(self):
     FunctionCommon.smartsearch(self,"Extang")
     Mutil_Selection.Products_ViewDetail(self)
     Verification.Verify_Brand(self,"Extang")
     AddCart.AddCart(self)
     PublicFunctions.my_wait_text_present(self,"Your Shopping Cart")
     AddCart.CheckOut(self)
Ejemplo n.º 3
0
def main_process(cmd):
    devices = Fun.devices_list_with_connection_check()
    if len(devices) == 0:
        Fun.log('no device connected')
        sys.exit(2)
    for dev in devices:
        Thread(target=collect_dump_info, args=(dev, cmd)).start()
Ejemplo n.º 4
0
def access_to_electricity(tag, uid_info):
    info = Modules.BatteryInfo()
    info.end_time.append(FunCom.current_time())
    battery_info = FunCom.p_open(Res.adb_dump_battery(tag)).readlines()
    for ii in range(len(battery_info) - 1):
        if 'level:' in battery_info[ii]:
            battery_info_arr = battery_info[ii].split('  level: ')
            info.battery_percentage.append(battery_info_arr[1].strip())

    battery_detailed_info = FunCom.p_open(
        Res.adb_dump_battery_status(tag)).readlines()
    for i in range(len(battery_detailed_info) - 1):
        if 'Capacity:' in battery_detailed_info[i]:
            bat_info = battery_detailed_info[i].split(',')

            battery_capacity = bat_info[0].split('    Capacity: ')
            battery_computed_drain = bat_info[1].split(' Computed drain: ')
            info.battery_actual_drain = bat_info[2].split(' actual drain: ')
            info.capacity.append(int(battery_capacity[1].strip()))
            info.computed.append(float(battery_computed_drain[1].strip()))

        if 'Uid ' + str(uid_info) in battery_detailed_info[i]:
            num = battery_detailed_info[i].split(':')
            num = num[1].split('(')
            info.uid_item_info.append(float(num[0].strip()))
    return info
Ejemplo n.º 5
0
 def test030_Category_Name(self):
     FunctionCommon.smartsearch(self,"Ignition")
     Mutil_Selection.Products_ViewDetail(self)
     Verification.Verify_Category(self,"Ignition")
     AddCart.AddCart(self)
     PublicFunctions.my_wait_text_present(self,"Your Shopping Cart")
     AddCart.CheckOut(self)
Ejemplo n.º 6
0
def install_r(device, apk_path, r):
    install_cmd = Res.install_r if r else Res.install
    try:
        command = Res.adb_s + device + install_cmd + '%s' % apk_path
        return FunCom.p_open(command)
    except Exception as e:
        FunCom.log(e)
Ejemplo n.º 7
0
 def test004_CompanyGiftCertificatesCatesOrder(self):
     Selection.Categories_QP(self,"Air Intakes")
     FunctionCommon.my_wait_element(self,"//img[@alt=\'View Products\']")
     self.selenium.click("//img[@alt=\'View Products\']")
     ##Selection.SubCategories(self)
     
     Selection.Products(self)
     AddCart.AddCart(self,"1")
Ejemplo n.º 8
0
 def test002_CouponCodesProductsOrder(self):
     Selection.Categories_QP(self,"Air Filter")         
     Selection.SubCategories_options(self,"Air-Filters")
     FunctionCommon.my_wait_element(self,"//img[@alt=\'View Products\']")
     self.selenium.click("//img[@alt=\'View Products\']")
     Selection.Products(self)
     AddCart.AddCart(self,"1")
     Selection.couponcode(self,"EN7XQ9WF9HV")
Ejemplo n.º 9
0
 def test001_ymmCat_TonneauCovers(self):
     Selection.Year(self,"2010")
     Selection.Make(self,"GMC")
     Selection.Categories_QP(self,"Tonneau Covers")
     FunctionCommon.my_wait_element(self,"//img[@alt='View More Details About Snap Truck Bed Covers']")
     self.selenium.click("//img[@alt='View More Details About Snap Truck Bed Covers']")
     Selection.Products(self)
     AddCart.AddCart(self,"1")
Ejemplo n.º 10
0
def convert_and_store_in_directory(dest_path, target_name):
    target_name = target_name.replace(Res.hprof_suffix, '')
    dump_file_path = os.path.join(dest_path, target_name)
    dump_file = dump_file_path + Res.hprof_suffix if not dump_file_path.endswith(
        Res.hprof_suffix) else dump_file_path
    Fun.make_dir_if_not_exist(dump_file_path)
    convert_file = os.path.join(dump_file_path,
                                target_name + Res.convert_suffix)
    Fun.p_open(Res.adb_convert_heap_profile(dump_file, convert_file))
Ejemplo n.º 11
0
    def test001_ymmbrand_BestinAuto_AvengerProLiteNonGlareSideMirrorReplacementGlass(self):
        Selection.Year(self, "2010")
        Selection.Brand(self, "BestInAUTO")
        Selection.Series_options(self, "Avenger Pro Lite Non-Glare Side Mirror Replacement Glass")
        FunctionCommon.my_wait_element(self, "//img[@alt='View Products']")
        self.selenium.click("//img[@alt='View Products']")

        Selection.Products(self)
        AddCart.AddCart(self, "2")
        AddCart.CheckOut(self)
Ejemplo n.º 12
0
 def test005_CompanyGiftCertificatesProductsOrder(self):
     Selection.Year(self,"2010")
     Selection.Brand(self,"BestInAUTO")   
     Selection.Series_options(self,"Avenger Pro Lite Non-Glare Side Mirror Replacement Glass")
     FunctionCommon.my_wait_element(self,"//img[@alt=\'View Products\']")
     self.selenium.click("//img[@alt=\'View Products\']")
     
     Selection.Products(self)
     AddCart.AddCart(self,"2") 
     AddCart.CheckOut(self)
Ejemplo n.º 13
0
    def test006_ymmbrand_Magnaflow_MagnaflowGasExhaustSystems(self):
        Selection.Brand(self, "Magnaflow")
        Selection.Year(self, "2010")
        Selection.Make(self, "FORD")
        Selection.Series_options(self, "Magnaflow Gas Exhaust Systems")
        FunctionCommon.my_wait_element(self, "//img[@alt='View Products']")
        self.selenium.click("//img[@alt='View Products']")

        Selection.Products(self)
        AddCart.AddCart(self, "2")
        AddCart.CheckOut(self)
Ejemplo n.º 14
0
    def test005_ymmbrand_Magnaflow_MagnaflowDirectFitCatalyticConverters(self):
        Selection.Brand(self, "Magnaflow")
        Selection.Year(self, "2010")
        Selection.Make(self, "FORD")
        Selection.Series_options(self, "Magnaflow Direct Fit Catalytic Converters")
        FunctionCommon.my_wait_element(self, "//img[@alt='View Products']")
        self.selenium.click("//img[@alt='View Products']")

        Selection.Products(self)
        AddCart.AddCart(self, "2")
        AddCart.CheckOut(self)
Ejemplo n.º 15
0
    def test004_ymmbrand_Husky_FloorCargoandTruckLiners(self):
        Selection.Brand(self, "Husky")
        Selection.Year(self, "2010")
        Selection.Make(self, "FORD")
        Selection.Series_options(self, "Husky Shield Paint Protection")
        FunctionCommon.my_wait_element(self, "//img[@alt='View Products']")
        self.selenium.click("//img[@alt='View Products']")

        Selection.Products(self)
        AddCart.AddCart(self, "2")
        AddCart.CheckOut(self)
Ejemplo n.º 16
0
    def test003_ymmbrand_Stampede_StampedeTapeOnzSidewindDeflectorWindowVisors(self):
        Selection.Brand(self, "Stampede")
        Selection.Year(self, "2010")
        Selection.Make(self, "FORD")
        Selection.Series_options(self, "Stampede Tape-Onz Sidewind Deflector Window Visors")
        FunctionCommon.my_wait_element(self, "//img[@alt='View Products']")
        self.selenium.click("//img[@alt='View Products']")

        Selection.Products(self)
        AddCart.AddCart(self, "2")
        AddCart.CheckOut(self)
Ejemplo n.º 17
0
    def test002_ymmbrand_Stampede_VigilanteLowProfileBugShield(self):
        Selection.Brand(self, "Stampede")
        Selection.Year(self, "2010")
        Selection.Make(self, "FORD")
        Selection.Series_options(self, "Vigilante Low Profile Bug Shield")
        FunctionCommon.my_wait_element(self, "//img[@alt='View Products']")
        self.selenium.click("//img[@alt='View Products']")

        Selection.Products(self)
        AddCart.AddCart(self, "2")
        AddCart.CheckOut(self)
Ejemplo n.º 18
0
def install_app_start_activity(tag, pkg, act, app_file, replace_apk=False, delay=6):
    if replace_apk or not FunCom.tell_app_installed(tag, pkg):
        apk_path = ''
        for f in FunCom.list_dir(FunCom.Res.util_path):
            if app_file in f:
                apk_path = FunCom.get_abspath(FunCom.path_join(FunCom.Res.util_path, f))
        if apk_path == '':
            FunCom.raise_error(
                app_file + ' Apk file not found under ./util directory')
        # windows do not support grep command, cannot tell existence
        install_r(tag, apk_path, False)
        FunCom.sleep(delay)
    FunCom.p_open(FunCom.Res.asb_shell_start_activity(tag, act))
Ejemplo n.º 19
0
def count_info(tag, total_number_dalvik_size, dalvik_size, dalvik_alloc):
    FunCom.sleep(15)
    mem_info = FunCom.p_open(
        'adb -s ' + tag +
        '  shell dumpsys mem_info  com.kcg.com.fun').readlines()
    for info_item in mem_info:
        if 'Dalvik Heap' in info_item:
            info_item_info_arr = info_item.split('   ')
            if len(info_item_info_arr) > 4:
                total_number_dalvik_size.append(info_item_info_arr[1])
                dalvik_size.append(info_item_info_arr[-3])
                dalvik_alloc.append(info_item_info_arr[-2])
                FunCom.log(str(info_item_info_arr[1]) + '===============')
Ejemplo n.º 20
0
def start_monkey_and_analyze(android_version, anr_receivers, browser, device,
                             device_info, events, keyword, logfile, mail_pwd,
                             pkg_name, receivers, sender, subject, throttle):
    Fun.kill_monkey(device)
    Mon.prepare_log_file_path_file(logfile)
    # todo
    Mon.start(device, pkg_name, events, throttle, logfile)
    try:
        Mon.log_trick(device, logfile, sender, mail_pwd, receivers,
                      anr_receivers, subject, logfile, browser, device_info,
                      android_version, keyword)
    except Exception as e:
        Fun.log(e)
Ejemplo n.º 21
0
def click_test():
    tags = FunCom.devices_list_with_connection_check()
    tag = tags[0]
    apk_files = FunPkg.get_apk_file_in_project()
    if len(apk_files) > 0:
        for f in apk_files:
            if str(f).endswith(Res.pgk_suffix):
                FunPkg.uninstall(tag, Res.pkg_name)
                FunPkg.install_r(tag, FunCom.get_abspath(f), True)
                break
    else:
        raise Exception(
            "no apk found in project '/apk' directory, put one at least")
    FunCom.serial_clicks_by_control_file(tag)
Ejemplo n.º 22
0
def main_process():
    print '''\n
    -----------------------------------------------
    you can pass params to define dump :(every param can be ignored)
    example----$ python GradDump.py  
    example----$ python GradDump.py  1_file_name  
    example----$ python GradDump.py  1_file_name  2_destination_directory  
    example----$ python GradDump.py  1_file_name  2_destination_directory  3_process_name
    1. 1_file_name
    2. 2_destination_directory
    3. 3_process_name
    
    NOTE: once you've input a param already, the next time function running will use the latest param you input
    -----------------------------------------------
    '''
    argv = sys.argv
    dump_name = 1
    path = 2
    process = 3
    params = ['', '', '', '']
    config_file_path = Res.config_path
    configs = Fun.get_usable_lines_from_file(config_file_path)
    for config in configs:
        data = config.split(Res.config_split)
        if data[0].startswith(Res.ck_dump_name) and len(data) > 1:
            params[dump_name] = data[1].strip()
        elif data[0].startswith(Res.ck_path) and len(data) > 1:
            params[path] = data[1].strip()
        elif data[0].startswith(Res.ck_process) and len(data) > 1:
            params[process] = data[1].strip()
    if Fun.list_contain_content_on_index(
            argv,
            dump_name):  # the python file name will take the 0 index in array
        params[dump_name] = argv[dump_name]
        Fun.replace_line_in_file(
            config_file_path, Res.ck_dump_name,
            Res.assemble_config(Res.ck_dump_name, params[dump_name]))
        if Fun.list_contain_content_on_index(argv, path):
            params[path] = argv[path]
            Fun.replace_line_in_file(
                config_file_path, Res.ck_path,
                Res.assemble_config(Res.ck_path, params[path]))
            if Fun.list_contain_content_on_index(argv, process):
                params[process] = argv[process]
                Fun.replace_line_in_file(
                    config_file_path, Res.ck_process,
                    Res.assemble_config(Res.ck_process, params[process]))
    grab_dump_and_convert(params[dump_name], params[path], params[process])
Ejemplo n.º 23
0
    def get_device_not_found_content(self, receivermail, date, subject,
                                     browser, device):
        html = """\
                <html>
                <body>
                <h2><center> DATE APPNAME Monkey Test exception explanation</center></h2>
                <table border="1" algin="center">
                <caption><em>Jenkins AutoTest Result</em></caption>
                <tr>
                <tr><th>Jenkins</th><td><a href='http://10.60.118.93:8080/jenkins/view/Monkey/job/APPNAME_DEVICENAME/'>http://10.60.118.93:8080/jenkins/view/Monkey/job/APPNAME_DEVICENAME/</a></td></tr>
                <tr><th>DeviceInfo</th><td>DEVICENAME</td></tr>
                </table>
                <body>
                <html>
                """

        html = html.replace("DATE", date)
        html = html.replace("10.60.118.93", Fun.get_my_ip())
        html = html.replace('APPNAME', browser)
        html = html.replace('DEVICENAME', device)

        msgRoot = MIMEMultipart('related')
        msgRoot['Subject'] = subject.replace('_', '')
        msgRoot['From'] = self.proxysender
        msgRoot['To'] = ",".join(receivermail)

        msgText = MIMEText(html, 'html', 'utf-8')
        msgRoot.attach(msgText)

        print '>>>>>> MailSender.get_device_not_found_content() finished '
        return msgRoot
Ejemplo n.º 24
0
def information_collection(apk_tag, dev, path):
    Fun.log('trigger gc')
    absolute_tmp_dump_path = os.path.realpath(path)
    Fun.p_open(
        Res.adb_grab_heap_dump_file_with_pkg(dev, absolute_tmp_dump_path,
                                             Res.pkg_name))
    Fun.sleep(10)

    lines = Fun.p_open(Res.asb_shell_dump_mem_info(dev)).readlines()
    name = apk_tag + Res.dump + Fun.current_time()
    dump_mem_info_store_to_file(name, lines, path)
    Grab.grab_dump_and_convert(dev, name, absolute_tmp_dump_path, Res.pkg_name)
Ejemplo n.º 25
0
def install_pkg_and_prepare_record_file(d,
                                        apk_path,
                                        package_name,
                                        logfile,
                                        installed_once=True):
    parser = FunCom.get_conf_parser(Res.monkey_conf_file)
    if not parser.has_option(Res.monkey_target_key_word_opt,
                             Res.monkey_target_key_word_key):
        FunCom.raise_error(Res.monkey_target_not_found)
    key_word = parser.get(Res.monkey_target_key_word_opt,
                          Res.monkey_target_key_word_key)
    apk_full_path = FunCom.parse_apk_full_path(key_word)

    if not installed_once:
        FunPkg.uninstall_and_install(d, apk_full_path, package_name)
        FunLch.start_launcher_omit_splash(d)
    else:
        FunPkg.install_r(d, apk_full_path, True)
        FunLch.start_launcher_omit_splash(d, False, False)
    prepare_path_record_file(logfile, apk_full_path)
Ejemplo n.º 26
0
def perform_operations(tag, uid_info, x, app_file):
    FunCom.p_open(Res.adb_dump_battery_status_reset(tag))
    FunCom.serial_operation_by_control_file(tag)

    battery_info = access_to_electricity(tag, uid_info)
    FunCom.sleep(5)
    write_data_into_excel(battery_info, x, app_file)
Ejemplo n.º 27
0
def CheckOut(self):
    FunctionCommon.my_wait_element(self, "//div[@id='CartContent']/div/div[1]/div[2]/div[1]/a/img")
    self.selenium.click("//div[@id='CartContent']/div/div[1]/div[2]/div[1]/a/img")
    # step1 Account Detail: Checkout as a guest
    FunctionCommon.my_wait_element(self, "checkout_type_guest")
    self.selenium.click("checkout_type_guest")
    FunctionCommon.my_wait_element(self, "CreateAccountButton")
    self.selenium.click("CreateAccountButton")
Ejemplo n.º 28
0
def grab_dump_and_convert(dev, target_name, dest_path, pkg):
    Fun.p_open(
        Res.adb_grab_heap_dump_file_with_pkg(dev, absolute_tmp_dump_path, pkg))
    Fun.sleep(4)
    dump_file_path = os.path.join(dest_path, target_name)
    dump_file = dump_file_path + Res.hprof_suffix if not dump_file_path.endswith(
        Res.hprof_suffix) else dump_file_path
    if os.path.exists(dump_file):
        dump_file = dump_file.replace(Res.hprof_suffix,
                                      Fun.current_time() + Res.hprof_suffix)
    Fun.p_open(
        Res.adb_pull_heap_file_to_dest(dev, absolute_tmp_dump_path, dump_file))
    convert_file_into_directory(dump_file)
Ejemplo n.º 29
0
    def test022_ymmbrand_Stampede_VigilanteLowProfileBugShield(self):
        FunctionCommon.my_wait_element(self, "brand_more")
        self.selenium.click("brand_more")

        FunctionCommon.my_wait_element(self, "link=Stampede")
        self.selenium.click("link=Stampede")
        FunctionCommon.my_wait_text_prsesent(self, "Series Found for")

        Selection.Year(self, "2010")
        Selection.Make(self, "FORD")
        Selection.Series_options(self, "Vigilante Low Profile Bug Shield")
        FunctionCommon.my_wait_element(self, "//img[@alt='View Products']")
        self.selenium.click("//img[@alt='View Products']")

        Selection.Products(self)
        AddCart.AddCart(self, "2")
        AddCart.CheckOut(self)
Ejemplo n.º 30
0
    def get_content(self, receivermail, date, crash_result, subject, logfile,
                    browser, device, androidversion):
        html = """\
                <html>
                <body>
                <h2><center> 2014-06-10 APPNAME Monkey Test exception explanation</center></h2>
                <table border="1" algin="center">
                <caption><em>Jenkins AutoTest Result</em></caption>
                <tr>
                <tr><th>Jenkins<td><a href='http://10.60.118.93:8080/jenkins/view/Monkey/job/APPNAME_DEVICENAME/'>http://10.60.118.93:8080/jenkins/view/Monkey/job/APPNAME_DEVICENAME/</a>
                <tr><th>Install APK_PATH<td>test.apk
                <tr><th>DeviceInfo<td>DEVICENAME
                <tr><th>System<td>ANDROIDVERSION
                <tr><th>Result<td>Found crash Log, please check out logfile or download attachments
                </table>
                <br>contentsss
                <br>
                <body>
                <html>
                """
        # <img border="0" src="cid:image_win" width="200" length="200" >

        mFile = open(logfile.replace('.log', '.path'))
        strfile = mFile.read()
        mFile.close()
        html = html.replace("2014-06-10", date)
        html = html.replace("10.60.118.93", Fun.get_my_ip())
        html = html.replace("test.apk", strfile.split('/')[-1])
        html = html.replace("contentsss", crash_result)
        html = html.replace('APPNAME', browser)
        html = html.replace('DEVICENAME', device)
        html = html.replace('ANDROIDVERSION', androidversion)
        msgRoot = MIMEMultipart('related')
        msgRoot['Subject'] = subject.replace('_', '')
        msgRoot['From'] = self.proxysender
        msgRoot['To'] = ",".join(receivermail)

        msgText = MIMEText(html, 'html', 'utf-8')
        msgRoot.attach(msgText)

        txt = MIMEText(open(logfile, 'rb').read(), 'base64', 'gb2312')
        txt["Content-Type"] = 'application/octet-stream'
        txt["Content-Disposition"] = 'attachment; filename="CrashLog.txt"'
        msgRoot.attach(txt)

        print '>>>>>> MailSender.get_content() finished '
        return msgRoot
Ejemplo n.º 31
0
 def __get_api_conf(self, sfile, conf_name):
     full_path = Fun.get_file_in_directory_full_path(sfile)
     print full_path
     if not os.path.exists(full_path):
         print("Error: Cannot get config file")
         sys.exit(-1)
     sfile = full_path
     conf = ConfigParser.ConfigParser()
     conf.read(sfile)
     print conf.sections()
     try:
         self.url = conf.get(conf_name, "url")
         self.access_token = conf.get(conf_name, "access_token")
         self.api_token = conf.get(conf_name, "api_token")
     except Exception, e:
         print("Error: " + str(e))
         sys.exit(-1)
Ejemplo n.º 32
0
def collect_info_repeat_with_fixed_rate(apk, dev, path):
    for i in range(collect_times):
        information_collection(apk, dev, path)
        Fun.sleep(collect_info_internal)
Ejemplo n.º 33
0
def collect_dump_info(dev):
    Fun.log('start thread for device:' + dev)
    path = make_device_tag_dir(dev)
    for apk in pkg_list:
        inspect_apk_dump_with_internal(apk, dev, path)
Ejemplo n.º 34
0
def main_process():
    devices = Fun.devices_list_with_connection_check()
    for dev in devices:
        Thread(target=collect_dump_info, args=(dev, )).start()
Ejemplo n.º 35
0
import sys
Ejemplo n.º 36
0
def make_device_tag_dir(d):
    model, bluetooth = Fun.parse_device_model_and_bluetooth(d)
    path = os.path.join(Res.output_path, model + Res.underline + bluetooth)
    Fun.make_dir_if_not_exist(path)
    return path
Ejemplo n.º 37
0
def AddCart(self, qty):
    FunctionCommon.my_wait_element(self, "qty_")
    self.selenium.select("qty_", "label=" + qty)
    FunctionCommon.my_wait_element(self, "//div[@id='ProductDetails']/div/form/div/dl[2]/dd/div/input")
    self.selenium.click("//div[@id='ProductDetails']/div/form/div/dl[2]/dd/div/input")
Ejemplo n.º 38
0
import FunctionCommon as Fun
Ejemplo n.º 39
0
import sys
Ejemplo n.º 40
0
def swipe_test():
    tags = FunCom.devices_list_with_connection_check()
    for tag in tags:
        FunCom.serial_operation_by_control_file(tag,
                                                '/case/%s.txt' % 'all_apps')
Ejemplo n.º 41
0
def dump_mem_info_store_to_file(name, lines, path):
    file_path = os.path.join(path, name + Res.txt_suffix)
    if not os.path.exists(file_path):
        Fun.p_open('touch ' + file_path)
    Fun.write_lines_into_file(file_path, lines)
Ejemplo n.º 42
0
import sys
Ejemplo n.º 43
0
import FunctionCommon as Fun
Ejemplo n.º 44
0
from multiprocessing import freeze_support
Ejemplo n.º 45
0
def monkey_work(device_id, app_name=Res.app_name):
    browser = app_name
    device = device_id

    conf = Fun.get_conf_parser(Res.monkey_conf_file)
    Fun.assert_options_presents(conf, ['mail', 'ftp', 'apk', 'monkey_params'])
    sender = conf.get('mail', 'sender')
    mail_pwd = conf.get('mail', 'pwd')
    subject = conf.get('mail', 'subject')
    receivers = conf.get('mail', 'receivers').split(',')
    anr_receivers = conf.get('mail', 'anr_receivers').split(',')
    pkg_name = conf.get('apk', 'package_name')
    subject = conf.get('apk', 'name') + subject
    keyword = conf.get('apk', 'keyword')
    events = conf.get('monkey_params', 'events')
    throttle = conf.get('monkey_params', 'throttle')

    apk_path = Fun.get_abspath(Res.apk_path)
    android_version = Fun.get_android_version(device_id)
    device_info = Fun.parse_device_info(device_id)
    logfile = Fun.get_abspath(
        Fun.path_join(Res.log_path, device_info + Res.log_suffix))

    package_installed_once = False
    Mon.push_lib_to_phone(device)

    while True:
        if not package_installed_once:
            try:
                # todo
                Mon.prepare_log_file_path_file(logfile)
                Mon.refresh_with_apk(device, apk_path, pkg_name, logfile,
                                     package_installed_once)
                package_installed_once = True

                # todo
                Mon.skip(device)
                start_monkey_and_analyze(android_version, anr_receivers,
                                         browser, device, device_info, events,
                                         keyword, logfile, mail_pwd, pkg_name,
                                         receivers, sender, subject, throttle)
            except Exception as e:
                Fun.log(e)
        else:

            # todo
            Fun.kill_monkey(device)

            # todo
            FunLch.start_launcher_omit_splash(device, False, False)
            Fun.sleep(2)
            start_monkey_and_analyze(android_version, anr_receivers, browser,
                                     device, device_info, events, keyword,
                                     logfile, mail_pwd, pkg_name, receivers,
                                     sender, subject, throttle)
Ejemplo n.º 46
0
def start_launcher_omit_splash(d, omit_splash=True, back_press=True):
    if omit_splash:
        Fun.p_open(Res.asb_shell_start_activity(d))
        Fun.sleep(Res.pkg_init_delay)
        Fun.p_open(Res.asb_shell_force_stop(d))
    Fun.p_open(Res.asb_shell_start_activity(d))
    if back_press:
        for i in range(5):
            Fun.sleep(3)
            Fun.p_open(Res.adb_key_event_back(d))