Exemple #1
0
    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)()
Exemple #2
0
 def __init__(self, account=None, password=None, subject=None, **kwargs):
     ui_step.__init__(self, **kwargs)
     adb_step.__init__(self, **kwargs)
     self.account = account
     self.subject = subject
     self.password = password
     self.acc_no = gms_utils.get_google_account_number(serial=self.serial)
Exemple #3
0
    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"})()
Exemple #4
0
################################################################################
# Fetch parameters passed to the script
################################################################################
args = get_args(sys.argv)
globals().update(vars(args))
globals().update(eval(script_args[0]))
adb_steps.root_connect_device(serial=serial, port=adb_server_port)()
globals().update({"version": adb_utils.get_android_version()})

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"})()
Exemple #5
0
from testlib.base.base_utils import get_args
from testlib.scripts.android.adb import adb_utils
from testlib.utils.ui.uiandroid import UIDevice as ui_device

args = get_args(sys.argv)
globals().update(vars(args))
globals().update(eval(script_args[0]))
adb_steps.connect_device(serial=serial)()
globals().update({"version": adb_utils.get_android_version()})

uidevice = ui_device(serial=serial)

ui_steps.close_app_from_recent(serial = serial,\
                view_to_find = {"text": "Sheets"})()

if (gms_utils.get_google_account_number(serial=serial) == 0):
    ui_steps.add_google_account_for_L(serial = serial,version = "L",\
                 account = account,
                 password = password)()
if (gms_utils.get_google_account_number(serial=serial) > 1):
    ui_steps.remove_all_google_accounts(serial=serial)()
    ui_steps.add_google_account_for_L(serial = serial,version = "L",\
                 account = account,
                 password = password)()


ui_steps.open_app_from_allapps(serial = serial,\
                    view_to_find = {"text": "Sheets"})()

if uidevice(text="Spreadsheets on the go").exists:
    ui_steps.click_button_if_exists(serial = serial,\
Exemple #6
0
 def check_condition(self):
     new_acc_no = gms_utils.get_google_account_number(serial=self.serial)
     return new_acc_no == self.acc_no + 1