UNPKG

@coinbase/onchaintestkit

Version:

End-to-end testing toolkit for blockchain applications, powered by Playwright

19 lines (18 loc) 733 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.tryClickElement = tryClickElement; const ConditionWatcher_1 = require("./ConditionWatcher"); async function tryClickElement(element, shouldClick, timeoutMs = 3000) { try { // Convert boolean action to nullable result for ConditionWatcher const nullableAction = async () => { const result = await shouldClick(); return result ? true : null; }; await ConditionWatcher_1.ConditionWatcher.waitForCondition(nullableAction, timeoutMs, "element click condition"); await element.click(); } catch { // If condition fails, just don't click (same behavior as before) } }