def do(self): adb_steps.am_start_command( serial=self.serial, component="com.android.settings/.Settings")() ui_steps.click_button_with_scroll( serial=self.serial, view_to_find={"textContains": "Backup"}, view_to_check={"text": "Factory data reset"})() ui_steps.click_button(serial=self.serial, view_to_find={"text": "Factory data reset"}, view_to_check={"text": self.reset_button_text})() ui_steps.click_button(serial=self.serial, view_to_find={"text": self.reset_button_text}, view_to_check={"text": "Erase everything"})() ui_steps.click_button(serial=self.serial, view_to_find={"text": "Erase everything"})() adb_steps.check_device_reboots(serial=self.serial, reboot_timeout=self.reboot_timeout)()
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")()
ui_steps.open_settings(print_error = "Error - Settings page was not " "displayed")() ui_steps.open_app_from_settings(print_error = "Failed to open Language & input", view_to_find = {"text":"Language & input"}, wait_time = 5000, view_to_check = {"textContains":"Spell checker"})() #change language ui_steps.click_button(print_error = "Failed to open Language - hey, I might " "have used a language that's now removed", view_to_find = {"text":"Language"}, view_to_check = {"text":"Afrikaans"}, critical = False)() ui_steps.click_button_with_scroll(view_to_find = {"text":"Italiano (Italia)"}, wait = 5000, critical = False)() ui_device()(text = "Lingua").wait.exists(timeout = 20000) #restore English ui_steps.click_button(print_error = "Failed to open Language " "- hey, I might have used a " "language that's now removed", view_to_find = {"text":"Lingua"}, view_to_check = {"textContains":"Afrikaans"}, critical = False)() ui_steps.click_button_with_scroll(view_to_find = {"text": "English (United States)"}, critical = False)()
ap_name = args.get("ap_name") ap_lists = [ap_name, "WIFI_ADB"] uidevice = Device(serial=serial) product_name = adb_utils.get_product_name(serial=serial) # 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 settings app if product_name != "bxtp_abl_car": ui_steps.press_all_apps(serial=serial)() ui_steps.click_button_with_scroll(serial=serial, view_to_find={"text": "Settings"} ,view_to_check={"textContains": "Wi‑Fi"})() else: ui_steps.press_home(serial=serial)() ui_steps.click_button_with_scroll(serial=serial, view_to_find={"resourceId": "com.android.car.overview:id/gear_button"} , view_to_check={"textContains": "Wi‑Fi"})() ui_steps.click_button_with_scroll(serial=serial, view_to_find={"text": "Wi‑Fi"} ,view_to_check={"textContains": "Wi‑Fi"})() # click switch On button,Switch wifi Off if uidevice(text="On").exists: ui_steps.click_button_with_scroll(serial=serial, view_to_find={"text": "On"} , view_to_check={"resourceId": "android:id/empty"})() # click switch Off button,Switch wifi ON if uidevice(text="Off").exists: ui_steps.click_button_with_scroll(serial=serial, view_to_find={"text": "Off"}, view_to_check={"text": "On"})()
# ############# Get parameters ############ globals().update(vars(get_args(sys.argv))) args = {} for entry in script_args: key, val = entry.split("=") args[key] = val while not ui_steps.remove_user(user_name="New user",optional=True, serial=serial)(): break #Setup ui_steps.open_settings(serial=serial)() ui_steps.click_button_with_scroll(view_to_find={"text":"Users & accounts"},view_to_check={"text":"Users"},serial=serial)() ui_steps.click_button_common(view_to_find={"text":"Users"},view_to_check={"text":"Add user or profile"},serial=serial)() ui_steps.click_button_common(view_to_find={"text":"Admin"},serial=serial)() ui_steps.press_home(serial=serial)() ui_steps.open_settings(serial=serial)() ui_steps.click_button_common(view_to_find={"text":"System"},view_to_check={"text":"Date & time"},serial=serial)() ui_steps.click_button_common(view_to_find={"text":"Date & time"},view_to_check={"text":"Automatic date & time"},serial=serial)() if not ui_steps.click_button_common(view_to_find = {"text":"Use 24-hour format"}, second_view_to_find={"className": "android.widget.Switch", "text": "OFF"},view_to_check = {"text": "ON"},optional= True, serial=serial)(): ui_steps.click_button_common(view_to_find={"text": "Use 24-hour format"}, second_view_to_find={"className": "android.widget.Switch", "text": "ON"}, view_to_check={"text": "OFF"}, serial=serial)() #change to owner will enable 24hors format
relay_port = args["relay_port"] power_port = args["power_port"] uidevice = ui_device(serial=serial) # Test start # 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" })()