adb 触摸屏滑动在通话中失败

2022-09-01 23:55:28

我正在尝试使用触摸和滑动来模拟adb的自动视频通话。场景:

设备 1 音频呼叫 设备 2、设备 2 应答、设备 1 要求视频呼叫(双向)、设备 2 尝试应答并失败。有线的事情是,有时它可以工作,但是当设备2试图通过adb刷卡应答时,大多数情况下都会失败。

这是代码:

@Test(timeout = 60000000)
    /**
     *
     */
    @TestProperties(name = "Video call / Normal video call")
    public void VT111_0011() throws InterruptedException, IOException, AWTException {
        initTestVariable("Normal_Video_Call_Test_VT111_0011");
        sleep(idleBeforeTest);
        System.out.println("Starting normal video test");
        Android.adbCommand(secondDevice.getDevice1(), "adb -s " + secondDevice.getDeviceID() + " shell input touchscreen swipe 355 858 590 858");

        for(int i=0; i<Iteration; i++) {
            moveMouse();
            Jsystem.broadCastMessage("\nIteration " + i, globalVar.nameForLogFile);
            cleanLogs();
            firstDevice.call(secondDevice);
            Thread.sleep(2000);
            if(secondDevice.isRinging())
                secondDevice.answerCall(1000);
            else{
                ringingFail();
            }

            // Start video by gui
            Android.adbCommand(firstDevice.getDevice1(),"adb -s " + firstDevice.getDeviceID() + " shell input tap 650 380");
            Android.adbCommand(firstDevice.getDevice1(),"adb -s " + firstDevice.getDeviceID() + " shell input tap 420 470");
            Thread.sleep(1000);
            Android.adbCommand(firstDevice.getDevice1(),"adb -s " + firstDevice.getDeviceID() + " shell input tap 197 780"); // 197 920 Video bidirectional
            Thread.sleep(5500);
            // Device2 answers video
            Android.adbCommand(firstDevice.getDevice1(),"adb -s " + firstDevice.getDeviceID() + " shell input tap 355 858"); // 197 920 Video bidirectional
            Android.adbCommand(secondDevice.getDevice1(), "adb -s " + secondDevice.getDeviceID() + " shell input touchscreen swipe 355 858 590 858");
            Thread.sleep(200);
            Android.adbCommand(firstDevice.getDevice1(),"adb -s " + firstDevice.getDeviceID() + " shell input tap 60 372");
            Android.adbCommand(secondDevice.getDevice1(),"adb -s " + secondDevice.getDeviceID() + " shell input tap 60 372");


        /*  Thread.sleep(5000);
            if((!firstDevice.isInCall()) || (!secondDevice.isInCall())){
                inCallFail();
                continue;
            } */
            int failsCounter = 0;
            VerifyVideo verifyVideo = new VerifyVideo(); 
            for(int j = 8; j<10; j++){
                if(verifyVideo.verrfiyVideo(firstDevice, secondDevice) == false)
                    failsCounter++;
            }
            if(failsCounter>2) {
                Jsystem.broadCastMessage("****** TEST FAILED, VIDEO DOSENT WORK GOOD ENOUGH ****** " , globalVar.nameForLogFile); 
                System.out.println("Number of fails: " + failsCounter);
                comparePhototsFail();
            }

            firstDevice.endCall();
            secondDevice.endCall();
            sleep(TimeBetweenIteration);

        }

    }

有什么想法吗?谢谢。


答案 1

尝试添加持续时间以滑动:

adb shell input touchscreen swipe <x1> <y1> <x2> <y2> [duration(ms)]

答案 2

推荐