Skip to content

Commit 63ef151

Browse files
committed
fix(cloud): stop advising a timeout the source read never sees
The hint and the AWS docs both told the caller to retry with a larger `--timeout`. That flag widens the command envelope around the read; the read's own budget is the transport's, so the advice could not work and cost rented minutes to discover. The report on #2509 shows exactly that experiment failing at 65 seconds. Say whose budget it is, and offer the two things that do work: a `screenshot`, which never reads the tree, and the `@refs` an earlier snapshot captured.
1 parent 1adbc57 commit 63ef151

3 files changed

Lines changed: 11 additions & 4 deletions

File tree

‎packages/provider-webdriver/src/webdriver-interactor.test.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,10 @@ test('a source capture that runs out of budget keeps the timeout reason and name
352352
assert.equal(error.details?.reason, 'webdriver_request_timeout');
353353
assert.equal(isWebDriverRequestTimeout(error), true);
354354
assert.match(String(error.details?.hint), /never goes idle/);
355+
// Reviewing #2509 found the advice that failed there was a longer `--timeout`,
356+
// which cannot reach this read. The hint says so and offers what does work.
357+
assert.match(String(error.details?.hint), /does not grow with --timeout/);
358+
assert.match(String(error.details?.hint), /screenshot/);
355359
return true;
356360
});
357361
});

‎packages/provider-webdriver/src/webdriver-interactor.ts‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,9 @@ function webDriverOperationForGesture(plan: GesturePlan): CloudWebDriverOperatio
600600
* driver answers this call by walking the live UI tree, so a screen that never
601601
* goes idle — looping video, live ticker, continuous animation — gives the walk no
602602
* reason to settle. The transport's reason code is kept as-is; what the capture
603-
* adds is what the wait was waiting for.
603+
* adds is what the wait was waiting for, and the one thing the caller cannot do,
604+
* since this read's budget is the transport's own and no wider than the command's
605+
* `--timeout` envelope around it.
604606
*/
605607
function webDriverSourceTimeoutError(error: AppError): AppError {
606608
return new AppError(
@@ -610,8 +612,9 @@ function webDriverSourceTimeoutError(error: AppError): AppError {
610612
...error.details,
611613
hint:
612614
'A screen that never goes idle (looping video, live ticker, continuous animation) ' +
613-
'gives the driver no moment to read the UI tree. Retry with a larger --timeout, ' +
614-
'or drive the screen from refs an earlier snapshot already captured.',
615+
"gives the driver no moment to read the UI tree. This read has the transport's own " +
616+
'budget and does not grow with --timeout; take a screenshot, or drive the screen from ' +
617+
'refs an earlier snapshot already captured.',
615618
},
616619
error,
617620
);

‎website/docs/docs/aws-device-farm.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,4 +110,4 @@ If `connect` fails, use the reported `aws devicefarm get-*` error to check the c
110110

111111
On hosted WebDriver sessions, `fill` checks that the field received focus before it sends keys. If it cannot confirm focus, it fails without typing. Use `snapshot -i` to confirm the target. If the driver cannot expose focus at all, use `press <target>` followed by `type <text>`. That sends text without confirming the destination.
112112

113-
A screen that never goes still — a looping video, a live ticker, continuous animation — gives the driver no quiet moment to read the UI tree, so `snapshot` can run past its budget and fail with a reason that names the cause. The failed read is cancelled with its request instead of being dropped while it still runs, so it stops occupying the session and later commands are not queued behind a capture nobody is waiting for. A `screenshot` of the same screen keeps working because it never reads the tree. Retry with a larger `--timeout`, or drive the screen from `@refs` an earlier snapshot captured. `--depth` trims a tree after it arrives, so it cannot shorten a read that never returned.
113+
A screen that never goes still — a looping video, a live ticker, continuous animation — gives the driver no quiet moment to read the UI tree, so `snapshot` can run past its budget and fail with a reason that names the cause. The failed read is cancelled with its request instead of being dropped while it still runs, so it stops occupying the session and later commands are not queued behind a capture nobody is waiting for. That budget belongs to the read itself: a larger `--timeout` widens the command around it and cannot shorten the walk, so it is not the recovery. A `screenshot` of the same screen keeps working because it never reads the tree, and `@refs` an earlier snapshot captured stay valid to drive from. `--depth` trims a tree after it arrives, so it cannot shorten a read that never returned.

0 commit comments

Comments
 (0)