Пример #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)()
Пример #2
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"})()
Пример #3
0
    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()
Пример #4
0
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)()
Пример #5
0
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,\
                view_to_find = {"text":"Skip"},\
                wait_time = 5000)()
from testlib.scripts.gms import gms_utils

from testlib.base.base_utils import get_args
from testlib.scripts.android.adb import adb_utils

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()})

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

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, open_from_settings = True,\
                 from_gmail = False)()

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


gmail_steps.compose_mail(serial = serial,\
            account_to = account_to,
            subject = "Compose mail Test",
            body_mail = "this is a test mail",
            save_as_draft = True, send_mail = False)()

ui_steps.close_all_app_from_recent(serial=serial)()
                    view_to_find = {"text":"Skip"},
                    view_to_check = {"text": "Add an email address"})()

ui_steps.click_button(serial = serial,\
                    view_to_find = {"text":"Add an email address"},
                    view_to_check = {"text": "Google"})()

while not uidevice(resourceId="android:id/contentPanel").\
        child_by_text("Google", className="android.widget.LinearLayout").\
        child(resourceId="com.google.android.gm:id/radio_button").checked:
    ui_steps.click_button(serial = serial,\
                        view_to_find = {"text":"Google"})()

ui_steps.click_button(serial = serial,
                    view_to_find = {"text":"OK"})()

uidevice(text="Checking info").wait.gone(timeout = 30000)

ui_steps.wait_for_view(serial = serial,
            view_to_find = {"descriptionContains":"Sign in to"},\
            timeout = 20)()

ui_steps.add_google_account_for_L(serial = serial,version = "L",\
                 account = account,
                 password = password, open_from_settings = False,\
                 from_gmail = True)()


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