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
time.sleep(10)
os.system('ifconfig eth1 up')
time.sleep(10)
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,
Ejemplo n.º 6
0
SPDX-License-Identifier: Apache-2.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"])()
Ejemplo n.º 7
0
wait_time = int(args["wait-time"]) / 1000
sleep_time = int(args["sleep-time"]) / 1000
host_path = args["host-path"]

ui_steps.press_home()()

################## Openning app to test
ui_steps.open_app_from_allapps(view_to_find={"text": app_to_test})()
time.sleep(wait_time)

################## Taking initial screenshot
adb_steps.take_screenshot_given_path(screenshot_file="sleep_initial.png",
                                     host_path=host_path)()

################## Go to homescreen
ui_steps.put_device_into_sleep_mode()()
time.sleep(sleep_time)
ui_steps.wake_up_device()()
time.sleep(wait_time)

################## Taking final screenshot
adb_steps.take_screenshot_given_path(screenshot_file="sleep_final.png",
                                     host_path=host_path)()

################## Compare the two screenshots
file_steps.compare_images(first_file=host_path + "/sleep_initial.png",
                          second_file=host_path + "/sleep_final.png",
                          tolerance=10)()

ui_steps.press_home()()
Ejemplo n.º 8
0
    mode,
    security,
    encryption=encryption,
    wifi_password=ddwrt_ap_pass,
    radius_ip=radius_ip,
    radius_secret=radius_secret,
    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,