|
| 1 | +[ |
| 2 | + { |
| 3 | + "name": "first document-order match wins over a shallower later sibling (breadth-first would pick index 3)", |
| 4 | + "scope": "Settings", |
| 5 | + "nodes": [ |
| 6 | + { "depth": 0, "type": "FrameLayout" }, |
| 7 | + { "depth": 1, "type": "ViewGroup", "identifier": "content" }, |
| 8 | + { "depth": 2, "type": "TextView", "label": "Settings" }, |
| 9 | + { "depth": 1, "type": "ViewGroup", "identifier": "settings-panel" }, |
| 10 | + { "depth": 2, "type": "Button", "label": "Save" } |
| 11 | + ], |
| 12 | + "expectedRootIndex": 2, |
| 13 | + "expectedSubtreeIndexes": [2] |
| 14 | + }, |
| 15 | + { |
| 16 | + "name": "container match keeps its whole subtree", |
| 17 | + "scope": "settings-panel", |
| 18 | + "nodes": [ |
| 19 | + { "depth": 0, "type": "FrameLayout" }, |
| 20 | + { "depth": 1, "type": "TextView", "label": "Title" }, |
| 21 | + { "depth": 1, "type": "ViewGroup", "identifier": "settings-panel" }, |
| 22 | + { "depth": 2, "type": "Button", "label": "Save" }, |
| 23 | + { "depth": 3, "type": "TextView", "label": "Save label" }, |
| 24 | + { "depth": 1, "type": "Button", "label": "Cancel" } |
| 25 | + ], |
| 26 | + "expectedRootIndex": 2, |
| 27 | + "expectedSubtreeIndexes": [2, 3, 4] |
| 28 | + }, |
| 29 | + { |
| 30 | + "name": "case-insensitive substring over the label", |
| 31 | + "scope": "sett", |
| 32 | + "nodes": [ |
| 33 | + { "depth": 0, "type": "FrameLayout" }, |
| 34 | + { "depth": 1, "type": "Button", "label": "Open SETTINGS" } |
| 35 | + ], |
| 36 | + "expectedRootIndex": 1, |
| 37 | + "expectedSubtreeIndexes": [1] |
| 38 | + }, |
| 39 | + { |
| 40 | + "name": "value matches (EditText text)", |
| 41 | + "scope": "hello", |
| 42 | + "nodes": [ |
| 43 | + { "depth": 0, "type": "FrameLayout" }, |
| 44 | + { "depth": 1, "type": "EditText", "label": "Message", "value": "Hello world" } |
| 45 | + ], |
| 46 | + "expectedRootIndex": 1, |
| 47 | + "expectedSubtreeIndexes": [1] |
| 48 | + }, |
| 49 | + { |
| 50 | + "name": "identifier matches (resource-id / testID), including generic android ids", |
| 51 | + "scope": "id/toolbar", |
| 52 | + "nodes": [ |
| 53 | + { "depth": 0, "type": "FrameLayout" }, |
| 54 | + { "depth": 1, "type": "Toolbar", "identifier": "com.example:id/toolbar" }, |
| 55 | + { "depth": 2, "type": "TextView", "label": "Inbox" } |
| 56 | + ], |
| 57 | + "expectedRootIndex": 1, |
| 58 | + "expectedSubtreeIndexes": [1, 2] |
| 59 | + }, |
| 60 | + { |
| 61 | + "name": "type never matches", |
| 62 | + "scope": "Button", |
| 63 | + "nodes": [ |
| 64 | + { "depth": 0, "type": "FrameLayout" }, |
| 65 | + { "depth": 1, "type": "Button", "label": "OK" } |
| 66 | + ], |
| 67 | + "expectedRootIndex": null, |
| 68 | + "expectedSubtreeIndexes": [] |
| 69 | + }, |
| 70 | + { |
| 71 | + "name": "no match yields an empty snapshot, never the full tree", |
| 72 | + "scope": "zzzz-no-match-token", |
| 73 | + "nodes": [ |
| 74 | + { "depth": 0, "type": "FrameLayout", "label": "Root" }, |
| 75 | + { "depth": 1, "type": "Button", "label": "Search" } |
| 76 | + ], |
| 77 | + "expectedRootIndex": null, |
| 78 | + "expectedSubtreeIndexes": [] |
| 79 | + }, |
| 80 | + { |
| 81 | + "name": "root itself may be the scope root", |
| 82 | + "scope": "Root", |
| 83 | + "nodes": [ |
| 84 | + { "depth": 0, "type": "FrameLayout", "label": "Root" }, |
| 85 | + { "depth": 1, "type": "Button", "label": "Search" } |
| 86 | + ], |
| 87 | + "expectedRootIndex": 0, |
| 88 | + "expectedSubtreeIndexes": [0, 1] |
| 89 | + } |
| 90 | +] |
0 commit comments