【问题标题】:adb touchscreen swipe fail in a calladb 触摸屏滑动通话失败
【发布时间】:2016-08-28 07:06:23
【问题描述】:

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

Device1 音频呼叫 Device2,Device2 应答,Device1 请求视频呼叫(双向),Device2 尝试应答但失败。 有线的事情是,有时它可以工作,但当 device2 尝试通过 adb swipe 回答时,大部分都失败了。

代码如下:

@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);

        }

    }

有什么想法吗? 谢谢。

【问题讨论】:

  • “尝试回答但失败”是什么意思?您在设备本身上看到了什么?如果您尝试手动接听视频通话,您总是成功吗?
  • 当我运行此代码时,secoundDevice 尝试回答弹出消息“不幸的是手机已停止”并且没有视频...当我手动执行相同的场景时,它每次都有效。

标签: java android automation adb


【解决方案1】:

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

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

【讨论】:

    猜你喜欢
    • 2019-05-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多