fix: address the Maps search box by id, and re-prove Phase 5
The Maps omnibox hint rotates: it read "Search here" in the Phase 5 run and "Try petrol stations, ATMs" in the AUD-128 re-verification, so the recipe's text match on it failed. The resource id does not rotate. - internal/ui: add Find/FindID and the "id:" selector; Find dispatches an id: selector to the resource id and everything else to text as before. - internal/recipe: wait/tap/wait_gone/tap_if and the tap helper use Find, so a recipe may name a resource id. Guards stay text-only. - recipes/maps_navigate.recipe: wait/tap id:search_omnibox_text_box. - tests for the id selector; docs and README updated.
This commit is contained in:
@@ -324,7 +324,7 @@ func executeStep(r *adb.Runner, rec *Recipe, step Step, index int, params map[st
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
matches := h.FindText(args[0], step.Exact)
|
||||
matches := h.Find(args[0], step.Exact)
|
||||
if len(matches) == 0 {
|
||||
sr.Detail = fmt.Sprintf("%q not on screen, skipped", args[0])
|
||||
return nil
|
||||
@@ -410,7 +410,8 @@ func executeStep(r *adb.Runner, rec *Recipe, step Step, index int, params map[st
|
||||
return sr
|
||||
}
|
||||
|
||||
// tapByText finds an element by text and taps its centre (FR-4).
|
||||
// tapByText finds an element by text and taps its centre (FR-4). The selector
|
||||
// may name a resource id with the "id:" prefix.
|
||||
//
|
||||
// The element is looked up twice: once to wait for it, and again immediately
|
||||
// before the tap, so the coordinates come from the newest dump. On a busy
|
||||
@@ -423,9 +424,9 @@ func tapByText(r *adb.Runner, rec *Recipe, query string, exact bool, timeout tim
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
matches := h.FindText(query, exact)
|
||||
matches := h.Find(query, exact)
|
||||
if len(matches) == 0 {
|
||||
return describeFailure(r, rec, fmt.Errorf("element with text %q disappeared before the tap", query))
|
||||
return describeFailure(r, rec, fmt.Errorf("element matching %q disappeared before the tap", query))
|
||||
}
|
||||
node, err := ui.TapNode(r, matches)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user