lazyscout 0.3.9 → 0.3.11
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/README.md +7 -1
- package/dist/index.js +17 -5
- package/dist/web/assets/{index-yhPFgatq.js → index-CqjtbfVm.js} +36 -36
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,12 +14,18 @@ npx lazyscout@latest
|
|
|
14
14
|
|
|
15
15
|
LazyScout starts its UI on `http://localhost:4321` and opens it automatically.
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
Install the Playwright Chromium browser before using Scout or running automation:
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
20
|
npx playwright install chromium
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
+
For Ubuntu or another Linux distribution, install the required system dependencies too:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npx playwright install --with-deps chromium
|
|
27
|
+
```
|
|
28
|
+
|
|
23
29
|
## CLI scan
|
|
24
30
|
|
|
25
31
|
```bash
|
package/dist/index.js
CHANGED
|
@@ -2405,7 +2405,7 @@ function generatePlaywrightTest(testCase) {
|
|
|
2405
2405
|
return lines.join("\n");
|
|
2406
2406
|
}
|
|
2407
2407
|
function locator(target) {
|
|
2408
|
-
const base = target.role && target.name ? `page.getByRole(${quote(target.role)}, { name: ${quote(target.name)} })` : target.label ? `page.getByLabel(${quote(target.label)}, { exact: true })` : target.testId ? `page.getByTestId(${quote(target.testId)})` : target.placeholder ? `page.getByPlaceholder(${quote(target.placeholder)})` : target.text ? `page.getByText(${quote(target.text)})` : `page.locator(${
|
|
2408
|
+
const base = target.role && target.name ? `page.getByRole(${quote(target.role)}, { name: ${quote(target.name)} })` : target.label ? `page.getByLabel(${quote(target.label)}, { exact: true })` : target.testId ? `page.getByTestId(${quote(target.testId)})` : target.placeholder ? `page.getByPlaceholder(${quote(target.placeholder)})` : target.text ? `page.getByText(${quote(target.text)})` : `page.locator(${quoteCssSelector(normalizeCssSelector(target.cssSelector ?? ""))})`;
|
|
2409
2409
|
const context = target.contextTestId ? `page.getByTestId(${quote(target.contextTestId)})` : target.contextSelector ? `page.locator(${quote(target.contextSelector)})` : void 0;
|
|
2410
2410
|
const scoped = context ? target.contextText ? `${context}.filter({ hasText: ${quote(target.contextText)} }).${base.slice(5)}` : `${context}.${base.slice(5)}` : base;
|
|
2411
2411
|
return target.nth === void 0 ? scoped : `${scoped}.nth(${target.nth})`;
|
|
@@ -2426,7 +2426,7 @@ function playwrightStep(step) {
|
|
|
2426
2426
|
if (step.mode === "timeout")
|
|
2427
2427
|
return `await page.waitForTimeout(${Math.min(5e3, Math.max(0, Number(step.value) || 0))})`;
|
|
2428
2428
|
if (step.mode === "url")
|
|
2429
|
-
return `await
|
|
2429
|
+
return `await page.waitForURL(new RegExp(${quote(step.value)}))`;
|
|
2430
2430
|
if (step.mode === "text")
|
|
2431
2431
|
return `await expect(page).toContainText(${quote(step.value)})`;
|
|
2432
2432
|
return `await expect(${locator(step.target)}).toBeVisible()`;
|
|
@@ -2451,6 +2451,12 @@ function runtimeValue(step) {
|
|
|
2451
2451
|
return step.value;
|
|
2452
2452
|
}
|
|
2453
2453
|
var quote = (value) => JSON.stringify(value);
|
|
2454
|
+
function normalizeCssSelector(value) {
|
|
2455
|
+
return value.replace(/\\(["'])/g, "$1");
|
|
2456
|
+
}
|
|
2457
|
+
function quoteCssSelector(value) {
|
|
2458
|
+
return `'${value.replace(/\\/g, "\\\\").replace(/'/g, "\\'")}'`;
|
|
2459
|
+
}
|
|
2454
2460
|
|
|
2455
2461
|
// ../../packages/generators/dist/guidedflow/flowToTestCase.js
|
|
2456
2462
|
function flowToTestCase(flow) {
|
|
@@ -2527,7 +2533,7 @@ function playwrightFlowStep(flow, step) {
|
|
|
2527
2533
|
if (step.mode === "timeout")
|
|
2528
2534
|
return `await page.waitForTimeout(${Math.min(5e3, Math.max(0, Number(step.value) || 0))})`;
|
|
2529
2535
|
if (step.mode === "url")
|
|
2530
|
-
return `await
|
|
2536
|
+
return `await page.waitForURL(new RegExp(${JSON.stringify(step.value)}))`;
|
|
2531
2537
|
if (step.mode === "text")
|
|
2532
2538
|
return `await expect(page).toContainText(${JSON.stringify(step.value)})`;
|
|
2533
2539
|
return `await expect(${locator2(step.target)}).toBeVisible()`;
|
|
@@ -2550,7 +2556,13 @@ function locator2(target) {
|
|
|
2550
2556
|
return `page.getByTestId(${JSON.stringify(target.testId ?? target.value ?? "")})`;
|
|
2551
2557
|
if (target.strategy === "text" || target.text)
|
|
2552
2558
|
return `page.getByText(${JSON.stringify(target.text ?? target.value ?? "")})`;
|
|
2553
|
-
return `page.locator(${
|
|
2559
|
+
return `page.locator(${quoteCssSelector2(normalizeCssSelector2(target.cssSelector ?? target.value ?? ""))})`;
|
|
2560
|
+
}
|
|
2561
|
+
function normalizeCssSelector2(value) {
|
|
2562
|
+
return value.replace(/\\(["'])/g, "$1");
|
|
2563
|
+
}
|
|
2564
|
+
function quoteCssSelector2(value) {
|
|
2565
|
+
return `'${value.replace(/\\/g, "\\\\").replace(/'/g, "\\'")}'`;
|
|
2554
2566
|
}
|
|
2555
2567
|
|
|
2556
2568
|
// src/commands/scan.ts
|
|
@@ -4192,7 +4204,7 @@ async function openInBrowser(url) {
|
|
|
4192
4204
|
}
|
|
4193
4205
|
|
|
4194
4206
|
// src/version.ts
|
|
4195
|
-
var VERSION = true ? "0.3.
|
|
4207
|
+
var VERSION = true ? "0.3.11" : "0.0.0-dev";
|
|
4196
4208
|
|
|
4197
4209
|
// src/commands/serve.ts
|
|
4198
4210
|
var DEFAULT_PORT = 4321;
|