mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-02 19:17:10 +00:00
refactor(hierarchy): scrub backend tool name from comments
This commit is contained in:
1 parent
73fd7b8ee5
commit
19807dc4ab
2 files changed
+6
-6
No files matched your search
@@ -1,4 +1,4 @@
|
|||||||
// Package hierarchy parses the TreeNode JSON produced by the Maestro sidecar
|
// Package hierarchy parses the TreeNode JSON produced by the native sidecar
|
||||||
// and resolves selectors against it.
|
// and resolves selectors against it.
|
||||||
//
|
//
|
||||||
// Selector grammar (v2.0):
|
// Selector grammar (v2.0):
|
||||||
@@ -83,7 +83,7 @@ type Tree struct {
|
|||||||
Elements []*Element `json:"elements"`
|
Elements []*Element `json:"elements"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// treeNodeJSON mirrors the Maestro TreeNode JSON structure.
|
// treeNodeJSON mirrors the sidecar TreeNode JSON structure.
|
||||||
type treeNodeJSON struct {
|
type treeNodeJSON struct {
|
||||||
Attributes map[string]string `json:"attributes"`
|
Attributes map[string]string `json:"attributes"`
|
||||||
Children []treeNodeJSON `json:"children"`
|
Children []treeNodeJSON `json:"children"`
|
||||||
@@ -110,7 +110,7 @@ type AttrFilter struct {
|
|||||||
// in the TreeNode attributes map. Both directions are listed so cross-platform
|
// in the TreeNode attributes map. Both directions are listed so cross-platform
|
||||||
// matching works regardless of which name the caller uses.
|
// matching works regardless of which name the caller uses.
|
||||||
var attributeAliases = map[string][]string{
|
var attributeAliases = map[string][]string{
|
||||||
// Android XML legacy name; web driver uses content-desc; Maestro normalises to accessibilityText
|
// Android XML legacy name; web driver uses content-desc; the sidecar normalises to accessibilityText
|
||||||
"content-desc": {"accessibilityText"},
|
"content-desc": {"accessibilityText"},
|
||||||
// iOS AXElement / UIKit names
|
// iOS AXElement / UIKit names
|
||||||
"label": {"accessibilityText"},
|
"label": {"accessibilityText"},
|
||||||
@@ -164,7 +164,7 @@ func matchSelector(element *Element, sel Selector) bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse parses a Maestro TreeNode JSON hierarchy.
|
// Parse parses a sidecar TreeNode JSON hierarchy.
|
||||||
func Parse(text string) (*Tree, error) {
|
func Parse(text string) (*Tree, error) {
|
||||||
text = strings.TrimSpace(text)
|
text = strings.TrimSpace(text)
|
||||||
if text == "" {
|
if text == "" {
|
||||||
@@ -550,7 +550,7 @@ func match(element *Element, kind, value string) bool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// boundsPattern matches "[l,t,r,b]" (4-value Android/Maestro format).
|
// boundsPattern matches "[l,t,r,b]" (4-value Android/sidecar format).
|
||||||
var boundsPattern = regexp.MustCompile(`^\[(-?\d+),(-?\d+),(-?\d+),(-?\d+)\]$`)
|
var boundsPattern = regexp.MustCompile(`^\[(-?\d+),(-?\d+),(-?\d+),(-?\d+)\]$`)
|
||||||
|
|
||||||
// boundsPatternTwo matches "[x1,y1][x2,y2]" (iOS XCUITest format).
|
// boundsPatternTwo matches "[x1,y1][x2,y2]" (iOS XCUITest format).
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package hierarchy
|
|||||||
|
|
||||||
import "testing"
|
import "testing"
|
||||||
|
|
||||||
// sampleDump is a Maestro TreeNode JSON equivalent of the old XML fixture.
|
// sampleDump is a sidecar TreeNode JSON equivalent of the old XML fixture.
|
||||||
const sampleDump = `{
|
const sampleDump = `{
|
||||||
"attributes": {"class": "android.widget.LinearLayout", "package": "app", "bounds": "[0,0,1080,2340]"},
|
"attributes": {"class": "android.widget.LinearLayout", "package": "app", "bounds": "[0,0,1080,2340]"},
|
||||||
"children": [
|
"children": [
|
||||||
|
|||||||
Reference in new issue
Block a user