コード例 #1
0
def run_test(log_dir, geek):
    clear_all(geek)
    time.sleep(1)
    geek.launch_app()
    time.sleep(5)
    geek.ui_operation.click_ui_button_by_text('Run Benchmarks')
    kill_uiautomator()
    ver = os.popen('adb shell getprop ro.build.version.release').read()
    if ver:
        ver = ver.strip()
    if ver == '6.0.1':
        result = geek.ui_operation.wait_for_complete_by_text("Result",
                                                             timeout=500)
    else:
        result = geek.ui_operation.wait_for_complete_by_text("RESULT",
                                                             timeout=500)
    time.sleep(5)
    if not result:
        return False
    try:
        lines = geek.device.dump()
        with open("score.xml", 'wb+') as fp:
            fp.write(lines)
    except Exception, e:
        geek.logout(geek.my_func_name(), "test error %s" % e)
        return False
コード例 #2
0
def down_up(panning_test, times):
    kill_uiautomator()
    for i in range(times):
        panning_test.swiping.up()
        panning_test.swiping.up()
        panning_test.swiping.up()
        panning_test.swiping.down()
        panning_test.swiping.down()
        panning_test.swiping.down()
コード例 #3
0
    def run_test(self, timeout=100):
        # self.clear_data()
        self.mobile_test.launch_app()
        # time.sleep(30)
        self.mobile_test.ui_operation.wait_for_root_page("ok_button")
        kill_adb_uiautomator_block_old()
        self.mobile_test.ui_operation.click_ui_button_by_resourceIdMatches(
            'ok_button')
        self.mobile_test.ui_operation.click_ui_button_by_resourceIdMatches(
            'launch_button', timeout=timeout)
        while "Extracting content" in self.mobile_test.device.dump():
            time.sleep(10)
            kill_adb_uiautomator_block_old()
            time.sleep(2)
        # 	time.sleep
        # time.sleep(60)
        if self.tr_name == "MobileXPRT_perf":
            self.mobile_test.ui_operation.click_ui_button_by_resourceIdMatches(
                'cancel_button', timeout=timeout)
            # self.mobile_test.wait_for_root_page('button_media_tests')
            if not self.mobile_test.ui_operation.click_ui_button_by_resourceIdMatches(
                    'button_media_tests', timeout=120):
                return False
        if self.tr_name == "MobileXPRT_ux":
            self.mobile_test.ui_operation.click_ui_button_by_resourceIdMatches(
                'ok_button', timeout=timeout)
            self.mobile_test.ui_operation.click_ui_button_by_resourceIdMatches(
                'done_button', timeout=timeout)
            # self.mobile_test.wait_for_root_page('button_ux_tests')
            if not self.mobile_test.ui_operation.click_ui_button_by_resourceIdMatches(
                    'button_ux_tests', timeout=120):
                return False
        kill_adb_uiautomator_block()
        kill_uiautomator()
        time.sleep(5)
        # time.sleep(400)
        if self.mobile_test.ui_operation.wait_for_complete(
                "group_score", splittime=400, timeout=500) == False:
            return False
        time.sleep(2)
        # self.tr.kill_watt_runtime()
        kill_adb_uiautomator_block()
        if not app_exception_kill_case(self.mobile_test.app_package):
            return False
        app_device = self.mobile_test.device(resourceIdMatches=".+/group_name")

        if (app_device.exists):
            right_dev = app_device.right(resourceIdMatches=".+/group_score")
            if right_dev.exists:
                self.data = str(right_dev.info['text'])
        kill_adb_uiautomator_block()

        if self.data != "" and self.data.isdigit():
            self.mobile_test.logout(self.mobile_test.my_func_name(),
                                    "Test data is %s" % self.data)
            return self.data
        return False
コード例 #4
0
def run_test(panning_fps_test, panning_test, log):
    push_html()
    clean_app(panning_test)
    panning_test.skip_chrome_wizard()
    panning_test.launch_chrome_with_page("permission_allow_button")
    time.sleep(3)
    kill_adb_uiautomator_block_old()
    kill_uiautomator()
    panning_fps_test.doInThread(down_up, panning_test, 50)
    time.sleep(2)
    panning_fps_test.doInThread(panning_fps_test.run_fpstool_ext, log)
    if not panning_test.ui_operation.wait_for_compelet_for_fps(timeout=60):
        return False
    avg_fps = panning_fps_test.collect_result(log)
    panning_fps_test.kill_fps_tools()
    panning_test.kill_app()
    panning_test.logout(panning_test.my_func_name(), "Frame rate while panning web page in Browser- average:%s"%avg_fps)
    return avg_fps
コード例 #5
0
def run_test(geek, tr):
    clear_all(geek)
    time.sleep(1)
    geek.clear_caches()

    if tr.case_info["arg"] == "version_3":
        geek.launch_app()
        geek.ui_operation.wait_for_root_page("runBenchmarks")
        geek.ui_operation.app_package = "android"
        geek.ui_operation.click_ui_button_by_text("OK")
        geek.ui_operation.app_package = geek.app_package
        time.sleep(1)
        geek.ui_operation.click_ui_button_by_text('Run Benchmarks')
    else:
        system_operation.connect_wifi_manual("shz13f-otcandroidlab-ap01-aosp",
                                             "cdexswzaq")
        time.sleep(3)
        geek.launch_app()
        geek.ui_operation.wait_for_root_page("home")
        geek.ui_operation.click_ui_button_by_text("ACCEPT")
        time.sleep(1)
        geek.ui_operation.click_ui_button_by_text("RUN CPU BENCHMARK")
        time.sleep(2)
        geek.ui_operation.click_ui_button_by_text("OK")
    kill_uiautomator()
    ver = os.popen('adb shell getprop ro.build.version.release').read()
    if ver:
        ver = ver.strip()
    if ver == '6.0.1':
        result = geek.ui_operation.wait_for_complete_by_text("Result",
                                                             timeout=500)
    else:
        result = geek.ui_operation.wait_for_complete_by_text("RESULT",
                                                             timeout=500)
    time.sleep(5)
    if not result:
        return False
    try:
        lines = geek.device.dump()
        with open("score.xml", 'wb+') as fp:
            fp.write(lines)
    except Exception, e:
        geek.logout(geek.my_func_name(), "test error %s" % e)
        return False