def random_swipes(no, min_size, max_size, width, height): for i in range(no): x1, y1 = generate_random_pair(1, width, 1, height) x2, y2 = generate_random_pair(min_size, max_size, min_size, max_size) x2 += x1 y2 += y2 ui_steps.swipe(sx = x1, sy = y1, ex = x2, ey = y2, steps = 5)()
def do(self): ui_steps.swipe(sx=100, sy=10, ex=100, ey=500, steps=10)() time.sleep(1) ui_steps.click_button( view_to_find={'text': 'Bluetooth share: Incoming file'})() accept_text = self.uidevice(textContains='wants to send').text self.file_to_accept = accept_text.split('"')[2].split(' ')[5] ui_steps.click_button(view_to_find={'text': 'Accept'})()
def check_condition(self): ui_steps.swipe(sx=100, sy=10, ex=100, ey=500, steps=10)() time.sleep(1) ui_steps.click_button( view_to_find={'text': 'Bluetooth share: Received files'})() ui_steps.click_button( view_to_find={'textContains': self.contact_name})() return self.uidevice(text=self.contact_name).exists
def do(self): app = self.uidevice(className='android.widget.FrameLayout') x_coord = app.info['bounds']['right'] y_coord = app.info['bounds']['bottom'] ui_steps.swipe(sx=x_coord / 2, sy=y_coord / 2, ex=x_coord / 2, ey=y_coord / 2)() ui_steps.click_button(view_to_find={"textContains": "Widgets"})()
def do(self): ui_steps.swipe(serial = self.serial, print_error = "Swipe error", sx = self.x, sy = self.y, ex = self.x, ey = self.y, steps = 100, blocking = True)() ui_steps.click_button(serial = self.serial, view_to_find = {"text": "Open image in new tab"})() self.uidevice.wait.update()
def do(self): self.set_passm("Open system utils area from top bar") self.set_errorm("", "Open system utils area from top bar") app = self.uidevice(className='android.widget.FrameLayout') x_coord = app.info['bounds']['right'] y_coord = app.info['bounds']['bottom'] ui_steps.swipe(sx=x_coord - 10, sy=1, ex=x_coord - 10, ey=y_coord - 100)() if version == "L": ui_steps.swipe(sx=x_coord - 10, sy=1, ex=x_coord - 10, ey=y_coord - 100)()
def do(self): adb_steps.delete_folder_content(serial = self.serial, folder = "/storage/sdcard0/Download")() ui_steps.swipe( serial = self.serial, print_error = "Swipe error", sx = self.x, sy = self.y, ex = self.x, ey = self.y, steps = 100, blocking = True)() ui_steps.click_button(serial = self.serial, wait_time = 2000, view_to_find = {"text": "Save image"})()
globals().update(vars(get_args(sys.argv))) adb_steps.connect_device(serial=serial, port=adb_server_port)() globals().update({"version": adb_utils.get_android_version()}) uidevice = ui_device() app = uidevice(className='android.widget.FrameLayout') x_coord = app.info['bounds']['right'] y_coord = app.info['bounds']['bottom'] ui_steps.press_home()() for i in range(1, 4): ui_steps.press_all_apps()() ui_steps.press_back()() ui_steps.swipe(sx=x_coord - 500, sy=y_coord / 2, ex=x_coord, ey=y_coord / 2)() time.sleep(1) ui_steps.press_home()() for i in range(1, 4): ui_steps.press_all_apps()() ui_steps.press_back()() ui_steps.swipe(sx=x_coord - 10, sy=y_coord / 2, ex=x_coord - 500, ey=y_coord / 2)() time.sleep(1)
globals().update(vars(get_args(sys.argv))) adb_steps.connect_device( serial = serial, port = adb_server_port, )() globals().update({"version": adb_utils.get_android_version()}) ui_steps.press_home()() ui_steps.press_all_apps(print_error = "Error - failed to open all apps screen", blocking = True)() apk_folder = media_path apps_to_install = apks if apps_to_install: for app in apps_to_install: apk_path = os.path.join(apk_folder, app) adb_steps.install_apk(print_error = "Error - App was not installed", blocking = False, apk_path = apk_path, debug = True)() ui_steps.swipe(print_error = "Swipe error", sx = 300, sy = 400, ex = 100, ey = 400, steps = 10, blocking = True, view_to_check = {"textContains": "YouTube"})() ui_steps.press_home()()
import sys from testlib.base.base_utils import get_args globals().update(vars(get_args(sys.argv))) adb_steps.connect_device(serial=serial, port=adb_server_port)() globals().update({"version": adb_utils.get_android_version()}) ui_steps.press_home()() steps.open_notif_area( print_error="Notification not found after opening the notification area.", blocking=True)() sx, sy = ui_utils.get_view_middle_coords({"textContains": "Your test"}) ui_steps.swipe(print_error="Swipe error", sx=sx, sy=sy, ex=sx + 200, ey=sy, steps=10, blocking=True)() steps.open_notification( print_error="Open Notification area error", view_to_check={"textContains": "Your test notification title"}, should_exist=False)() ui_steps.press_home()()
from testlib.scripts.android.ui.settings import steps from testlib.scripts.android.ui import ui_steps from testlib.scripts.android.ui import ui_utils from testlib.scripts.android.adb import adb_steps from testlib.scripts.android.adb import adb_utils from testlib.base.base_utils import get_args globals().update(vars(get_args(sys.argv))) adb_steps.connect_device(serial = serial, port = adb_server_port)() globals().update({"version": adb_utils.get_android_version()}) ui_steps.press_home()() ui_steps.open_settings()() ui_steps.open_app_from_settings(view_to_find = {"text": "Apps"}, wait_time = 2000, view_to_check = {"text":"Downloaded"})() ui_steps.swipe(sx = 500, sy = 300, ex = 200, ey = 300, steps = 10, view_presence = True, view_to_check = {"text":"Settings"}, wait_time = 5000)() ui_steps.swipe(sx = 500, sy = 300, ex = 200, ey = 300, steps = 10, view_presence = True, view_to_check = {"text":"Android " "System"}, wait_time = 5000)() ui_steps.press_home()()
def do(self): layout = self.uidevice(className='android.widget.FrameLayout') x_coord = layout.info['bounds']['right'] y_coord = layout.info['bounds']['bottom'] ui_steps.swipe(sx=1, sy=0, ex=1, ey=y_coord - 100)()