def do(self): ui_steps.open_settings(print_error="Error - Settings page was not " "displayed")() ui_steps.click_switch(print_error="Error - Settings page was not " "displayed", view_to_find={ "resourceId": "com.android.settings:id/switchWidget", "instance": "1" }, state=self.state)()
def do(self): open_bluetooth_settings()() bt_remove_all_pair_devices()() ui_steps.click_switch( print_error="Error - Settings page was not displayed", blocking=True, view_to_find={"className": "android.widget.Switch"}, state="OFF")() ui_steps.click_switch( print_error="Error - Settings page was not displayed", blocking=True, view_to_find={"className": "android.widget.Switch"}, state="ON")()
def do(self): if self.intent: adb_steps.am_start_command( serial=self.serial, component="com.android.settings/.DisplaySettings")() else: ui_steps.open_settings_app(serial=self.serial, view_to_find={"text": "Display"}, view_to_check={"text": "Sleep"})() if self.uidevice( resourceId="com.android.settings:id/switch_widget").exists: ui_steps.click_switch(serial=self.serial, view_to_find={ "resourceId": "com.android.settings:" "id/switch_widget" }, state="OFF")()
def do(self): if self.intent: adb_steps.am_start_command( serial=self.serial, component="com.android.settings/.Settings")() self.uidevice(text="Location").wait.exists(timeout=10000) ui_steps.click_button_with_scroll( serial=self.serial, view_to_find={"text": "Location"}, view_to_check={"text": "Mode"})() else: ui_steps.open_settings_app(serial=self.serial, view_to_find={"text": "Location"}, view_to_check={"text": "Mode"})() ui_steps.click_switch(serial=self.serial, view_to_find={ "resourceId": "com.android.settings:" "id/switch_widget" }, state="OFF")()
def do(self): if self.state == "ON": reverse_state = "OFF" elif self.state == "OFF": reverse_state = "ON" ui_steps.press_home()() ui_steps.open_settings()() ui_steps.open_app_from_settings( view_to_find={"text": "Bluetooth"}, view_to_check={"description": "Bluetooth, Navigate up"})() print ">>> Bluetooth radio is %s" % bluetooth_utils.get_switch_state( self) if self.state == bluetooth_utils.get_switch_state(self): if self.verbose: print ">>> Bluetooth radio is already in the required state, inverting it first..." print ui_steps.click_switch(view_to_find={ "className": "android.widget.Switch", "instance": "0" }, state=reverse_state)() time.sleep(10)
def do(self): open_bluetooth_settings()() ui_steps.click_switch( print_error="Error - Settings page was not displayed", blocking=True, view_to_find={'className': "android.widget.Switch"}, state="ON")() if self.uidevice(resourceId="android:id/title").text != self.name: ui_steps.click_button( view_to_find={'descriptionContains': 'More options'}, view_to_check={'textContains': 'Rename tablet'})() ui_steps.click_button( view_to_find={'textContains': 'Rename tablet'})() #replace name ui_steps.click_button( view_to_find={'className': 'android.widget.EditText'})() while self.uidevice(className='android.widget.EditText').text: self.uidevice.press("del") ui_steps.edit_text( view_to_find={'className': 'android.widget.EditText'}, value=self.name)() ui_steps.click_button(view_to_find={'textMatches': 'Rename'})() bt_make_discoverable(name=self.name)()
def do(self): is_switch_on = ui_utils.is_switch_on(view_to_find =\ {"className":"android.widget.Switch"}) if self.state == "ON": if is_switch_on: pass if not is_switch_on: ui_steps.click_switch( print_error="Error - switching bt on", view_to_find={"className": "android.widget.Switch"}, state=self.state, index=0)() elif self.state == "OFF": if is_switch_on: ui_steps.click_switch( print_error="Error - switching bt on", view_to_find={"className": "android.widget.Switch"}, state=self.state, index=0)() if not is_switch_on: pass self.bt_list = self.uidevice(resourceId="android:id/title").count
def check_condition(self): return ui_steps.click_switch(view_to_find={ "className": "android.widget.Switch", "instance": "0" }, state=self.state)()
ui_steps.open_picture_from_gallery(serial=serial, port=adb_server_port)() while not ui_device(serial=serial)(descriptionContains='Share with').exists: ui_steps.click_button( serial=serial, port=adb_server_port, view_to_find={'className': 'android.widget.FrameLayout'})() bluetooth_steps_old.bt_share_picture(serial=serial, port=adb_server_port)() bluetooth_steps_old.open_bluetooth_settings(serial=PAIRING_DEV, port=adb_server_port)() ui_steps.click_switch(serial=PAIRING_DEV, port=adb_server_port, print_error="Error - Settings page was not displayed", blocking=True, view_to_find={'className': "android.widget.Switch"}, state="ON")() ui_steps.click_button(serial=serial, port=adb_server_port, view_to_find={'text': PAIRING_DEV_NAME})() bluetooth_steps_old.bt_accept_picture(serial=PAIRING_DEV, port=adb_server_port, path=BLUETOOTH_PATH)() ########### Postconditions ############## ######################################### #clear photos local_steps.command(command='rm ' + PHOTO_NAME)()
try: relay_steps.reboot_main_os(serial=serial, relay_type=relay_type, relay_port=relay_port, power_port=power_port)() ui_steps.open_settings(serial=serial)() ui_steps.click_button_with_scroll(serial=serial, view_to_find={ "resourceId": "android:id/title", "text": "Date & time" })() ui_steps.click_switch(serial=serial, right_of=True, state="OFF", view_to_find={ "resourceId": "android:id/title", "text": "Automatic date & time" })() ui_steps.click_button(serial=serial, view_to_find={ "resourceId": "android:id/title", "text": "Set date" })() tmp_result = False tmp_tries = 1000 while tmp_tries > 0: if uidevice(resourceId="android:id/prev").wait.exists(timeout=5000): ui_steps.click_button(
# turn display on, if turned off ui_steps.wake_up_device(serial = serial)() # ensure the device is unlocked ui_steps.unlock_device(serial = serial, pin=wifi_defaults.wifi['pin'])() # go to home screen ui_steps.press_home(serial = serial)() wifi_steps.set_am_state(serial = serial, state='off')() # turn WiFi on wifi_steps.set_wifi_state(serial = serial, state='ON')() # turn BT on adb_steps.command(serial = serial, command = "am start -n com.android.settings/.bluetooth.BluetoothSettings", timeout = wait_time)() ui_steps.click_switch(serial = serial, view_to_find = {"className": "android.widget.Switch"}, state = "ON")() # open More Wireless & networks page adb_steps.command(serial = serial, command = "am start -a android.settings.WIRELESS_SETTINGS", timeout = wait_time)() if ui_utils.view_exists(serial = serial, view_to_find = {"text":"NFC"}): ui_steps.click_switch(serial = serial, view_to_find = {"text":"NFC", "resourceId":"android:id/title"}, state = "ON", right_of = True )() class check_radios_behaviour_airplane_mode(adb_step): def __init__(self, state = 'on', wait_time = 5, **kwargs): adb_step.__init__(self, **kwargs) self.state = state self.wait_time = wait_time def do(self):
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(print_error="Error - Settings page was not displayed")() ui_steps.click_button(print_error="Failed to open Location", blocking=True, view_to_find={"text": "Location"}, view_to_check={"text": "Mode"})() ui_steps.click_switch(print_error="Error - switching Location", view_to_find={"className": "android.widget.Switch"}, click_to_close_popup={"text": "Agree"}, state="ON", index=0)() ui_steps.click_button(print_error="Failed to open Mode", view_to_find={"text": "Mode"}, view_to_check={"text": "High accuracy"})() if version == "L": steps.click_radio_button_with_agree(view_to_find={"text": "High accuracy"}, critical=False, index=0)() ui_steps.click_button(view_to_find={"text": "Battery saving"}, critical=False)() ui_steps.click_button(view_to_find={"text": "Device only"}, critical=False)()
ui_steps.press_home(serial=serial)() drive_steps.open_drive(serial=serial, account=account, password=password, force=False)() drive_utils.search_by(name=offline_file_name, serial=serial) ui_steps.click_button( serial=serial, view_to_find={"descriptionContains": offline_file_name}, child_view_to_find={"description": "Show item properties"}, view_to_check={"text": "Keep on device"})() ui_steps.click_switch(serial=serial, view_to_find={"text": "Keep on device"}, right_of=True)() ui_steps.click_button(serial=serial, view_to_find={"description": "Close item details"}, view_to_check={"description": "Close search"})() ui_steps.click_button(serial=serial, view_to_find={"description": "Close search"}, view_to_check={"text": "My Drive"})() time.sleep(60) # Made available offline # Turn Wifi off # Enclosed in try except to make sure Wifi is turned back on if failure