def setup(self): """setup implement's resource file""" busybox_obj.setup() if not pkgmgr._package_installed(pkgName=self.PKG_NAME): file_path = self.config.get("apk") apk_path = self.arti.get(file_path) pkgmgr.apk_install(apk_path)
def _check_dependency(self): if not pkgmgr._package_installed(pkgName=PACKAGENAME): android_version = self.env.get_android_version() selection = { 'L': 'apk_l', 'M': 'apk_m', 'N': 'apk_n', 'O-MR0': 'apk_omr0', 'O-MR1': 'apk_omr1' } try: file_path = get_resource_from_atifactory( 'tests.common.dEQP.conf', 'dEQP', selection[android_version]) pkgmgr.apk_install(file_path) except KeyError, e: print "DEQP app version not match with android os: %s" % str(e)
def _install_apk(self): if not pkgmgr._package_installed(pkgName=PACKAGE_NAME): android_version = EnvironmentUtils().get_android_version() selection = { 'L': 'apk_l', 'M': 'apk_m', 'N': 'apk_n', 'O-MR0': 'apk_omr0', 'O-MR1': 'apk_omr1' } try: file_path = get_resource_from_atifactory( 'tests.tablet.artifactory.conf', 'content_colormode', selection[android_version]) pkgmgr.apk_install(file_path) except KeyError, e: print "ColorMode app version not match with android os: %s" % str( e)
def setup(self): """setup implement's resource file""" busybox_obj.setup() if not pkgmgr._package_installed(pkgName=self.PKG_NAME): file_path = self.config.get("apk") apk_path = self.arti.get(file_path) pkgmgr.apk_install(apk_path) cmd = "cd %s || mkdir -p %s" % (self.apk_cache_dir, self.apk_cache_dir) g_common_obj.adb_cmd_capture_msg(repr(cmd)) apk_cache_files = self.arti.get(self.config.get("apk_cache_files")) ret = g_common_obj.push_file(apk_cache_files, self.dut_download) assert ret, 'Failed push %s' % (apk_cache_files) files_name = os.path.basename(apk_cache_files) cmd = "busybox tar zxf %s/%s --directory %s > /dev/null 2>&1 && print UnzipComplete"\ % (self.dut_download, files_name, self.apk_cache_dir) output = busybox_obj.adb_busybox_cmd(repr(cmd), 60 * 10) assert 'UnzipComplete' in output,\ "[FAILURE] Failed unzip: %s" % (files_name)
def setup(self): gfb = Gfxbench() def _wait_init(timeout=60): """wait app initialize""" start_time = time.time() is_completed = False while time.time() - start_time < timeout: _, current_activity = get_current_focus_window() if current_activity == gfb.MAIN_ACTIVITY: is_completed = True break if gfb.device(text='Accept').exists: gfb.device(text='Accept').click() if gfb.device(text='OK').exists: gfb.device(text='OK').click() if gfb.device(text='Retry').exists: gfb.device(text='Retry').click() time.sleep(5) assert is_completed, \ "[FAILURE] Server timeout: %s" % (timeout) def _clean_chooses(): """check off all checkbox""" def _search_item_checkbox(name): """scroll find checkbox""" if gfb.device(resourceId="com.glbenchmark.glbenchmark27:id/main_testSelectListView")\ .scroll.vert.to(text=name): return gfb.device(text=name).right( className="android.widget.CheckBox") for each in gfb.TEST_GROUPS: checkbox = _search_item_checkbox(each) if checkbox.exists: check = checkbox.info['checked'] if check == True: checkbox.click() else: checkbox.click() checkbox.click() # install apk if not pkgmgr._package_installed(pkgName=self.PKG_NAME): pkgmgr.apk_install(self.apk_path) # Push cache files if not any([ True for i in file_sys.get_file_list(self.remote_apk_cache_path + " -type d -print") if self.PKG_NAME in i ]): busybox_obj.setup() clean_cache_cmd = "rm -rf %s%s" % (self.remote_apk_cache_path, self.PKG_NAME) push_cmd = "push %s %s" % (self.apk_cache_path, self.remote_apk_cache_path) cmd = "busybox tar xvf %s%s -C %s" % (self.remote_apk_cache_path, self.apk_cache_name, self.remote_apk_cache_path) td_cmd = "rm -rf %s%s" % (self.remote_apk_cache_path, self.apk_cache_name) g_common_obj.adb_cmd_capture_msg(clean_cache_cmd) g_common_obj.adb_cmd_common(push_cmd) busybox_obj.adb_busybox_cmd(cmd) g_common_obj.adb_cmd_capture_msg(td_cmd) # Go to main menu g_common_obj.launch_app_am(self.PKG_NAME, self.MAIN_ACTIVITY) _wait_init(240) # Log in account for i in range(4): self.device(className="android.widget.RelativeLayout").swipe.left() time.sleep(1) if not self.device(text=self.USERNAME).exists: self.device(resourceId="com.glbenchmark.glbenchmark27:id/settings_editableUserName").\ set_text(self.USERNAME) time.sleep(1) if not self.device( resourceId= "com.glbenchmark.glbenchmark27:id/settings_editableUserPassword" ).exists: self.device.press.back() time.sleep(1) self.device(resourceId="com.glbenchmark.glbenchmark27:id/settings_editableUserPassword").\ set_text(self.PASSWORD) time.sleep(1) if not self.device( resourceId="com.glbenchmark.glbenchmark27:id/settings_login" ).exists: self.device.press.back() time.sleep(1) self.device( resourceId="com.glbenchmark.glbenchmark27:id/settings_login" ).click.wait() time.sleep(1) for i in range(4): self.device( className="android.widget.RelativeLayout").swipe.right() time.sleep(1) # Show test lists if self.device( resourceId='com.glbenchmark.glbenchmark27:id/main_circleControl' ).exists: bounds = self.device( resourceId='com.glbenchmark.glbenchmark27:id/main_circleControl' ).info['visibleBounds'] for i in range(10): self.device.click( bounds['left'] + (bounds['right'] - bounds['left']) * 0.75, bounds['bottom'] - 20 * i) if self.device(text='Test selection').exists: break assert self.device(text='Test selection').exists, \ "[FAILURE] Failed skip_guide" _clean_chooses() self.device( resourceId="com.glbenchmark.glbenchmark27:id/main_testSelectListView" ).scroll.toBeginning() time.sleep(3)
def setup(self): """install apk""" if not pkgmgr._package_installed(pkgName=self.PKG_NAME): file_path = self.config.get("apk") apk_path = self.arti.get(file_path) pkgmgr.apk_install(apk_path)
def test_Virtual_DisplayTest(self): if not pkgmgr._package_installed(PACKAGE_NAME): g_common_obj.adb_cmd_common("install -r %s" % self.apk) assert adb32.run_instrument_test(CLASS_NAME, PACKAGE_NAME), "Test failed."