MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / clickToReveal

Function clickToReveal

e2e/src/surfaces/browser.ts:143–159  ·  view source on GitHub ↗
(
  trigger: Locator,
  revealed: Locator,
  { attempts = 5, revealTimeoutMs = 4_000 }: { attempts?: number; revealTimeoutMs?: number } = {},
)

Source from the content-addressed store, hash-verified

141 * surfaces as the ordinary locator error.
142 */
143export const clickToReveal = async (
144 trigger: Locator,
145 revealed: Locator,
146 { attempts = 5, revealTimeoutMs = 4_000 }: { attempts?: number; revealTimeoutMs?: number } = {},
147): Promise<void> => {
148 for (let attempt = 1; attempt < attempts; attempt++) {
149 await trigger.click();
150 const shown = await revealed
151 .waitFor({ timeout: revealTimeoutMs })
152 .then(() => true)
153 // oxlint-disable-next-line executor/no-promise-catch -- retry boundary: a missed reveal is the signal to click again, not a failure
154 .catch(() => false);
155 if (shown) return;
156 }
157 await trigger.click();
158 await revealed.waitFor({ timeout: revealTimeoutMs });
159};
160
161// acquireUseRelease so a vitest timeout (fiber interruption) still closes the
162// browser and flushes video + trace — a bare promise would leak Chromium.

Calls

no outgoing calls

Tested by 1