@aarwitz/tapp 0.17.0-rc.3 → 0.17.0-rc.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -205,7 +205,22 @@ export class AndroidDriver {
|
|
|
205
205
|
const r = await this.adb(["shell", "am", "start", "-W", "-n", component], { timeout: 30_000 });
|
|
206
206
|
if (r.code !== 0 || !/Status:\s*ok/i.test(String(r.stdout))) throw new Error((r.stderr || r.stdout || `Could not launch ${this.appId}`).trim());
|
|
207
207
|
await sleep(600);
|
|
208
|
-
return this.
|
|
208
|
+
return this.waitForOwnedSnapshot();
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
async waitForOwnedSnapshot(timeoutMs = 4_000) {
|
|
212
|
+
const deadline = Date.now() + timeoutMs;
|
|
213
|
+
let latest;
|
|
214
|
+
do {
|
|
215
|
+
latest = await this.snapshot();
|
|
216
|
+
if (isAndroidAppSnapshot(latest, this.appId)) return latest;
|
|
217
|
+
if (Date.now() >= deadline) break;
|
|
218
|
+
// Activity and UIAutomator are intentionally required to agree. During app
|
|
219
|
+
// launch they may momentarily describe opposite sides of the transition;
|
|
220
|
+
// retry that mixed snapshot instead of turning it into zero-screen evidence.
|
|
221
|
+
await sleep(150);
|
|
222
|
+
} while (Date.now() < deadline);
|
|
223
|
+
return latest;
|
|
209
224
|
}
|
|
210
225
|
|
|
211
226
|
async currentActivity() {
|
package/package.json
CHANGED