seveniruby/AppCrawler

backbutton应该排除在selectList中

windanchaos opened this issue · 1 comments

版本:2.3.1
原因:如果selectList的规则命中返回键,先执行返回键,会导致部分页面无法被遍历。
case:个人页--->右上角设置
app:绿洲
在不排除返回键的前提下,执行Steps后,就点击返回键。设置下的所有元素不能被遍历。
反之则可以。

配置文件:

---
pluginList: ["com.testerhome.appcrawler.plugin.TagLimitPlugin",
"com.testerhome.appcrawler.plugin.ReportPlugin",
      "com.testerhome.appcrawler.plugin.FreeMind"]
saveScreen: true
reportTitle: ""
resultDir: "20201112_yam3"
waitLoading: 800
waitLaunch: 6000
showCancel: true
maxTime: 10800
maxDepth: 12
capability:
  appActivity: "com.sina.oasis.main.SplashActivity"
  appium: "http://127.0.0.1:4723/wd/hub"
  autoLaunch: "true"
  noReset: "true"
  app: ""
  appPackage: "com.sina.oasis"
  fullReset: "false"
  dontStopAppOnReset: "true"
androidCapability:
  app: ""
  appPackage: "com.sina.oasis"
  appActivity: "com.sina.oasis.main.SplashActivity"
  automationName: "UiAutomator2"
  #deviceName: "10.226.245.99:5558"
testcase:
  name: "TesterHome AppCrawler"
  steps:
    - given: null
      when: null
      then: []
      xpath: "//android.widget.ImageView[@resource-id='com.sina.oasis:id/mine']"
      action: "click"
      actions: null
      times: 1
    - given: null
      when: null
      then: []
      xpath: "//android.widget.ImageView[@resource-id='com.sina.oasis:id/user_setting']"
      action: "click"
      actions: null
      times: 1
selectedList:
  - given: null
    when: null
    then: null
    xpath: "//android.widget.EditText[@resource-id='com.sina.oasis:id/input_edit']"
    action: "driver.sendKeys(\"挺不错的\")"
  - given: null
    when: null
    then: []
    xpath: "//*[@enabled='true' and @displayed='true' and @clickable='true']"
    action: "click"
    actions: []
    times: 0
  - given: null
    when: null
    then: null
    xpath: "//android.widget.Button"
    action: "click"
  - given: null
    when: null
    then: null
    xpath: "//android.app.ActionBar.Tab"
    action: "click"

# 优先操作
firstList:
  - given: null
    when: null
    then: null
    xpath: "//android.widget.EditText[@resource-id='com.sina.oasis:id/input_edit']"
    action: "driver.sendKeys(\"挺不错的\")"
  - given: null
    when: null
    then: null
    xpath: "//android.app.ActionBar.Tab"
    action: "click"
    times: 3
  - given: null
    when: null
    then: null
    xpath: "//android.widget.Button[contains(@resource-id,'new_bnLogin')]"
    action: "click"    
# 执行完selectlist后的操作
lastList:
  - given: null
    when: null
    then: null
    xpath: "//android.widget.ImageView[@resource-id='com.sina.oasis:id/home']"
    action: "click"
  - given: null
    when: null
    then: null
    xpath: "//android.widget.ImageView[@resource-id='com.sina.oasis:id/discovery']"
    action: "click"
  - given: null
    when: null
    then: null
    xpath: "//android.widget.ImageView[@resource-id='com.sina.oasis:id/publish']"
    action: "click"
  - given: null
    when: null
    then: null
    xpath: "//android.widget.ImageView[@resource-id='com.sina.oasis:id/message']"
    action: "click"
  - given: null
    when: null
    then: null
    xpath: "//android.widget.ImageView[@resource-id='com.sina.oasis:id/mine']"
    action: "click"
backButton:
  - given: null
    when: null
    then: null
    xpath: "Navigate up"
  - given: null
    when: null
    then: null
    xpath: "//*[contains(@text,'允许')]"
  - given: null
    when: null
    then: null
    xpath: "//android.widget.ImageView[contains(@resource-id,'Close') or contains(@resource-id,'toolbar_image_menu') or contains(@resource-id,'close')]"
triggerActions: 
  - given: null
    when: null
    then: null
    xpath: "//*[@resource-id='com.android.packageinstaller:id/permission_allow_button']"
    action: "click"
    times: 5
xpathAttributes:
- "name"
- "label"
#- "value"
- "resource-id"
#- "content-desc"
#- "instance"
#- "text"
sortByAttribute:
- "depth"
- "list"
- "selected"
findBy: "xpath"
defineUrl: []
baseUrl: []
appWhiteList: []
urlBlackList: [”WelcomeActivity“,”RegByMobileRegAIOUI“]
urlWhiteList: []
# 由于把text去掉了,所有用text的都无效
blackList:
  - given: null
    when: null
    then: null
    xpath: "//*[contains(@resource-id,'deny')]"
    action: "click"
  - given: null
    when: null
    then: null
    xpath: "//android.widget.TextView[contains(@resource-id,'permission_message')]"
    action: "click"
  - given: null
    when: null
    then: null
    xpath: "//*[@resource-id='com.sina.oasis:id/phone']"
    action: "click"
  - given: null
    when: null
    then: null
    xpath: "//*[@resource-id='com.sina.oasis:id/weixin']"
    action: "click"
  - given: null
    when: null
    then: null
    xpath: "//*[@resource-id='com.sina.oasis:id/qq']"
    action: "click"
  - given: null
    when: null
    then: null
    xpath: "//android.widget.TextView[contains(@resource-id,'security')]"
  - given: null
    when: null
    then: null
    xpath: "//android.widget.ImageView[@resource-id='com.sina.oasis:id/more']"
beforeRestart: []
beforeElement:
- given: []
  when: null
  then: []
  xpath: "/*"
  action: "Thread.sleep(500)"
  actions: []
  times: 0
afterElement: []
afterPage: 
  - given: ["//androidx.recyclerview.widget.RecyclerView"]
    when: 
      xpath: null
    then: null
    xpath: "//androidx.recyclerview.widget.RecyclerView"
    action: "driver.swipe(\"up\")"
tagLimitMax: 12
tagLimit: []
assertGlobal: []

把后退按键加到黑名单里或者backButton里就可以了