Await & Retry Strategy

SkillWeb & browsing

Helps your agent fix flaky end-to-end tests by waiting and retrying properly instead of using fixed delays.

Available today. Use it from your connected AI after setup.

Add ahel to your AI once: Claude, ChatGPT, Cursor, Claude Code or Codex. Then ask it to use this.

Then ask your AI: use the Await & Retry Strategy skill

About this skill

Await and retry strategy for Suite E2E tests: Playwright auto-waiting, expect polling, Redux waits, flakiness prevention. Use every time a test is flaky due to timing.

What this skill tells your AI

The instructions your AI receives, as published by trezor/trezor-suite in suite/e2e/skills/retries/SKILL.md and read by ahel’s review.

When to use: Every time you wonder why a test is flaky due to timing. Prerequisites: locators for locator strategies used in examples.

Core Patterns (3 Essentials)

1. Expect-Based Retry (Full Operation Retry)

Wrap the full flaky operation in expect(async () => { ... }).toPass({ timeout }). The entire block retries with exponential backoff. Use for UI operations that fail intermittently (dropdown selection, navigation).

2. Poll-Based Retry (Value Polling)

Use expect.poll(() => fn, message).toBeGreaterThanOrEqual(n) to poll a specific value until a condition is met. Use for analytics request counts, state change counters.

3. Redux State Waits

Use page.expectReduxObjectNotToBeEmpty(), page.expectReduxObjectToEqual(), or page.expectReduxSubtreeToContain() before actions that have race conditions in automation. To find the right property to wait on, use page.runWithReduxDump() — it writes before/after state snapshots to disk; diff the files to identify what changed.


Device Interaction (Critical)

Always verify the device prompt is shown before triggering a device action (device.pressYes(), etc.). Use devicePrompt.confirmOnDevicePromptIsShown() or devicePrompt.waitForFinalPromptAndConfirm() for multi-step flows. Verify display before action: use device.expectToContainOnDisplay() before device.pressYes()


Network Waits (Race Condition Prevention)

Golden Rule: Create the waitForRequest promise before triggering the action that fires the request, not after.


Anti-Patterns

❌ Arbitrary Delays

await page.waitForTimeout(5000); // DON'T do this

Exception LAST RESORT: Only with explanation comment for animation sync.

await page.waitForTimeout(500); // Wait for walletSwitcher animation

Signals

GitHub stars
1k
Forks
383
Last commit
Sep 2026
Advanced
Catalog kind
skill
Key
retries
Source
github.com/trezor/trezor-suite