Ejemplo n.º 1
0
 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"})()
Ejemplo n.º 2
0
    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)
from testlib.utils.ui.uiandroid import UIDevice as ui_device

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()()

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
Ejemplo n.º 4
0
from testlib.scripts.android.adb import adb_steps
from testlib.scripts.android.ui import ui_steps
from testlib.scripts.media import media_steps

# Connect to device
from testlib.base.base_utils import get_args

globals().update(vars(get_args(sys.argv)))

OPENGL_VERSION = 'OpenGL ES 3.0'

########### Preconditions ###############
#########################################

adb_steps.connect_device(serial=serial, port=adb_server_port)()

############### Test ####################
#########################################

ui_steps.press_home()()
ui_steps.open_settings()()
ui_steps.open_app_from_settings(view_to_find={'text': 'About tablet'},
                                view_to_check={'textContains':
                                               OPENGL_VERSION})()

########### Postconditions ##############
#########################################

adb_steps.disconnect_device(serial=serial, local_port=adb_server_port)()
Ejemplo n.º 5
0
from testlib.scripts.android.ui.settings import steps
from testlib.scripts.android.ui import ui_steps
from testlib.scripts.android.ui import ui_utils
from testlib.scripts.android.adb import adb_steps
from testlib.scripts.android.adb import adb_utils
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()()
ui_steps.open_settings()()

ui_steps.open_app_from_settings(view_to_find = {"text": "Apps"},
                                wait_time = 2000,
                                view_to_check = {"text":"Downloaded"})()

ui_steps.swipe(sx = 500, sy = 300, ex = 200, ey = 300, steps = 10,
               view_presence = True, view_to_check = {"text":"Settings"},
               wait_time = 5000)()

ui_steps.swipe(sx = 500, sy = 300, ex = 200, ey = 300, steps = 10,
               view_presence = True, view_to_check = {"text":"Android "
                                                             "System"},
               wait_time = 5000)()

ui_steps.press_home()()


Ejemplo n.º 6
0
    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)
Ejemplo n.º 7
0
########### Preconditions ###############
#########################################

adb_steps.connect_device(
    serial = serial,
    port = adb_server_port
)()
adb_steps.root_connect_device()()

############### Test ####################
#########################################

ui_steps.press_home()()
ui_steps.open_settings()()
ui_steps.open_app_from_settings(view_to_find = {'textContains': 'Sound'},
                                view_to_check = {'textContains': 'Volume'})()

if not (script_args and "gmin" in script_args):
    ui_steps.click_button(view_to_find = {'textContains': 'Volumes'})()

if script_args and "gmin" in script_args:
    media_steps.mute_sound('volume_alarm_speaker', 1)()
    media_steps.mute_sound('volume_ring_speaker', 2)()
    media_steps.mute_sound('volume_music_speaker', 0)()
else:
    media_steps.mute_sound('volume_ring_speaker', 1)()
    media_steps.mute_sound('volume_alarm_speaker', 2)()
    media_steps.mute_sound('volume_music_speaker', 0)()


if not (script_args and "gmin" in script_args):
Ejemplo n.º 8
0
import sys
from testlib.scripts.android.ui.settings import steps
from testlib.scripts.android.ui import ui_steps
from testlib.scripts.android.ui import ui_utils
from testlib.scripts.android.adb import adb_steps
from testlib.scripts.android.adb import adb_utils
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()()
ui_steps.open_settings()()

ui_steps.open_app_from_settings(view_to_find={"text": "Display"},
                                wait_time=2000,
                                view_to_check={"textContains": "Brightness"})()

ui_steps.click_button(view_to_find={"textContains": "Brightness"},
                      view_to_check={"className": "android.widget.SeekBar"})()

steps.slide_brightness(view_to_find={
    "className": 'android.widget.SeekBar',
    "instance": 0
},
                       position=30)()

ui_steps.press_home()()
from testlib.scripts.android.adb import adb_utils
from testlib.utils.ui.uiandroid import UIDevice as ui_device

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()})

uidevice = ui_device()
ui_steps.press_home()()
ui_steps.open_settings(blocking=True)()
ui_steps.open_app_from_settings(
    print_error="Error - Settings page was not displayed",
    blocking=True,
    view_to_find={"text": "Bluetooth"},
    view_to_check={"text": "Bluetooth"})()

if uidevice(text="Off").exists:
    ui_steps.click_button(print_error="Failed to change BT state",
                          blocking=True,
                          view_to_find={"text": "Off"},
                          view_to_check={"text": "On"})()

uidevice(text="Available devices").wait.exists(timeout=20000)
bt_steps.bt_list_displayed(print_error="Error - counting bt devices",
                           state="ON")()

bt_steps.bt_list_displayed(print_error="Error - counting bt devices",
                           state="OFF")()
Ejemplo n.º 10
0
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()()

ui_steps.open_settings()()
ui_steps.open_app_from_settings(view_to_find = {"text":"About tablet"},
                                view_to_check = {"text":"Build number"})()

if version == "K":
    ui_steps.click_button(print_error = "Failed to click Intel System Software "
                                        "Auto-Update",
                          view_to_find = {"text":"Intel System Software "
                                                 "Auto-Update"},
                          view_to_check = {"textContains":"Auto-Update "
                                                          "determines the best"},
                          critical = False)()
    ui_steps.click_button(print_error = "Failed to click Check for Updates",
                          view_to_find = {"text":"Check for Updates"},
                          view_to_check = {"text":"Intel System Software "
                                                  "Auto-Update"},
                          critical = False)()
Ejemplo n.º 11
0
#!/usr/bin/env python

##############################################################################
#
# @description: ET/../Settings/Settings Wireless & Networks more...
#               Open More for Wireless
# @author:      [email protected]
#
##############################################################################

import sys
from testlib.scripts.android.ui.settings import steps
from testlib.scripts.android.ui import ui_steps
from testlib.scripts.android.ui import ui_utils
from testlib.scripts.android.adb import adb_steps
from testlib.scripts.android.adb import adb_utils
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()()
ui_steps.open_settings()()

ui_steps.open_app_from_settings(view_to_find={"textContains": "More"},
                                wait_time=3000,
                                view_to_check={"text": "VPN"})()

ui_steps.press_home()()