test(selector): 连接操作符<<测试例子

This commit is contained in:
lisonge 2023-11-05 18:20:06 +08:00
parent 1126ff23aa
commit 113c84cb84
2 changed files with 868 additions and 0 deletions

View File

@ -0,0 +1,854 @@
{
"id": 1698990932472,
"appId": "com.coolapk.market",
"activityId": "com.coolapk.market.view.splash.SplashActivity",
"appName": "酷安",
"appVersionCode": 2308241,
"appVersionName": "13.3.3",
"screenHeight": 3088,
"screenWidth": 1440,
"isLandscape": false,
"gkdVersionCode": 9,
"device": {
"device": "dm3q",
"model": "SM-S9180",
"manufacturer": "samsung",
"brand": "samsung",
"sdkInt": 33,
"release": "13"
},
"nodes": [
{
"id": 0,
"pid": -1,
"index": 0,
"quickFind": null,
"attr": {
"id": null,
"name": "android.widget.FrameLayout",
"text": null,
"desc": null,
"clickable": false,
"focusable": false,
"checkable": false,
"checked": false,
"visibleToUser": true,
"left": 0,
"top": 0,
"right": 1440,
"bottom": 3088,
"width": 1440,
"height": 3088,
"childCount": 1,
"index": 0,
"depth": 0
}
},
{
"id": 1,
"pid": 0,
"index": 0,
"quickFind": null,
"attr": {
"id": null,
"name": "android.widget.LinearLayout",
"text": null,
"desc": null,
"clickable": false,
"focusable": false,
"checkable": false,
"checked": false,
"visibleToUser": true,
"left": 0,
"top": 0,
"right": 1440,
"bottom": 3088,
"width": 1440,
"height": 3088,
"childCount": 1,
"index": 0,
"depth": 1
}
},
{
"id": 2,
"pid": 1,
"index": 0,
"quickFind": null,
"attr": {
"id": null,
"name": "android.widget.FrameLayout",
"text": null,
"desc": null,
"clickable": false,
"focusable": false,
"checkable": false,
"checked": false,
"visibleToUser": true,
"left": 0,
"top": 0,
"right": 1440,
"bottom": 3088,
"width": 1440,
"height": 3088,
"childCount": 1,
"index": 0,
"depth": 2
}
},
{
"id": 3,
"pid": 2,
"index": 0,
"quickFind": true,
"attr": {
"id": "com.coolapk.market:id/action_bar_root",
"name": "android.widget.LinearLayout",
"text": null,
"desc": null,
"clickable": false,
"focusable": false,
"checkable": false,
"checked": false,
"visibleToUser": true,
"left": 0,
"top": 0,
"right": 1440,
"bottom": 3088,
"width": 1440,
"height": 3088,
"childCount": 1,
"index": 0,
"depth": 3
}
},
{
"id": 4,
"pid": 3,
"index": 0,
"quickFind": true,
"attr": {
"id": "android:id/content",
"name": "android.widget.FrameLayout",
"text": null,
"desc": null,
"clickable": false,
"focusable": false,
"checkable": false,
"checked": false,
"visibleToUser": true,
"left": 0,
"top": 0,
"right": 1440,
"bottom": 3088,
"width": 1440,
"height": 3088,
"childCount": 1,
"index": 0,
"depth": 4
}
},
{
"id": 5,
"pid": 4,
"index": 0,
"quickFind": null,
"attr": {
"id": null,
"name": "android.widget.FrameLayout",
"text": null,
"desc": null,
"clickable": false,
"focusable": false,
"checkable": false,
"checked": false,
"visibleToUser": true,
"left": 0,
"top": 0,
"right": 1440,
"bottom": 3088,
"width": 1440,
"height": 3088,
"childCount": 1,
"index": 0,
"depth": 5
}
},
{
"id": 6,
"pid": 5,
"index": 0,
"quickFind": true,
"attr": {
"id": "com.coolapk.market:id/root_view",
"name": "android.view.ViewGroup",
"text": null,
"desc": null,
"clickable": false,
"focusable": false,
"checkable": false,
"checked": false,
"visibleToUser": true,
"left": 0,
"top": 0,
"right": 1440,
"bottom": 3088,
"width": 1440,
"height": 3088,
"childCount": 3,
"index": 0,
"depth": 6
}
},
{
"id": 7,
"pid": 6,
"index": 0,
"quickFind": true,
"attr": {
"id": "com.coolapk.market:id/ad_container",
"name": "android.widget.FrameLayout",
"text": null,
"desc": null,
"clickable": false,
"focusable": false,
"checkable": false,
"checked": false,
"visibleToUser": true,
"left": 0,
"top": 0,
"right": 1440,
"bottom": 2560,
"width": 1440,
"height": 2560,
"childCount": 1,
"index": 0,
"depth": 7
}
},
{
"id": 8,
"pid": 6,
"index": 1,
"quickFind": true,
"attr": {
"id": "com.coolapk.market:id/info_view",
"name": "android.widget.TextView",
"text": null,
"desc": null,
"clickable": false,
"focusable": false,
"checkable": false,
"checked": false,
"visibleToUser": false,
"left": 1440,
"top": 2489,
"right": 1440,
"bottom": 2560,
"width": 0,
"height": 71,
"childCount": 0,
"index": 1,
"depth": 7
}
},
{
"id": 9,
"pid": 6,
"index": 2,
"quickFind": true,
"attr": {
"id": "com.coolapk.market:id/bottom_container",
"name": "android.widget.FrameLayout",
"text": null,
"desc": null,
"clickable": false,
"focusable": false,
"checkable": false,
"checked": false,
"visibleToUser": true,
"left": 0,
"top": 2560,
"right": 1440,
"bottom": 3088,
"width": 1440,
"height": 528,
"childCount": 1,
"index": 2,
"depth": 7
}
},
{
"id": 10,
"pid": 9,
"index": 0,
"quickFind": true,
"attr": {
"id": "com.coolapk.market:id/logo_container",
"name": "android.widget.FrameLayout",
"text": null,
"desc": null,
"clickable": false,
"focusable": false,
"checkable": false,
"checked": false,
"visibleToUser": true,
"left": 0,
"top": 2560,
"right": 1440,
"bottom": 3088,
"width": 1440,
"height": 528,
"childCount": 1,
"index": 0,
"depth": 8
}
},
{
"id": 11,
"pid": 10,
"index": 0,
"quickFind": true,
"attr": {
"id": "com.coolapk.market:id/logo_view",
"name": "android.widget.ImageView",
"text": null,
"desc": null,
"clickable": false,
"focusable": false,
"checkable": false,
"checked": false,
"visibleToUser": true,
"left": 438,
"top": 2734,
"right": 1001,
"bottom": 2914,
"width": 563,
"height": 180,
"childCount": 0,
"index": 0,
"depth": 9
}
},
{
"id": 12,
"pid": 7,
"index": 0,
"quickFind": null,
"attr": {
"id": null,
"name": "android.widget.FrameLayout",
"text": null,
"desc": null,
"clickable": false,
"focusable": false,
"checkable": false,
"checked": false,
"visibleToUser": true,
"left": 0,
"top": 0,
"right": 1440,
"bottom": 2560,
"width": 1440,
"height": 2560,
"childCount": 1,
"index": 0,
"depth": 8
}
},
{
"id": 13,
"pid": 12,
"index": 0,
"quickFind": null,
"attr": {
"id": null,
"name": "android.widget.FrameLayout",
"text": null,
"desc": null,
"clickable": false,
"focusable": false,
"checkable": false,
"checked": false,
"visibleToUser": true,
"left": 0,
"top": 0,
"right": 1440,
"bottom": 2560,
"width": 1440,
"height": 2560,
"childCount": 2,
"index": 0,
"depth": 9
}
},
{
"id": 14,
"pid": 13,
"index": 0,
"quickFind": null,
"attr": {
"id": null,
"name": "android.widget.FrameLayout",
"text": null,
"desc": null,
"clickable": false,
"focusable": false,
"checkable": false,
"checked": false,
"visibleToUser": false,
"left": 0,
"top": 0,
"right": 0,
"bottom": 0,
"width": 0,
"height": 0,
"childCount": 0,
"index": 0,
"depth": 10
}
},
{
"id": 15,
"pid": 13,
"index": 1,
"quickFind": false,
"attr": {
"id": "com.byted.pangle.m:id/tt_splash_view",
"name": "android.widget.FrameLayout",
"text": null,
"desc": null,
"clickable": false,
"focusable": false,
"checkable": false,
"checked": false,
"visibleToUser": true,
"left": 0,
"top": 0,
"right": 1440,
"bottom": 2560,
"width": 1440,
"height": 2560,
"childCount": 3,
"index": 1,
"depth": 10
}
},
{
"id": 16,
"pid": 15,
"index": 0,
"quickFind": false,
"attr": {
"id": "com.byted.pangle.m:id/tt_splash_express_container",
"name": "android.widget.FrameLayout",
"text": null,
"desc": null,
"clickable": false,
"focusable": false,
"checkable": false,
"checked": false,
"visibleToUser": true,
"left": 0,
"top": 0,
"right": 1440,
"bottom": 2560,
"width": 1440,
"height": 2560,
"childCount": 1,
"index": 0,
"depth": 11
}
},
{
"id": 17,
"pid": 15,
"index": 1,
"quickFind": false,
"attr": {
"id": "com.byted.pangle.m:id/tt_splash_skip_btn",
"name": "android.view.View",
"text": null,
"desc": null,
"clickable": true,
"focusable": true,
"checkable": false,
"checked": false,
"visibleToUser": true,
"left": 1230,
"top": 160,
"right": 1380,
"bottom": 310,
"width": 150,
"height": 150,
"childCount": 0,
"index": 1,
"depth": 11
}
},
{
"id": 18,
"pid": 15,
"index": 2,
"quickFind": false,
"attr": {
"id": "com.byted.pangle.m:id/tt_splash_ad_logo",
"name": "android.widget.TextView",
"text": null,
"desc": null,
"clickable": true,
"focusable": true,
"checkable": false,
"checked": false,
"visibleToUser": true,
"left": 75,
"top": 2357,
"right": 195,
"bottom": 2410,
"width": 120,
"height": 53,
"childCount": 0,
"index": 2,
"depth": 11
}
},
{
"id": 19,
"pid": 16,
"index": 0,
"quickFind": null,
"attr": {
"id": null,
"name": "android.widget.FrameLayout",
"text": null,
"desc": null,
"clickable": false,
"focusable": false,
"checkable": false,
"checked": false,
"visibleToUser": true,
"left": 0,
"top": 0,
"right": 1440,
"bottom": 2560,
"width": 1440,
"height": 2560,
"childCount": 1,
"index": 0,
"depth": 12
}
},
{
"id": 20,
"pid": 19,
"index": 0,
"quickFind": null,
"attr": {
"id": null,
"name": "android.widget.FrameLayout",
"text": null,
"desc": null,
"clickable": false,
"focusable": false,
"checkable": false,
"checked": false,
"visibleToUser": true,
"left": 0,
"top": 0,
"right": 1440,
"bottom": 2560,
"width": 1440,
"height": 2560,
"childCount": 1,
"index": 0,
"depth": 13
}
},
{
"id": 21,
"pid": 20,
"index": 0,
"quickFind": null,
"attr": {
"id": null,
"name": "android.widget.FrameLayout",
"text": null,
"desc": "root:root:0:0",
"clickable": true,
"focusable": true,
"checkable": false,
"checked": false,
"visibleToUser": true,
"left": 0,
"top": 0,
"right": 1440,
"bottom": 2560,
"width": 1440,
"height": 2560,
"childCount": 1,
"index": 0,
"depth": 14
}
},
{
"id": 22,
"pid": 21,
"index": 0,
"quickFind": null,
"attr": {
"id": null,
"name": "android.widget.FrameLayout",
"text": null,
"desc": "image-long:3fe98e:0:2",
"clickable": false,
"focusable": false,
"checkable": false,
"checked": false,
"visibleToUser": true,
"left": 0,
"top": 0,
"right": 1440,
"bottom": 2560,
"width": 1440,
"height": 2560,
"childCount": 4,
"index": 0,
"depth": 15
}
},
{
"id": 23,
"pid": 22,
"index": 0,
"quickFind": null,
"attr": {
"id": null,
"name": "android.widget.ImageView",
"text": null,
"desc": null,
"clickable": true,
"focusable": true,
"checkable": false,
"checked": false,
"visibleToUser": true,
"left": 0,
"top": 0,
"right": 1440,
"bottom": 2560,
"width": 1440,
"height": 2560,
"childCount": 0,
"index": 0,
"depth": 16
}
},
{
"id": 24,
"pid": 22,
"index": 1,
"quickFind": null,
"attr": {
"id": null,
"name": "android.widget.FrameLayout",
"text": null,
"desc": "vessel:78427a:0:2",
"clickable": true,
"focusable": true,
"checkable": false,
"checked": false,
"visibleToUser": true,
"left": 0,
"top": 1436,
"right": 1440,
"bottom": 2560,
"width": 1440,
"height": 1124,
"childCount": 0,
"index": 1,
"depth": 16
}
},
{
"id": 25,
"pid": 22,
"index": 2,
"quickFind": null,
"attr": {
"id": null,
"name": "android.widget.FrameLayout",
"text": null,
"desc": "vessel:1e0f2e:0:2",
"clickable": true,
"focusable": true,
"checkable": false,
"checked": false,
"visibleToUser": true,
"left": 0,
"top": 1436,
"right": 1440,
"bottom": 2036,
"width": 1440,
"height": 600,
"childCount": 1,
"index": 2,
"depth": 16
}
},
{
"id": 26,
"pid": 22,
"index": 3,
"quickFind": null,
"attr": {
"id": null,
"name": "android.widget.FrameLayout",
"text": null,
"desc": "vessel:dd18a6:0:2",
"clickable": true,
"focusable": true,
"checkable": false,
"checked": false,
"visibleToUser": true,
"left": 158,
"top": 2149,
"right": 1283,
"bottom": 2374,
"width": 1125,
"height": 225,
"childCount": 2,
"index": 3,
"depth": 16
}
},
{
"id": 27,
"pid": 26,
"index": 0,
"quickFind": null,
"attr": {
"id": null,
"name": "android.widget.FrameLayout",
"text": null,
"desc": "vessel:7a459f:0:2",
"clickable": true,
"focusable": true,
"checkable": false,
"checked": false,
"visibleToUser": true,
"left": 274,
"top": 2216,
"right": 357,
"bottom": 2306,
"width": 83,
"height": 90,
"childCount": 0,
"index": 0,
"depth": 17
}
},
{
"id": 28,
"pid": 26,
"index": 1,
"quickFind": null,
"attr": {
"id": null,
"name": "android.widget.FrameLayout",
"text": null,
"desc": "text:52effd:0:2",
"clickable": false,
"focusable": false,
"checkable": false,
"checked": false,
"visibleToUser": true,
"left": 379,
"top": 2229,
"right": 1167,
"bottom": 2293,
"width": 788,
"height": 64,
"childCount": 1,
"index": 1,
"depth": 17
}
},
{
"id": 29,
"pid": 28,
"index": 0,
"quickFind": true,
"attr": {
"id": null,
"name": "android.widget.TextView",
"text": "摇一摇或点击跳转详情或第三方应用",
"desc": null,
"clickable": true,
"focusable": true,
"checkable": false,
"checked": false,
"visibleToUser": true,
"left": 379,
"top": 2229,
"right": 1167,
"bottom": 2293,
"width": 788,
"height": 64,
"childCount": 0,
"index": 0,
"depth": 18
}
},
{
"id": 30,
"pid": 25,
"index": 0,
"quickFind": null,
"attr": {
"id": null,
"name": "android.widget.FrameLayout",
"text": null,
"desc": "text:1871ff:0:2",
"clickable": false,
"focusable": false,
"checkable": false,
"checked": false,
"visibleToUser": true,
"left": 0,
"top": 1905,
"right": 1440,
"bottom": 2036,
"width": 1440,
"height": 131,
"childCount": 1,
"index": 0,
"depth": 17
}
},
{
"id": 31,
"pid": 30,
"index": 0,
"quickFind": true,
"attr": {
"id": null,
"name": "android.widget.TextView",
"text": "任意滑动查看详情或下载第三方应用",
"desc": null,
"clickable": true,
"focusable": true,
"checkable": false,
"checked": false,
"visibleToUser": true,
"left": 0,
"top": 1905,
"right": 1440,
"bottom": 2036,
"width": 1440,
"height": 131,
"childCount": 0,
"index": 0,
"depth": 18
}
}
]
}

View File

@ -157,4 +157,18 @@ class ParserTest {
println("$x1->$x1N, $x2->$x2N, ($x1,$x2)->$x12N")
}
@Test
fun check_descendant() {
// ad_container 符合 quickFind, 目标节点 tt_splash_skip_btn 在其内部但不符合 quickFind
val source =
"@[id=\"com.byted.pangle.m:id/tt_splash_skip_btn\"] <<n [id=\"com.coolapk.market:id/ad_container\"]"
println("source:$source")
val selector = Selector.parse(source)
println("selector:$selector")
// https://i.gkd.li/import/13247610
val snapshotNode = getTreeNode("snapshot-1698990932472.json")
println("result:" + transform.querySelectorAll(snapshotNode, selector).map { n -> n.id }
.toList())
}
}