@letsrunit/playwright 0.2.6 → 0.3.3

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.js CHANGED
@@ -189,7 +189,7 @@ async function waitAfterInteraction(page, target, opts = {}) {
189
189
  });
190
190
  return;
191
191
  }
192
- if (kind === "button" && await target.isDisabled()) {
192
+ if (kind === "button" && await target.isDisabled({ timeout: 1e3 }).catch(() => false)) {
193
193
  await Promise.race([
194
194
  waitUntilEnabled(page, target, settleTimeout).catch(() => {
195
195
  }),
@@ -207,14 +207,15 @@ async function waitAfterInteraction(page, target, opts = {}) {
207
207
  }
208
208
  }
209
209
  async function elementKind(target) {
210
- const role = await target.getAttribute("role").catch(() => null);
210
+ const PROBE = 1e3;
211
+ const role = await target.getAttribute("role", { timeout: PROBE }).catch(() => null);
211
212
  if (role === "link") return "link";
212
213
  if (role === "button") return "button";
213
- const tag = await target.evaluate((el) => el.tagName.toLowerCase()).catch(() => "");
214
+ const tag = await target.evaluate((el) => el.tagName.toLowerCase(), null, { timeout: PROBE }).catch(() => "");
214
215
  if (tag === "a") return "link";
215
216
  if (tag === "button") return "button";
216
217
  if (tag === "input") {
217
- const type = await target.getAttribute("type").catch(() => null);
218
+ const type = await target.getAttribute("type", { timeout: PROBE }).catch(() => null);
218
219
  if (type === "button" || type === "submit" || type === "reset") return "button";
219
220
  }
220
221
  return "other";