Repository navigation
fix(wda): leave a prompt only to the step aimed at it, as DeviceLab's driver does - #265
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
I pushed a second commit after running this on simulators and five real iPhones. Answering a prompt only when a lookup misses came too late, in two ways:
The commit leaves a prompt only to the step aimed at it, as DeviceLab's driver does ( On five real iPhones (iOS 18.3, 18.4, 26.2, 27.0 and 27.2), 20 flows of our suite, three rounds alternating with a build that has the first commit only (the build with this commit also had the settle fix of #269):
On simulators with |
…hers answered (#265) Since a flow that taps a prompt's button turns WDA's alert monitor off for the whole session (so WDA cannot beat the flow to it), a prompt the flow never meant to answer stayed up over the app: a flow that taps "Ask App Not to Track" left the notification prompt open, and every later lookup failed. A lookup that finds nothing now reads the open alert and, when none of its buttons is one the flow's taps name and the flow has no acceptAlert or dismissAlert, answers it as WDA's monitor would have (launchApp's permissions: the "Allow…" button, or "Don't Allow…" / "Ask App Not…"), then looks again. The prompts the flow names are still left to it. Refs #264
… driver does When the flow answers some permission prompts itself (WDA's monitor off), a prompt is now left only to the step aimed at it (a tap on one of its buttons, a check of its text), not to every step of a flow that names one of its buttons somewhere, and it is asked for by a tap after its find, in a watch after launchApp (15 s) and after an answered prompt (3 s), as well as by a lookup that misses (at most once a second). A tap under the notification prompt was lost, since its element was found in the app beneath the prompt, and the tracking prompt held the onboarding's 10 s wait for the screen beneath it until the flow's retry tapped it. Asked before the find, the check could hold WebDriverAgent for 19 s while the app was still launching.
79f1e8a to
779c67b
Compare
|
Rebased onto |
Follows #264, fixed in 1.1.31 by
d75c50d(this PR's first commit). Rebased ontomain, so this is the second commit alone.With 1.1.31 a lookup that finds nothing answers a prompt the flow does not tap, so the notification prompt no longer stays up for the whole flow. It still answers late: a tap that meets the prompt is lost under it, and the flow then waits out a lookup for what the lost tap should have opened (about 20 s on an onboarding).
The change: when the flow turned WDA's alert monitor off, the driver answers prompts as DeviceLab's driver does: a prompt is left only to the step aimed at it, and answered before any other step acts, as the monitor would have.
stepAimsAtAlert): a tap, double tap or long press on one of its buttons (pickAlertButton, as a tap would pick it), a check of one of its buttons or of its text (assertVisible,assertNotVisible,copyTextFrom,extendedWaitUntil). A flow withacceptAlert/dismissAlertkeeps every prompt to itself, as today.answerUnnamedPrompt): the button the monitor'sautoClickAlertSelectorwould have tapped (Allow…; orDon't Allow…/Ask App Not…forall: deny), checked closed (answerAlert), one log line.launchApp, 3 s after an answered prompt, at most every 0.5 s), answers, and finds its element again. A lookup that finds nothing asks at most once a second. Asking after the find matters: an alert check sent while the app was still launching held WebDriverAgent for 19 s on a busy simulator, and a find answers only once the app does.What stays: a flow with no prompt tap keeps WDA's monitor and pays nothing. The common "if the prompt shows, tap Don't Allow" (
runFlowwithwhen: visible) still answers the prompt itself when it runs while the prompt is up: its condition finds the prompt's button, and its tap is aimed at it. A tap on the app that meets the prompt first gets it answered as the permissions say, as with DeviceLab's driver.Cost: only in flows that tap a prompt's button: one
/alert/text(60-80 ms on a light page, about 0.3 s on a heavy one), plus/wda/alert/buttonswhen an alert is up, at the taps in the watch and on lookups that miss.Tests:
TestLookupLeavesThePromptToTheStepAimedAtIt,TestLookupAnswersAPromptTheFlowAnswersElsewhere,TestTapAnswersAnUnnamedPromptFirst,TestTapAsksForNoAlertWhenWDAAnswers,TestTapAsksForPromptsOnlyInTheWatch.go test -race ./pkg/driver/wda/ ./pkg/executor/ ./pkg/flow/passes; golangci-lint v2.13.2: 0 issues.On devices: five real iPhones (iOS 18.3 to 27.2), 20 flows of our suite that tap the tracking prompt's button themselves and leave the notification prompt to the runner: no prompt stayed up in 300 flow runs, and the three onboarding flows took 24 s at the median, against 44 s with the first commit (now
d75c50d) alone. On simulators (--driver wda, iOS 27, six at once) the onboarding flows take 16-17 s, against 34-46 s before and 14-15 s with DeviceLab's driver.