def setUpClass(self): """ install apk """ super(RunImageProcessing, self).setUpClass() config = TestConfig() cfg_file = 'tests.tablet.artifactory.conf' cfg_arti = config.read(cfg_file, 'artifactory') config_handle = ConfigHandle() cfg_arti["location"] = config_handle.read_configuration( 'artifactory', 'location', '/etc/oat/', 'sys.conf') cfg = config.read(cfg_file, 'content_imageprocessing') arti = Artifactory(cfg_arti.get('location')) version_array = osversion.get_android_version() androidversion = version_array[0] if androidversion == 7: print "osversion is N" apk_name = cfg.get("name") elif androidversion == 6: print "osversion is M" apk_name = cfg.get("name") elif androidversion == 5: print "osversion is L" apk_name = cfg.get("name_l") else: print "osversion is %s" % (androidversion) apk_name = cfg.get("name_l") file_path = arti.get(apk_name) result = config_handle.check_apps("com.android.rs.image") if result == 0: g_common_obj.adb_cmd_common('install ' + file_path)
def btn_force_stop(self): """ UI button browser force stop """ version_array = osversion.get_android_version() androidversion = version_array[0] if androidversion == 6: return self.d(text="Force stop") return self.d(text="FORCE STOP")
def set_wallpaper_by_desktop(self, wallpaper): """ set wallpaper by desktop The wallpaper parameter just need the number of description from uiautomator, Eg:description=Wallpaper 7 of 10;you just need imput 7 as parameter; To distinguish total number is 10 or 11,it depends on android M or android L. """ print "Set wallpaper by desktop" version_array = osversion.get_android_version() androidversion = version_array[0] if androidversion == 7: print "osversion is N" wallpaper = "Wallpaper %s of 10" % (wallpaper) elif androidversion == 6: print "osversion is M" wallpaper = "Wallpaper %s of 10" % (wallpaper) elif androidversion == 5: print "osversion is L" wallpaper = "Wallpaper %s of 11" % (wallpaper) else: print "osversion is %s" % (androidversion) wallpaper = "Wallpaper %s of 11" % (wallpaper) self.launch_set_wallpaper_by_desktop() self._device(text="Wallpapers").click.wait() time.sleep(1) self._device(scrollable=True).scroll.horiz.to(description=wallpaper) time.sleep(1) self._device(description=wallpaper).click.wait() time.sleep(4) self._device(textContains="Set wallpaper").click.wait() time.sleep(2) self._device.press.home() time.sleep(1) g_common_obj.assert_exp_happens()
def installImageProcessor(self): ''' install from Artifactory ''' config = TestConfig() cfg_file = 'tests.tablet.artifactory.conf' cfg_arti = config.read(cfg_file, 'artifactory') config_handle = ConfigHandle() cfg_arti["location"] = config_handle.read_configuration( 'artifactory', 'location', '/etc/oat/', 'sys.conf') cfg = config.read(cfg_file, 'content_imageprocessing') arti = Artifactory(cfg_arti.get('location')) version_array = osversion.get_android_version() androidversion = version_array[0] if androidversion == 7: print "osversion is N" apk_name = cfg.get("name") elif androidversion == 6: print "osversion is M" apk_name = cfg.get("name") elif androidversion == 5: print "osversion is L" apk_name = cfg.get("name_l") else: print "osversion is %s" % (androidversion) apk_name = cfg.get("name_l") file_path = arti.get(apk_name) result = config_handle.check_apps(self.pkg_name) if result == 0: g_common_obj.adb_cmd_common('install ' + str(file_path), 300)
def run_case_program_binary_es3(self): """ Run given test case Run given test case with given es version """ version_array = osversion.get_android_version() androidversion = version_array[0] if androidversion == 7: print "osversion is N" cmd = "shell %s -v 4 -minFmt -libGL /system/vendor/lib/egl/libGLES_*.so -es3 -testList " \ "/data/app/get-program-binary_es3 | grep 'Total Failed : 0'" % self.exec_bin elif androidversion == 6: print "osversion is M" cmd = "shell %s -v 4 -minFmt -libGL /system/vendor/lib/egl/libGLES_*.so -es3 -testList " \ "/data/app/get-program-binary_es3 | grep 'Total Failed : 0'" % self.exec_bin elif androidversion == 5: print "osversion is L" cmd = "shell %s -v 4 -minFmt -libGL /system/lib/egl/libGLES_intel*.so -es3 -testList " \ "/data/app/get-program-binary_es3 | grep 'Total Failed : 0'" % self.exec_bin else: print "osversion is %s" % (androidversion) cmd = "shell %s -v 4 -minFmt -libGL /system/lib/egl/libGLES_intel*.so -es3 -testList " \ "/data/app/get-program-binary_es3 | grep 'Total Failed : 0'" % self.exec_bin diag_output = g_common_obj.adb_cmd_common(cmd, 600) assert diag_output.find( 'Total Failed : 0') >= 0, "run_case_program_binary_es3 failed"
def test_DebugMode_SimulateSecondaryDisplay_Drag(self): ''' refer TC test_DebugMode_SimulateSecondaryDisplay_Drag ''' print "[RunTest]: %s" % self.__str__() version_array = osversion.get_android_version() androidversion = version_array[0] if androidversion in (5, 6, 7, 8): print "osversion is M,N,O" self._debugmodeDrag.launch_settings_am() self._debugmodeDrag.choose_simulate_secondary_displays() self._debugmodeDrag.change_simulate_720p_1080p_dualscreen() self._debugmodeDrag.drag_simulated_secondary_display() self._debugmodeDrag.change_simulate_4K_upscaled_secure() self._debugmodeDrag.drag_simulated_secondary_display() self._debugmodeDrag.change_simulate_4K_upscaled() self._debugmodeDrag.drag_simulated_secondary_display() self._debugmodeDrag.change_simulate_4K_secure() self._debugmodeDrag.drag_simulated_secondary_display() self._debugmodeDrag.change_simulate_4K() self._debugmodeDrag.drag_simulated_secondary_display() self._debugmodeDrag.change_simulate_1080p_secure() self._debugmodeDrag.drag_simulated_secondary_display() self._debugmodeDrag.change_simulate_1080p() self._debugmodeDrag.drag_simulated_secondary_display() self._debugmodeDrag.change_simulate_720p_secure() self._debugmodeDrag.drag_simulated_secondary_display() self._debugmodeDrag.change_simulate_720p() self._debugmodeDrag.drag_simulated_secondary_display() self._debugmodeDrag.change_simulate_480p_secure() self._debugmodeDrag.drag_simulated_secondary_display() self._debugmodeDrag.change_simulate_480p() self._debugmodeDrag.change_simulate_None() self._debugmodeDrag.stop_settings_am() else: print "osversion is %s" % (androidversion) self._debugmodeDrag.launch_settings_am() self._debugmodeDrag.choose_simulate_secondary_displays() self._debugmodeDrag.change_simulate_1280x720_and_1920x1080() self._debugmodeDrag.drag_simulated_secondary_display() self._debugmodeDrag.change_simulate_1920x1080_secure() self._debugmodeDrag.drag_simulated_secondary_display() self._debugmodeDrag.change_simulate_1920x1080() self._debugmodeDrag.drag_simulated_secondary_display() self._debugmodeDrag.change_simulate_1280x720_secure() self._debugmodeDrag.drag_simulated_secondary_display() self._debugmodeDrag.change_simulate_1280x720() self._debugmodeDrag.drag_simulated_secondary_display() self._debugmodeDrag.change_simulate_720x480_secure() self._debugmodeDrag.drag_simulated_secondary_display() self._debugmodeDrag.change_simulate_720x480() self._debugmodeDrag.change_simulate_None() self._debugmodeDrag.stop_settings_am()
def setup(self): """setup implement's resource file""" version_array = osversion.get_android_version() androidversion = version_array[0] if androidversion == 7: print "osversion is N" apk_path = self.arti.get(self.config.get("apk")) elif androidversion == 6: print "osversion is M" apk_path = self.arti.get(self.config.get("apk")) elif androidversion == 5: print "osversion is L" apk_path = self.arti.get(self.config.get("apk_l")) else: print "osversion is %s" % (androidversion) apk_path = self.arti.get(self.config.get("apk_l")) cmd = "install -r %s" % (apk_path) print g_common_obj.adb_cmd_common(cmd, 300)
def check_adobeAir_in_All_Apps(self): g_common_obj.launch_app_am("com.android.settings", "com.android.settings.Settings") time.sleep(1) self.device(text="Apps").click.wait() time.sleep(1) version_array = osversion.get_android_version() androidversion = version_array[0] if androidversion == 7: print "osversion is N" elif androidversion == 6: print "osversion is M" elif androidversion == 5: print "osversion is L" for _ in range(0, 5): self.device(scrollable=True).scroll.horiz.forward(steps=100) else: print "osversion is %s" % (androidversion) for _ in range(0, 5): self.device(scrollable=True).scroll.horiz.forward(steps=100) if not self.device(text="Adobe AIR").exists: self.device(scrollable=True).scroll.to(text="Adobe AIR") assert self.device(text="Adobe AIR").exists, "dobeAir is not in All Apps"
def test_DebugMode_SimulateSecondaryDisplay_Sleep(self): ''' refer TC test_DebugMode_SimulateSecondaryDisplay ''' print "[RunTest]: %s" % self.__str__() version_array = osversion.get_android_version() androidversion = version_array[0] if androidversion == 7: print "osversion is N" self._debugmodeSleep.launch_settings_am() self._debugmodeSleep.change_to_vertical() self._debugmodeSleep.choose_simulate_secondary_displays() self._debugmodeSleep.change_simulate_720p_1080p_dualscreen() self._debugmodeSleep.change_simulate_4K_upscaled_secure() self._debugmodeSleep.change_simulate_4K_upscaled() self._debugmodeSleep.change_simulate_4K_secure() self._debugmodeSleep.change_simulate_4K() self._debugmodeSleep.change_simulate_1080p_secure() self._debugmodeSleep.change_simulate_1080p() self._debugmodeSleep.change_simulate_720p_secure() self._debugmodeSleep.change_simulate_720p() self._debugmodeSleep.change_simulate_480p_secure() self._debugmodeSleep.change_simulate_480p() self._debugmodeSleep.change_simulate_None() self._debugmodeSleep.stop_settings_am() elif androidversion == 6: print "osversion is M" self._debugmodeSleep.launch_settings_am() self._debugmodeSleep.change_to_vertical() self._debugmodeSleep.choose_simulate_secondary_displays() self._debugmodeSleep.change_simulate_720p_1080p_dualscreen() self._debugmodeSleep.change_simulate_4K_upscaled_secure() self._debugmodeSleep.change_simulate_4K_upscaled() self._debugmodeSleep.change_simulate_4K_secure() self._debugmodeSleep.change_simulate_4K() self._debugmodeSleep.change_simulate_1080p_secure() self._debugmodeSleep.change_simulate_1080p() self._debugmodeSleep.change_simulate_720p_secure() self._debugmodeSleep.change_simulate_720p() self._debugmodeSleep.change_simulate_480p_secure() self._debugmodeSleep.change_simulate_480p() self._debugmodeSleep.change_simulate_None() self._debugmodeSleep.stop_settings_am() elif androidversion == 5: print "osversion is L" self._debugmodeSleep.launch_settings_am() self._debugmodeSleep.change_to_vertical() self._debugmodeSleep.choose_simulate_secondary_displays() self._debugmodeSleep.change_simulate_720x480() self._debugmodeSleep.change_simulate_1280x720() self._debugmodeSleep.change_simulate_1280x720_secure() self._debugmodeSleep.change_simulate_1920x1080() self._debugmodeSleep.change_simulate_1920x1080_secure() self._debugmodeSleep.change_simulate_1280x720_and_1920x1080() self._debugmodeSleep.change_simulate_720x480_secure() self._debugmodeSleep.change_simulate_None() self._debugmodeSleep.stop_settings_am() else: print "osversion is %s" % (androidversion) self._debugmodeSleep.launch_settings_am() self._debugmodeSleep.change_to_vertical() self._debugmodeSleep.choose_simulate_secondary_displays() self._debugmodeSleep.change_simulate_720x480() self._debugmodeSleep.change_simulate_1280x720() self._debugmodeSleep.change_simulate_1280x720_secure() self._debugmodeSleep.change_simulate_1920x1080() self._debugmodeSleep.change_simulate_1920x1080_secure() self._debugmodeSleep.change_simulate_1280x720_and_1920x1080() self._debugmodeSleep.change_simulate_720x480_secure() self._debugmodeSleep.change_simulate_None() self._debugmodeSleep.stop_settings_am()