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_Set_PTT_For_All_VPA_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]
    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"
    test_step(3, "Set and check PPT of google VPA", dut)
    dut.device.set_google_assistant_as_push_to_talk_vpa()
    assert dut.status.get_push_to_talk_vpa_status() == '0', "Failed to check PTT status of Google VPA"
    dut.device.set_alexa_as_push_to_talk_vpa()
    test_step(4, "Set and check PPT of alexa VPA", dut)
    assert dut.status.get_push_to_talk_vpa_status() == '1', "Failed to check PTT status of Alexa VPA"
    test_step(5, "Set and check PPT of xiaowei VPA", dut)
    dut.device.set_xiaowei_as_push_to_talk_vpa()
    assert dut.status.get_push_to_talk_vpa_status() == '3', "Failed to check PTT status of Xiaowei 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(6, "Switch to xiaowei APP", dut)
    assert phone.launch_application(PhoneAppType.XIAOWEI), "Failed to switch to Xiaowei"
    test_step(7, "Verify if xiaowei connect to dut", dut)
    assert phone.xiaowei.insure_device_connection(), "Failed to connect dut via xiaowei"
    test_step(8, "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(9, "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"
    phone.xiaowei.swip_down(n=8)
Exemplo n.º 3
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.º 4
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)
 def perform_eq_query(self):
     # return XiaoweiSupport.test_xiaowei_vpa(self.dut, self.query_eq_text, hold_seconds=6, query_no_response=True)
     XiaoweiSupport.test_vpa(self.dut, self.query_eq_text, hold_seconds=6)
     return XiaoweiSupport.test_query_no_response()
 def perform_nc_query(self):
     XiaoweiSupport.test_vpa(self.dut, self.query_nc_text, hold_seconds=6)
     return XiaoweiSupport.test_query_no_response()