view_to_check={"textContains": "SONGS"})()
    ui_steps.click_button_common(serial=serial_dev,view_to_find={"textContains": "SONGS"},
                                     view_to_check={"className":"android.widget.LinearLayout"})()
    if not ui_steps.click_button_common(serial=serial_dev,
                                        view_to_find={"resourceId": "com.google.android.music:id/pause"},
                                        optional=True, scroll=False)():
        ui_steps.click_button_common(serial=serial_dev,
                                     first_view_to_find={"resourceId":"com.google.android.music:id/list_context_menu"},
                                     second_view_to_find={"index": "2"},scroll=False)()
    ui_steps.press_media(serial=serial)()
    ui_steps.click_button_common(serial=serial, view_to_find={"textContains": "Bluetooth Audio"})()
    time.sleep(20)
    bluetooth_steps.PressHome(serial=serial, critical=False)()
    bluetooth_steps.OpenBluetoothSettings(serial=serial, use_intent=True, version=DUT_VERSION, critical=False)()
    bluetooth_steps.BtSetService(serial=serial,
                                 paired_device_name=PAIRING_DEV_NAME, state=False,
                                 service="Media audio", check_if_already=True,
                                 disable_profile_confirm=True, version=DUT_VERSION)()
    ui_steps.click_button_common(serial=serial_dev, view_to_find={"resourceId": "com.google.android.music:id/pause"},
                                 optional=True, scroll=False)()

finally:

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

    bluetooth_steps.LogInfo("####### CLEANUP #######")()

    # DUT: stop settings and turn on BT (if not already)
    bluetooth_steps.StopPackage(serial=serial, critical=False)()
    bluetooth_steps.PressHome(serial=serial, critical=False)()
    bluetooth_steps.OpenBluetoothSettings(serial=serial, use_intent=True, version=DUT_VERSION, critical=False)()
    # pair devices
    bt_utils.bt_pair_devices(serial=serial,
                             dev=serial_dev,
                             dut_name=DUT_NAME,
                             dev_name=PAIRING_DEV_NAME,
                             scan_max_attempts=5,
                             version_dut=DUT_VERSION,
                             version_dev=DEV_VERSION,
                             blocking=True)

    # NAP: check internet connection
    bluetooth_steps.CheckInternetConnection(serial=nap_serial, blocking=True)()
    # PAN: activate internet service
    bluetooth_steps.BtSetService(serial=pan_serial,
                                 paired_device_name=nap_name,
                                 state=True,
                                 service="Internet access",
                                 version=pan_version,
                                 blocking=True)()
    bluetooth_steps.WaitForState(serial=pan_serial,
                                 device_name=nap_name,
                                 connected=True,
                                 version=pan_version,
                                 blocking=True)()
    bluetooth_steps.WaitForState(serial=nap_serial,
                                 device_name=pan_name,
                                 connected=True,
                                 version=nap_version,
                                 blocking=True)()
    bluetooth_steps.CheckInternetAccessServiceState(serial=pan_serial,
                                                    state="ON",
                                                    max_checks=15,
    bluetooth_steps.CheckInternetConnection(serial=serial, blocking=True)()

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

    bluetooth_steps.LogInfo("##### ACTUAL TEST #####")()

    # activate bt tethering on DUT
    bluetooth_steps.BtSetTethering(serial=serial,
                                   state="ON",
                                   tethering_settings_opened=False,
                                   version=DUT_VERSION)()
    # activate internet service on DEV
    bluetooth_steps.BtSetService(serial=serial_dev,
                                 paired_device_name=DUT_NAME,
                                 state=True,
                                 service="Internet access",
                                 version=DEV_VERSION)()
    bluetooth_steps.WaitForState(serial=serial_dev,
                                 device_name=DUT_NAME,
                                 connected=True,
                                 version=DEV_VERSION)()
    bluetooth_steps.CheckInternetAccessServiceState(serial=serial_dev,
                                                    state="ON",
                                                    max_checks=15,
                                                    version=DEV_VERSION)()

finally:

    # ########### Postconditions ##############
    # #########################################
Example #4
0
     dev=serial_dev,
     dut_name=DUT_NAME,
     dev_name=PAIRING_DEV_NAME,
     action_dut=action_dut,
     action_dev=action_dev,
     perform_action_first_on_initiator=action_initiator_first,
     pair_request_initiator=initiator,
     scan_timeout=scan_timeout,
     scan_max_attempts=scan_max_attempts,
     time_to_wait_timeout_action=timeout_time,
     version_dut=DUT_VERSION,
     version_dev=DEV_VERSION)
 bluetooth_steps.BtSetService(serial=serial_dev,
                              paired_device_name=DUT_NAME,
                              state=True,
                              service="Contact sharing",
                              check_if_already=False,
                              disable_profile_confirm=True,
                              version=DEV_VERSION)()
 bluetooth_steps.BtSetService(serial=serial,
                              paired_device_name=PAIRING_DEV_NAME,
                              state=False,
                              service="Contact sharing",
                              check_if_already=True,
                              disable_profile_confirm=True,
                              version=DUT_VERSION)()
 bluetooth_steps.BtSetService(serial=serial,
                              paired_device_name=PAIRING_DEV_NAME,
                              state=True,
                              service="Contact sharing",
                              check_if_already=False,