mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-04 20:17:09 +00:00
feat(hierarchy): an element reports whether it masks what is typed into it
ios reads it off SecureTextField, which the companion already sent and nothing read; web reads input[type=password]. Android cannot: the native tree mapper drops the password attribute before the sidecar sees it, so the fact is three-valued and null there rather than a false that would read as "not secure".
This commit is contained in:
1 parent
5f1f50c2fb
commit
b1e95739ad
11 files changed
+186
-5
No files matched your search
@@ -54,6 +54,7 @@ type treeNode struct {
|
||||
Clickable *bool `json:"clickable,omitempty"`
|
||||
Enabled *bool `json:"enabled,omitempty"`
|
||||
Editable *bool `json:"editable,omitempty"`
|
||||
Secure *bool `json:"secure,omitempty"`
|
||||
}
|
||||
|
||||
// MapHierarchy converts a flat describe-all dump from the simulator companion
|
||||
@@ -228,6 +229,11 @@ func mapElement(element *rawElement, scrollable bool) (treeNode, bool) {
|
||||
if editable {
|
||||
yes := true
|
||||
node.Editable = &yes
|
||||
// Stated on every editable field, false included: a consumer deciding
|
||||
// what a typed value may be recorded as has to tell "not a secure
|
||||
// entry" apart from "nobody said".
|
||||
secure := element.Type == "SecureTextField"
|
||||
node.Secure = &secure
|
||||
}
|
||||
if element.Type == "Button" {
|
||||
yes := true
|
||||
@@ -238,7 +244,8 @@ func mapElement(element *rawElement, scrollable bool) (treeNode, bool) {
|
||||
}
|
||||
|
||||
func isEditable(elementType string) bool {
|
||||
return elementType == "TextArea" || elementType == "TextField"
|
||||
return elementType == "TextArea" || elementType == "TextField" ||
|
||||
elementType == "SecureTextField"
|
||||
}
|
||||
|
||||
// labelIsDisplayedText reports whether an element type's AXLabel is the string
|
||||
|
||||
Reference in new issue
Block a user