def do(self): if local_utils.has_fastboot_serial(serial=self.serial): fastboot_steps.continue_to_adb(serial=self.serial, blocking=True)() local_steps.wait_for_adb(serial=self.serial, blocking=True)() adb_steps.wait_for_ui(serial=self.serial, pin=self.pin, blocking=True)() adb_steps.command(serial=self.serial, command="svc power stayon true")() ui_steps.remove_pin_screen_lock(serial=self.serial, pin=self.pin, blocking=True)() if self.set_screen_lock: ui_steps.set_pin_screen_lock( serial=self.serial, dut_pin=self.pin, require_pin_to_start_device=self.require_pin_to_start_device, blocking=True)() if self.set_wifi: wifi_steps.remove_network(serial=self.serial, ap_name=self.ap_name)() wifi_steps.connect_with_password(serial=self.serial, ap_name=self.ap_name, password=self.ap_password, blocking=True)() ui_steps.press_home(serial=self.serial)()
def do(self): ui_steps.press_home(serial=self.serial, )() ui_steps.open_app_from_allapps( serial=self.serial, view_to_find={'text': 'Camera'}, view_to_check={'descriptionContains': 'Shutter'})() if self.platform == "gmin": self.uidevice.swipe(serial=self.serial, sx=100, sy=400, ex=400, ey=400, steps=10)() ui_steps.click_button(serial=self.serial, view_to_find={'text': 'Camera'})() else: ui_steps.click_button( serial=self.serial, view_to_find={ 'className': 'android.widget.ImageView', 'descriptionContains': 'Camera' }, view_to_check={'descriptionContains': 'Photo'})() ui_steps.click_button( serial=self.serial, view_to_find={'descriptionContains': 'Photo'}, view_to_check={'descriptionContains': 'Shutter'})() ui_steps.click_button(serial=self.serial, view_to_find={'descriptionContains': 'Shutter'}, view_to_check={'descriptionContains': 'Shutter'})()
def do(self): ui_steps.press_all_apps(serial=self.serial)() ui_steps.click_button(serial=self.serial, print_error="Error - Could not find the app", blocking=True, view_to_find={"text": "File Manager"})() ui_steps.click_button(serial=self.serial, print_error="Error - Could not find the button", blocking=True, view_to_find={"text": "Home"})() ui_steps.click_button(serial=self.serial, print_error="Error - Could not find the button", blocking=True, view_to_find={"text": "Download"})() self.uidevice(textContains=self.value).swipe.right(steps=100) ui_steps.click_button(serial=self.serial, print_error="Error - Could not find the button", blocking=True, view_to_find={"text": "Copy"})() ui_steps.press_home(serial=self.serial)() file_manager_usb(serial=self.serial)() if not self.uidevice(textContains=self.value).exists: ui_steps.click_button( serial=self.serial, print_error="Error - Could not find the button", blocking=True, view_to_find={"text": "Paste"})() else: print "The file already exists!"
def run_prepare(platform): serial = DEVICE[platform] print "Pushing compass.conf" adb_steps.root_connect_device(serial = serial)() adb_steps.push_file(local = "/home/sensors/CTS/x86/android-cts/resource/compass.conf" , remote = "/data/compass.conf", serial = serial)() print "Unlocking device" adb_steps.wake_up_device(serial = serial)() adb_steps.menu_to_unlock(serial = serial)() print "Set location to False" cts_verifier_steps.set_location(serial = serial)() print "Set Adaptive brightness to False" cts_verifier_steps.set_display(serial = serial)() print "Set Stay Awake to False" adb_steps.enable_developer_options(serial = serial)() ui_steps.disable_options_from_developer_options(serial = serial, enabled = True, developer_options = ["Stay awake"])() print "Set airplane mode to True" wifi_steps.set_airplane_mode(state = "ON", serial = serial)() ui_steps.press_home(serial = serial)() print "Set Auto rotate to False" cts_verifier_steps.set_screen_rotation(serial = serial)() ui_steps.press_home(serial = serial)()
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)()
def do(self): ui_steps.press_home(serial=self.serial)() ui_steps.click_button( serial=self.serial, view_to_find={"resourceIdMatches": ".*launcher_search_button.*"})() if self.uidevice(text="Skip").wait.exists(timeout=20000): self.uidevice(text="Skip").click() else: self.uidevice(textContains="Search, or say ").wait.exists( timeout=20000)
def do(self): ui_steps.press_home()() ui_steps.open_app_from_allapps(serial=self.serial, view_to_find={"textContains": "Docs"})() self.uidevice(resourceId="com.google.android.apps.docs.editors.\ docs:id/doc_list_syncing_spinner").wait.gone(timeout=20000) if self.uidevice(text="Skip").wait.exists(timeout=20000): ui_steps.click_button( serial=self.serial, view_to_find={"text": "Skip"}, view_to_check={"description": "Create new document"})() docs_utils.exit_search() self.uidevice(resourceId="com.google.android.apps.docs.editors.\ docs:id/doc_list_syncing_spinner").wait.gone(timeout=20000)
def do(self): ui_steps.press_home(serial=self.serial)() ui_steps.close_app_from_recent(serial = self.serial,view_to_find=\ {"text": "Gmail"})() ui_steps.open_app_from_allapps(serial = self.serial,\ view_to_find = {"text": "Gmail"})() ui_steps.click_button_if_exists(serial = self.serial,view_to_find =\ {"descriptionContains" : "Open navigation drawer"},\ wait_time = 5000)() if ui_steps.wait_for_view(view_to_find = {"descriptionContains":\ "Switch to "+self.account_to_switch},timeout = 20, serial = self.serial): ui_steps.click_button_if_exists(serial = self.serial,view_to_find =\ {"descriptionContains" : "Switch to "+self.account_to_switch},\ wait_time = 5000)()
def do(self): ui_steps.press_home(serial=self.serial)() ui_steps.press_all_apps(serial=self.serial)() ui_steps.click_button(serial=self.serial, print_error="Error - Could not find the app", blocking=True, view_to_find={"text": "Settings"})() ui_steps.click_button(serial=self.serial, print_error="Error - Could not find the button", blocking=True, view_to_find={"text": "Storage"})() ui_utils.is_text_visible(serial=self.serial, text_to_find="Mount USB storage") ui_steps.click_button(serial=self.serial, print_error="Error - Could not find the button", blocking=True, view_to_find={"text": "Mount USB storage"})() ui_steps.press_home(serial=self.serial)() file_manager_usb(serial=self.serial)()
def connect_to_ap(serial, condition, mode='bg', security='none', dut_security=None, ddwrt_ap_name='ddwrt', ddwrt_ap_pass='******', encryption=None, iteration=1, q=None): for _ in range(0, iteration): # configure ap ap_steps.setup(mode, security, encryption=encryption, wifi_password=ddwrt_ap_pass, new_ssid=ddwrt_ap_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 home screen ui_steps.press_home(serial=serial)() # make sure there are no saved networks wifi_generic_steps.clear_saved_networks(serial=serial)() # add the Wi-Fi network wifi_generic_steps.add_network(ssid=ddwrt_ap_name, security=dut_security, password=ddwrt_ap_pass, serial=serial)() # wait until the device connects to a wifi network wifi_generic_steps.wait_until_connected(serial=serial)() # check we are connected to the correct network. wifi_generic_steps.check_connection_info(serial=serial, SSID=ddwrt_ap_name, state='CONNECTED/CONNECTED')() # check connection obj = wifi_generic_steps.ping_gateway(serial=serial) obj() if 'passed' in obj.resolution.lower(): return True if q is None else q.put(['Pass']) else: return False if q is None else q.put(['Success'])
def do(self): 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..." ui_steps.open_quick_settings( print_error="Error - Quick settings page was not displayed")() ui_steps.long_click( print_error="Error - bluetooth page was not displayed", view_to_find={"textContains": "Bluetooth"})() time.sleep(10) ui_steps.open_quick_settings( print_error="Error - Quick settings page was not displayed")() ui_steps.long_click( print_error="Error - bluetooth page was not displayed", view_to_find={"textContains": "Bluetooth"})()
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): ui_steps.press_home()() ui_steps.press_all_apps()() ui_steps.click_button(serial=self.serial, print_error="Error - Could not find the app", blocking=True, view_to_find={"text": "File Manager"})() ui_steps.click_button(serial=self.serial, print_error="Error - Could not find the button", blocking=True, view_to_find={"text": "Home"})() ui_steps.click_button(serial=self.serial, print_error="Error - Could not find the button", blocking=True, view_to_find={"text": "Up"})() ui_steps.click_button(serial=self.serial, print_error="Error - Could not find the button", blocking=True, view_to_find={"text": "Up"})() ui_steps.click_button(serial=self.serial, print_error="Error - Could not find the button", blocking=True, view_to_find={"text": "usbdisk2"})()
def do(self): ui_steps.press_home(serial=self.serial)() ui_steps.press_all_apps(serial=self.serial)() ui_steps.click_button(serial=self.serial, print_error="Error - Could not find the app", blocking=True, view_to_find={"text": "File Manager"})() ui_steps.click_button(serial=self.serial, print_error="Error - Could not find the button", blocking=True, view_to_find={"text": "Home"})() ui_steps.click_button(serial=self.serial, print_error="Error - Could not find the button", blocking=True, view_to_find={"text": "Download"})() self.uidevice(textContains=self.value).swipe.right(steps=100) ui_steps.click_button(serial=self.serial, print_error="Error - Could not find the button", blocking=True, view_to_find={"text": "Delete"})() ui_steps.click_button(serial=self.serial, print_error="Error - Could not find the button", blocking=True, view_to_find={"text": "OK"})()
def do(self): # sending MEDIA_MOUNTED intent to have # audio files available for Play Music app adb_steps.command(serial=self.serial, command="am broadcast -a\ android.intent.action.MEDIA_MOUNTED -d file:///storage/sdcard0/Music", timeout=10)() # Close app before openning it to ensure first screen consistency ui_steps.close_app_from_recent(serial=self.serial, view_to_find={"text": "Play Music"})() ui_steps.press_home(serial=self.serial)() ui_steps.open_app_from_allapps( serial=self.serial, view_to_find={"text": "Play Music"}, view_to_check={"packageName": "com.google.android.music"})() time.sleep(5) ui_steps.click_button_if_exists(serial=self.serial, view_to_find={"text": "Use Standard"})() ui_steps.click_button_if_exists(serial=self.serial, view_to_find={"text": "Done"})() ui_steps.click_button_if_exists(serial=self.serial, view_to_find={"text": "Skip"})() ui_steps.click_button_if_exists( serial=self.serial, view_to_find={"description": "Navigate up"})() try: ui_steps.wait_for_view(serial=self.serial, view_to_find={"text": "Listen Now"})() except: ui_steps.click_button( serial=self.serial, view_to_find={"description": "Show navigation drawer"}, view_to_check={"text": "Listen Now"})() ui_steps.click_button(serial=self.serial, view_to_find={"text": "Listen Now"}, view_to_check={"text": "Listen Now"})()
See the License for the specific language governing permissions and limitations under the License. ? SPDX-License-Identifier: Apache-2.0 """ # Used defined libraries from testlib.base.base_utils import parse_args from testlib.scripts.android.ui import ui_steps import time # ############# Get parameters ############ args = parse_args() # Setup ui_steps.press_home(serial=args["serial"])() # Run ui_steps.enable_developer_options(serial=args["serial"])() ui_steps.click_button_common(view_to_find={"text": "Developer options"}, view_to_check={"text": "OEM unlocking"}, serial=args["serial"])() # for full report ui_steps.click_button_common(view_to_find={"text": "Take bug report"}, view_to_check={"text": "Interactive report"}, serial=args["serial"])() ui_steps.click_button_common(view_to_find={"text": "Full report"}, serial=args["serial"])() ui_steps.click_button_common(view_to_find={"text": "REPORT"}, serial=args["serial"])()
def do(self): self.set_passm("Google Bar present HomeScreen") self.set_errorm("", "Google Bar present HomeScreen") ui_steps.press_home()()
bluetooth_steps_old.bt_change_device_name(serial=serial, port=adb_server_port, name=DUT_NAME)() bluetooth_steps_old.bt_make_discoverable(serial=serial, port=adb_server_port, name=DUT_NAME)() bluetooth_steps_old.bt_change_device_name(serial=PAIRING_DEVICE, port=adb_server_port, name=PAIRING_DEVICE_NAME)() bluetooth_steps_old.bt_make_discoverable(serial=PAIRING_DEVICE, port=adb_server_port, name=PAIRING_DEVICE_NAME)() #remove existing contact with the same name ui_steps.press_home(serial=PAIRING_DEVICE)() ui_steps.open_app_from_allapps(serial=PAIRING_DEVICE, view_to_find={'text': 'People'})() while uidevice(text=CONTACT_NAME).exists: ui_steps.click_button(serial=PAIRING_DEVICE, port=adb_server_port, view_to_find={'descriptionContains': 'More options'}, view_to_check={'text': 'Delete'})() ui_steps.click_button(serial=PAIRING_DEVICE, port=adb_server_port, view_to_find={'text': 'Delete'}, view_to_check={'text': 'OK'})() ui_steps.click_button(serial=PAIRING_DEVICE, port=adb_server_port, view_to_find={'text': 'OK'})()
def do(self): ui_steps.press_home(serial=self.serial)() ui_steps.open_app_from_allapps(serial = self.serial,\ view_to_find = {"text": "Gmail"})() ui_steps.click_button_if_exists(serial = self.serial,view_to_find =\ {"descriptionContains" : "Open navigation drawer"},\ wait_time = 5000)() ui_steps.click_button(view_to_find={ "resourceId": "com.google.android.gm:id/account_list_button" }, view_to_check={"text": "Add account"})() ui_steps.click_button(view_to_find={"text": "Add account"})() while not self.uidevice(resourceId="com.google.android.gm:id/google_option").\ child(resourceId="com.google.android.gm:id/radio_button").checked: ui_steps.click_button(serial = self.serial,\ view_to_find = {"text":"Google"})() ui_steps.click_button(serial=self.serial, view_to_find={"text": "Next"})() self.uidevice(text="Checking info").wait.gone(timeout=30000) ui_steps.click_button( serial=self.serial, view_to_find={"descriptionContains": "Enter your email"}, view_to_check={"descriptionContains": "Sign in"})() ui_steps.edit_text( serial=self.serial, view_to_find={"className": "android.widget.EditText"}, value=self.account, is_password=True)() #press enter keycode self.uidevice.press(66) self.uidevice(text=self.account).wait.exists(timeout=5000) ui_steps.edit_text( serial=self.serial, view_to_find={"className": "android.widget.EditText"}, value=self.password, is_password=True)() #press enter keycode self.uidevice.press(66) ui_steps.wait_for_view(view_to_find={"description": "ACCEPT"}, timeout=30)() for f in range(1, 10): if not self.uidevice(description="ACCEPT").exists: break else: # get object coords x, y = [ c for c in ui_utils.get_center_coords( self.uidevice(description="ACCEPT").info["bounds"]) ] cmd = "input tap {0} {1}".format(x, y) self.adb_connection.run_cmd(cmd, timeout=6) self.uidevice(text="Next").wait.exists(timeout=20000) self.uidevice(text="Sync your account").wait.exists(timeout=40000)
def do(self): ui_steps.open_quick_settings( print_error="Error - Quick settings page as not displayed")() if self.verbose: print bluetooth_utils.check_airplane_mode_on() if bluetooth_utils.check_airplane_mode_on() == self.state: if self.state == "0": 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"})() Bluetooth_state = bluetooth_utils.get_switch_state(self) if Bluetooth_state == "OFF": if self.verbose: print ">>> Bluetooth is already OFF, enabling it first" bluetooth_set_from_status_bar(state="ON")() if self.verbose: print ">>> Airplane mode is already in the required state, inverting it first..." ui_steps.open_quick_settings( print_error="Error - Quick settings page as not displayed")() ui_steps.click_button(print_error="Error - Airplane Mode not found", view_to_find={"text": "Airplane mode"})() time.sleep(10) adb_steps.connect_device(serial=sys.argv[1] + ":5555")() if self.state == "1": 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"})() Bluetooth_state = bluetooth_utils.get_switch_state(self) if Bluetooth_state == "OFF": if self.verbose: print ">>> Bluetooth is already OFF, enabling it first" bluetooth_set_from_status_bar(state="ON")() if self.state == "0": 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"})() Bluetooth_state = bluetooth_utils.get_switch_state(self) if Bluetooth_state == "ON": if self.verbose: print ">>> Bluetooth radio is enabled whereas Flight Mode is active, disabling then enabling again Flight Mode to reset Bluetooth radio state..." ui_steps.open_quick_settings( print_error="Error - Quick settings page as not displayed" )() ui_steps.click_button( print_error="Error - Airplane Mode not found", view_to_find={"text": "Airplane mode"})() ui_steps.open_quick_settings( print_error="Error - Quick settings page as not displayed")() ui_steps.click_button( print_error="Error - Airplane Mode not found", view_to_find={"text": "Airplane mode"})() ui_steps.open_quick_settings( print_error="Error - Quick settings page as not displayed")() ui_steps.click_button(print_error="Error - Airplane Mode not found", view_to_find={"text": "Airplane mode"})() time.sleep(10) adb_steps.connect_device(serial=sys.argv[1] + ":5555")() if self.state == "0": 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"})() Bluetooth_state = bluetooth_utils.get_switch_state(self) if Bluetooth_state == "OFF": if self.verbose: print ">>> Bluetooth radio stays OFF whereas Flight Mode has been deactivated, checking if not a special case..." bluetooth_set_from_status_bar(state="ON")() ui_steps.open_quick_settings( print_error="Error - Quick settings page as not displayed")() ui_steps.click_button( print_error="Error - Airplane Mode not found", view_to_find={"text": "Airplane mode"})() time.sleep(10) adb_steps.connect_device(serial=sys.argv[1] + ":5555")() ui_steps.open_quick_settings( print_error="Error - Quick settings page as not displayed")() ui_steps.click_button(print_error="Error - Airplane Mode not found", view_to_find={"text": "Airplane mode"})() time.sleep(10)
def do(self): ui_steps.press_home()() ui_steps.open_settings()() ui_steps.click_button( print_error="Error - bluetooth page was not displayed", view_to_find={"textContains": "Bluetooth"})()
new_ssid=ddwrt_ap_name if str(new_ssid).lower() == "none" else new_ssid, channel_bw=channel_bw, interface5ghz=interface5ghz, serial=serial, channel_no=channel_no, ipv4_class=ipv4_class)() for i in range(len(device_list)): #turn display on, if turned off ui_steps.wake_up_device(serial=devices[i])() # ensure the device is unlocked ui_steps.unlock_device(serial=devices[i], pin=wifi_defaults.wifi['pin'])() # go to home screen ui_steps.press_home(serial=devices[i])() # make sure there are no saved networks wifi_generic_steps.clear_saved_networks(serial=devices[i])() # add the Wi-Fi network wifi_generic_steps.add_network( ssid=ddwrt_ap_name if str(new_ssid).lower() == "none" else new_ssid, security=dut_security, password=ddwrt_ap_pass, identity=radius_identity, EAP_method=EAP_method, phase_2_auth=phase_2_auth, user_certificate=user_certificate, ca_certificate=ca_certificates, serial=devices[i])()
def do(self): self.wrap_do() try: wifi_steps.set_wifi_security(serial=self.serial, security=self.security, password=self.password, EAP_method=self.EAP_method, phase_2_auth=self.phase_2_auth, user_certificate=self.user_certificate, identity=self.identity, anonymous_identity=self.anonymous_identity, ca_certificate=self.ca_certificate, clear_text_boxes=False)() except Exception: self.logger.debug("Install certificate again for TLS test retry") ui_steps.press_home(serial=self.serial)() wifi_steps.install_WIFI_certificate( serial=self.serial, cert_pass="******", cert_name="TLS_certificate", dut_pin=1234)() self.wrap_do() set_wifi_advanced_options(serial=self.serial, proxy=self.proxy, proxy_pac_url=self.proxy_pac_url, proxy_hostname=self.proxy_hostname, proxy_port=self.proxy_port, proxy_bypass=self.proxy_bypass, ip_settings=self.ip_settings, ip_address=self.ip_address, gateway=self.gateway, network_prefix_length=self.network_prefix_length, dns1=self.dns1, dns2=self.dns2, clear_text_boxes=False)() # Implementation of adding Hidden network capability that is changed in # UI, P dessert onwards if self.hidden_ssid == '1': if adb_utils.is_virtual_keyboard_on(serial=self.serial): ui_steps.press_back(serial=self.serial)() # The attributes of the below View To Find has to be taken properly # to work. This is temporary and fails some times. Add scroll = # False ui_steps.click_button(serial=self.serial, view_to_find={ "resourceId": "com.android.settings:id/wifi_advanced_toggle"}, view_to_check={"textContains": "Hidden network"}, scroll=False)() ui_steps.click_button(serial=self.serial, view_to_find={ "resourceId": "com.android.settings:id/hidden_settings"}, view_to_check={"textContains": "Yes"}, scroll=False)() ui_steps.click_button(serial=self.serial, view_to_find={"textContains": "Yes"}, view_to_check={"textContains": "SAVE"}, scroll=False)() # Click Save apply_config_btn = { "className": "android.widget.Button", "enabled": True} apply_config_btn.update(self.device_info.wifi_add_network_save_btn_id) print apply_config_btn if self.apply_config: # if self.valid_config: # ui_steps.click_button(serial=self.serial, # view_to_find = {"textContains" : "SAVE"})() # # view_to_check = {"descriptionContains" : "Add network"})() # ui_steps.click_button(serial=self.serial, # view_to_find={'className': 'android.widget.Button', 'enabled': True, # 'textContains': 'SAVE'}, # view_to_check=None)() # else: apply_config_btn.update({"enabled": False}) ui_steps.click_button(serial=self.serial, view_to_find={'className': 'android.widget.Button', 'enabled': True, 'textContains': 'SAVE'})() else: ui_steps.click_button(serial=self.serial, view_to_find=apply_config_btn)() # Sometimes, the AP will not connected at once after the account has # been saved, so force to connect to the AP if self.apply_config: if self.uidevice(resourceId="android:id/title", text=self.ssid).wait.exists(timeout=1000): self.uidevice( resourceId="android:id/title", text=self.ssid).click.wait() if self.uidevice(textMatches="^(?i)connect$").exists: self.uidevice(textMatches="^(?i)connect$").click.wait()
""" ################### HowTo: take_screenshot adb_steps.take_screenshot_given_path(screenshot_file = "gigi.png", host_path = "/home/sys_spjenkins/")() """ """ ################### HowTo: take_screenrecord adb_steps.take_screenrecord_given_path(screenrecord_file = "gigi.mp4", record_time = 30, host_path = "/home/sys_spjenkins/")() """ """ ################### HowTo: check app in recent apps ui_steps.press_home()() ui_steps.open_app_from_allapps(view_to_find = {"text": "Calculator"}, view_to_check = {"text": "sin"})() ui_steps.press_home()() ui_steps.app_in_recent_apps(app_name = "Calculator")() ui_steps.press_home()() """ """ ################### HowTo: sleep/wakeup device adb_steps.take_screenshot_given_path(screenshot_file = "start.png",
# is displayed as expected # Will check if apps displayed on screen are sorted # alphabetically. # @author: [email protected] # ############################################################################## from testlib.scripts.android.ui.interface import steps from testlib.scripts.android.ui import ui_steps from testlib.scripts.android.adb import adb_steps from testlib.scripts.android.adb import adb_utils from testlib.base.base_utils import get_args import sys 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 - The connection to the device " "was not established", blocking=True)() steps.check_apps_are_sorted(print_error="Error - Apps are not sorted in " "android all apps screen.", version=version)() ui_steps.press_home()()
ip_split_01 = ip[:3] ip_split_02 = ipv4_class[:3] if ip_split_01 == ip_split_02: print 'IP Successfully assigned' else: print 'IP Change unsuccessful' # 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)() # make sure there are no saved networks wifi_generic_steps.clear_saved_networks(serial=serial)() # add the Wi-Fi network wifi_generic_steps.add_network( ssid=ddwrt_ap_name if str(new_ssid).lower() == "none" else new_ssid, security=dut_security, password=ddwrt_ap_pass, identity=radius_identity, EAP_method=EAP_method, phase_2_auth=phase_2_auth, user_certificate=user_certificate, ca_certificate=ca_certificates, serial=serial)()
############################################################################## from testlib.scripts.android.ui.notification import steps from testlib.scripts.android.ui import ui_steps from testlib.scripts.android.adb import adb_steps from testlib.scripts.android.adb import adb_utils 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)() ui_steps.click_button(print_error = "Error: click on notification.", blocking = False, view_to_find = {"textContains": "Your test notification title"}, view_to_check = \ {"textContains": "This is the result " "activity opened from the notification"})() ui_steps.press_home(print_error="Error: pressing Home", blocking=False)()