@skrillex1224/android-toolkit 1.0.5 → 1.0.6

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.
package/dist/index.cjs CHANGED
@@ -1352,8 +1352,24 @@ async function waitForStable(ctx, selectors, options = {}) {
1352
1352
  let stableSince = 0;
1353
1353
  let mutationCount = 0;
1354
1354
  let wasPaused = false;
1355
+ let snapshotErrorCount = 0;
1356
+ let lastSnapshotError = null;
1355
1357
  while (Date.now() < deadline) {
1356
- const snapshot2 = await captureSnapshot(ctx, selectorList, options);
1358
+ const snapshot2 = await captureSnapshot(ctx, selectorList, options).catch((error) => {
1359
+ snapshotErrorCount += 1;
1360
+ lastSnapshotError = error;
1361
+ if (snapshotErrorCount === 1 || snapshotErrorCount % 5 === 0) {
1362
+ Logger.warn("Mutation.waitForStable snapshot skipped", {
1363
+ snapshotErrorCount,
1364
+ message: error?.message || String(error)
1365
+ });
1366
+ }
1367
+ return null;
1368
+ });
1369
+ if (!snapshot2) {
1370
+ await sleep(pollIntervalMs);
1371
+ continue;
1372
+ }
1357
1373
  if (!foundInitial) {
1358
1374
  if (snapshot2.found || Date.now() >= initialDeadline) {
1359
1375
  foundInitial = true;
@@ -1401,7 +1417,7 @@ async function waitForStable(ctx, selectors, options = {}) {
1401
1417
  }
1402
1418
  await sleep(pollIntervalMs);
1403
1419
  }
1404
- throw new Error(`Mutation.waitForStable \u8D85\u65F6 (${timeout}ms), \u5DF2\u68C0\u6D4B\u5230 ${mutationCount} \u6B21\u53D8\u5316`);
1420
+ throw new Error(`Mutation.waitForStable \u8D85\u65F6 (${timeout}ms), \u5DF2\u68C0\u6D4B\u5230 ${mutationCount} \u6B21\u53D8\u5316, snapshotErrorCount=${snapshotErrorCount}, lastSnapshotError=${lastSnapshotError?.message || ""}`);
1405
1421
  }
1406
1422
  async function waitForStableAcrossRoots(ctx, selectors, options = {}) {
1407
1423
  return waitForStable(ctx, selectors, options);