@auto-wiz/playwright 1.2.0 → 1.3.0

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.
Files changed (2) hide show
  1. package/dist/runner.js +7 -14
  2. package/package.json +3 -3
package/dist/runner.js CHANGED
@@ -234,7 +234,7 @@ class PlaywrightFlowRunner {
234
234
  return { success: true, extractedData: text?.trim() };
235
235
  }
236
236
  case "waitFor": {
237
- if (step.selector || step.locator) {
237
+ if (step.locator) {
238
238
  // resolveLocator internally waits for visibility, so this is implicitly handled,
239
239
  // but we call it to ensure we find the valid element.
240
240
  await this.resolveLocator(page, step, step.timeoutMs || timeout);
@@ -252,26 +252,19 @@ class PlaywrightFlowRunner {
252
252
  }
253
253
  }
254
254
  async resolveLocator(page, step, timeout) {
255
- const candidates = [];
256
- // 1. Gather all candidate selectors
257
- if ("locator" in step && step.locator) {
258
- const { primary, fallbacks = [] } = step.locator;
259
- candidates.push(primary, ...fallbacks);
260
- }
261
- else if ("selector" in step && step.selector) {
262
- candidates.push(step.selector);
263
- }
264
- else {
265
- throw new Error(`Step ${step.type} requires a selector or locator`);
255
+ if (!("locator" in step) || !step.locator) {
256
+ throw new Error(`Step ${step.type} requires a locator`);
266
257
  }
258
+ const { primary, fallbacks = [] } = step.locator;
259
+ const candidates = [primary, ...fallbacks];
267
260
  if (candidates.length === 0) {
268
261
  throw new Error(`Step ${step.type} has no valid selectors`);
269
262
  }
270
- // 2. If only one candidate, just return it (Playwright's default behavior)
263
+ // If only one candidate, just return it (Playwright's default behavior)
271
264
  if (candidates.length === 1) {
272
265
  return page.locator(candidates[0]).first();
273
266
  }
274
- // 3. Parallel Race: Check all candidates for visibility
267
+ // Parallel Race: Check all candidates for visibility
275
268
  // We create a promise for each candidate that resolves if the element becomes visible
276
269
  // and returns the corresponding Locator.
277
270
  const promises = candidates.map(async (selector) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@auto-wiz/playwright",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "license": "MIT",
5
5
  "author": "JaeSang",
6
6
  "repository": {
@@ -23,7 +23,7 @@
23
23
  }
24
24
  },
25
25
  "peerDependencies": {
26
- "@auto-wiz/core": "^1.1.4"
26
+ "@auto-wiz/core": "^1.2.0"
27
27
  },
28
28
  "dependencies": {
29
29
  "playwright": "^1.40.0"
@@ -31,7 +31,7 @@
31
31
  "devDependencies": {
32
32
  "typescript": "^5.0.0",
33
33
  "@types/node": "^20.0.0",
34
- "@auto-wiz/core": "1.1.4"
34
+ "@auto-wiz/core": "1.2.0"
35
35
  },
36
36
  "scripts": {
37
37
  "build": "tsc"