Ejemplo n.º 1
0
    def check_condition(self):
        # Unlock device
        ui_steps.wake_up_device(serial=self.serial)()
        ui_steps.unlock_device(serial=self.serial)()

        # Check if the app is NOT displayed in normal mode
        ui_steps.find_app_from_allapps(serial=self.serial,
                                       view_to_find={"text": self.app_to_find},
                                       presence=False)()
        return True
Ejemplo n.º 2
0
 def do(self):
     ui_steps.open_users_settings(serial=self.serial)()
     ui_steps.click_button(
         serial=self.serial,
         view_to_find={"text": "Not set up"},
         view_to_check={"textContains": "Set up user now?"})()
     ui_steps.click_button(serial=self.serial,
                           view_to_find={"text": "SET UP NOW"})()
     time.sleep(10)
     ui_steps.wake_up_device(serial=self.serial)()
     ui_steps.unlock_device(serial=self.serial)()
     self.step_data = True
    def do(self):
        # Enable auto time date
        ui_steps.enable_disable_auto_time_date(serial=self.serial,
                                               enable=True)()

        # Get the value of the DUT date via adb shell
        output = self.adb_connection.parse_cmd_output(cmd="date").strip()
        self.first_date = datetime.datetime.strptime(output, adb_shell_date_format)

        # Close Settings from recent apps
        ui_steps.close_app_from_recent(serial=self.serial,
                                       view_to_find={"text": "Settings"})()

        # Disable auto time date
        ui_steps.enable_disable_auto_time_date(serial=self.serial,
                                               enable=False)()

        # Power off device
        relay_steps.power_off_device(serial=self.serial,
                                     except_charging=True,
                                     relay_type=relay_type,
                                     relay_port=relay_port,
                                     power_port=power_port)()

        # keep the device off for 2 minutes
        for i in range(0, dut_time_off, 10):
            print "DUT SLEEPING FOR {} SECONDS".format(dut_time_off-i)
            time.sleep(10)

        # Power on device
        relay_steps.power_on_device(serial=self.serial,
                                    relay_type=relay_type,
                                    relay_port=relay_port,
                                    power_port=power_port)()
        adb_steps.wait_for_ui(serial=self.serial)()

        # Get the value of the DUT date via adb shell
        output = self.adb_connection.parse_cmd_output(cmd="date").strip()
        self.second_date = datetime.datetime.strptime(output, adb_shell_date_format)

        # Enable auto time and date
        ui_steps.wake_up_device(serial=self.serial)()
        ui_steps.unlock_device(serial=self.serial)()
        ui_steps.enable_disable_auto_time_date(serial=self.serial,
                                               enable=True)()

        # Close Settings from recent apps
        ui_steps.close_app_from_recent(serial=self.serial,
                                       view_to_find={"text": "Settings"})()
Ejemplo n.º 4
0
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'])
Ejemplo n.º 5
0
ip_address = os.popen(
    'ifconfig eth1 | grep "inet\ addr" | cut -d: -f2 | cut -d" " -f1')
ip = ip_address.read()
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,
Ejemplo n.º 6
0
import time
from testlib.scripts.android.ui import ui_steps
from testlib.scripts.wireless.wifi import wifi_steps
from testlib.utils.defaults import wifi_defaults
from testlib.base.base_utils import parse_args
'''initialization '''
args = parse_args()
script_params = args["script_args"]
''' test start '''

# turn display on, if turned off
ui_steps.wake_up_device(serial=args["serial"])()

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

# go to home screen
ui_steps.press_home(serial=args["serial"])()

# make sure there are no saved networks
wifi_steps.clear_saved_networks(serial=args["serial"])()

# add the Wi-Fi network
wifi_steps.add_network(ssid=script_params["ap_name"],
                       security=script_params["dut_security"],
                       password=script_params["passphrase"],
                       serial=args["serial"])()

# Introduce sleep so that the Authentication failure happens and the device state moves to Disconnect
time.sleep(15)
Ejemplo n.º 7
0
power_port = args["power_port"]
v_up_port = args["v_up_port"]
v_down_port = args["v_down_port"]

# Test start #
try:
    relay_steps.reboot_main_os(serial=serial,
                               relay_type=relay_type,
                               relay_port=relay_port,
                               power_port=power_port,
                               v_down_port=v_down_port,
                               v_up_port=v_up_port,
                               wait_ui=True)()

    ui_steps.wake_up_device(serial=serial)()
    ui_steps.unlock_device(serial=serial)()

    # Reboot into fastboot #
    adb_steps.reboot(command="fastboot", serial=serial)()

    # Check the vars
    fastboot_steps.check_all_vars(serial=serial)()
except:
    raise
finally:
    relay_steps.reboot_main_os(serial=serial,
                               relay_type=relay_type,
                               relay_port=relay_port,
                               power_port=power_port,
                               v_down_port=v_down_port,
                               v_up_port=v_up_port,
Ejemplo n.º 8
0
    reset_rds = args["reset_rds"]
else:
    reset_rds = False

##### start Ada Radio ####

radio.start_radio(" -n " + str(radio_name) + " -f " + str(frequency) +
                  " --TA " + ta + " --PI " + str(pi) + " --PTY " + str(pty))

##### test start #####

# turn display on, if turned off
ui_steps.wake_up_device(serial=serial)()

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

# clear logcat
logcat_steps.clear_logcat(serial=serial)()

# start the FM Radio app
radio_steps.start_fmradio(serial=serial,
                          frequency=frequency,
                          rds="ON",
                          ta="ON",
                          af="ON",
                          wait_time=10)()

# check the Radio Data System (RDS) data is supported
logcat_steps.grep_for(serial=serial,
                      grep_for_text="radio_hw: PS: " + radio_name,