Преглед на файлове

DFS返回后,检查是否还在APP内

LiHaoyu преди 5 години
родител
ревизия
229d053067
променени са 1 файла, в които са добавени 3 реда и са изтрити 8 реда
  1. 3 8
      src/main/java/net/mooctest/www/android_auto_test/Scripts/DefaultScript.java

+ 3 - 8
src/main/java/net/mooctest/www/android_auto_test/Scripts/DefaultScript.java

@@ -271,7 +271,9 @@ public class DefaultScript extends AbstractBaseScript {
                 //返回之后马上检查是否有android消息弹窗出现,若有(这种情况一般是返回了MainActivity)就点击取消按钮
                 //并检查是否在AppPackage中,不在就结束遍历
                 headleAndroidMessage();
-                boolean outOfAppPackageFlag = judgeOutOfAppPackage(componentList);
+                List<Component> comListAfterReturn = getCurrentClickableComList(depth, true);
+                PrintUtil.print("Current activity is " + driver.currentActivity(), TAG, udid, myTestLogWriter, PrintUtil.ANSI_BLUE);
+                boolean outOfAppPackageFlag = judgeOutOfAppPackage(comListAfterReturn);
                 if(outOfAppPackageFlag) {
                     //如果返回后的页面不在AppPackage中
                     PrintUtil.print("Change isEnd to true because not in AppPackage", TAG, udid, myTestLogWriter, PrintUtil.ANSI_BLUE);
@@ -279,13 +281,6 @@ public class DefaultScript extends AbstractBaseScript {
                     return;
                 }
                 //准备继续遍历这个页面接下来的控件
-                try{
-                    PrintUtil.print("Current activity is " + driver.currentActivity(), TAG, udid, myTestLogWriter, PrintUtil.ANSI_BLUE);
-                }catch(Exception e){
-                    PrintUtil.printException(TAG, udid, e);
-                    return;
-                }
-                List<Component> comListAfterReturn = getCurrentClickableComList(depth, true);
                 if(componentList.hashCode() != comListAfterReturn.hashCode()){
                     //此时的页面和之前的页面有区别,就用现在的页面更新了之前页面comList,且去除先前页面已有且测试过的控件,继续遍历这个页面剩下的控件
                     PrintUtil.print("Update the activity's component , because current comList is different with before", TAG, udid, myTestLogWriter, PrintUtil.ANSI_BLUE);