Exemplo n.º 1
0
 def test_xiaowei_query(stepnum1, stepnum2):
     test_step(stepnum1, "Test xiaowei voice query the weather of a city", dut)
     XiaoweiSupport.test_vpa(dut, query_text)
     assert XiaoweiSupport.test_xiaowei_vpa(), "xiaowei recording or streaming failed"
     test_step(stepnum2, "Verify that the text of this query and response in xiaowei APP is correct or not", dut)
     assert phone.xiaowei.verify_query_response_text(query_text, response_text,
                                                     response_with_icon=True), "xiaowei query or response failed"
Exemplo n.º 2
0
def test_Xiaowei_Disconnect_Cycle_01(automation_xiaowei_connect):
    dut = automation_xiaowei_connect[0]
    phone = automation_xiaowei_connect[1]
    assert phone.xiaowei.verify_device_icon(), "Xiaowei connection fail"
    cycle = 20
    for i in range(cycle):
        logger.info("Test disconnect xiaowei and reopen for %d times, %d" % (cycle, i + 1))
        test_step(1, "Disconnect dut", dut)
        assert phone.xiaowei.disconnect_device(), "Failed to disconnect dut"
        test_step(2, "Close xiaowei APP", dut)
        assert phone.xiaowei.close_app(), "Failed to close xiaowei"
        test_step(3, "Re-open xiaowei APP", dut)
        assert phone.xiaowei.launch_app(), "Failed to re-open Xiaowei"
        test_step(4, "Verify prompt and accept it", dut)
        assert phone.xiaowei.verify_connection_prompt(), "Failed to verify connection prompt"
        assert phone.xiaowei.accept_connection_prompt(), "Failed to accept connection prompt"
        test_step(5, "Verify if xiaowei connect to dut", dut)
        assert phone.xiaowei.verify_device_icon(), "Failed to connect with dut"
Exemplo n.º 3
0
def test_Retrieve_PTT_Configuration_Before_Setting_Up_VPA_01(automation_xiaowei_ux):
    dut = automation_xiaowei_ux[0]
    phone = automation_xiaowei_ux[1]
    current_name = dut.bluetooth.get_name()
    query_response_dict = XiaoweiSupport.xw_query_response_dict()
    query_text = random.choice(list(query_response_dict["query_weather"]))
    response_text = query_response_dict["query_weather"][query_text]
    def test_xiaowei_query(stepnum1, stepnum2):
        test_step(stepnum1, "Test xiaowei voice query the weather of a city", dut)
        XiaoweiSupport.test_vpa(dut, query_text)
        assert XiaoweiSupport.test_xiaowei_vpa(), "xiaowei recording or streaming failed"
        test_step(stepnum2, "Verify that the text of this query and response in xiaowei APP is correct or not", dut)
        assert phone.xiaowei.verify_query_response_text(query_text, response_text,
                                                        response_with_icon=True), "xiaowei query or response failed"
    test_step(1, "Perform factory default", dut)
    assert dut.device.perform_factory_default(restore_name=True, wait_time_after_fd=5), "Failed to perform factory default"
    dut.manager.initialize()
    test_step(2, "Check PPT of native VPA", dut)
    assert dut.status.get_push_to_talk_vpa_status() == '2', "Failed to check PTT status of native VPA"

    phone.launch_application(PhoneAppType.BLUETOOTH)
    for device in phone.bluetooth.bt_get_pairlist():
        phone.bluetooth.bt_unpair(device)
    # don't use Precondition.set_discoverable(dut), because Precondition.set_discoverable(dut) may power cycle dut.
    # For earbuds test, initialize() is needed after power cycle
    # dut.bluetooth.set_discoverable() just send a BMAP to dut
    dut.bluetooth.set_discoverable()
    phone.bluetooth.bt_radio(enable='off')
    phone.bluetooth.bt_radio(enable='on')
    assert phone.bluetooth.bt_connect(current_name), "Failed to reconnect dut via bluetooth"
    test_step(3, "Switch to xiaowei APP", dut)
    assert phone.launch_application(PhoneAppType.XIAOWEI), "Failed to switch to Xiaowei"
    test_step(4, "Verify if xiaowei connect to dut", dut)
    assert phone.xiaowei.insure_device_connection(), "Failed to connect dut via xiaowei"
    test_step(5, "Verify if xiaowei connect to dut", dut)
    #because product change VPA slowly
    for _ in range(5):
        wait(1)
        if dut.status.get_push_to_talk_vpa_status() == '3':
            break
    else:
        assert False, "Failed to check PTT status of xiaowei VPA"
    test_xiaowei_query(6, 7)
    phone.xiaowei.swip_down(n=8)
Exemplo n.º 4
0
def test_Xiaowei_Accept_Prompt_01(automation_xiaowei_connect):
    dut = automation_xiaowei_connect[0]
    phone = automation_xiaowei_connect[1]
    test_step(1, "Disconnect dut", dut)
    assert phone.xiaowei.disconnect_device(), "Failed to disconnect dut"
    assert phone.xiaowei.close_app(), "Failed to close xiaowei"
    test_step(2, "Open xiaowei", dut)
    assert phone.xiaowei.launch_app(), "Failed to open Xiaowei"
    test_step(3, "Verify prompt and accept it", dut)
    assert phone.xiaowei.verify_connection_prompt(), "Failed to verify connection prompt"
    assert phone.xiaowei.accept_connection_prompt(), "Failed to accept connection prompt"
    test_step(4, "Verify if xiaowei connect to dut", dut)
    assert phone.xiaowei.verify_device_icon(), "Failed to connect with dut"
Exemplo n.º 5
0
def test_Xiaowei_Dut_Power_Cycle_01(automation_xiaowei_connect):
    dut = automation_xiaowei_connect[0]
    phone = automation_xiaowei_connect[1]
    assert phone.xiaowei.verify_device_icon(), "Xiaowei connection fail"
    cycle = 20
    for i in range(cycle):
        logger.info("Power cycle dut for %d times, %d" % (cycle, i + 1))
        test_step(1, "Power off dut", dut)
        dut.key.press_power_off()
        test_step(2, "Verify if xiaowei connect to dut", dut)
        assert not phone.xiaowei.verify_device_icon(wait_time=3), "Xiaowei still connect"
        test_step(3, "Power on dut", dut)
        dut.key.press_power_on()
        test_step(4, "Verify if xiaowei connect to dut", dut)
        assert phone.xiaowei.verify_device_icon(), "Fail to connect with dut"
Exemplo n.º 6
0
def test_Xiaowei_Bluetooth_Disable_Cycle_01(automation_xiaowei_connect):
    dut = automation_xiaowei_connect[0]
    current_name = dut.bluetooth.get_name()
    phone = automation_xiaowei_connect[1]
    assert phone.xiaowei.verify_device_icon(), "Xiaowei connection fail"
    cycle = 20
    for i in range(cycle):
        logger.info("Test Bluetooth disable and enable cycle for %d times, %d" % (cycle, i + 1))
        test_step(1, "Switch to bluetooth settings", dut)
        assert phone.launch_application(PhoneAppType.BLUETOOTH), "Failed to switch to bluetooth settings"
        test_step(2, "Disable bluetooth on phone", dut)
        assert phone.bluetooth.bt_radio(enable='off'), "Failed to disable bluetooth"
        test_step(3, "Enable bluetooth on phone", dut)
        assert phone.bluetooth.bt_radio(enable='on'), "Failed to enable bluetooth"
        # iPhone will not connect with blutooth device after disable/enable bluetooth
        wait(3)
        if not phone.bluetooth.bt_is_connected_to(current_name):
            assert phone.bluetooth.connect_paired_device(current_name), "Failed to dut via bluetooth"
        wait(0.5) ###iap issue workaround
        test_step(4, "Switch to xiaowei APP", dut)
        assert phone.launch_application(PhoneAppType.XIAOWEI), "Failed to switch to Xiaowei"
        test_step(5, "Verify if xiaowei connect to dut", dut)
        assert phone.xiaowei.verify_device_icon(), "Fail to connect with dut"
Exemplo n.º 7
0
def test_Xiaowei_Reopen_Cycle_01(automation_xiaowei_connect):
    dut = automation_xiaowei_connect[0]
    phone = automation_xiaowei_connect[1]
    assert phone.xiaowei.verify_device_icon(), "Failed to connect with dut"
    cycle = 20
    for i in range(cycle):
        logger.info("Test xiaowei reopen for %d times, %d" % (cycle, i+1))
        test_step(1, "Close xiaowei APP", dut)
        assert phone.xiaowei.close_app(), "Failed to close xiaowei"
        test_step(2, "Re-open xiaowei APP", dut)
        assert phone.xiaowei.launch_app(), "Failed to re-open Xiaowei"
        test_step(3, "Verify if xiaowei connect to dut", dut)
        assert phone.xiaowei.verify_device_icon(), "Failed to connect with dut"
Exemplo n.º 8
0
def test_Xiaowei_Hibernation_Cycle_01(automation_xiaowei_connect):
    cycle_time = 4  #duration, unit - h
    dut = automation_xiaowei_connect[0]
    current_name = dut.bluetooth.get_name()
    phone = automation_xiaowei_connect[1]
    query_response_dict = XiaoweiSupport.xw_query_response_dict()
    query_text = random.choice(list(query_response_dict["query_weekday"]))
    response_text = query_response_dict["query_weekday"][query_text]
    assert phone.xiaowei.verify_device_icon(), "Xiaowei connection fail"

    @retry(stop_max_attempt_number=3, wait_fixed=2000)
    def test_xiaowei_query(stepnum1, stepnum2):
        test_step(stepnum1, "Test xiaowei voice query the query_weather", dut)
        XiaoweiSupport.test_vpa(dut, query_text)
        assert XiaoweiSupport.test_xiaowei_vpa(), "xiaowei recording or streaming failed"
        test_step(stepnum2, "Verify that the text of this query and response in xiaowei APP is correct or not", dut)
        assert phone.xiaowei.verify_query_response_text(query_text, response_text), "xiaowei query or response failed"

    test_step(1, "Set dut auto off", dut)
    assert dut.device.enable_auto_off() == '5', "Fail to set auto off timer as 5"
    base_t = time.time()
    current_t = time.time()
    while float(current_t-base_t) <= float(cycle_time*3600):
        test_step(2, "Check if dut power off in 10 minutes", dut)
        for i in [300, 60, 60, 60, 60, 60, 60]:
            wait(i)
            if dut.status.get_sink_state() == SinkStates.STANDBY:
                break
        else:
            assert False, "Dut didn't power off in 10 minutes"
        test_step(3, "Power on dut", dut)
        assert dut.key.press_power_on(), "Fail to power on dut"
        wait(3)
        test_step(4, "Dut connect to phone and xiaowei", dut)
        assert phone.launch_application(PhoneAppType.BLUETOOTH), "Failed to switch to bluetooth settings"
        if not phone.bluetooth.bt_is_connected_to(current_name):
            assert phone.bluetooth.connect_paired_device(current_name), "Failed to dut via bluetooth"
        assert phone.launch_application(PhoneAppType.XIAOWEI), "Failed to switch to Xiaowei"
        test_xiaowei_query(5, 6)
        current_t = time.time()
    phone.xiaowei.swip_down(n=8)
Exemplo n.º 9
0
def test_Xiaowei_VPA_Button_Stress_01(automation_xiaowei_connect):
    dut = automation_xiaowei_connect[0]
    phone = automation_xiaowei_connect[1]
    assert phone.xiaowei.verify_device_icon(), "Xiaowei connection fail"
    cycle = 40
    for i in range(cycle):
        press_time = random.choice([0.35, 1, 2, 3, 5, 8, 13, 21])
        logger.info("VPA button stress for %d times, %d" % (cycle, i + 1))
        test_step(1, "Power VPA button for %d second" % press_time, dut)
        dut.key.press_and_release(keys=Buttons.VPA, press_duration_sec=press_time)
        wait(2)

    query_response_dict = XiaoweiSupport.xw_query_response_dict()
    query_text = random.choice(list(query_response_dict["query_weekday"]))
    response_text = query_response_dict["query_weekday"][query_text]
    test_step(2, "Test xiaowei voice query the query_weather", dut)
    XiaoweiSupport.test_vpa(dut, query_text)
    assert XiaoweiSupport.test_xiaowei_vpa(), "xiaowei recording or streaming failed"
    test_step(3, "Verify that the text of this query and response in xiaowei APP is correct or not", dut)
    assert phone.xiaowei.verify_query_response_text(query_text, response_text), "xiaowei query or response failed"
    phone.xiaowei.swip_down(n=8)
Exemplo n.º 10
0
def test_Xiaowei_Disconnect_Cycle_While_Music_Is_Streaming_01(automation_xiaowei_connect):
    dut = automation_xiaowei_connect[0]
    phone = automation_xiaowei_connect[1]
    assert phone.xiaowei.verify_device_icon(), "Xiaowei connection fail"
    test_step(1, "Launch QQ music", dut)
    assert phone.launch_application(PhoneAppType.QQMUSIC), "Failed to launch QQ music"
    test_step(2, "Play a music in QQ music", dut)
    assert phone.qqmusic.play_music(), "Failed to play music"
    assert dut.status.get_sink_state() == SinkStates.A2DP_STREAMING, "The music was not played"
    test_step(3, "Launch xiaowei", dut)
    assert phone.launch_application(PhoneAppType.XIAOWEI), "Failed to switch to Xiaowei"

    cycle = 20
    for i in range(cycle):
        logger.info("Test disconnect xiaowei and reopen for %d times, %d" % (cycle, i + 1))
        assert dut.status.get_sink_state() == SinkStates.A2DP_STREAMING, "The music was not played"
        test_step(4, "Disconnect dut", dut)
        assert phone.xiaowei.disconnect_device(), "Failed to disconnect dut"
        test_step(5, "Close xiaowei APP", dut)
        assert phone.xiaowei.close_app(), "Failed to close xiaowei"
        test_step(6, "Re-open xiaowei APP", dut)
        assert phone.xiaowei.launch_app(), "Failed to re-open Xiaowei"
        test_step(7, "Verify prompt and accept it", dut)
        assert phone.xiaowei.verify_connection_prompt(), "Failed to verify connection prompt"
        assert phone.xiaowei.accept_connection_prompt(), "Failed to accept connection prompt"
        test_step(8, "Verify if xiaowei connect to dut", dut)
        assert phone.xiaowei.verify_device_icon(), "Failed to connect with dut"

    test_step(9, "Close QQ music", dut)
    assert phone.qqmusic.terminate_app(), "Failed to close QQ music"
    wait(20)
    assert dut.status.get_sink_state() == SinkStates.CONNECTED, "Failed to close QQ music"