def do(self): if self.force: # sending MEDIA_MOUNTED intent to have # video files available adb_steps.command(serial=self.serial, command="am broadcast -a\ android.intent.action.MEDIA_MOUNTED -d file:///storage/sdcard0/Movies", timeout=10)() # Make sure user is signed in before opening app WHERE = 'name = "{0}"'.format(self.account) account_exists = ui_utils.google_account_exists(serial=self.serial, where=WHERE) total_account_no = gms_utils.get_google_account_number( serial=self.serial) if account_exists: account_synced = ui_steps.sync_google_account( serial=self.serial, account=self.account, password=self.password)() if (total_account_no >= 2) or (not account_exists) or ( account_exists and not account_synced): ui_steps.remove_all_google_accounts(serial=self.serial)() ui_steps.add_google_account_for_L(serial=self.serial, account=self.account, password=self.password, prefer_sync=True)() #~ ui_steps.remove_all_google_accounts(serial = self.serial)() #~ ui_steps.add_google_account_for_L(serial = self.serial, #~ account = self.account, password = self.password)() time.sleep(5) ui_steps.press_home(serial=self.serial)()
def do(self): if self.force: # sending MEDIA_MOUNTED intent to have # video files available adb_steps.command(serial=self.serial, command="am broadcast -a\ android.intent.action.MEDIA_MOUNTED -d file:///storage/sdcard0/Movies", timeout=10)() # Make sure user is signed in before opening app WHERE = 'name = "{0}"'.format(self.account) account_exists = ui_utils.google_account_exists(serial=self.serial, where=WHERE) total_account_no = gms_utils.get_google_account_number( serial=self.serial) if account_exists: account_synced = ui_steps.sync_google_account( serial=self.serial, account=self.account, password=self.password)() if (total_account_no >= 2) or (not account_exists) or ( account_exists and not account_synced): ui_steps.remove_all_google_accounts(serial=self.serial)() ui_steps.add_google_account_for_L(serial=self.serial, account=self.account, password=self.password, prefer_sync=True)() #~ ui_steps.remove_all_google_accounts(serial = self.serial)() #~ ui_steps.add_google_account_for_L(serial = self.serial, #~ account = self.account, password = self.password)() time.sleep(2) # Close app before openning it to ensure first screen consistency ui_steps.close_app_from_recent(serial=self.serial, view_to_find={"text": "Drive"})() self.uidevice.wait.idle() ui_steps.open_app_from_allapps( serial=self.serial, view_to_find={"text": "Drive"}, view_to_check={"packageName": "com.google.android.apps.docs"})() # if opened for first time self.uidevice.wait.idle() ui_steps.click_button_if_exists(serial=self.serial, view_to_find={"text": "Skip"})()
def do(self): if self.force: ui_steps.remove_all_google_accounts(serial=self.serial)() open_youtube(serial=self.serial)() ui_steps.click_button(serial=self.serial, view_to_find={"description": "More options"}, view_to_check={"text": "Settings"})() if self.uidevice(text="Sign out").exists: self.uidevice.press.back() if not self.force: return sign_out(serial=self.serial)() if self.existing: ui_steps.click_button(serial=self.serial, view_to_find={"text": "Sign in"}, view_to_check={"text": self.account})() ui_steps.click_button(serial=self.serial, view_to_find={"text": self.account}, view_to_check={"text": "OK"})() ui_steps.click_button( serial=self.serial, view_to_find={"text": "OK"}, view_to_check={"packageName": "com.google.android.youtube"})() else: ui_steps.click_button( serial=self.serial, view_to_find={"text": "Sign in"}, view_to_check={"description": "Add your account"})() ui_steps.add_google_account_for_L(serial=self.serial, account=self.account, password=self.password, open_from_settings=False)() time.sleep(2) ui_steps.click_button(serial=self.serial, view_to_find={"description": "More options"}, view_to_check={"text": "Sign out"})() self.uidevice.press.back()
ACCOUNT = account PASSWORD = password WHERE = 'name = "{0}"'.format(ACCOUNT) account_exists = ui_utils.google_account_exists(serial=serial, where=WHERE) total_account_no = gms_utils.get_google_account_number(serial=serial) if account_exists: account_synced = ui_steps.sync_google_account(serial=serial, account=ACCOUNT, password=PASSWORD)() if (total_account_no >= 2) or (not account_exists) or (account_exists and not account_synced): ui_steps.remove_all_google_accounts(serial=serial)() ui_steps.add_google_account_for_L(serial=serial, account=ACCOUNT, password=PASSWORD, prefer_sync=True)() play_games_steps.open_play_games_play_now(serial=serial)() ui_steps.swipe_down_to_view(view_to_check={"text": "Continue playing"})() ui_steps.click_button(view_to_find={"text": "FREE"}, view_to_check={"text": "ABOUT"})() ui_steps.click_button(view_to_find={"text": "FREE"}, view_to_check={"text": "INSTALL"})() ui_steps.close_all_app_from_recent(serial=serial)()