def wrap_do(self):
        # Go to Settings - Wi-Fi menu and turn on Wi-Fi
        wifi_steps.set_wifi(serial=self.serial, state="ON")()
        wifi_steps.open_wifi_settings(serial=self.serial)()

        # TODO: Implement steps in ui_steps for using spinners and check boxes?

        # Click "More"
        # if self.device_info.dessert in ["L", "M"]:
        #     ui_steps.click_button(serial=self.serial,
        #                           view_to_find={"descriptionContains": "More"},
        #                           view_to_check={"textContains": "Add network"})()
        # if self.device_info.dessert in ["N"]:
        #     ui_steps.wait_for_view_with_scroll(serial=self.serial, timeout=10000,
        #                                        view_to_find={"resourceId": "android:id/icon_frame"},
        #                                        iterations=5)()

        # Click "Add network"
        ui_steps.click_button(serial=self.serial,
                              view_to_find={
                                  "textContains": "Add network"},
                              view_to_check={"textContains": "Network name"})()

        # Complete the SSID text field
        ui_steps.edit_text(serial=self.serial,
                           view_to_find={
                               "resourceId": "com.android.settings:id/ssid"},
                           value=self.ssid,
                           is_password=False)()
    def do(self):
        if self.open_wifi_settings:
            # Turn on Wi-Fi and go to Settings - Wi-Fi menu and Turn
            wifi_steps.set_wifi(
                serial=self.serial,
                state="ON",
                use_adb=self.use_adb)()
            wifi_steps.open_wifi_settings(serial=self.serial, use_adb=False)()

        # Click the More button
        # if not ui_steps.click_button_if_exists(serial=self.serial,
        #            view_to_find = self.device_info.wifi_more_options_id)():
        if self.uidevice(scrollable=True):
            self.uidevice(scrollable=True).scroll.toEnd()

        # Look for the 'Saved Networks' button.
        # If it exists, click it. If not, it means there are no saved Wi-Fi
        # networks.
        if self.uidevice(text="Saved networks").wait.exists(timeout=1000):
            ui_steps.click_button(serial=self.serial,
                                  view_to_find={"text": "Saved networks"},
                                  view_to_check={"text": "Saved networks"})()

            # Get the top saved network from the ListView
            i = self.uidevice(resourceId="android:id/title").count
            number_of_saved_networks = i - 1
            for x in xrange(number_of_saved_networks):
                ui_steps.click_button(serial=self.serial,
                                      view_to_find={
                                          "resourceId": "android:id/title"},
                                      view_to_check={"textContains": "CANCEL"})()
                ui_steps.click_button(serial=self.serial,
                                      view_to_find={
                                          "textContains": "FORGET"},
                                      view_to_check={"textContains": "Add network"})()

            # If we still have an entry in the list, the step is failed.
            if self.max_entries == 0:
                self.step_data = False
                self.set_errorm("", "Network still in 'Saved Networks' list.")
            else:
                self.step_data = True
        else:
            self.step_data = True
Exemple #3
0
    # wait until the device connects to a wifi network
    wifi_steps.wait_until_connected(serial=args["serial"])()

    # check we are connected to the correct network.
    wifi_steps.check_connection_info(serial=args["serial"],
                                     SSID=script_params["ap_name"],
                                     state='CONNECTED/CONNECTED')()

    # check connection
    wifi_steps.ping_gateway(trycount=5, serial=args["serial"])()

    if script_params["iterate_connect_disconnect"] == "True":
        for x in xrange(int(script_params["iterations"])):
            # Turn ON the wifi and check if it is successfully turned ON
            wifi_steps.set_wifi(serial=args["serial"],
                                state="OFF",
                                use_adb=False)()

            time.sleep(3)

            # Check for the connection status
            wifi_steps.check_connection_info(
                serial=args["serial"], state='DISCONNECTED/DISCONNECTED')()

            # Turn OFF the wifi and check if it is successfully turned turned
            # OFF
            wifi_steps.set_wifi(serial=args["serial"],
                                state="ON",
                                use_adb=False)()

            time.sleep(3)
Exemple #4
0
# restart as root
adb_steps.root_connect_device(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_steps.open_wifi_settings(serial= serial)()
wifi_steps.clear_saved_networks(serial = serial)()
wifi_steps.set_wifi(serial = serial, state="OFF")
i=2
while int(no_of_clients) > 0:
    #On reference device
    # turn display on, if turned off on reference device
    ser="serial"+str(i)
    ser=args[ser]
    ui_steps.wake_up_device(serial = ser)()

    # ensure the device is unlocked
    ui_steps.unlock_device(serial = ser, pin=wifi_defaults.wifi['pin'])()

    wifi_steps.open_wifi_settings(serial= ser)()
    # make sure there are no saved networks
    wifi_steps.clear_saved_networks(serial = ser)()
    no_of_clients = int(no_of_clients)-1
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)()

# open wifi settings menu
wifi_generic_steps.set_wifi(serial = serial)()

# make sure there are no saved networks
wifi_steps.clear_saved_networks(serial = serial)()
ui_steps.press_home(serial=serial)()
wifi_steps.open_wifi_settings(serial=serial)()
wifi_steps.set_wifi(serial = serial,use_adb=False)()
i= int(i)
if "roaming" in args.keys():
    """This is to execute roaming scenario tests"""
    ap_steps.set_ap_wireless(state="off",ssh_host=ddwrt_ap2_ip, interface5g=ddwrt_ap2_band)()
    wifi_steps.connect_with_password(ap_name = ddwrt_ap1_name,scroll= True,open_settings=False,password = ddwrt_ap1_pass,serial=serial)()
    time.sleep(3)
    """ to execute CWS_WLAN Roaming tests , use the key "roaming_ping" to script args"""
    if "roaming_ping" in args.keys():
        print "entering roaming ping"
        wifi_steps.ping_ip(serial=serial, ip=ddwrt_ap1_ip, trycount=10, timeout=30)()
        wifi_steps.ping_ip(serial=serial, ip=ddwrt_ap2_ip,trycount=10,timeout=30,negative=True)()
    else:
        wifi_steps.ping_gateway(serial=serial, trycount=10, timeout=30)()
    ap_steps.set_ap_wireless(state="off", interface5g=ddwrt_ap1_band, ssh_host=ddwrt_ap1_ip)()
    ap_steps.set_ap_wireless(state="on", interface5g=ddwrt_ap2_band, ssh_host=ddwrt_ap2_ip)()