def setUp(self): super(LiveWallpaperPreview, self).setUp() self._test_name = __name__ self._device = g_common_obj.get_device() print "[Setup]: %s" % self._test_name self._liveWallpaper = WallpaperImpl() self._composeui = ComposeUiImpl() # self._liveWallpaper.reset_wallpaper() self._device = g_common_obj.get_device() config_handle = ConfigHandle() result = config_handle.check_apps("com.android.galaxy4") if result == 0: self._composeui.install_apk('Galaxy4') self.livewallpaper = ["Black Hole"]
def __init__(self, cfg): self.d = g_common_obj.get_device() self.locator = LLTUDE.Locator(self.d) self.cfg = cfg base_path = os.path.split(os.path.realpath(__file__))[0].split(os.sep) self.apk_file = (os.sep).join\ (base_path+['com.kaiwidment.latlon-1.apk'])
def setUp(self): super(ComposeUI, self).setUp() self._test_name = __name__ self.device = g_common_obj.get_device() print "[Setup]: %s" % self._test_name self._composeui = ComposeUiImpl() self._imageviewer = ImageDetails() self.photos = PhotosExtendImpl() self.photosImpl = get_photo_implement() self.qrcodeImpl = QRcode() g_common_obj.root_on_device() g_common_obj.remount_device() self.photosImpl.rm_delete_photos() self.photosImpl.refresh_sdcard() self.photos.clean() self.qrcode = "GIFPICTURE" 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, 'qrcode_marked_image') self.qrcode = cfg.get("screenshot_edit_qrcode") print "[Debug] qrcode:%s" % (self.qrcode) arti = Artifactory(cfg_arti.get('location')) pic_name = cfg.get("screenshot_edit_image") file_path = arti.get(pic_name) g_common_obj.adb_cmd_common('push ' + file_path + ' /sdcard/Pictures') self.photosImpl.refresh_sdcard() special_actions.setup() self.photos.setup()
def __init__(self, cfg={}): self.d = g_common_obj.get_device() self.cfg = cfg self.brightness = { 'start': None, 'end': None, 'step': 10, 'inc': 0, 'current': [0, 0] } self.volumes = { 'media': { 'start': None, 'end': None, 'step': 10, 'inc': 0, 'current': [0, 0] }, 'notification': { 'start': None, 'end': None, 'step': 10, 'inc': 0, 'current': [0, 0] }, 'alarm': { 'start': None, 'end': None, 'step': 10, 'inc': 0, 'current': [0, 0] } }
def setUp(self): super(IterationControl, self).setUp() self._test_name = __name__ g_common_obj2.system_reboot(90) for _ in range(20): self.api = ApiImpl() self.api.d = g_common_obj.get_device() self.api.d.wakeup() if self.api.check_ui_exists("resourceId", self.api.ui.lock_clock_view): break time.sleep(5) self.api.unlock_screen() # self.api = ApiImpl() # self.api.unlock_screen() self.api.clean_tasks() if not self.api.locate_apps("Work Sample MDM"): self.api.setup_managed_profile(True) self.api.enable_system_applications(True) time.sleep(10) self.api.clean_tasks() if not self.api.locate_apps("Work Downloads"): self.api.unhide_applications(True) time.sleep(10) self.api.clean_tasks() if not self.api.locate_apps("Work Chrome"): self.api.enable_system_applications(True) time.sleep(10) self.api.clean_tasks() print "[Setup]: %s" % self._test_name
def setUp(self): super(Messaging, self).setUp() self.__test_name = __name__ print "Setup: %s" % self.__test_name self.d = g_common_obj.get_device() UiAutomatorUtils.unlock_screen() resource.disable_app_verification() _apk_path = resource.get_resource_from_atifactory\ ("tests.tablet.artifactory.conf", "GCM", "gcm_listener") g_common_obj.adb_cmd_common("install -r %s" % _apk_path) self._jar_path = resource.get_resource_from_atifactory\ ("tests.tablet.artifactory.conf", "GCM", "gcm_sender") self._proxy_file = resource.get_resource_from_atifactory\ ("tests.tablet.artifactory.conf", "Proxy", "http_proxy") with open(self._proxy_file) as pf: self._proxy = pf.read().strip('\n') """ Get Android version: adb shell getprop | grep ro.build.version.sdk """ cmd = 'getprop | grep ro.build.version.sdk' sdk_string = g_common_obj.adb_cmd_capture_msg(cmd) if '24' in sdk_string: self.android_version = "N" elif '23' in sdk_string: self.android_version = "M" elif '22' in sdk_string: self.android_version = "L"
def __init__(self): self.device = g_common_obj.get_device() self.func = Function() self.conf = TestConfig().read(section='wifisetting') self.ssid = self.conf.get("ssid") self.passwd = self.conf.get("passwd") self.security = self.conf.get("security")
def setUp(self): super(CheckMapsAfterGOTA, self).setUp() self._test_name = __name__ self.gota= gotaImpl(self) self.maps=MapsImpl() self.d=g_common_obj.get_device() print "[Setup]: %s" % self._test_name
def __init__(self): self._device = g_common_obj.get_device() self._locator = Locator(self._device) self.base_path = os.path.split(os.path.realpath(__file__))[0].split( os.sep) self.apk_file = (os.sep).join\ (self.base_path+['GLBenchmark_2_7_0.apk'])
def setUp(self): print "[Setup]:%s" % self.__class__.__name__ super(ImageViewing, self).setUp() self.device = g_common_obj.get_device() self.photos = get_photo_implement() self.qrcodeImpl = QRcode() self.wallpaper = WallpaperImpl() self.photos.rm_delete_photos() self.photos.refresh_sdcard() self.qrcode = "GIFPICTURE" 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, 'qrcode_marked_image') self.qrcode = cfg.get("screenshot_imageview_qrcode") print "[Debug] qrcode:%s" % (self.qrcode) arti = Artifactory(cfg_arti.get('location')) pic_name = cfg.get("screenshot_imageview_image") file_path = arti.get(pic_name) g_common_obj.adb_cmd_common('push ' + file_path + ' /sdcard/Pictures') self.photos.refresh_sdcard()
def test_gpu_overdraw(self): try: # enable showing of overdraw areas g_common_obj.get_device().orientation = 'n' Settings.enable_gpu_overdraw_show_overdraw_areas() self.screenshooter.take_screenshot() total_nr_of_pixels = self.screenshooter.screen_width * self.screenshooter.screen_height dark_red_pixels = self.screenshooter.get_dark_red_pixels_from_current_screenshot( ) nr_of_dark_red_pixels = len(dark_red_pixels) LOG.info("dark red overdraw pixels nr.: " + str(nr_of_dark_red_pixels)) percent_of_dark_red_pixels = nr_of_dark_red_pixels * 100.0 / total_nr_of_pixels LOG.info("dark red percent: " + str(percent_of_dark_red_pixels)) self.assertTrue(percent_of_dark_red_pixels < 15, "dark red pixels must be under 15%") # enable showing of deuteranomaly Settings.enable_gpu_overdraw_show_deuteranomaly() self.screenshooter.take_screenshot() dark_red_pixels = self.screenshooter.get_dark_red_pixels_from_current_screenshot( ) nr_of_dark_red_pixels = len(dark_red_pixels) LOG.info("dark red deuteranomaly pixels nr.: " + str(nr_of_dark_red_pixels)) percent_of_dark_red_pixels = nr_of_dark_red_pixels * 100.0 / total_nr_of_pixels LOG.info("dark red percent: " + str(percent_of_dark_red_pixels)) self.assertTrue(percent_of_dark_red_pixels < 15, "dark red pixels must be under 15%") finally: # disable gpu_overdraw Settings.disable_gpu_overdraw()
def setUp(self): """ @summary: set up @return: None """ super(CameraTest, self).setUp() self._test_name = __name__ self.logger.debug("[Setup]: %s" % self._test_name) self.case_result = -1 g_common_obj.root_on_device() g_common_obj.remount_device() self.camera_common = CameraCommon() self.multimedia_setting = MultiMediaSetting(self.camera_common.DEFAULT_CONFIG_FILE) self.host_path = self.camera_common.getTmpDir() self.multimedia_scale_test_helper = MultiMediaScaleTestHelper(self.host_path) self.multimedia_checkiq_helper = MultiMediaCheckiqHelper(self.host_path) self.android_version = MultiMediaSwitchCameraHelper(skip_import_camera=True).android_version.lower() self.multimedia_scale_test_helper.scale_test_prepare() self.camera_common.removeDeivceFile() self.camera_common.removeDeivceFile(self.multimedia_scale_test_helper.movies_folder_device_path + "*") self.camera_common.removeFile(self.host_path + "/*.mp4") self.camera_common.unlockScreen() self.d = g_common_obj.get_device() self.skipAccountLoginLyout() g_common_obj.back_home() if self.d(text="Got it").exists: self.d(text="Got it").click.wait()
def __init__(self): self.device = g_common_obj.get_device() self.configer = TestConfig() self.config = self.configer.read(self.CONFIG_FILE, "SystemSettingsImpl") self.db_storage = Artifactory(self.config.get('settings_storage'))
def setUp(self): """ @summary: set up @return: None """ super(CameraTest, self).setUp() self._test_name = __name__ self.logger.debug("[Setup]: %s" % self._test_name) g_common_obj.root_on_device() self.camera_common = CameraCommon() self.host_path = self.camera_common.getTmpDir() self.rvc_camera = "" self.aosp_camera = "" self.ref_camera = "" self.case_result = -1 self.camera_common.removeDeivceFile() self.camera_common.removeFile(self.host_path + "/*") self.get_rvc_camera_class().stopCameraApp() self.camera_common.unlockScreen() self.get_rvc_camera_class().skipAccountLoginLyout() self.get_rvc_camera_class().backHome() self.d = g_common_obj.get_device() if self.d(text="Got it").exists: self.d(text="Got it").click.wait()
def startApp(): """ Skip Calendar first launch screen """ d = g_common_obj.get_device() g_common_obj.launch_app_from_home_sc("News & Weather") time.sleep(2) if d(resourceId="com.google.android.apps.magazines:id/image_header_logo" ).exists: g_common_obj.back_home() return while d(resourceId="com.google.android.apps.genie.geniewidget:id/next" ).exists: d(resourceId="com.google.android.apps.genie.geniewidget:id/next" ).click() d.wait.update() if d( resourceId="com.google.android.apps.genie.geniewidget:id/done").\ wait.exists(timeout=60000): d(resourceId="com.google.android.apps.genie.geniewidget:id/done" ).click() if d(description="Close navigation drawer").exists: d(description="Close navigation drawer").click() d.wait.update() g_common_obj.back_home()
def startApp(): # click ok in youtube g_common_obj.launch_app_from_home_sc("YouTube") d = g_common_obj.get_device() time.sleep(5) d.watcher("SKIP_UPDATE").\ when(resourceId="com.google.android.youtube:id/later_button")\ .click(resourceId="com.google.android.youtube:id/later_button") if d(text="What to Watch").exists: g_common_obj.back_home() return for _ in range(60): if d(text="What to Watch").exists and not d(text="OK").exists: break if d(text="OK").exists: d(text="OK").click.wait() if d(text="Skip").exists: d(text="Skip").click.wait() if d(text="Retry").exists: d(text="Retry").click.wait() time.sleep(2) d.press.back() if d(description="YouTube").exists: d(description="YouTube").click.wait() time.sleep(2) if d(text="Skip").exists: d(text="Skip").click.wait() d.watcher("SKIP_UPDATE").remove() g_common_obj.back_home()
def setUpClass(self): print "[setUpClass]: %s" % self.__name__ super(HDMITest, self).setUpClass() self.photosImpl = get_photo_implement() self.d = g_common_obj.get_device() g_common_obj.root_on_device() g_common_obj.remount_device()
def setUpClass(cls): super(VehicleTestBase, cls).setUpClass() cls.d = g_common_obj.get_device() g_common_obj.root_on_device() g_common_obj.remount_device() cls.kitchensink_pkg_name = "com.google.android.car.kitchensink" cls.kitchensink_activity_name = ".KitchenSinkActivity"
def setup(self): self.d = g_common_obj.get_device() self.dut = BluetoothSetting() # BluetoothSetting in DUT self.adapter = BTManager().default_adapter() self.log = AudioLogger.getLogger() Logger.set_enable(True) try: # register a agent, just do nothing to accept, just like headset self.agent = Agent.init_from_remote(capability="NoInputNoOutput") self.agent.register() # profiles self.headset = HeadsetProfile.init_from_remote() # Headset Profile self.headset.register() # self.handsfree = HandsFreeProfile.init_from_remote() # Handsfree # self.handsfree.register() self.a2dp_sink = AudioSink.init_from_remote() # A2DP Sink self.a2dp_sink.register() self.a2dp_source = SBCAudioSource.init_from_remote() # A2DP Source self.a2dp_source.register() self.sco = ScoServer.init_from_remote() self.adapter.Powered = True self.adapter.Discoverable = True except: self.teardown() raise
def startAppMusic(): d = g_common_obj.get_device() g_common_obj.launch_app_from_home_sc("Play Music") time.sleep(10) for _ in range(30): time.sleep(2) if not d(resourceId="com.google.android.music:id/tutorial_logo" ).exists: break assert not d( resourceId="com.google.android.music:id/tutorial_logo").exists if d(text="Skip").exists: d(text="Skip").click.wait() if d(text="Use Standard").exists: d(text="Use Standard").click.wait() if d(text="Done").exists: d(text="Done").click.wait() if d(resourceId="com.google.android.music:id/play_drawer_list").exists: d.press.back() if d(text="Got it").exists: d(text="Got it").click.wait() g_common_obj.launch_app_am( "com.google.android.music", "com.android.music.activitymanagement.TopLevelActivity") time.sleep(5) g_common_obj.back_home()
def setUp(self): """ @summary: set up @return: None """ super(CameraTest, self).setUp() self._test_name = __name__ self.logger.debug("[Setup]: %s" % self._test_name) g_common_obj.root_on_device() self.camera_common = CameraCommon() self.host_path = self.camera_common.getTmpDir() self.rvc_camera = MultiMediaSwitchCameraHelper().camera self.camera_common.removeDeivceFile() self.camera_common.removeFile(self.host_path + "/*") self.camera_common.unlockScreen() self.rvc_camera.skipAccountLoginLyout() self.rvc_camera.backHome() self.d = g_common_obj.get_device() if self.d(text="Got it").exists: self.d(text="Got it").click.wait() self.multimedia_setting = MultiMediaSetting(self.camera_common.DEFAULT_CONFIG_FILE) need_install_result = self.multimedia_setting.install_apk("multi_camera_apk") if need_install_result: self.reboot_device() self.multi_camera_package_name, _ = self.multimedia_setting.get_package_and_activity_name("multi_camera_apk") MULTI_CAMERA_PERMISSION_LIST = ["android.permission.CAMERA"] self.camera_common.grantPermission(self.multi_camera_package_name, MULTI_CAMERA_PERMISSION_LIST)
def __init__(self): self.device = g_common_obj.get_device() self.configer = TestConfig() self.config = self.configer.read(self.CONFIG_FILE, "APIDemoImpl") config_handle = ConfigHandle() self.config["artifactory_location"] = config_handle.read_configuration('artifactory', 'location', '/etc/oat', 'sys.conf') self.arti = Artifactory(self.config.get('artifactory_location'))
def __init__(self): self.device = g_common_obj.get_test_device() self._device = g_common_obj.get_device() self.base_path = os.path.split(os.path.realpath(__file__))[0].split( os.sep) chk_64_supported = "getprop | grep ro.product.cpu.abi\]" result = g_common_obj.adb_cmd_capture_msg(chk_64_supported) self.exec_bin = "/data/app/oglconform" if "64" in result else "/data/app/oglconform_x86"
def __init__(self): self.d = g_common_obj.get_device() self.x = self.d.info["displayWidth"] self.y = self.d.info["displayHeight"] test_config = TestConfig() conf_file = 'tests.tablet.artifactory.conf' self.config = test_config.read(conf_file, "content_video_apk")
def setUp(self): super(CheckClockAfterGOTA, self).setUp() self._test_name = __name__ self.system=SystemImpl(self) self.gota=gotaImpl(self) self.d=g_common_obj.get_device() self.clock=Clock() print "[Setup]: %s" % self._test_name
def setUp(self): super(AGPS, self).setUp() self._test_name = __name__ self.d = g_common_obj.get_device() print "[Setup]: %s" % self._test_name self.gc = GPS_Common() self.gc.Turn_On_Location() self.gc.check_if_wifi_connected()
def __init__(self): self.success = False self.d = g_common_obj.get_device() self.config = TestConfig() self.func = Function() cfg_file = 'tests.tablet.dut_init.conf' self.username = self.config.read(cfg_file, 'google_account').get("username") self.passwd = self.config.read(cfg_file, 'google_account').get("password")
def setUp(self): super(CheckOnlyDeviceOwnerCouldGOTA, self).setUp() cfg_file = os.path.join(os.environ.get('TEST_DATA_ROOT', ''), 'tests.tablet.gota.conf') self._test_name = __name__ print "[Setup]: %s" % self._test_name self.cfg = self.config.read(cfg_file, 'gota') self.gota = gotaImpl(self.cfg) self.d = g_common_obj.get_device()
def test_Camera_IVI_RVC_Preview_Horizontal(self): self.get_rvc_camera_class().startCameraApp() time.sleep(5) d = g_common_obj.get_device() x = d.info["displayWidth"] y = d.info["displayHeight"] self.logger.debug("display size--- x:%s, y:%s" % (str(x), str(y))) assert int(x) > int(y), "RVC FOV not display as horizontal" self.get_rvc_camera_class().stopCameraApp()
def setUp(self): super(Safe_Mode, self).setUp() self.__test_name = __name__ print "Setup: %s" % self.__test_name self.d = g_common_obj.get_device() resource.disable_app_verification() _apk_path = resource.get_resource_from_atifactory\ ("tests.tablet.artifactory.conf", "SDK_API", "api_demos") g_common_obj.adb_cmd_common("install -r %s" % _apk_path)