Example #1
0
    def do(self):
        # click Search
        ui_steps.click_button(serial=self.serial,
                              view_to_find={"description": "Search"},
                              view_to_check={"textContains":
                                             "Search YouTube"})()

        time.sleep(2)
        # Input search string
        ui_steps.edit_text(serial=self.serial,
                           view_to_find={"textContains": "Search YouTube"},
                           value=self.search_for)()

        adb_steps.command(serial=self.serial,
                          timeout=10,
                          command="input keyevent KEYCODE_ENTER")()

        time.sleep(5)
        # Check
        ui_steps.check_object_count(
            serial=self.serial,
            view_to_find={"textContains": self.search_for},
            count=self.items_count,
            comparator=self.comparator)()
ui_steps.click_button(serial=serial,
                      view_to_find={"description": "Close search"},
                      view_to_check={"text": "My Drive"})()

ui_steps.click_button(serial=serial,
                      view_to_find={"description": "Open navigation drawer"},
                      view_to_check={"text": "Starred"})()

ui_steps.click_button(serial=serial,
                      view_to_find={"text": "Starred"},
                      view_to_check={"descriptionContains": file_name})()

ui_steps.check_object_count(
    serial=serial,
    view_to_find={
        "className": "android.widget.FrameLayout",
        "resourceId": "com.google.android.apps.docs:id/doc_entry_root"
    },
    count=1,
    comparator="=")()

# unstar the file
ui_steps.click_button(
    serial=serial,
    view_to_find={"descriptionContains": file_name},
    child_view_to_find={"description": "Show item properties"},
    view_to_check={"text": "Unstar"})()

ui_steps.click_button(serial=serial,
                      view_to_find={"text": "Unstar"},
                      view_to_check={"text": "Star"})()
while not uidevice(resourceId="com.google.android.gm:id/google_option").\
        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":"Next"})()

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


ui_steps.edit_text(serial = serial,\
    view_to_find = {"className":"android.widget.EditText"},\
    value = "gigi", is_password=True)()


uidevice(text  =\
    "gigi").wait.exists(timeout = 7000)

#press enter keycode
uidevice.press(66)

uidevice(descriptionContains  =\
    "Sorry, Google doesn't recognize that email").wait.exists(timeout = 7000)
ui_steps.check_object_count(view_to_find = \
    {"descriptionContains":"Couldn't find your Google Account. Try again."})()


ui_steps.close_all_app_from_recent()()
Example #4
0
play_music_steps.open_play_music(serial=serial)()

# click Search
ui_steps.click_button(serial=serial,
                      view_to_find={"description": "Search"},
                      view_to_check={"textContains": "Search music"})()

# Input song title
ui_steps.edit_text(serial=serial,
                   view_to_find={"textContains": "Search music"},
                   value=song_title)()

# Check
ui_steps.wait_for_view(serial=serial, view_to_find={"text": "Songs"})()
ui_steps.wait_for_view(serial=serial, view_to_find={"text": artist})()
ui_steps.wait_for_view(serial=serial, view_to_find={"text": song_title})()
ui_steps.check_object_count(
    serial=serial,
    view_to_find={"resourceId": "com.google.android.music:id/play_card"},
    count=1)()

# Go back to initial app screen
ui_steps.click_button(
    serial=serial,
    view_to_find={"description": "Navigate up"},
    view_to_check={"packageName": "com.google.android.music"})()

# press Home
ui_steps.press_home(serial=serial)()
Example #5
0
drive_steps.open_drive(serial=serial,
                       account=account,
                       password=password,
                       force=True)()

ui_steps.click_button(serial=serial,
                      view_to_find={"description": "Search"},
                      view_to_check={"textContains": "Search"})()

# Input search string
ui_steps.edit_text(serial=serial,
                   view_to_find={"textContains": "Search"},
                   value=search_for)()

ui_steps.wait_for_view(serial=serial, view_to_find={"textContains":
                                                    "Earlier"})()

# Check
ui_steps.check_object_count(serial=serial,
                            view_to_find={"descriptionContains": search_for},
                            count=2,
                            comparator="=")()

ui_steps.click_button(serial=serial,
                      view_to_find={"description": "Close search"},
                      view_to_check={"text": "My Drive"})()

# Close app
ui_steps.close_app_from_recent(serial=serial, view_to_find={"text": "Drive"})()
                        view_to_find = {"text":"Google"})()

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

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

ui_steps.edit_text(serial = serial,\
                  view_to_find = {"className":"android.widget.EditText"},\
                  value = account, is_password=True)()

uidevice(text=account).wait.exists(timeout=7000)
#press enter keycode
uidevice.press(66)

ui_steps.click_button(serial = serial,\
    view_to_find = {"descriptionContains":"Password"},\
    view_to_check = {"descriptionContains":"Forgot password?"})()

ui_steps.edit_text(serial = serial, view_to_find = {"className":\
    "android.widget.EditText"},value = "wrongpass", is_password = True)()

#press enter keycode
uidevice.press(66)

uidevice(descriptionContains  =\
    "The email and password you entered don't match").wait.exists(timeout = 7000)
ui_steps.check_object_count(view_to_find = \
    {"descriptionContains":"The email and password you entered don't match"})()

ui_steps.close_all_app_from_recent()()