lazyscout 0.3.6 → 0.3.8
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
|
@@ -438,6 +438,13 @@ function collectPageData() {
|
|
|
438
438
|
}
|
|
439
439
|
const disabled = el.disabled === true || el.getAttribute("aria-disabled") === "true";
|
|
440
440
|
const required = el.required === true || el.getAttribute("aria-required") === "true";
|
|
441
|
+
const context = el.closest('form, fieldset, tr, [role="row"], li, section, article, aside, main, nav, dialog, [role="dialog"], [role="region"], .card, [class*="card" i]');
|
|
442
|
+
const contextAriaLabel = context?.getAttribute("aria-label");
|
|
443
|
+
const contextHeading = context?.querySelector("h1, h2, h3");
|
|
444
|
+
const rowLabel = context?.matches('tr, [role="row"]') ? context.querySelector('th, td, [role="cell"], [role="gridcell"]') : void 0;
|
|
445
|
+
const namedContainer = context?.querySelector("[data-title], [data-name], [data-label]");
|
|
446
|
+
const contextText = cleanText(contextAriaLabel || contextHeading?.textContent || namedContainer?.getAttribute("data-title") || namedContainer?.getAttribute("data-name") || namedContainer?.getAttribute("data-label") || rowLabel?.textContent);
|
|
447
|
+
const contextTestId = context?.getAttribute("data-testid")?.trim() || void 0;
|
|
441
448
|
return {
|
|
442
449
|
kind,
|
|
443
450
|
role,
|
|
@@ -447,14 +454,52 @@ function collectPageData() {
|
|
|
447
454
|
inputType,
|
|
448
455
|
placeholder: attr(el, "placeholder"),
|
|
449
456
|
name: attr(el, "name"),
|
|
457
|
+
testId: attr(el, "data-testid"),
|
|
450
458
|
id: el.id || void 0,
|
|
451
459
|
href: el instanceof HTMLAnchorElement ? el.href : void 0,
|
|
452
460
|
options,
|
|
453
461
|
required,
|
|
454
462
|
disabled,
|
|
455
|
-
cssSelector: cssSelector(el)
|
|
463
|
+
cssSelector: cssSelector(el),
|
|
464
|
+
contextText: contextText || void 0,
|
|
465
|
+
contextSelector: context ? cssSelector(context) : void 0,
|
|
466
|
+
contextTestId
|
|
456
467
|
};
|
|
457
468
|
}
|
|
469
|
+
function annotateMatches(elements) {
|
|
470
|
+
const groups = /* @__PURE__ */ new Map();
|
|
471
|
+
for (const element of elements) {
|
|
472
|
+
if (!element.accessibleName)
|
|
473
|
+
continue;
|
|
474
|
+
const key = `${element.role}|${element.accessibleName}`;
|
|
475
|
+
const group = groups.get(key) ?? [];
|
|
476
|
+
group.push(element);
|
|
477
|
+
groups.set(key, group);
|
|
478
|
+
}
|
|
479
|
+
for (const group of groups.values()) {
|
|
480
|
+
if (group.length < 2)
|
|
481
|
+
continue;
|
|
482
|
+
group.forEach((element, index) => {
|
|
483
|
+
element.matchIndex = index;
|
|
484
|
+
element.matchCount = group.length;
|
|
485
|
+
});
|
|
486
|
+
const scopedGroups = /* @__PURE__ */ new Map();
|
|
487
|
+
for (const element of group) {
|
|
488
|
+
if (!element.contextSelector)
|
|
489
|
+
continue;
|
|
490
|
+
const scopedKey = element.contextSelector;
|
|
491
|
+
const scoped = scopedGroups.get(scopedKey) ?? [];
|
|
492
|
+
scoped.push(element);
|
|
493
|
+
scopedGroups.set(scopedKey, scoped);
|
|
494
|
+
}
|
|
495
|
+
for (const scoped of scopedGroups.values()) {
|
|
496
|
+
scoped.forEach((element, index) => {
|
|
497
|
+
element.scopeIndex = index;
|
|
498
|
+
element.scopeMatchCount = scoped.length;
|
|
499
|
+
});
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
}
|
|
458
503
|
function isCollectable(el) {
|
|
459
504
|
if (el.closest('[aria-hidden="true"]'))
|
|
460
505
|
return false;
|
|
@@ -491,7 +536,7 @@ function collectPageData() {
|
|
|
491
536
|
submitButtons
|
|
492
537
|
};
|
|
493
538
|
});
|
|
494
|
-
|
|
539
|
+
const result = {
|
|
495
540
|
title: document.title,
|
|
496
541
|
headings: Array.from(document.querySelectorAll("h1, h2, h3")).map((el) => cleanText(el.textContent)).filter(Boolean).slice(0, 30),
|
|
497
542
|
links: collect("a[href]", "link", "link"),
|
|
@@ -523,6 +568,9 @@ function collectPageData() {
|
|
|
523
568
|
stateContent: Array.from(document.querySelectorAll('[aria-live], [data-state], [data-testid*="state" i]')).filter(isCollectable).map((element) => cleanText(element.textContent)).filter(Boolean).slice(0, 30),
|
|
524
569
|
validationMessages: Array.from(document.querySelectorAll('[role="alert"], [aria-invalid="true"], .error, .errors, .invalid-feedback')).filter(isCollectable).map((element) => cleanText(element.textContent)).filter(Boolean).slice(0, 20)
|
|
525
570
|
};
|
|
571
|
+
annotateMatches([...result.links, ...result.buttons, ...result.inputs, ...result.textareas, ...result.selects]);
|
|
572
|
+
annotateMatches(result.forms.flatMap((form) => [...form.fields, ...form.submitButtons]));
|
|
573
|
+
return result;
|
|
526
574
|
}
|
|
527
575
|
|
|
528
576
|
// ../../packages/explorer/dist/mapToPageModel.js
|
|
@@ -700,6 +748,10 @@ async function exploreWithScope(startUrl, explorationConfig = {}, exploreOptions
|
|
|
700
748
|
...explorationConfig,
|
|
701
749
|
limits: { ...DEFAULT_LIMITS, ...explorationConfig.limits }
|
|
702
750
|
};
|
|
751
|
+
const abortIfRequested = () => {
|
|
752
|
+
if (exploreOptions.signal?.aborted)
|
|
753
|
+
throw new ExplorerError("browser-error", "Scout stopped because the client disconnected.");
|
|
754
|
+
};
|
|
703
755
|
const legacyOptions = {
|
|
704
756
|
maxPages: config2.limits.maxPages,
|
|
705
757
|
maxDepth: config2.limits.maxDepth,
|
|
@@ -1245,6 +1297,7 @@ async function exploreWithScope(startUrl, explorationConfig = {}, exploreOptions
|
|
|
1245
1297
|
entryFlow
|
|
1246
1298
|
});
|
|
1247
1299
|
while (stateQueue.length > 0) {
|
|
1300
|
+
abortIfRequested();
|
|
1248
1301
|
if (pages.length >= config2.limits.maxPages) {
|
|
1249
1302
|
endReason = "max-pages-reached";
|
|
1250
1303
|
debug(`Limit reached: max pages (${config2.limits.maxPages})`);
|
|
@@ -1812,13 +1865,23 @@ function assignModules(pages) {
|
|
|
1812
1865
|
|
|
1813
1866
|
// ../../packages/generators/dist/testcases/targets.js
|
|
1814
1867
|
function toTargetRef(element) {
|
|
1868
|
+
const needsDisambiguation = element.matchCount !== void 0 && element.matchCount > 1;
|
|
1869
|
+
const disambiguation = needsDisambiguation ? {
|
|
1870
|
+
nth: element.scopeMatchCount && element.scopeMatchCount > 1 ? element.scopeIndex : element.contextSelector || element.contextText ? void 0 : element.matchIndex,
|
|
1871
|
+
matchCount: element.matchCount,
|
|
1872
|
+
contextText: element.contextText,
|
|
1873
|
+
contextSelector: element.contextSelector,
|
|
1874
|
+
contextTestId: element.contextTestId
|
|
1875
|
+
} : void 0;
|
|
1815
1876
|
if (element.accessibleName) {
|
|
1816
|
-
return { role: element.role, name: element.accessibleName };
|
|
1877
|
+
return { role: element.role, name: element.accessibleName, ...disambiguation };
|
|
1817
1878
|
}
|
|
1818
1879
|
if (element.placeholder) {
|
|
1819
|
-
return { role: element.role, placeholder: element.placeholder };
|
|
1880
|
+
return { role: element.role, placeholder: element.placeholder, ...disambiguation };
|
|
1820
1881
|
}
|
|
1821
|
-
|
|
1882
|
+
if (element.testId)
|
|
1883
|
+
return { testId: element.testId, ...disambiguation };
|
|
1884
|
+
return { role: element.role, cssSelector: element.cssSelector, ...disambiguation };
|
|
1822
1885
|
}
|
|
1823
1886
|
function labelOf(element) {
|
|
1824
1887
|
return element.accessibleName || element.placeholder || element.name || element.id || element.tagName;
|
|
@@ -1880,7 +1943,17 @@ function fillFieldStep(field) {
|
|
|
1880
1943
|
const option = field.options?.[1] ?? field.options?.[0] ?? "";
|
|
1881
1944
|
return { type: "select", target: toTargetRef(field), option };
|
|
1882
1945
|
}
|
|
1883
|
-
return { type: "fill", target: toTargetRef(field), value:
|
|
1946
|
+
return { type: "fill", target: toTargetRef(field), value: automationValueFor(field) };
|
|
1947
|
+
}
|
|
1948
|
+
function automationValueFor(field) {
|
|
1949
|
+
const hint = `${field.inputType ?? ""} ${field.name ?? ""} ${field.accessibleName ?? ""} ${field.placeholder ?? ""}`.toLowerCase();
|
|
1950
|
+
if (field.inputType === "password" || hint.includes("password") || hint.includes("\u0E23\u0E2B\u0E31\u0E2A\u0E1C\u0E48\u0E32\u0E19"))
|
|
1951
|
+
return "{{TEST_PASSWORD}}";
|
|
1952
|
+
if (field.inputType === "email" || hint.includes("email") || hint.includes("\u0E2D\u0E35\u0E40\u0E21\u0E25"))
|
|
1953
|
+
return "{{TEST_EMAIL}}";
|
|
1954
|
+
if (hint.includes("username") || hint.includes("user name") || hint.includes("\u0E0A\u0E37\u0E48\u0E2D\u0E1C\u0E39\u0E49\u0E43\u0E0A\u0E49"))
|
|
1955
|
+
return "{{TEST_USERNAME}}";
|
|
1956
|
+
return sampleValueFor(field);
|
|
1884
1957
|
}
|
|
1885
1958
|
function pageStructureRule(ctx) {
|
|
1886
1959
|
const { page } = ctx;
|
|
@@ -1913,6 +1986,40 @@ function pageStructureRule(ctx) {
|
|
|
1913
1986
|
})
|
|
1914
1987
|
];
|
|
1915
1988
|
}
|
|
1989
|
+
function interactionRule(ctx) {
|
|
1990
|
+
const interactions = ctx.page.state?.interactions ?? [];
|
|
1991
|
+
return interactions.slice(0, 12).map((interaction) => {
|
|
1992
|
+
const target = interactionTarget(interaction);
|
|
1993
|
+
return build(ctx, {
|
|
1994
|
+
title: (interaction.name || interaction.kind) + " interaction works",
|
|
1995
|
+
preconditions: precondition(ctx.page),
|
|
1996
|
+
steps: [
|
|
1997
|
+
navigateStep(ctx.page),
|
|
1998
|
+
{ type: "click", target, description: interactionAction(interaction) },
|
|
1999
|
+
{ type: "assertVisible", target }
|
|
2000
|
+
],
|
|
2001
|
+
expectedResult: interaction.kind + ' "' + (interaction.name || "control") + '" opens and is usable.',
|
|
2002
|
+
type: "positive",
|
|
2003
|
+
priority: "medium",
|
|
2004
|
+
automationStatus: "needs-review",
|
|
2005
|
+
notes: "Generated from the observed " + interaction.kind + " interaction."
|
|
2006
|
+
});
|
|
2007
|
+
});
|
|
2008
|
+
}
|
|
2009
|
+
function interactionTarget(interaction) {
|
|
2010
|
+
return { role: interaction.role, name: interaction.name || void 0, cssSelector: interaction.cssSelector };
|
|
2011
|
+
}
|
|
2012
|
+
function interactionAction(interaction) {
|
|
2013
|
+
const labels = {
|
|
2014
|
+
dialog: "Open modal or dialog",
|
|
2015
|
+
tab: "Select tab",
|
|
2016
|
+
accordion: "Expand accordion",
|
|
2017
|
+
dropdown: "Open dropdown",
|
|
2018
|
+
drawer: "Open drawer",
|
|
2019
|
+
popover: "Open popover"
|
|
2020
|
+
};
|
|
2021
|
+
return labels[interaction.kind];
|
|
2022
|
+
}
|
|
1916
2023
|
function requiredFieldRule(ctx, form) {
|
|
1917
2024
|
const submit = form.submitButtons.find((button) => !button.disabled);
|
|
1918
2025
|
const fields = form.fields.filter(isUsable);
|
|
@@ -1954,19 +2061,34 @@ function formSubmitRule(ctx, form) {
|
|
|
1954
2061
|
}
|
|
1955
2062
|
steps.push({ type: "click", target: toTargetRef(submit) });
|
|
1956
2063
|
const formName = form.accessibleName || labelOf(submit);
|
|
2064
|
+
const loginForm = isLoginForm(ctx.page, form, fields, submit);
|
|
2065
|
+
const expectedPath = form.action ? pathFromAction(ctx.page.finalUrl, form.action) : void 0;
|
|
2066
|
+
if (loginForm && expectedPath)
|
|
2067
|
+
steps.push({ type: "assertUrl", urlContains: expectedPath });
|
|
1957
2068
|
return [
|
|
1958
2069
|
build(ctx, {
|
|
1959
|
-
title: `Submit ${formName} with valid data`,
|
|
2070
|
+
title: loginForm ? `Login with valid credentials via ${formName}` : `Submit ${formName} with valid data`,
|
|
1960
2071
|
preconditions: [...precondition(ctx.page), "Valid test data is prepared"],
|
|
1961
2072
|
steps,
|
|
1962
|
-
expectedResult: UNKNOWN_BEHAVIOUR,
|
|
2073
|
+
expectedResult: loginForm && expectedPath ? `The form is submitted and the browser navigates to ${expectedPath}.` : UNKNOWN_BEHAVIOUR,
|
|
1963
2074
|
type: "positive",
|
|
1964
2075
|
priority: "high",
|
|
1965
|
-
automationStatus: "needs-data",
|
|
2076
|
+
automationStatus: loginForm ? "ready" : "needs-data",
|
|
1966
2077
|
notes: "Sample values are placeholders \u2014 replace them with real test data before running."
|
|
1967
2078
|
})
|
|
1968
2079
|
];
|
|
1969
2080
|
}
|
|
2081
|
+
function isLoginForm(page, form, fields, submit) {
|
|
2082
|
+
const text = [page.finalUrl, page.title, form.name, form.accessibleName, labelOf(submit), ...fields.map(labelOf)].filter(Boolean).join(" ").toLowerCase();
|
|
2083
|
+
return /login|log in|sign in|signin|password/.test(text) && fields.some((field) => field.inputType === "password");
|
|
2084
|
+
}
|
|
2085
|
+
function pathFromAction(pageUrl, action) {
|
|
2086
|
+
try {
|
|
2087
|
+
return new URL(action, pageUrl).pathname;
|
|
2088
|
+
} catch {
|
|
2089
|
+
return void 0;
|
|
2090
|
+
}
|
|
2091
|
+
}
|
|
1970
2092
|
function navigationRule(ctx) {
|
|
1971
2093
|
const { page } = ctx;
|
|
1972
2094
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -2060,6 +2182,7 @@ function generateTestCases(pages, options = {}) {
|
|
|
2060
2182
|
...pageStructureRule(context),
|
|
2061
2183
|
...page.forms.flatMap((form) => requiredFieldRule(context, form)),
|
|
2062
2184
|
...page.forms.flatMap((form) => formSubmitRule(context, form)),
|
|
2185
|
+
...interactionRule(context),
|
|
2063
2186
|
...navigationRule(context),
|
|
2064
2187
|
...destructiveActionRule(context)
|
|
2065
2188
|
].slice(0, config2.maxTestCasesPerPage);
|
|
@@ -2102,7 +2225,7 @@ function translateStep(step) {
|
|
|
2102
2225
|
}
|
|
2103
2226
|
}
|
|
2104
2227
|
function translate(value) {
|
|
2105
|
-
return value.replace(/^(.+) page displays required controls$/, "$1 \u0E41\u0E2A\u0E14\u0E07\u0E2D\u0E07\u0E04\u0E4C\u0E1B\u0E23\u0E30\u0E01\u0E2D\u0E1A\u0E17\u0E35\u0E48\u0E08\u0E33\u0E40\u0E1B\u0E47\u0E19").replace(/^All (\d+) controls detected on the page are visible\.$/, "\u0E1E\u0E1A\u0E2D\u0E07\u0E04\u0E4C\u0E1B\u0E23\u0E30\u0E01\u0E2D\u0E1A\u0E1A\u0E19\u0E2B\u0E19\u0E49\u0E32\u0E40\u0E27\u0E47\u0E1A\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14 $1 \u0E23\u0E32\u0E22\u0E01\u0E32\u0E23\u0E41\u0E25\u0E30\u0E41\u0E2A\u0E14\u0E07\u0E1C\u0E25\u0E2D\u0E22\u0E39\u0E48").replace(/^(.+) is required$/, "$1 \u0E40\u0E1B\u0E47\u0E19\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E08\u0E33\u0E40\u0E1B\u0E47\u0E19").replace(/^Submit (.+) with valid data$/, "\u0E2A\u0E48\u0E07 $1 \u0E14\u0E49\u0E27\u0E22\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07").replace(/^Navigate to (.+)$/, "\u0E44\u0E1B\u0E22\u0E31\u0E07 $1").replace(/^The application is available at (.+)$/, "\u0E23\u0E30\u0E1A\u0E1A\u0E1E\u0E23\u0E49\u0E2D\u0E21\u0E43\u0E0A\u0E49\u0E07\u0E32\u0E19\u0E17\u0E35\u0E48 $1").replace(/^The application is available$/, "\u0E23\u0E30\u0E1A\u0E1A\u0E1E\u0E23\u0E49\u0E2D\u0E21\u0E43\u0E0A\u0E49\u0E07\u0E32\u0E19").replace(/^Valid test data is prepared$/, "\u0E40\u0E15\u0E23\u0E35\u0E22\u0E21\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E14\u0E2A\u0E2D\u0E1A\u0E17\u0E35\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E41\u0E25\u0E49\u0E27").replace(/^Disposable test data is prepared$/, "\u0E40\u0E15\u0E23\u0E35\u0E22\u0E21\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E14\u0E2A\u0E2D\u0E1A\u0E17\u0E35\u0E48\u0E2A\u0E32\u0E21\u0E32\u0E23\u0E16\u0E25\u0E1A\u0E44\u0E14\u0E49\u0E41\u0E25\u0E49\u0E27").replace(/^Leave "(.+)" empty$/, '\u0E40\u0E27\u0E49\u0E19\u0E0A\u0E48\u0E2D\u0E07 "$1" \u0E27\u0E48\u0E32\u0E07\u0E44\u0E27\u0E49').replace(/^Select "(.+)"$/, '\u0E40\u0E25\u0E37\u0E2D\u0E01 "$1"').replace(/^Verify that a validation message is displayed for the empty required field, and the form is not submitted\.$/, "\u0E15\u0E23\u0E27\u0E08\u0E2A\u0E2D\u0E1A\u0E27\u0E48\u0E32\u0E21\u0E35\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E08\u0E49\u0E07\u0E40\u0E15\u0E37\u0E2D\u0E19\u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A\u0E0A\u0E48\u0E2D\u0E07\u0E17\u0E35\u0E48\u0E08\u0E33\u0E40\u0E1B\u0E47\u0E19\u0E0B\u0E36\u0E48\u0E07\u0E40\u0E27\u0E49\u0E19\u0E27\u0E48\u0E32\u0E07 \u0E41\u0E25\u0E30\u0E1F\u0E2D\u0E23\u0E4C\u0E21\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E2A\u0E48\u0E07").replace(/^The browser navigates to (.+) and the page "(.+)" is displayed\.$/, '\u0E40\u0E1A\u0E23\u0E32\u0E27\u0E4C\u0E40\u0E0B\u0E2D\u0E23\u0E4C\u0E44\u0E1B\u0E22\u0E31\u0E07 $1 \u0E41\u0E25\u0E30\u0E41\u0E2A\u0E14\u0E07\u0E2B\u0E19\u0E49\u0E32 "$2"').replace(/^The browser navigates to (.+)\.$/, "\u0E40\u0E1A\u0E23\u0E32\u0E27\u0E4C\u0E40\u0E0B\u0E2D\u0E23\u0E4C\u0E44\u0E1B\u0E22\u0E31\u0E07 $1").replace(/^Dialog "(.+)" is visible\.$/, '\u0E01\u0E25\u0E48\u0E2D\u0E07\u0E42\u0E15\u0E49\u0E15\u0E2D\u0E1A "$1" \u0E41\u0E2A\u0E14\u0E07\u0E2D\u0E22\u0E39\u0E48').replace(/^Validation message "(.+)" is visible\.$/, '\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E08\u0E49\u0E07\u0E40\u0E15\u0E37\u0E2D\u0E19 "$1" \u0E41\u0E2A\u0E14\u0E07\u0E2D\u0E22\u0E39\u0E48').replace(/^Heading "(.+)" is visible\.$/, '\u0E2B\u0E31\u0E27\u0E02\u0E49\u0E2D "$1" \u0E41\u0E2A\u0E14\u0E07\u0E2D\u0E22\u0E39\u0E48').replace(/^Observed state requires tester review before automation\.$/, "\u0E2A\u0E16\u0E32\u0E19\u0E30\u0E17\u0E35\u0E48\u0E1E\u0E1A\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E2B\u0E49\u0E1C\u0E39\u0E49\u0E17\u0E14\u0E2A\u0E2D\u0E1A\u0E15\u0E23\u0E27\u0E08\u0E2A\u0E2D\u0E1A\u0E01\u0E48\u0E2D\u0E19\u0E17\u0E33 Automation").replace(/^Verify "(.+)" action \(manual\)$/, '\u0E15\u0E23\u0E27\u0E08\u0E2A\u0E2D\u0E1A action "$1" \u0E14\u0E49\u0E27\u0E22\u0E15\u0E19\u0E40\u0E2D\u0E07').replace(/^Open (.+)$/, "\u0E40\u0E1B\u0E34\u0E14 $1").replace(/^The page is reachable and rendered$/, "\u0E2B\u0E19\u0E49\u0E32\u0E40\u0E27\u0E47\u0E1A\u0E2A\u0E32\u0E21\u0E32\u0E23\u0E16\u0E40\u0E1B\u0E34\u0E14\u0E41\u0E25\u0E30\u0E41\u0E2A\u0E14\u0E07\u0E1C\u0E25\u0E44\u0E14\u0E49").replace(/^Expected behavior is not known from static exploration; review manually\.$/, "\u0E44\u0E21\u0E48\u0E17\u0E23\u0E32\u0E1A\u0E1E\u0E24\u0E15\u0E34\u0E01\u0E23\u0E23\u0E21\u0E08\u0E32\u0E01\u0E01\u0E32\u0E23\u0E2A\u0E33\u0E23\u0E27\u0E08\u0E41\u0E1A\u0E1A static \u0E01\u0E23\u0E38\u0E13\u0E32\u0E15\u0E23\u0E27\u0E08\u0E2A\u0E2D\u0E1A\u0E14\u0E49\u0E27\u0E22\u0E15\u0E19\u0E40\u0E2D\u0E07").replace(/^Verify that the result is displayed according to application requirements \(needs review by tester\)\.$/, "\u0E15\u0E23\u0E27\u0E08\u0E2A\u0E2D\u0E1A\u0E27\u0E48\u0E32\u0E1C\u0E25\u0E25\u0E31\u0E1E\u0E18\u0E4C\u0E41\u0E2A\u0E14\u0E07\u0E15\u0E32\u0E21\u0E02\u0E49\u0E2D\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E02\u0E2D\u0E07\u0E23\u0E30\u0E1A\u0E1A (\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E2B\u0E49\u0E1C\u0E39\u0E49\u0E17\u0E14\u0E2A\u0E2D\u0E1A\u0E15\u0E23\u0E27\u0E08\u0E2A\u0E2D\u0E1A)").replace(/^Generated from elements detected on the page\.$/, "\u0E2A\u0E23\u0E49\u0E32\u0E07\u0E08\u0E32\u0E01\u0E2D\u0E07\u0E04\u0E4C\u0E1B\u0E23\u0E30\u0E01\u0E2D\u0E1A\u0E17\u0E35\u0E48\u0E15\u0E23\u0E27\u0E08\u0E1E\u0E1A\u0E1A\u0E19\u0E2B\u0E19\u0E49\u0E32\u0E40\u0E27\u0E47\u0E1A").replace(/^Evidence: the field has the HTML "required" attribute\.$/, '\u0E2B\u0E25\u0E31\u0E01\u0E10\u0E32\u0E19: \u0E0A\u0E48\u0E2D\u0E07\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E21\u0E35\u0E41\u0E2D\u0E15\u0E17\u0E23\u0E34\u0E1A\u0E34\u0E27\u0E15\u0E4C HTML "required"').replace(/^No "required" attribute found — confirm with the specification whether this field is mandatory\.$/, '\u0E44\u0E21\u0E48\u0E1E\u0E1A\u0E41\u0E2D\u0E15\u0E17\u0E23\u0E34\u0E1A\u0E34\u0E27\u0E15\u0E4C "required" \u2014 \u0E42\u0E1B\u0E23\u0E14\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19\u0E01\u0E31\u0E1A\u0E02\u0E49\u0E2D\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E27\u0E48\u0E32\u0E0A\u0E48\u0E2D\u0E07\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E19\u0E35\u0E49\u0E1A\u0E31\u0E07\u0E04\u0E31\u0E1A\u0E01\u0E23\u0E2D\u0E01\u0E2B\u0E23\u0E37\u0E2D\u0E44\u0E21\u0E48').replace(/^Sample values are placeholders — replace them with real test data before running\.$/, "\u0E04\u0E48\u0E32\u0E15\u0E31\u0E27\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E40\u0E1B\u0E47\u0E19\u0E40\u0E1E\u0E35\u0E22\u0E07\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E41\u0E17\u0E19\u0E17\u0E35\u0E48 \u2014 \u0E40\u0E1B\u0E25\u0E35\u0E48\u0E22\u0E19\u0E40\u0E1B\u0E47\u0E19\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E14\u0E2A\u0E2D\u0E1A\u0E08\u0E23\u0E34\u0E07\u0E01\u0E48\u0E2D\u0E19\u0E40\u0E23\u0E34\u0E48\u0E21\u0E17\u0E14\u0E2A\u0E2D\u0E1A").replace(/^Explorer did not open this page — expected result needs review\.$/, "Explorer \u0E44\u0E21\u0E48\u0E44\u0E14\u0E49\u0E40\u0E1B\u0E34\u0E14\u0E2B\u0E19\u0E49\u0E32\u0E19\u0E35\u0E49 \u2014 \u0E1C\u0E25\u0E25\u0E31\u0E1E\u0E18\u0E4C\u0E17\u0E35\u0E48\u0E04\u0E32\u0E14\u0E2B\u0E27\u0E31\u0E07\u0E15\u0E49\u0E2D\u0E07\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A\u0E01\u0E32\u0E23\u0E15\u0E23\u0E27\u0E08\u0E2A\u0E2D\u0E1A").replace(/^Detected as a potentially destructive action — Explorer did not click it\.$/, "\u0E15\u0E23\u0E27\u0E08\u0E1E\u0E1A\u0E27\u0E48\u0E32\u0E2D\u0E32\u0E08\u0E40\u0E1B\u0E47\u0E19\u0E01\u0E32\u0E23\u0E01\u0E23\u0E30\u0E17\u0E33\u0E17\u0E35\u0E48\u0E17\u0E33\u0E25\u0E32\u0E22\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25 \u2014 Explorer \u0E08\u0E36\u0E07\u0E44\u0E21\u0E48\u0E44\u0E14\u0E49\u0E04\u0E25\u0E34\u0E01").replace(/^Manually trigger (.+) "(.+)" in a safe test environment$/, '\u0E2A\u0E31\u0E48\u0E07\u0E43\u0E0A\u0E49\u0E07\u0E32\u0E19 $1 "$2" \u0E14\u0E49\u0E27\u0E22\u0E15\u0E19\u0E40\u0E2D\u0E07\u0E43\u0E19\u0E2A\u0E20\u0E32\u0E1E\u0E41\u0E27\u0E14\u0E25\u0E49\u0E2D\u0E21\u0E17\u0E14\u0E2A\u0E2D\u0E1A\u0E17\u0E35\u0E48\u0E1B\u0E25\u0E2D\u0E14\u0E20\u0E31\u0E22');
|
|
2228
|
+
return value.replace(/^Login with valid credentials via (.+)$/, "\u0E40\u0E02\u0E49\u0E32\u0E2A\u0E39\u0E48\u0E23\u0E30\u0E1A\u0E1A\u0E14\u0E49\u0E27\u0E22\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E1C\u0E48\u0E32\u0E19 $1").replace(/^The form is submitted and the browser navigates to (.+?)[.]?$/, "\u0E1F\u0E2D\u0E23\u0E4C\u0E21\u0E16\u0E39\u0E01\u0E2A\u0E48\u0E07\u0E41\u0E25\u0E30\u0E40\u0E1A\u0E23\u0E32\u0E27\u0E4C\u0E40\u0E0B\u0E2D\u0E23\u0E4C\u0E44\u0E1B\u0E22\u0E31\u0E07 $1").replace(/^(.+) interaction works$/, "\u0E01\u0E32\u0E23\u0E17\u0E33\u0E07\u0E32\u0E19\u0E02\u0E2D\u0E07 $1 \u0E17\u0E33\u0E07\u0E32\u0E19\u0E44\u0E14\u0E49\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07").replace(/^(.+) "(.+)" opens and is usable\.$/, '$1 "$2" \u0E40\u0E1B\u0E34\u0E14\u0E41\u0E25\u0E30\u0E2A\u0E32\u0E21\u0E32\u0E23\u0E16\u0E43\u0E0A\u0E49\u0E07\u0E32\u0E19\u0E44\u0E14\u0E49').replace(/^Generated from the observed (.+) interaction\.$/, "\u0E2A\u0E23\u0E49\u0E32\u0E07\u0E08\u0E32\u0E01\u0E01\u0E32\u0E23\u0E15\u0E23\u0E27\u0E08\u0E1E\u0E1A interaction \u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17 $1").replace(/^Login with valid credentials via (.+)$/, "\u0E40\u0E02\u0E49\u0E32\u0E2A\u0E39\u0E48\u0E23\u0E30\u0E1A\u0E1A\u0E14\u0E49\u0E27\u0E22\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E1C\u0E48\u0E32\u0E19 $1").replace(/^(.+) page displays required controls$/, "$1 \u0E41\u0E2A\u0E14\u0E07\u0E2D\u0E07\u0E04\u0E4C\u0E1B\u0E23\u0E30\u0E01\u0E2D\u0E1A\u0E17\u0E35\u0E48\u0E08\u0E33\u0E40\u0E1B\u0E47\u0E19").replace(/^All (\d+) controls detected on the page are visible\.$/, "\u0E1E\u0E1A\u0E2D\u0E07\u0E04\u0E4C\u0E1B\u0E23\u0E30\u0E01\u0E2D\u0E1A\u0E1A\u0E19\u0E2B\u0E19\u0E49\u0E32\u0E40\u0E27\u0E47\u0E1A\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14 $1 \u0E23\u0E32\u0E22\u0E01\u0E32\u0E23\u0E41\u0E25\u0E30\u0E41\u0E2A\u0E14\u0E07\u0E1C\u0E25\u0E2D\u0E22\u0E39\u0E48").replace(/^(.+) is required$/, "$1 \u0E40\u0E1B\u0E47\u0E19\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E08\u0E33\u0E40\u0E1B\u0E47\u0E19").replace(/^Submit (.+) with valid data$/, "\u0E2A\u0E48\u0E07 $1 \u0E14\u0E49\u0E27\u0E22\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07").replace(/^Navigate to (.+)$/, "\u0E44\u0E1B\u0E22\u0E31\u0E07 $1").replace(/^The application is available at (.+)$/, "\u0E23\u0E30\u0E1A\u0E1A\u0E1E\u0E23\u0E49\u0E2D\u0E21\u0E43\u0E0A\u0E49\u0E07\u0E32\u0E19\u0E17\u0E35\u0E48 $1").replace(/^The application is available$/, "\u0E23\u0E30\u0E1A\u0E1A\u0E1E\u0E23\u0E49\u0E2D\u0E21\u0E43\u0E0A\u0E49\u0E07\u0E32\u0E19").replace(/^Valid test data is prepared$/, "\u0E40\u0E15\u0E23\u0E35\u0E22\u0E21\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E14\u0E2A\u0E2D\u0E1A\u0E17\u0E35\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E41\u0E25\u0E49\u0E27").replace(/^Disposable test data is prepared$/, "\u0E40\u0E15\u0E23\u0E35\u0E22\u0E21\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E14\u0E2A\u0E2D\u0E1A\u0E17\u0E35\u0E48\u0E2A\u0E32\u0E21\u0E32\u0E23\u0E16\u0E25\u0E1A\u0E44\u0E14\u0E49\u0E41\u0E25\u0E49\u0E27").replace(/^Leave "(.+)" empty$/, '\u0E40\u0E27\u0E49\u0E19\u0E0A\u0E48\u0E2D\u0E07 "$1" \u0E27\u0E48\u0E32\u0E07\u0E44\u0E27\u0E49').replace(/^Select "(.+)"$/, '\u0E40\u0E25\u0E37\u0E2D\u0E01 "$1"').replace(/^Verify that a validation message is displayed for the empty required field, and the form is not submitted\.$/, "\u0E15\u0E23\u0E27\u0E08\u0E2A\u0E2D\u0E1A\u0E27\u0E48\u0E32\u0E21\u0E35\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E08\u0E49\u0E07\u0E40\u0E15\u0E37\u0E2D\u0E19\u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A\u0E0A\u0E48\u0E2D\u0E07\u0E17\u0E35\u0E48\u0E08\u0E33\u0E40\u0E1B\u0E47\u0E19\u0E0B\u0E36\u0E48\u0E07\u0E40\u0E27\u0E49\u0E19\u0E27\u0E48\u0E32\u0E07 \u0E41\u0E25\u0E30\u0E1F\u0E2D\u0E23\u0E4C\u0E21\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E2A\u0E48\u0E07").replace(/^The browser navigates to (.+) and the page "(.+)" is displayed\.$/, '\u0E40\u0E1A\u0E23\u0E32\u0E27\u0E4C\u0E40\u0E0B\u0E2D\u0E23\u0E4C\u0E44\u0E1B\u0E22\u0E31\u0E07 $1 \u0E41\u0E25\u0E30\u0E41\u0E2A\u0E14\u0E07\u0E2B\u0E19\u0E49\u0E32 "$2"').replace(/^The browser navigates to (.+)\.$/, "\u0E40\u0E1A\u0E23\u0E32\u0E27\u0E4C\u0E40\u0E0B\u0E2D\u0E23\u0E4C\u0E44\u0E1B\u0E22\u0E31\u0E07 $1").replace(/^Dialog "(.+)" is visible\.$/, '\u0E01\u0E25\u0E48\u0E2D\u0E07\u0E42\u0E15\u0E49\u0E15\u0E2D\u0E1A "$1" \u0E41\u0E2A\u0E14\u0E07\u0E2D\u0E22\u0E39\u0E48').replace(/^Validation message "(.+)" is visible\.$/, '\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E08\u0E49\u0E07\u0E40\u0E15\u0E37\u0E2D\u0E19 "$1" \u0E41\u0E2A\u0E14\u0E07\u0E2D\u0E22\u0E39\u0E48').replace(/^Heading "(.+)" is visible\.$/, '\u0E2B\u0E31\u0E27\u0E02\u0E49\u0E2D "$1" \u0E41\u0E2A\u0E14\u0E07\u0E2D\u0E22\u0E39\u0E48').replace(/^Observed state requires tester review before automation\.$/, "\u0E2A\u0E16\u0E32\u0E19\u0E30\u0E17\u0E35\u0E48\u0E1E\u0E1A\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E2B\u0E49\u0E1C\u0E39\u0E49\u0E17\u0E14\u0E2A\u0E2D\u0E1A\u0E15\u0E23\u0E27\u0E08\u0E2A\u0E2D\u0E1A\u0E01\u0E48\u0E2D\u0E19\u0E17\u0E33 Automation").replace(/^Verify "(.+)" action \(manual\)$/, '\u0E15\u0E23\u0E27\u0E08\u0E2A\u0E2D\u0E1A action "$1" \u0E14\u0E49\u0E27\u0E22\u0E15\u0E19\u0E40\u0E2D\u0E07').replace(/^Open (.+)$/, "\u0E40\u0E1B\u0E34\u0E14 $1").replace(/^The page is reachable and rendered$/, "\u0E2B\u0E19\u0E49\u0E32\u0E40\u0E27\u0E47\u0E1A\u0E2A\u0E32\u0E21\u0E32\u0E23\u0E16\u0E40\u0E1B\u0E34\u0E14\u0E41\u0E25\u0E30\u0E41\u0E2A\u0E14\u0E07\u0E1C\u0E25\u0E44\u0E14\u0E49").replace(/^Expected behavior is not known from static exploration; review manually\.$/, "\u0E44\u0E21\u0E48\u0E17\u0E23\u0E32\u0E1A\u0E1E\u0E24\u0E15\u0E34\u0E01\u0E23\u0E23\u0E21\u0E08\u0E32\u0E01\u0E01\u0E32\u0E23\u0E2A\u0E33\u0E23\u0E27\u0E08\u0E41\u0E1A\u0E1A static \u0E01\u0E23\u0E38\u0E13\u0E32\u0E15\u0E23\u0E27\u0E08\u0E2A\u0E2D\u0E1A\u0E14\u0E49\u0E27\u0E22\u0E15\u0E19\u0E40\u0E2D\u0E07").replace(/^Verify that the result is displayed according to application requirements \(needs review by tester\)\.$/, "\u0E15\u0E23\u0E27\u0E08\u0E2A\u0E2D\u0E1A\u0E27\u0E48\u0E32\u0E1C\u0E25\u0E25\u0E31\u0E1E\u0E18\u0E4C\u0E41\u0E2A\u0E14\u0E07\u0E15\u0E32\u0E21\u0E02\u0E49\u0E2D\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E02\u0E2D\u0E07\u0E23\u0E30\u0E1A\u0E1A (\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E2B\u0E49\u0E1C\u0E39\u0E49\u0E17\u0E14\u0E2A\u0E2D\u0E1A\u0E15\u0E23\u0E27\u0E08\u0E2A\u0E2D\u0E1A)").replace(/^Generated from elements detected on the page\.$/, "\u0E2A\u0E23\u0E49\u0E32\u0E07\u0E08\u0E32\u0E01\u0E2D\u0E07\u0E04\u0E4C\u0E1B\u0E23\u0E30\u0E01\u0E2D\u0E1A\u0E17\u0E35\u0E48\u0E15\u0E23\u0E27\u0E08\u0E1E\u0E1A\u0E1A\u0E19\u0E2B\u0E19\u0E49\u0E32\u0E40\u0E27\u0E47\u0E1A").replace(/^Evidence: the field has the HTML "required" attribute\.$/, '\u0E2B\u0E25\u0E31\u0E01\u0E10\u0E32\u0E19: \u0E0A\u0E48\u0E2D\u0E07\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E21\u0E35\u0E41\u0E2D\u0E15\u0E17\u0E23\u0E34\u0E1A\u0E34\u0E27\u0E15\u0E4C HTML "required"').replace(/^No "required" attribute found — confirm with the specification whether this field is mandatory\.$/, '\u0E44\u0E21\u0E48\u0E1E\u0E1A\u0E41\u0E2D\u0E15\u0E17\u0E23\u0E34\u0E1A\u0E34\u0E27\u0E15\u0E4C "required" \u2014 \u0E42\u0E1B\u0E23\u0E14\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19\u0E01\u0E31\u0E1A\u0E02\u0E49\u0E2D\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E27\u0E48\u0E32\u0E0A\u0E48\u0E2D\u0E07\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E19\u0E35\u0E49\u0E1A\u0E31\u0E07\u0E04\u0E31\u0E1A\u0E01\u0E23\u0E2D\u0E01\u0E2B\u0E23\u0E37\u0E2D\u0E44\u0E21\u0E48').replace(/^Sample values are placeholders — replace them with real test data before running\.$/, "\u0E04\u0E48\u0E32\u0E15\u0E31\u0E27\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E40\u0E1B\u0E47\u0E19\u0E40\u0E1E\u0E35\u0E22\u0E07\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E41\u0E17\u0E19\u0E17\u0E35\u0E48 \u2014 \u0E40\u0E1B\u0E25\u0E35\u0E48\u0E22\u0E19\u0E40\u0E1B\u0E47\u0E19\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E14\u0E2A\u0E2D\u0E1A\u0E08\u0E23\u0E34\u0E07\u0E01\u0E48\u0E2D\u0E19\u0E40\u0E23\u0E34\u0E48\u0E21\u0E17\u0E14\u0E2A\u0E2D\u0E1A").replace(/^Explorer did not open this page — expected result needs review\.$/, "Explorer \u0E44\u0E21\u0E48\u0E44\u0E14\u0E49\u0E40\u0E1B\u0E34\u0E14\u0E2B\u0E19\u0E49\u0E32\u0E19\u0E35\u0E49 \u2014 \u0E1C\u0E25\u0E25\u0E31\u0E1E\u0E18\u0E4C\u0E17\u0E35\u0E48\u0E04\u0E32\u0E14\u0E2B\u0E27\u0E31\u0E07\u0E15\u0E49\u0E2D\u0E07\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A\u0E01\u0E32\u0E23\u0E15\u0E23\u0E27\u0E08\u0E2A\u0E2D\u0E1A").replace(/^Detected as a potentially destructive action — Explorer did not click it\.$/, "\u0E15\u0E23\u0E27\u0E08\u0E1E\u0E1A\u0E27\u0E48\u0E32\u0E2D\u0E32\u0E08\u0E40\u0E1B\u0E47\u0E19\u0E01\u0E32\u0E23\u0E01\u0E23\u0E30\u0E17\u0E33\u0E17\u0E35\u0E48\u0E17\u0E33\u0E25\u0E32\u0E22\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25 \u2014 Explorer \u0E08\u0E36\u0E07\u0E44\u0E21\u0E48\u0E44\u0E14\u0E49\u0E04\u0E25\u0E34\u0E01").replace(/^Manually trigger (.+) "(.+)" in a safe test environment$/, '\u0E2A\u0E31\u0E48\u0E07\u0E43\u0E0A\u0E49\u0E07\u0E32\u0E19 $1 "$2" \u0E14\u0E49\u0E27\u0E22\u0E15\u0E19\u0E40\u0E2D\u0E07\u0E43\u0E19\u0E2A\u0E20\u0E32\u0E1E\u0E41\u0E27\u0E14\u0E25\u0E49\u0E2D\u0E21\u0E17\u0E14\u0E2A\u0E2D\u0E1A\u0E17\u0E35\u0E48\u0E1B\u0E25\u0E2D\u0E14\u0E20\u0E31\u0E22');
|
|
2106
2229
|
}
|
|
2107
2230
|
function safeNormalize(url) {
|
|
2108
2231
|
try {
|
|
@@ -2547,6 +2670,38 @@ async function openWorkspace(root) {
|
|
|
2547
2670
|
async function browserProfileDirectory(root, projectId) {
|
|
2548
2671
|
return join(await ensureProject(root, projectId), "browser-profile");
|
|
2549
2672
|
}
|
|
2673
|
+
async function browserProfileStatus(root, projectId) {
|
|
2674
|
+
const directory = join(projectDirectory(root, projectId), "browser-profile");
|
|
2675
|
+
try {
|
|
2676
|
+
const entries = await readdir(directory);
|
|
2677
|
+
const candidates = [
|
|
2678
|
+
directory,
|
|
2679
|
+
join(directory, "Local State"),
|
|
2680
|
+
join(directory, "Default"),
|
|
2681
|
+
join(directory, "Default", "Cookies"),
|
|
2682
|
+
join(directory, "Default", "Local Storage")
|
|
2683
|
+
];
|
|
2684
|
+
const modifiedTimes = await Promise.all(candidates.map(async (candidate) => {
|
|
2685
|
+
try {
|
|
2686
|
+
return (await stat(candidate)).mtimeMs;
|
|
2687
|
+
} catch {
|
|
2688
|
+
return 0;
|
|
2689
|
+
}
|
|
2690
|
+
}));
|
|
2691
|
+
return {
|
|
2692
|
+
profileExists: true,
|
|
2693
|
+
browserDataDetected: entries.includes("Default") || entries.includes("Local State"),
|
|
2694
|
+
cookieStoreDetected: modifiedTimes[3] > 0 || modifiedTimes[4] > 0,
|
|
2695
|
+
lastModifiedAt: new Date(Math.max(...modifiedTimes)).toISOString()
|
|
2696
|
+
};
|
|
2697
|
+
} catch {
|
|
2698
|
+
return { profileExists: false, browserDataDetected: false, cookieStoreDetected: false };
|
|
2699
|
+
}
|
|
2700
|
+
}
|
|
2701
|
+
async function clearBrowserProfile(root, projectId) {
|
|
2702
|
+
const directory = join(projectDirectory(root, projectId), "browser-profile");
|
|
2703
|
+
await rm(directory, { recursive: true, force: true });
|
|
2704
|
+
}
|
|
2550
2705
|
async function readProject(root, projectId) {
|
|
2551
2706
|
try {
|
|
2552
2707
|
const directory = projectDirectory(root, projectId);
|
|
@@ -2671,6 +2826,12 @@ function registerAnalyzeRoute(app, workspaceRoot) {
|
|
|
2671
2826
|
}
|
|
2672
2827
|
const browserProfileDir = body.projectId ? await browserProfileDirectory(workspaceRoot, body.projectId).catch(() => void 0) : void 0;
|
|
2673
2828
|
try {
|
|
2829
|
+
const abortController = new AbortController();
|
|
2830
|
+
let completed = false;
|
|
2831
|
+
request.raw.once("close", () => {
|
|
2832
|
+
if (!completed)
|
|
2833
|
+
abortController.abort();
|
|
2834
|
+
});
|
|
2674
2835
|
const result = await exploreWithScope(check.url.toString(), {
|
|
2675
2836
|
startPath: body.startPath,
|
|
2676
2837
|
scopePath: body.scopePath,
|
|
@@ -2688,6 +2849,7 @@ function registerAnalyzeRoute(app, workspaceRoot) {
|
|
|
2688
2849
|
}, {
|
|
2689
2850
|
waitAfterNavigationMs: clamp(body.waitAfterNavigationMs, 0, 5e3, 750),
|
|
2690
2851
|
blockedKeywords: normalizeBlockedKeywords(body.blockedKeywords),
|
|
2852
|
+
signal: abortController.signal,
|
|
2691
2853
|
...browserProfileDir ? { browserProfileDir } : {}
|
|
2692
2854
|
});
|
|
2693
2855
|
if (result.pages.length === 0) {
|
|
@@ -2768,6 +2930,7 @@ function registerAnalyzeRoute(app, workspaceRoot) {
|
|
|
2768
2930
|
runEvents,
|
|
2769
2931
|
apiChecks: body.includeApiChecks ? buildApiChecks(result.pages) : []
|
|
2770
2932
|
};
|
|
2933
|
+
completed = true;
|
|
2771
2934
|
return reply.send(response);
|
|
2772
2935
|
} catch (error) {
|
|
2773
2936
|
request.log.error({ message: redactSensitiveText(error instanceof Error ? error.message : String(error)) }, "analyze failed");
|
|
@@ -3394,11 +3557,11 @@ function registerApiCheckRunRoute(app) {
|
|
|
3394
3557
|
if (!target.ok)
|
|
3395
3558
|
return reply.status(400).send({ error: { code: target.code, message: target.message } });
|
|
3396
3559
|
const method = check.method.toUpperCase();
|
|
3397
|
-
if (!SAFE_API_METHODS.has(method))
|
|
3560
|
+
if (!SAFE_API_METHODS.has(method) && !body.allowUnsafe)
|
|
3398
3561
|
return reply.status(400).send({
|
|
3399
3562
|
error: {
|
|
3400
3563
|
code: "unsafe-api-method",
|
|
3401
|
-
message: `${method} API checks are
|
|
3564
|
+
message: `${method} API checks are protected. Confirm allowUnsafe to run this endpoint once.`
|
|
3402
3565
|
}
|
|
3403
3566
|
});
|
|
3404
3567
|
const token = body.secrets?.apiToken ?? process.env.LAZYSCOUT_API_TOKEN;
|
|
@@ -3716,6 +3879,11 @@ function registerWorkspaceRoutes(app, root) {
|
|
|
3716
3879
|
await page.goto(body.url, { waitUntil: "domcontentloaded" });
|
|
3717
3880
|
return reply.send({ opened: true });
|
|
3718
3881
|
});
|
|
3882
|
+
app.get("/api/workspace/projects/:projectId/auth-session/status", async (request) => browserProfileStatus(root, request.params.projectId));
|
|
3883
|
+
app.delete("/api/workspace/projects/:projectId/auth-session", async (request, reply) => {
|
|
3884
|
+
await clearBrowserProfile(root, request.params.projectId);
|
|
3885
|
+
return reply.send({ cleared: true });
|
|
3886
|
+
});
|
|
3719
3887
|
app.get("/api/workspace/projects/:projectId/screenshots", async (request) => readScreenshots(root, request.params.projectId));
|
|
3720
3888
|
app.post("/api/workspace/projects/:projectId/screenshots", async (request) => saveScreenshot(root, request.params.projectId, request.body));
|
|
3721
3889
|
app.get("/api/workspace/projects/:projectId/screenshots/:name", async (request, reply) => {
|
|
@@ -3919,7 +4087,7 @@ async function openInBrowser(url) {
|
|
|
3919
4087
|
}
|
|
3920
4088
|
|
|
3921
4089
|
// src/version.ts
|
|
3922
|
-
var VERSION = true ? "0.3.
|
|
4090
|
+
var VERSION = true ? "0.3.8" : "0.0.0-dev";
|
|
3923
4091
|
|
|
3924
4092
|
// src/commands/serve.ts
|
|
3925
4093
|
var DEFAULT_PORT = 4321;
|