@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 +5 -4
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/wait.ts +5 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@letsrunit/playwright",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "Playwright extensions and utilities for letsrunit",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"testing",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
},
|
|
45
45
|
"packageManager": "yarn@4.10.3",
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@letsrunit/utils": "0.
|
|
47
|
+
"@letsrunit/utils": "0.3.3",
|
|
48
48
|
"@playwright/test": "^1.57.0",
|
|
49
49
|
"case": "^1.6.3",
|
|
50
50
|
"diff": "^8.0.3",
|
package/src/wait.ts
CHANGED
|
@@ -136,7 +136,7 @@ export async function waitAfterInteraction(
|
|
|
136
136
|
return;
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
if (kind === 'button' && (await target.isDisabled())) {
|
|
139
|
+
if (kind === 'button' && (await target.isDisabled({ timeout: 1_000 }).catch(() => false))) {
|
|
140
140
|
// Buttons often disable during in-flight work, or disappear on success.
|
|
141
141
|
await Promise.race([
|
|
142
142
|
waitUntilEnabled(page, target, settleTimeout).catch(() => {}),
|
|
@@ -153,16 +153,17 @@ export async function waitAfterInteraction(
|
|
|
153
153
|
/* ---------- helpers ---------- */
|
|
154
154
|
|
|
155
155
|
async function elementKind(target: Locator): Promise<'link' | 'button' | 'other'> {
|
|
156
|
-
const
|
|
156
|
+
const PROBE = 1_000;
|
|
157
|
+
const role = await target.getAttribute('role', { timeout: PROBE }).catch(() => null);
|
|
157
158
|
if (role === 'link') return 'link';
|
|
158
159
|
if (role === 'button') return 'button';
|
|
159
160
|
|
|
160
|
-
const tag = await target.evaluate((el) => el.tagName.toLowerCase()).catch(() => '');
|
|
161
|
+
const tag = await target.evaluate((el) => el.tagName.toLowerCase(), null, { timeout: PROBE }).catch(() => '');
|
|
161
162
|
if (tag === 'a') return 'link';
|
|
162
163
|
|
|
163
164
|
if (tag === 'button') return 'button';
|
|
164
165
|
if (tag === 'input') {
|
|
165
|
-
const type = await target.getAttribute('type').catch(() => null);
|
|
166
|
+
const type = await target.getAttribute('type', { timeout: PROBE }).catch(() => null);
|
|
166
167
|
if (type === 'button' || type === 'submit' || type === 'reset') return 'button';
|
|
167
168
|
}
|
|
168
169
|
|