lazyscout 0.3.10 → 0.4.1

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
@@ -244,21 +244,9 @@ function redactUrl(value) {
244
244
  }
245
245
 
246
246
  // ../../packages/core/dist/safety/blocklist.js
247
- var SESSION_ENDING_KEYWORDS = [
248
- "log out",
249
- "logout",
250
- "log out",
251
- "sign out",
252
- "signout",
253
- "sign out",
254
- "\u0E2D\u0E2D\u0E01\u0E08\u0E32\u0E01\u0E23\u0E30\u0E1A\u0E1A",
255
- "\u0E2D\u0E2D\u0E01\u0E08\u0E32\u0E01\u0E23\u0E30\u0E1A\u0E1A"
256
- ];
257
247
  function isSessionEndingLabel(...labels) {
258
- const haystack = labels.filter(Boolean).join(" ").toLowerCase();
259
- if (!haystack.trim())
260
- return false;
261
- return SESSION_ENDING_KEYWORDS.some((keyword) => haystack.includes(keyword.toLowerCase()));
248
+ void labels;
249
+ return false;
262
250
  }
263
251
  function isUnsafeAutoClick(...labels) {
264
252
  return isSessionEndingLabel(...labels);
@@ -313,6 +301,10 @@ function describeStep(step) {
313
301
  return step.target ? `Verify that ${describeTarget(step.target)} shows "${step.text}"` : `Verify that the page shows "${step.text}"`;
314
302
  case "assertUrl":
315
303
  return `Verify that the URL contains "${step.urlContains}"`;
304
+ case "assertInvalid":
305
+ return `Verify that ${describeTarget(step.target)} is invalid and the form remains open`;
306
+ case "assertValidation":
307
+ return "Wait for a visible validation or error message";
316
308
  case "manual":
317
309
  return step.description;
318
310
  }
@@ -464,6 +456,13 @@ function collectPageData() {
464
456
  options,
465
457
  required,
466
458
  disabled,
459
+ minLength: el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement ? el.minLength >= 0 ? el.minLength : void 0 : void 0,
460
+ maxLength: el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement ? el.maxLength >= 0 ? el.maxLength : void 0 : void 0,
461
+ min: el instanceof HTMLInputElement ? attr(el, "min") : void 0,
462
+ max: el instanceof HTMLInputElement ? attr(el, "max") : void 0,
463
+ step: el instanceof HTMLInputElement ? attr(el, "step") : void 0,
464
+ pattern: el instanceof HTMLInputElement ? attr(el, "pattern") : void 0,
465
+ autocomplete: attr(el, "autocomplete"),
467
466
  cssSelector: cssSelector(el),
468
467
  contextText: contextText || void 0,
469
468
  contextSelector: context ? cssSelector(context) : void 0,
@@ -1548,6 +1547,7 @@ function recorderInitScript() {
1548
1547
  marker.__lazyscoutRecorderReady = true;
1549
1548
  const CLICKABLE = 'a,button,input,select,textarea,[role="button"],[role="link"],[role="tab"],[role="menuitem"],[role="checkbox"],[role="radio"],[role="option"]';
1550
1549
  const NON_TEXT_INPUTS = ["button", "submit", "reset", "checkbox", "radio", "file", "image"];
1550
+ const inspectState = window;
1551
1551
  const send = (event) => {
1552
1552
  try {
1553
1553
  void scope.__lazyscoutRecord?.(event);
@@ -1662,16 +1662,86 @@ function recorderInitScript() {
1662
1662
  };
1663
1663
  const targetOf = (element) => {
1664
1664
  const role = roleOf(element);
1665
- return {
1665
+ const name = accessibleName(element);
1666
+ const matches = role && name ? Array.from(document.querySelectorAll(CLICKABLE)).filter((candidate) => roleOf(candidate) === role && accessibleName(candidate)?.localeCompare(name, void 0, { sensitivity: "accent" }) === 0) : [];
1667
+ const target = {
1666
1668
  role,
1667
- name: accessibleName(element),
1669
+ name,
1668
1670
  // Only offer text matching where there is no role to match on.
1669
1671
  text: role ? void 0 : clean(element.textContent) || void 0,
1670
1672
  label: labelOf2(element),
1671
1673
  placeholder: clean(element.getAttribute("placeholder")) || void 0,
1672
1674
  cssSelector: cssPath(element)
1673
1675
  };
1676
+ return matches.length > 1 ? { ...target, matchCount: matches.length } : target;
1677
+ };
1678
+ const inspectionOf = (element, locked) => {
1679
+ const target = targetOf(element);
1680
+ const playwrightLocator = target.role && target.name ? `page.getByRole(${JSON.stringify(target.role)}, { name: ${JSON.stringify(target.name)}, exact: true })` : `page.locator(${JSON.stringify(target.cssSelector)})`;
1681
+ return {
1682
+ locked,
1683
+ tagName: element.tagName.toLowerCase(),
1684
+ role: target.role,
1685
+ accessibleName: target.name,
1686
+ text: clean(element.textContent) || void 0,
1687
+ id: element.getAttribute("id") || void 0,
1688
+ name: element.getAttribute("name") || void 0,
1689
+ cssSelector: target.cssSelector,
1690
+ playwrightLocator
1691
+ };
1674
1692
  };
1693
+ const clearInspectHighlight = () => {
1694
+ const previous = inspectState.__lazyscoutInspectTarget;
1695
+ if (previous)
1696
+ previous.removeAttribute("data-lazyscout-inspect");
1697
+ inspectState.__lazyscoutInspectTarget = void 0;
1698
+ };
1699
+ const inspectCandidate = (origin) => {
1700
+ const interactive = origin.closest(CLICKABLE);
1701
+ if (interactive)
1702
+ return interactive;
1703
+ const directText = clean(Array.from(origin.childNodes).filter((node) => node.nodeType === Node.TEXT_NODE).map((node) => node.textContent ?? "").join(" "));
1704
+ const hasStableIdentity = Boolean(origin.id || origin.getAttribute("name") || origin.getAttribute("data-testid") || origin.getAttribute("aria-label") || origin.getAttribute("title"));
1705
+ return directText || hasStableIdentity || getComputedStyle(origin).cursor === "pointer" ? origin : void 0;
1706
+ };
1707
+ const inspect = (element, locked) => {
1708
+ if (!document.querySelector("[data-lazyscout-inspect-style]")) {
1709
+ const style = document.createElement("style");
1710
+ style.setAttribute("data-lazyscout-inspect-style", "true");
1711
+ style.textContent = '[data-lazyscout-inspect="true"]{outline:3px solid #7c3aed !important;outline-offset:3px !important;cursor:crosshair !important;}';
1712
+ document.documentElement.appendChild(style);
1713
+ }
1714
+ clearInspectHighlight();
1715
+ element.setAttribute("data-lazyscout-inspect", "true");
1716
+ inspectState.__lazyscoutInspectTarget = element;
1717
+ inspectState.__lazyscoutInspectLocked = locked;
1718
+ send({ kind: "inspect", inspection: inspectionOf(element, locked) });
1719
+ };
1720
+ document.addEventListener("pointerover", (event) => {
1721
+ if (!inspectState.__lazyscoutInspectMode)
1722
+ return;
1723
+ if (inspectState.__lazyscoutInspectLocked)
1724
+ return;
1725
+ const origin = event.target instanceof Element ? event.target : null;
1726
+ const element = origin ? inspectCandidate(origin) : void 0;
1727
+ if (element)
1728
+ inspect(element, false);
1729
+ }, true);
1730
+ document.addEventListener("click", (event) => {
1731
+ if (!inspectState.__lazyscoutInspectMode)
1732
+ return;
1733
+ const origin = event.target instanceof Element ? event.target : null;
1734
+ event.preventDefault();
1735
+ event.stopImmediatePropagation();
1736
+ const element = origin ? inspectCandidate(origin) : void 0;
1737
+ if (element) {
1738
+ inspect(element, true);
1739
+ return;
1740
+ }
1741
+ clearInspectHighlight();
1742
+ inspectState.__lazyscoutInspectLocked = false;
1743
+ send({ kind: "inspect" });
1744
+ }, true);
1675
1745
  document.addEventListener("click", (event) => {
1676
1746
  const origin = event.target instanceof Element ? event.target : null;
1677
1747
  const element = origin?.closest(CLICKABLE);
@@ -1774,6 +1844,8 @@ function compactTarget(target) {
1774
1844
  return Object.fromEntries(entries);
1775
1845
  }
1776
1846
  function buildStep(event) {
1847
+ if (event.kind === "inspect")
1848
+ return void 0;
1777
1849
  const target = compactTarget(event.target);
1778
1850
  if (event.kind === "click")
1779
1851
  return { type: "click", target };
@@ -1793,14 +1865,18 @@ async function attachRecorder(context, startUrl, options = {}) {
1793
1865
  ended = true;
1794
1866
  options.onEnded?.();
1795
1867
  };
1796
- const pushNavigate = (url) => {
1797
- if (!url || url === "about:blank" || url === lastUrl)
1868
+ const pushNavigate = (url, force = false) => {
1869
+ if (!url || url === "about:blank" || !force && sameNavigationUrl(url, lastUrl))
1798
1870
  return;
1799
1871
  lastUrl = url;
1800
1872
  if (steps.length < MAX_RECORDED_STEPS)
1801
1873
  steps.push({ type: "navigate", url });
1802
1874
  };
1803
1875
  const record = (event) => {
1876
+ if (event.kind === "inspect") {
1877
+ options.onInspection?.(event.inspection);
1878
+ return;
1879
+ }
1804
1880
  if (steps.length >= MAX_RECORDED_STEPS)
1805
1881
  return;
1806
1882
  pushNavigate(event.url);
@@ -1808,7 +1884,7 @@ async function attachRecorder(context, startUrl, options = {}) {
1808
1884
  if (!step)
1809
1885
  return;
1810
1886
  const previous = steps[steps.length - 1];
1811
- if (step.type === "fill" && previous && previous.type === "fill" && sameTarget(previous.target, step.target) && previous.value !== SECRET_PLACEHOLDER) {
1887
+ if (step.type === "fill" && previous && previous.type === "fill" && sameTarget(previous.target, step.target)) {
1812
1888
  steps[steps.length - 1] = step;
1813
1889
  return;
1814
1890
  }
@@ -1820,6 +1896,26 @@ async function attachRecorder(context, startUrl, options = {}) {
1820
1896
  } catch {
1821
1897
  }
1822
1898
  });
1899
+ const setInspectMode = async (enabled) => {
1900
+ await context.addInitScript((value) => {
1901
+ const state = window;
1902
+ state.__lazyscoutInspectMode = value;
1903
+ if (!value) {
1904
+ state.__lazyscoutInspectLocked = false;
1905
+ state.__lazyscoutInspectTarget = void 0;
1906
+ document.querySelectorAll("[data-lazyscout-inspect]").forEach((element) => element.removeAttribute("data-lazyscout-inspect"));
1907
+ }
1908
+ }, enabled);
1909
+ await Promise.all(context.pages().map((page) => page.evaluate((value) => {
1910
+ const state = window;
1911
+ state.__lazyscoutInspectMode = value;
1912
+ if (!value) {
1913
+ state.__lazyscoutInspectLocked = false;
1914
+ state.__lazyscoutInspectTarget = void 0;
1915
+ document.querySelectorAll("[data-lazyscout-inspect]").forEach((element) => element.removeAttribute("data-lazyscout-inspect"));
1916
+ }
1917
+ }, enabled)));
1918
+ };
1823
1919
  await context.addInitScript(recorderInitScript);
1824
1920
  const inject = (page) => {
1825
1921
  void page.evaluate(recorderInitScript).catch(() => void 0);
@@ -1850,9 +1946,18 @@ async function attachRecorder(context, startUrl, options = {}) {
1850
1946
  const closing = closingAssertion(lastUrl, finalUrl);
1851
1947
  return closing ? [...steps, closing] : steps.slice();
1852
1948
  },
1853
- currentUrl: () => lastUrl
1949
+ currentUrl: () => lastUrl,
1950
+ recordNavigation: pushNavigate,
1951
+ setInspectMode
1854
1952
  };
1855
1953
  }
1954
+ function sameNavigationUrl(left, right) {
1955
+ try {
1956
+ return new URL(left).href === new URL(right).href;
1957
+ } catch {
1958
+ return left === right;
1959
+ }
1960
+ }
1856
1961
 
1857
1962
  // ../../packages/generators/dist/moduleNames.js
1858
1963
  function assignModules(pages) {
@@ -2027,7 +2132,7 @@ function interactionAction(interaction) {
2027
2132
  function requiredFieldRule(ctx, form) {
2028
2133
  const submit = form.submitButtons.find((button) => !button.disabled);
2029
2134
  const fields = form.fields.filter(isUsable);
2030
- const testableFields = fields.filter((field) => !isToggleField(field)).slice(0, 5);
2135
+ const testableFields = fields.filter((field) => !isToggleField(field)).slice(0, 12);
2031
2136
  if (!submit || testableFields.length === 0)
2032
2137
  return [];
2033
2138
  return testableFields.map((field) => {
@@ -2037,21 +2142,280 @@ function requiredFieldRule(ctx, form) {
2037
2142
  continue;
2038
2143
  steps.push(fillFieldStep(other));
2039
2144
  }
2040
- steps.push({
2041
- type: "manual",
2042
- description: `Leave "${labelOf(field)}" empty`
2043
- });
2044
- steps.push({ type: "click", target: toTargetRef(submit) });
2145
+ if (field.required) {
2146
+ steps.push({ type: "click", target: toTargetRef(submit) });
2147
+ steps.push({
2148
+ type: "assertInvalid",
2149
+ target: toTargetRef(field),
2150
+ description: `Verify that "${labelOf(field)}" is invalid and the form is not submitted`
2151
+ });
2152
+ } else {
2153
+ steps.push({
2154
+ type: "manual",
2155
+ description: `Verify whether "${labelOf(field)}" may be empty according to the product requirement`
2156
+ });
2157
+ }
2045
2158
  return build(ctx, {
2046
- title: `${labelOf(field)} is required`,
2159
+ title: field.required ? `${labelOf(field)} is required` : `${labelOf(field)} handles empty input`,
2047
2160
  preconditions: precondition(ctx.page),
2048
2161
  steps,
2049
- expectedResult: field.required ? "Verify that a validation message is displayed for the empty required field, and the form is not submitted." : UNKNOWN_BEHAVIOUR,
2162
+ expectedResult: field.required ? "A required-field validation is displayed and the form is not submitted." : `${labelOf(field)} accepts or rejects empty input according to the product requirement.`,
2050
2163
  type: "validation",
2051
2164
  priority: field.required ? "high" : "medium",
2165
+ automationStatus: field.required ? "ready" : "needs-review",
2166
+ tags: ["validation", field.required ? "required" : "empty-input"],
2167
+ notes: field.required ? 'Evidence: the field has the HTML "required" attribute. Playwright waits for the field to become invalid.' : "No required attribute was detected. Confirm whether an empty value is allowed before automating submission."
2168
+ });
2169
+ });
2170
+ }
2171
+ function validationMatrixRule(ctx, form) {
2172
+ const submit = form.submitButtons.find((button) => !button.disabled && !button.destructive);
2173
+ const fields = form.fields.filter(isUsable);
2174
+ if (!submit)
2175
+ return [];
2176
+ const cases = [];
2177
+ for (const field of fields.slice(0, 12)) {
2178
+ for (const scenario of validationScenarios(field).slice(0, 8)) {
2179
+ const steps = [navigateStep(ctx.page)];
2180
+ for (const other of fields) {
2181
+ if (other === field)
2182
+ continue;
2183
+ steps.push(fillFieldStep(other));
2184
+ }
2185
+ steps.push({ type: "fill", target: toTargetRef(field), value: scenario.value });
2186
+ steps.push({ type: "click", target: toTargetRef(submit) });
2187
+ if (scenario.manualCheck) {
2188
+ steps.push({ type: "wait", mode: "timeout", value: "750" });
2189
+ steps.push({ type: "manual", description: scenario.manualCheck });
2190
+ } else {
2191
+ steps.push({ type: "assertInvalid", target: toTargetRef(field) });
2192
+ }
2193
+ cases.push(build(ctx, {
2194
+ title: `${labelOf(field)} ${scenario.title}`,
2195
+ preconditions: precondition(ctx.page),
2196
+ steps,
2197
+ expectedResult: scenario.expectedResult,
2198
+ type: "validation",
2199
+ priority: "high",
2200
+ automationStatus: scenario.automationStatus ?? "ready",
2201
+ tags: ["validation", "generated-matrix"],
2202
+ notes: scenario.notes
2203
+ }));
2204
+ }
2205
+ }
2206
+ return cases;
2207
+ }
2208
+ function loginFailureRule(ctx, form) {
2209
+ const submit = form.submitButtons.find((button) => !button.disabled && !button.destructive);
2210
+ const fields = form.fields.filter(isUsable);
2211
+ if (!submit || !isLoginForm(ctx.page, form, fields, submit))
2212
+ return [];
2213
+ const username = fields.find((field) => {
2214
+ const hint = `${field.name ?? ""} ${field.accessibleName} ${field.autocomplete ?? ""}`.toLowerCase();
2215
+ return /username|user name|email|อีเมล|ชื่อผู้ใช้/.test(hint) && field.inputType !== "password";
2216
+ });
2217
+ const password = fields.find((field) => field.inputType === "password");
2218
+ const scenarios = [
2219
+ username && !username.required && {
2220
+ field: username,
2221
+ value: "",
2222
+ title: "Reject empty username",
2223
+ expected: "The application keeps the user signed out and displays a username validation error."
2224
+ },
2225
+ password && !password.required && {
2226
+ field: password,
2227
+ value: "",
2228
+ title: "Reject empty password",
2229
+ expected: "The application keeps the user signed out and displays a password validation error."
2230
+ },
2231
+ username && {
2232
+ field: username,
2233
+ value: username.inputType === "email" ? "lazyscout.invalid@example.com" : "lazyscout-invalid-user",
2234
+ title: "Reject invalid username",
2235
+ expected: "The application keeps the user signed out and displays an authentication error."
2236
+ },
2237
+ password && {
2238
+ field: password,
2239
+ value: "LazyScout-Wrong-Password-123!",
2240
+ title: "Reject invalid password",
2241
+ expected: "The application keeps the user signed out and displays an authentication error."
2242
+ }
2243
+ ].filter(Boolean);
2244
+ return scenarios.map((scenario) => {
2245
+ const steps = [navigateStep(ctx.page)];
2246
+ for (const field of fields) {
2247
+ steps.push(field === scenario.field ? { type: "fill", target: toTargetRef(field), value: scenario.value } : fillFieldStep(field));
2248
+ }
2249
+ steps.push({ type: "click", target: toTargetRef(submit) });
2250
+ steps.push({ type: "assertValidation" });
2251
+ return build(ctx, {
2252
+ title: scenario.title,
2253
+ preconditions: [
2254
+ ...precondition(ctx.page),
2255
+ "Use a test environment where failed logins cannot lock a real account"
2256
+ ],
2257
+ steps,
2258
+ expectedResult: scenario.expected,
2259
+ type: "negative",
2260
+ priority: "high",
2261
+ automationStatus: "needs-review",
2262
+ tags: ["login", "negative", "server-validation"],
2263
+ notes: "Runs one failed login attempt only. Review the observed server message before marking this case ready."
2264
+ });
2265
+ });
2266
+ }
2267
+ function validationScenarios(field) {
2268
+ if (field.kind === "select" || isToggleField(field))
2269
+ return [];
2270
+ const label = labelOf(field);
2271
+ const scenarios = [];
2272
+ if (field.inputType === "email")
2273
+ scenarios.push({
2274
+ title: "rejects an invalid email format",
2275
+ value: "invalid-email",
2276
+ expectedResult: `${label} is marked invalid and the form is not submitted.`,
2277
+ notes: 'Generated from input type="email".'
2278
+ });
2279
+ if (field.inputType === "url")
2280
+ scenarios.push({
2281
+ title: "rejects an invalid URL format",
2282
+ value: "not-a-url",
2283
+ expectedResult: `${label} is marked invalid and the form is not submitted.`,
2284
+ notes: 'Generated from input type="url".'
2285
+ });
2286
+ if (field.required && isTextLikeField(field))
2287
+ scenarios.push({
2288
+ title: "handles whitespace-only input",
2289
+ value: " ",
2290
+ expectedResult: `${label} rejects whitespace-only input when meaningful text is required.`,
2291
+ notes: "HTML required accepts whitespace. Review this case against the product rule and the displayed message.",
2292
+ automationStatus: "needs-review",
2293
+ manualCheck: `Verify whether ${label} rejects whitespace-only input and shows the correct validation message`
2294
+ });
2295
+ if (isUsernameField(field)) {
2296
+ scenarios.push({
2297
+ title: "handles characters from another writing system",
2298
+ value: "\u0E1C\u0E39\u0E49\u0E43\u0E0A\u0E49\u0E17\u0E14\u0E2A\u0E2D\u0E1A",
2299
+ expectedResult: `${label} accepts or rejects characters from another writing system according to the username policy.`,
2300
+ notes: "No username character policy is inferred unless the HTML exposes a pattern. Review the result against requirements.",
2301
+ automationStatus: "needs-review",
2302
+ manualCheck: `Verify the username character policy and the validation message shown for ${label}`
2303
+ }, {
2304
+ title: "handles special characters",
2305
+ value: "user!@#$",
2306
+ expectedResult: `${label} accepts or rejects special characters according to the username policy.`,
2307
+ notes: "Generated as a business-rule review because HTML may not expose the server username policy.",
2308
+ automationStatus: "needs-review",
2309
+ manualCheck: `Verify whether ${label} permits special characters and shows the correct validation message`
2310
+ });
2311
+ }
2312
+ if (field.minLength && field.minLength > 0)
2313
+ scenarios.push({
2314
+ title: `rejects fewer than ${field.minLength} characters`,
2315
+ value: "a".repeat(Math.max(0, field.minLength - 1)),
2316
+ expectedResult: `${label} remains invalid below the minimum length of ${field.minLength}.`,
2317
+ notes: `Generated from minlength="${field.minLength}".`
2318
+ });
2319
+ if (field.pattern) {
2320
+ const mismatch = patternMismatch(field.pattern);
2321
+ if (mismatch)
2322
+ scenarios.push({
2323
+ title: "rejects a value outside the required pattern",
2324
+ value: mismatch,
2325
+ expectedResult: `${label} remains invalid when its pattern is not satisfied.`,
2326
+ notes: `Generated from pattern="${field.pattern}".`
2327
+ });
2328
+ }
2329
+ if (field.inputType === "number" && field.min !== void 0) {
2330
+ const min = Number(field.min);
2331
+ if (Number.isFinite(min))
2332
+ scenarios.push({
2333
+ title: `rejects a value below ${field.min}`,
2334
+ value: String(min - 1),
2335
+ expectedResult: `${label} remains invalid below the minimum value ${field.min}.`,
2336
+ notes: `Generated from min="${field.min}".`
2337
+ });
2338
+ }
2339
+ if (field.inputType === "number" && field.max !== void 0) {
2340
+ const max = Number(field.max);
2341
+ if (Number.isFinite(max))
2342
+ scenarios.push({
2343
+ title: `rejects a value above ${field.max}`,
2344
+ value: String(max + 1),
2345
+ expectedResult: `${label} remains invalid above the maximum value ${field.max}.`,
2346
+ notes: `Generated from max="${field.max}".`
2347
+ });
2348
+ }
2349
+ if (field.maxLength && field.maxLength > 0)
2350
+ scenarios.push({
2351
+ title: `handles more than ${field.maxLength} characters`,
2352
+ value: "A".repeat(Math.min(field.maxLength + 1, 256)),
2353
+ expectedResult: `${label} prevents or rejects input above ${field.maxLength} characters.`,
2354
+ notes: `Generated from maxlength="${field.maxLength}". Browser behavior can truncate typed input, so review the result.`,
2355
+ automationStatus: "needs-review",
2356
+ manualCheck: `Verify that ${label} does not accept more than ${field.maxLength} characters`
2357
+ });
2358
+ if (field.inputType === "password")
2359
+ scenarios.push(...passwordPolicyScenarios(field));
2360
+ return uniqueScenarios(scenarios);
2361
+ }
2362
+ function passwordPolicyScenarios(field) {
2363
+ const pattern = field.pattern ?? "";
2364
+ const requirements = [
2365
+ [(value) => /\[A-Z\]|\\p\{Lu\}/.test(value), "rejects a password without an uppercase letter", "lowercase123!"],
2366
+ [(value) => /\[a-z\]|\\p\{Ll\}/.test(value), "rejects a password without a lowercase letter", "UPPERCASE123!"],
2367
+ [(value) => /\\d|\[0-9\]/.test(value), "rejects a password without a number", "NoNumbersHere!"],
2368
+ [
2369
+ (value) => /\\W|special|symbol|\[[^\]]*[!@#$%^&][^\]]*\]/i.test(value),
2370
+ "rejects a password without a special character",
2371
+ "NoSpecial123"
2372
+ ]
2373
+ ];
2374
+ const scenarios = [];
2375
+ for (const [hasRequirement, title, value] of requirements) {
2376
+ if (!hasRequirement(pattern))
2377
+ continue;
2378
+ scenarios.push({
2379
+ title,
2380
+ value,
2381
+ expectedResult: `${labelOf(field)} remains invalid until the password policy is satisfied.`,
2382
+ notes: `Generated from the password pattern="${pattern}".`
2383
+ });
2384
+ }
2385
+ if (!field.minLength && !field.maxLength && !field.pattern)
2386
+ scenarios.push({
2387
+ title: "policy requires specification review",
2388
+ value: "password",
2389
+ expectedResult: "Confirm whether uppercase, lowercase, number, special-character, and length rules are required.",
2390
+ notes: "No minlength, maxlength, or pattern was found in the HTML. LazyScout does not invent a password policy.",
2052
2391
  automationStatus: "needs-review",
2053
- notes: field.required ? 'Evidence: the field has the HTML "required" attribute.' : 'No "required" attribute found \u2014 confirm with the specification whether this field is mandatory.'
2392
+ manualCheck: "Review the password policy with the product requirement and verify the displayed validation message"
2054
2393
  });
2394
+ return scenarios;
2395
+ }
2396
+ function isTextLikeField(field) {
2397
+ return !field.inputType || ["text", "search", "email", "url", "tel", "password"].includes(field.inputType);
2398
+ }
2399
+ function isUsernameField(field) {
2400
+ const hint = `${field.name ?? ""} ${field.accessibleName ?? ""} ${field.placeholder ?? ""} ${field.autocomplete ?? ""}`.toLowerCase();
2401
+ return /username|user name|ชื่อผู้ใช้/.test(hint);
2402
+ }
2403
+ function patternMismatch(pattern) {
2404
+ try {
2405
+ const expression = new RegExp(`^(?:${pattern})$`, "u");
2406
+ return ["!", "invalid", "abc", "123", "lowercase", "UPPERCASE"].find((candidate) => !expression.test(candidate));
2407
+ } catch {
2408
+ return void 0;
2409
+ }
2410
+ }
2411
+ function uniqueScenarios(scenarios) {
2412
+ const seen = /* @__PURE__ */ new Set();
2413
+ return scenarios.filter((scenario) => {
2414
+ const key = `${scenario.title}|${scenario.value}`;
2415
+ if (seen.has(key))
2416
+ return false;
2417
+ seen.add(key);
2418
+ return true;
2055
2419
  });
2056
2420
  }
2057
2421
  function formSubmitRule(ctx, form) {
@@ -2166,7 +2530,7 @@ function destructiveActionRule(ctx) {
2166
2530
 
2167
2531
  // ../../packages/generators/dist/testcases/generateTestCases.js
2168
2532
  var DEFAULT_GENERATE_OPTIONS = {
2169
- maxTestCasesPerPage: 15,
2533
+ maxTestCasesPerPage: 120,
2170
2534
  language: "en"
2171
2535
  };
2172
2536
  function generateTestCases(pages, options = {}) {
@@ -2185,6 +2549,8 @@ function generateTestCases(pages, options = {}) {
2185
2549
  const fromPage = [
2186
2550
  ...pageStructureRule(context),
2187
2551
  ...page.forms.flatMap((form) => requiredFieldRule(context, form)),
2552
+ ...page.forms.flatMap((form) => validationMatrixRule(context, form)),
2553
+ ...page.forms.flatMap((form) => loginFailureRule(context, form)),
2188
2554
  ...page.forms.flatMap((form) => formSubmitRule(context, form)),
2189
2555
  ...interactionRule(context),
2190
2556
  ...navigationRule(context),
@@ -2221,19 +2587,23 @@ function translateStep(step) {
2221
2587
  case "check":
2222
2588
  return `${step.checked ? "Check" : "Uncheck"} ${step.target.name ?? step.target.label ?? "element"}`;
2223
2589
  case "wait":
2224
- return `Wait for ${step.mode}: ${step.value}`;
2590
+ return `\u0E23\u0E2D ${step.mode}: ${step.value}`;
2225
2591
  case "assertVisible":
2226
2592
  return `\u0E15\u0E23\u0E27\u0E08\u0E2A\u0E2D\u0E1A\u0E27\u0E48\u0E32 ${step.target.name ?? step.target.label ?? "element"} \u0E41\u0E2A\u0E14\u0E07\u0E2D\u0E22\u0E39\u0E48`;
2227
2593
  case "assertText":
2228
2594
  return step.target ? `\u0E15\u0E23\u0E27\u0E08\u0E2A\u0E2D\u0E1A\u0E27\u0E48\u0E32 ${step.target.name ?? step.target.label ?? "element"} \u0E41\u0E2A\u0E14\u0E07\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21 "${step.text}"` : `\u0E15\u0E23\u0E27\u0E08\u0E2A\u0E2D\u0E1A\u0E27\u0E48\u0E32\u0E2B\u0E19\u0E49\u0E32\u0E40\u0E27\u0E47\u0E1A\u0E41\u0E2A\u0E14\u0E07\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21 "${step.text}"`;
2229
2595
  case "assertUrl":
2230
2596
  return `\u0E15\u0E23\u0E27\u0E08\u0E2A\u0E2D\u0E1A\u0E27\u0E48\u0E32 URL \u0E21\u0E35\u0E04\u0E33\u0E27\u0E48\u0E32 "${step.urlContains}"`;
2597
+ case "assertInvalid":
2598
+ return `\u0E15\u0E23\u0E27\u0E08\u0E2A\u0E2D\u0E1A\u0E27\u0E48\u0E32 ${step.target.name ?? step.target.label ?? "\u0E0A\u0E48\u0E2D\u0E07\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25"} \u0E44\u0E21\u0E48\u0E1C\u0E48\u0E32\u0E19 validation \u0E41\u0E25\u0E30\u0E1F\u0E2D\u0E23\u0E4C\u0E21\u0E22\u0E31\u0E07\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E2A\u0E48\u0E07`;
2599
+ case "assertValidation":
2600
+ return "\u0E23\u0E2D\u0E08\u0E19\u0E01\u0E27\u0E48\u0E32\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21 validation \u0E2B\u0E23\u0E37\u0E2D error \u0E08\u0E30\u0E41\u0E2A\u0E14\u0E07\u0E02\u0E36\u0E49\u0E19\u0E21\u0E32";
2231
2601
  case "manual":
2232
2602
  return step.description;
2233
2603
  }
2234
2604
  }
2235
2605
  function translate(value) {
2236
- 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');
2606
+ 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(/^(.+) handles empty input$/, "$1 \u0E15\u0E23\u0E27\u0E08\u0E2A\u0E2D\u0E1A\u0E01\u0E32\u0E23\u0E40\u0E27\u0E49\u0E19\u0E27\u0E48\u0E32\u0E07").replace(/^(.+) rejects an invalid email format$/, "$1 \u0E44\u0E21\u0E48\u0E22\u0E2D\u0E21\u0E23\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E2D\u0E35\u0E40\u0E21\u0E25\u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07").replace(/^(.+) rejects an invalid URL format$/, "$1 \u0E44\u0E21\u0E48\u0E22\u0E2D\u0E21\u0E23\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A URL \u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07").replace(/^(.+) handles whitespace-only input$/, "$1 \u0E15\u0E23\u0E27\u0E08\u0E2A\u0E2D\u0E1A\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E21\u0E35\u0E41\u0E15\u0E48\u0E0A\u0E48\u0E2D\u0E07\u0E27\u0E48\u0E32\u0E07").replace(/^(.+) handles characters from another writing system$/, "$1 \u0E15\u0E23\u0E27\u0E08\u0E2A\u0E2D\u0E1A\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23\u0E08\u0E32\u0E01\u0E20\u0E32\u0E29\u0E32\u0E2D\u0E37\u0E48\u0E19").replace(/^(.+) handles special characters$/, "$1 \u0E15\u0E23\u0E27\u0E08\u0E2A\u0E2D\u0E1A\u0E2D\u0E31\u0E01\u0E02\u0E23\u0E30\u0E1E\u0E34\u0E40\u0E28\u0E29").replace(/^(.+) rejects fewer than (\d+) characters$/, "$1 \u0E44\u0E21\u0E48\u0E22\u0E2D\u0E21\u0E23\u0E31\u0E1A\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E2A\u0E31\u0E49\u0E19\u0E01\u0E27\u0E48\u0E32 $2 \u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23").replace(/^(.+) rejects a value outside the required pattern$/, "$1 \u0E44\u0E21\u0E48\u0E22\u0E2D\u0E21\u0E23\u0E31\u0E1A\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E15\u0E23\u0E07 Pattern").replace(/^(.+) rejects a value below (.+)$/, "$1 \u0E44\u0E21\u0E48\u0E22\u0E2D\u0E21\u0E23\u0E31\u0E1A\u0E04\u0E48\u0E32\u0E17\u0E35\u0E48\u0E15\u0E48\u0E33\u0E01\u0E27\u0E48\u0E32 $2").replace(/^(.+) rejects a value above (.+)$/, "$1 \u0E44\u0E21\u0E48\u0E22\u0E2D\u0E21\u0E23\u0E31\u0E1A\u0E04\u0E48\u0E32\u0E17\u0E35\u0E48\u0E2A\u0E39\u0E07\u0E01\u0E27\u0E48\u0E32 $2").replace(/^(.+) handles more than (\d+) characters$/, "$1 \u0E08\u0E31\u0E14\u0E01\u0E32\u0E23\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E22\u0E32\u0E27\u0E40\u0E01\u0E34\u0E19 $2 \u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23").replace(/^(.+) rejects a password without an uppercase letter$/, "$1 \u0E44\u0E21\u0E48\u0E22\u0E2D\u0E21\u0E23\u0E31\u0E1A\u0E23\u0E2B\u0E31\u0E2A\u0E1C\u0E48\u0E32\u0E19\u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E21\u0E35\u0E15\u0E31\u0E27\u0E1E\u0E34\u0E21\u0E1E\u0E4C\u0E43\u0E2B\u0E0D\u0E48").replace(/^(.+) rejects a password without a lowercase letter$/, "$1 \u0E44\u0E21\u0E48\u0E22\u0E2D\u0E21\u0E23\u0E31\u0E1A\u0E23\u0E2B\u0E31\u0E2A\u0E1C\u0E48\u0E32\u0E19\u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E21\u0E35\u0E15\u0E31\u0E27\u0E1E\u0E34\u0E21\u0E1E\u0E4C\u0E40\u0E25\u0E47\u0E01").replace(/^(.+) rejects a password without a number$/, "$1 \u0E44\u0E21\u0E48\u0E22\u0E2D\u0E21\u0E23\u0E31\u0E1A\u0E23\u0E2B\u0E31\u0E2A\u0E1C\u0E48\u0E32\u0E19\u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E21\u0E35\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02").replace(/^(.+) rejects a password without a special character$/, "$1 \u0E44\u0E21\u0E48\u0E22\u0E2D\u0E21\u0E23\u0E31\u0E1A\u0E23\u0E2B\u0E31\u0E2A\u0E1C\u0E48\u0E32\u0E19\u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E21\u0E35\u0E2D\u0E31\u0E01\u0E02\u0E23\u0E30\u0E1E\u0E34\u0E40\u0E28\u0E29").replace(/^(.+) policy requires specification review$/, "\u0E15\u0E23\u0E27\u0E08\u0E2A\u0E2D\u0E1A\u0E02\u0E49\u0E2D\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E02\u0E2D\u0E07 $1").replace(/^Reject invalid username$/, "\u0E44\u0E21\u0E48\u0E22\u0E2D\u0E21\u0E23\u0E31\u0E1A Username \u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07").replace(/^Reject invalid password$/, "\u0E44\u0E21\u0E48\u0E22\u0E2D\u0E21\u0E23\u0E31\u0E1A Password \u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07").replace(/^Reject empty username$/, "\u0E44\u0E21\u0E48\u0E22\u0E2D\u0E21\u0E23\u0E31\u0E1A Username \u0E17\u0E35\u0E48\u0E40\u0E27\u0E49\u0E19\u0E27\u0E48\u0E32\u0E07").replace(/^Reject empty password$/, "\u0E44\u0E21\u0E48\u0E22\u0E2D\u0E21\u0E23\u0E31\u0E1A Password \u0E17\u0E35\u0E48\u0E40\u0E27\u0E49\u0E19\u0E27\u0E48\u0E32\u0E07").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(/^Use a test environment where failed logins cannot lock a real account$/, "\u0E43\u0E0A\u0E49 Test environment \u0E17\u0E35\u0E48\u0E01\u0E32\u0E23 Login \u0E1C\u0E34\u0E14\u0E08\u0E30\u0E44\u0E21\u0E48\u0E25\u0E47\u0E2D\u0E01\u0E1A\u0E31\u0E0D\u0E0A\u0E35\u0E08\u0E23\u0E34\u0E07").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 whether "(.+)" may be empty according to the product requirement$/, '\u0E15\u0E23\u0E27\u0E08\u0E2A\u0E2D\u0E1A\u0E27\u0E48\u0E32 "$1" \u0E2A\u0E32\u0E21\u0E32\u0E23\u0E16\u0E40\u0E27\u0E49\u0E19\u0E27\u0E48\u0E32\u0E07\u0E44\u0E14\u0E49\u0E15\u0E32\u0E21\u0E02\u0E49\u0E2D\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E02\u0E2D\u0E07\u0E1C\u0E25\u0E34\u0E15\u0E20\u0E31\u0E13\u0E11\u0E4C\u0E2B\u0E23\u0E37\u0E2D\u0E44\u0E21\u0E48').replace(/^Verify whether (.+) rejects whitespace-only input and shows the correct validation message$/, "\u0E15\u0E23\u0E27\u0E08\u0E2A\u0E2D\u0E1A\u0E27\u0E48\u0E32 $1 \u0E44\u0E21\u0E48\u0E22\u0E2D\u0E21\u0E23\u0E31\u0E1A\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E21\u0E35\u0E41\u0E15\u0E48\u0E0A\u0E48\u0E2D\u0E07\u0E27\u0E48\u0E32\u0E07\u0E41\u0E25\u0E30\u0E41\u0E2A\u0E14\u0E07\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21 Validation \u0E17\u0E35\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07").replace(/^Verify the username character policy and the validation message shown for (.+)$/, "\u0E15\u0E23\u0E27\u0E08\u0E2A\u0E2D\u0E1A\u0E19\u0E42\u0E22\u0E1A\u0E32\u0E22\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23 Username \u0E41\u0E25\u0E30\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21 Validation \u0E17\u0E35\u0E48\u0E41\u0E2A\u0E14\u0E07\u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A $1").replace(/^Verify whether (.+) permits special characters and shows the correct validation message$/, "\u0E15\u0E23\u0E27\u0E08\u0E2A\u0E2D\u0E1A\u0E27\u0E48\u0E32 $1 \u0E22\u0E2D\u0E21\u0E23\u0E31\u0E1A\u0E2D\u0E31\u0E01\u0E02\u0E23\u0E30\u0E1E\u0E34\u0E40\u0E28\u0E29\u0E2B\u0E23\u0E37\u0E2D\u0E44\u0E21\u0E48\u0E41\u0E25\u0E30\u0E41\u0E2A\u0E14\u0E07\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21 Validation \u0E17\u0E35\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07").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(/^A required-field validation is displayed and the form is not submitted\.$/, "\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21 validation \u0E02\u0E2D\u0E07\u0E0A\u0E48\u0E2D\u0E07\u0E17\u0E35\u0E48\u0E08\u0E33\u0E40\u0E1B\u0E47\u0E19\u0E41\u0E2A\u0E14\u0E07\u0E02\u0E36\u0E49\u0E19 \u0E41\u0E25\u0E30\u0E1F\u0E2D\u0E23\u0E4C\u0E21\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E2A\u0E48\u0E07").replace(/^(.+) accepts or rejects empty input according to the product requirement\.$/, "$1 \u0E22\u0E2D\u0E21\u0E23\u0E31\u0E1A\u0E2B\u0E23\u0E37\u0E2D\u0E44\u0E21\u0E48\u0E22\u0E2D\u0E21\u0E23\u0E31\u0E1A\u0E01\u0E32\u0E23\u0E40\u0E27\u0E49\u0E19\u0E27\u0E48\u0E32\u0E07\u0E15\u0E32\u0E21\u0E02\u0E49\u0E2D\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E02\u0E2D\u0E07\u0E1C\u0E25\u0E34\u0E15\u0E20\u0E31\u0E13\u0E11\u0E4C").replace(/^(.+) is marked invalid and the form is not submitted\.$/, "$1 \u0E16\u0E39\u0E01\u0E23\u0E30\u0E1A\u0E38\u0E27\u0E48\u0E32\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07 \u0E41\u0E25\u0E30\u0E1F\u0E2D\u0E23\u0E4C\u0E21\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E2A\u0E48\u0E07").replace(/^(.+) rejects whitespace-only input when meaningful text is required\.$/, "$1 \u0E44\u0E21\u0E48\u0E22\u0E2D\u0E21\u0E23\u0E31\u0E1A\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E21\u0E35\u0E41\u0E15\u0E48\u0E0A\u0E48\u0E2D\u0E07\u0E27\u0E48\u0E32\u0E07\u0E40\u0E21\u0E37\u0E48\u0E2D\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E0A\u0E49\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E17\u0E35\u0E48\u0E21\u0E35\u0E04\u0E27\u0E32\u0E21\u0E2B\u0E21\u0E32\u0E22").replace(/^(.+) accepts or rejects characters from another writing system according to the username policy\.$/, "$1 \u0E22\u0E2D\u0E21\u0E23\u0E31\u0E1A\u0E2B\u0E23\u0E37\u0E2D\u0E44\u0E21\u0E48\u0E22\u0E2D\u0E21\u0E23\u0E31\u0E1A\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23\u0E08\u0E32\u0E01\u0E20\u0E32\u0E29\u0E32\u0E2D\u0E37\u0E48\u0E19\u0E15\u0E32\u0E21\u0E19\u0E42\u0E22\u0E1A\u0E32\u0E22 Username").replace(/^(.+) accepts or rejects special characters according to the username policy\.$/, "$1 \u0E22\u0E2D\u0E21\u0E23\u0E31\u0E1A\u0E2B\u0E23\u0E37\u0E2D\u0E44\u0E21\u0E48\u0E22\u0E2D\u0E21\u0E23\u0E31\u0E1A\u0E2D\u0E31\u0E01\u0E02\u0E23\u0E30\u0E1E\u0E34\u0E40\u0E28\u0E29\u0E15\u0E32\u0E21\u0E19\u0E42\u0E22\u0E1A\u0E32\u0E22 Username").replace(/^(.+) remains invalid below the minimum length of (\d+)\.$/, "$1 \u0E22\u0E31\u0E07\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E40\u0E21\u0E37\u0E48\u0E2D\u0E2A\u0E31\u0E49\u0E19\u0E01\u0E27\u0E48\u0E32\u0E04\u0E27\u0E32\u0E21\u0E22\u0E32\u0E27\u0E02\u0E31\u0E49\u0E19\u0E15\u0E48\u0E33 $2").replace(/^(.+) remains invalid when its pattern is not satisfied\.$/, "$1 \u0E22\u0E31\u0E07\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E40\u0E21\u0E37\u0E48\u0E2D\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E15\u0E23\u0E07 Pattern").replace(/^(.+) remains invalid below the minimum value (.+)\.$/, "$1 \u0E22\u0E31\u0E07\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E40\u0E21\u0E37\u0E48\u0E2D\u0E04\u0E48\u0E32\u0E15\u0E48\u0E33\u0E01\u0E27\u0E48\u0E32\u0E04\u0E48\u0E32\u0E02\u0E31\u0E49\u0E19\u0E15\u0E48\u0E33 $2").replace(/^(.+) remains invalid above the maximum value (.+)\.$/, "$1 \u0E22\u0E31\u0E07\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E40\u0E21\u0E37\u0E48\u0E2D\u0E04\u0E48\u0E32\u0E2A\u0E39\u0E07\u0E01\u0E27\u0E48\u0E32\u0E04\u0E48\u0E32\u0E2A\u0E39\u0E07\u0E2A\u0E38\u0E14 $2").replace(/^(.+) prevents or rejects input above (\d+) characters\.$/, "$1 \u0E1B\u0E49\u0E2D\u0E07\u0E01\u0E31\u0E19\u0E2B\u0E23\u0E37\u0E2D\u0E44\u0E21\u0E48\u0E22\u0E2D\u0E21\u0E23\u0E31\u0E1A\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E22\u0E32\u0E27\u0E40\u0E01\u0E34\u0E19 $2 \u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23").replace(/^(.+) remains invalid until the password policy is satisfied\.$/, "$1 \u0E22\u0E31\u0E07\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E08\u0E19\u0E01\u0E27\u0E48\u0E32\u0E08\u0E30\u0E1C\u0E48\u0E32\u0E19\u0E19\u0E42\u0E22\u0E1A\u0E32\u0E22\u0E23\u0E2B\u0E31\u0E2A\u0E1C\u0E48\u0E32\u0E19").replace(/^The application keeps the user signed out and displays an authentication error\.$/, "\u0E23\u0E30\u0E1A\u0E1A\u0E22\u0E31\u0E07\u0E44\u0E21\u0E48\u0E43\u0E2B\u0E49\u0E1C\u0E39\u0E49\u0E43\u0E0A\u0E49\u0E40\u0E02\u0E49\u0E32\u0E2A\u0E39\u0E48\u0E23\u0E30\u0E1A\u0E1A\u0E41\u0E25\u0E30\u0E41\u0E2A\u0E14\u0E07\u0E02\u0E49\u0E2D\u0E1C\u0E34\u0E14\u0E1E\u0E25\u0E32\u0E14\u0E01\u0E32\u0E23\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19\u0E15\u0E31\u0E27\u0E15\u0E19").replace(/^The application keeps the user signed out and displays a username validation error\.$/, "\u0E23\u0E30\u0E1A\u0E1A\u0E22\u0E31\u0E07\u0E44\u0E21\u0E48\u0E43\u0E2B\u0E49\u0E1C\u0E39\u0E49\u0E43\u0E0A\u0E49\u0E40\u0E02\u0E49\u0E32\u0E2A\u0E39\u0E48\u0E23\u0E30\u0E1A\u0E1A\u0E41\u0E25\u0E30\u0E41\u0E2A\u0E14\u0E07\u0E02\u0E49\u0E2D\u0E1C\u0E34\u0E14\u0E1E\u0E25\u0E32\u0E14\u0E02\u0E2D\u0E07 Username").replace(/^The application keeps the user signed out and displays a password validation error\.$/, "\u0E23\u0E30\u0E1A\u0E1A\u0E22\u0E31\u0E07\u0E44\u0E21\u0E48\u0E43\u0E2B\u0E49\u0E1C\u0E39\u0E49\u0E43\u0E0A\u0E49\u0E40\u0E02\u0E49\u0E32\u0E2A\u0E39\u0E48\u0E23\u0E30\u0E1A\u0E1A\u0E41\u0E25\u0E30\u0E41\u0E2A\u0E14\u0E07\u0E02\u0E49\u0E2D\u0E1C\u0E34\u0E14\u0E1E\u0E25\u0E32\u0E14\u0E02\u0E2D\u0E07 Password").replace(/^Confirm whether uppercase, lowercase, number, special-character, and length rules are required\.$/, "\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19\u0E27\u0E48\u0E32\u0E23\u0E30\u0E1A\u0E1A\u0E15\u0E49\u0E2D\u0E07\u0E1A\u0E31\u0E07\u0E04\u0E31\u0E1A\u0E15\u0E31\u0E27\u0E1E\u0E34\u0E21\u0E1E\u0E4C\u0E43\u0E2B\u0E0D\u0E48 \u0E15\u0E31\u0E27\u0E1E\u0E34\u0E21\u0E1E\u0E4C\u0E40\u0E25\u0E47\u0E01 \u0E15\u0E31\u0E27\u0E40\u0E25\u0E02 \u0E2D\u0E31\u0E01\u0E02\u0E23\u0E30\u0E1E\u0E34\u0E40\u0E28\u0E29 \u0E41\u0E25\u0E30\u0E04\u0E27\u0E32\u0E21\u0E22\u0E32\u0E27\u0E2B\u0E23\u0E37\u0E2D\u0E44\u0E21\u0E48").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(/^Evidence: the field has the HTML "required" attribute\. Playwright waits for the field to become invalid\.$/, '\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" \u0E41\u0E25\u0E30 Playwright \u0E08\u0E30\u0E23\u0E2D\u0E08\u0E19\u0E01\u0E27\u0E48\u0E32\u0E0A\u0E48\u0E2D\u0E07\u0E08\u0E30\u0E41\u0E2A\u0E14\u0E07\u0E2A\u0E16\u0E32\u0E19\u0E30\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07').replace(/^Generated from input type="(.+)"\.$/, '\u0E2A\u0E23\u0E49\u0E32\u0E07\u0E08\u0E32\u0E01 input type="$1"').replace(/^HTML required accepts whitespace\. Review this case against the product rule and the displayed message\.$/, "HTML required \u0E22\u0E2D\u0E21\u0E23\u0E31\u0E1A\u0E0A\u0E48\u0E2D\u0E07\u0E27\u0E48\u0E32\u0E07 \u0E08\u0E36\u0E07\u0E15\u0E49\u0E2D\u0E07\u0E15\u0E23\u0E27\u0E08\u0E01\u0E31\u0E1A\u0E02\u0E49\u0E2D\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E41\u0E25\u0E30\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E17\u0E35\u0E48\u0E41\u0E2A\u0E14\u0E07").replace(/^No username character policy is inferred unless the HTML exposes a pattern\. Review the result against requirements\.$/, "\u0E08\u0E30\u0E44\u0E21\u0E48\u0E40\u0E14\u0E32\u0E19\u0E42\u0E22\u0E1A\u0E32\u0E22\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23\u0E02\u0E2D\u0E07 Username \u0E16\u0E49\u0E32 HTML \u0E44\u0E21\u0E48\u0E21\u0E35 pattern \u0E01\u0E23\u0E38\u0E13\u0E32\u0E15\u0E23\u0E27\u0E08\u0E01\u0E31\u0E1A\u0E02\u0E49\u0E2D\u0E01\u0E33\u0E2B\u0E19\u0E14").replace(/^Generated as a business-rule review because HTML may not expose the server username policy\.$/, "\u0E2A\u0E23\u0E49\u0E32\u0E07\u0E40\u0E1B\u0E47\u0E19\u0E40\u0E04\u0E2A\u0E15\u0E23\u0E27\u0E08\u0E2A\u0E2D\u0E1A Business rule \u0E40\u0E1E\u0E23\u0E32\u0E30 HTML \u0E2D\u0E32\u0E08\u0E44\u0E21\u0E48\u0E40\u0E1B\u0E34\u0E14\u0E40\u0E1C\u0E22\u0E19\u0E42\u0E22\u0E1A\u0E32\u0E22 Username \u0E02\u0E2D\u0E07 Server").replace(/^Generated from minlength="(.+)"\.$/, '\u0E2A\u0E23\u0E49\u0E32\u0E07\u0E08\u0E32\u0E01 minlength="$1"').replace(/^Generated from min="(.+)"\.$/, '\u0E2A\u0E23\u0E49\u0E32\u0E07\u0E08\u0E32\u0E01 min="$1"').replace(/^Generated from max="(.+)"\.$/, '\u0E2A\u0E23\u0E49\u0E32\u0E07\u0E08\u0E32\u0E01 max="$1"').replace(/^Generated from pattern="(.+)"\.$/, '\u0E2A\u0E23\u0E49\u0E32\u0E07\u0E08\u0E32\u0E01 pattern="$1"').replace(/^Generated from the password pattern="(.+)"\.$/, '\u0E2A\u0E23\u0E49\u0E32\u0E07\u0E08\u0E32\u0E01 Password pattern="$1"').replace(/^Runs one failed login attempt only\. Review the observed server message before marking this case ready\.$/, "\u0E22\u0E34\u0E07 Login \u0E1C\u0E34\u0E14\u0E40\u0E1E\u0E35\u0E22\u0E07\u0E2B\u0E19\u0E36\u0E48\u0E07\u0E04\u0E23\u0E31\u0E49\u0E07 \u0E41\u0E25\u0E30\u0E15\u0E23\u0E27\u0E08\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E08\u0E32\u0E01 Server \u0E01\u0E48\u0E2D\u0E19\u0E40\u0E1B\u0E25\u0E35\u0E48\u0E22\u0E19\u0E40\u0E04\u0E2A\u0E40\u0E1B\u0E47\u0E19 Ready").replace(/^No minlength, maxlength, or pattern was found in the HTML\. LazyScout does not invent a password policy\.$/, "\u0E44\u0E21\u0E48\u0E1E\u0E1A minlength, maxlength \u0E2B\u0E23\u0E37\u0E2D pattern \u0E43\u0E19 HTML \u0E42\u0E14\u0E22 LazyScout \u0E08\u0E30\u0E44\u0E21\u0E48\u0E40\u0E14\u0E32\u0E19\u0E42\u0E22\u0E1A\u0E32\u0E22\u0E23\u0E2B\u0E31\u0E2A\u0E1C\u0E48\u0E32\u0E19\u0E02\u0E36\u0E49\u0E19\u0E40\u0E2D\u0E07").replace(/^No required attribute was detected\. Confirm whether an empty value is allowed before automating submission\.$/, "\u0E44\u0E21\u0E48\u0E1E\u0E1A\u0E41\u0E2D\u0E15\u0E17\u0E23\u0E34\u0E1A\u0E34\u0E27\u0E15\u0E4C required \u0E01\u0E23\u0E38\u0E13\u0E32\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19\u0E27\u0E48\u0E32\u0E2D\u0E19\u0E38\u0E0D\u0E32\u0E15\u0E43\u0E2B\u0E49\u0E40\u0E27\u0E49\u0E19\u0E27\u0E48\u0E32\u0E07\u0E2B\u0E23\u0E37\u0E2D\u0E44\u0E21\u0E48\u0E01\u0E48\u0E2D\u0E19\u0E17\u0E33 Automation \u0E2A\u0E48\u0E07\u0E1F\u0E2D\u0E23\u0E4C\u0E21").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');
2237
2607
  }
2238
2608
  function safeNormalize(url) {
2239
2609
  try {
@@ -2397,60 +2767,92 @@ function generatePlaywrightTest(testCase) {
2397
2767
  const lines = [
2398
2768
  `import { test, expect } from '@playwright/test'`,
2399
2769
  "",
2400
- `test('${quote(testCase.title)}', async ({ page }) => {`
2770
+ ...locatorResolverSource(),
2771
+ "",
2772
+ `test(${quote(testCase.title)}, async ({ page }) => {`
2401
2773
  ];
2402
2774
  for (const step of testCase.steps)
2403
2775
  lines.push(` ${playwrightStep(step)}`);
2404
2776
  lines.push("})", "");
2405
2777
  return lines.join("\n");
2406
2778
  }
2779
+ function locatorResolverSource() {
2780
+ return [
2781
+ `async function resolveTarget(candidates, description) {`,
2782
+ ` const attempts = []`,
2783
+ ` for (const [kind, candidate] of candidates) {`,
2784
+ ` const count = await candidate.count()`,
2785
+ ` if (count !== 1) {`,
2786
+ ` attempts.push(kind + ': ' + count + ' matches')`,
2787
+ ` continue`,
2788
+ ` }`,
2789
+ ` if (!(await candidate.isVisible().catch(() => false))) {`,
2790
+ ` attempts.push(kind + ': not visible')`,
2791
+ ` continue`,
2792
+ ` }`,
2793
+ ` console.log('[Locator] ' + description + ' -> ' + kind)`,
2794
+ ` return candidate`,
2795
+ ` }`,
2796
+ ` throw new Error('Could not continue at "' + description + '" because the element was not found as one visible, unique target. The page may have changed or an earlier step may have opened a different page. Technical details: ' + attempts.join('; '))`,
2797
+ `}`
2798
+ ];
2799
+ }
2407
2800
  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(${quote(target.cssSelector ?? "")})`;
2801
+ const semantic = target.role && target.name ? `page.getByRole(${quote(target.role)}, { name: ${quote(target.name)}, exact: true })` : 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
2802
  const context = target.contextTestId ? `page.getByTestId(${quote(target.contextTestId)})` : target.contextSelector ? `page.locator(${quote(target.contextSelector)})` : void 0;
2410
- const scoped = context ? target.contextText ? `${context}.filter({ hasText: ${quote(target.contextText)} }).${base.slice(5)}` : `${context}.${base.slice(5)}` : base;
2411
- return target.nth === void 0 ? scoped : `${scoped}.nth(${target.nth})`;
2803
+ const scopedSemantic = context ? target.contextText ? `${context}.filter({ hasText: ${quote(target.contextText)} }).${semantic.slice(5)}` : `${context}.${semantic.slice(5)}` : semantic;
2804
+ const primary = target.nth === void 0 ? scopedSemantic : `${scopedSemantic}.nth(${target.nth})`;
2805
+ const css = target.cssSelector ? `page.locator(${quoteCssSelector(normalizeCssSelector(target.cssSelector))})` : void 0;
2806
+ const candidates = [];
2807
+ if (target.strategy === "css" && css)
2808
+ candidates.push(["recorded CSS", css]);
2809
+ candidates.push(["semantic locator", primary]);
2810
+ if (css && !candidates.some(([, value]) => value === css))
2811
+ candidates.push(["recorded CSS", css]);
2812
+ const description = target.name ?? target.label ?? target.placeholder ?? target.text ?? target.cssSelector ?? "target";
2813
+ return `resolveTarget([${candidates.map(([kind, value]) => `[${quote(kind)}, ${value}]`).join(", ")}], ${quote(description)})`;
2412
2814
  }
2413
2815
  function playwrightStep(step) {
2414
2816
  switch (step.type) {
2415
2817
  case "navigate":
2416
2818
  return `await page.goto(${quote(step.url)})`;
2417
2819
  case "click":
2418
- return `await ${locator(step.target)}.click()`;
2820
+ return `await (await ${locator(step.target)}).click()`;
2419
2821
  case "fill":
2420
- return `await ${locator(step.target)}.fill(${quote(runtimeValue(step))})`;
2822
+ return `await (await ${locator(step.target)}).fill(${quote(step.value)})`;
2421
2823
  case "select":
2422
- return `await ${locator(step.target)}.selectOption(${quote(step.option)})`;
2824
+ return `await (await ${locator(step.target)}).selectOption(${quote(step.option)})`;
2423
2825
  case "check":
2424
- return `await ${locator(step.target)}.${step.checked ? "check" : "uncheck"}()`;
2826
+ return `await (await ${locator(step.target)}).${step.checked ? "check" : "uncheck"}()`;
2425
2827
  case "wait":
2426
2828
  if (step.mode === "timeout")
2427
2829
  return `await page.waitForTimeout(${Math.min(5e3, Math.max(0, Number(step.value) || 0))})`;
2428
2830
  if (step.mode === "url")
2429
- return `await expect(page).toHaveURL(new RegExp(${quote(step.value)}))`;
2831
+ return `await page.waitForURL(new RegExp(${quote(step.value)}))`;
2430
2832
  if (step.mode === "text")
2431
2833
  return `await expect(page).toContainText(${quote(step.value)})`;
2432
- return `await expect(${locator(step.target)}).toBeVisible()`;
2834
+ return `await expect(await ${locator(step.target)}).toBeVisible()`;
2433
2835
  case "assertVisible":
2434
- return `await expect(${locator(step.target)}).toBeVisible()`;
2836
+ return `await expect(await ${locator(step.target)}).toBeVisible()`;
2435
2837
  case "assertText":
2436
- return step.target ? `await expect(${locator(step.target)}).toContainText(${quote(step.text)})` : `await expect(page).toContainText(${quote(step.text)})`;
2838
+ return step.target ? `await expect(await ${locator(step.target)}).toContainText(${quote(step.text)})` : `await expect(page.locator('body')).toContainText(${quote(step.text)})`;
2437
2839
  case "assertUrl":
2438
2840
  return `await expect(page).toHaveURL(new RegExp(${quote(step.urlContains)}))`;
2841
+ case "assertInvalid":
2842
+ return `expect(await (await ${locator(step.target)}).evaluate((element) => element.matches(':invalid'))).toBe(true)`;
2843
+ case "assertValidation":
2844
+ return `await expect(page.locator('[role="alert"], [aria-invalid="true"], .error, .errors, .invalid-feedback, #error').filter({ visible: true }).first()).toBeVisible()`;
2439
2845
  case "manual":
2440
2846
  return `// TODO: ${step.description}`;
2441
2847
  }
2442
2848
  }
2443
- function runtimeValue(step) {
2444
- const hint = `${step.target.name ?? ""} ${step.target.label ?? ""} ${step.target.placeholder ?? ""}`.toLowerCase();
2445
- if (hint.includes("password") || hint.includes("\u0E23\u0E2B\u0E31\u0E2A\u0E1C\u0E48\u0E32\u0E19"))
2446
- return "{{TEST_PASSWORD}}";
2447
- if (hint.includes("email") || hint.includes("\u0E2D\u0E35\u0E40\u0E21\u0E25"))
2448
- return "{{TEST_EMAIL}}";
2449
- if (hint.includes("username") || hint.includes("user name") || hint.includes("\u0E0A\u0E37\u0E48\u0E2D\u0E1C\u0E39\u0E49\u0E43\u0E0A\u0E49"))
2450
- return "{{TEST_USERNAME}}";
2451
- return step.value;
2452
- }
2453
2849
  var quote = (value) => JSON.stringify(value);
2850
+ function normalizeCssSelector(value) {
2851
+ return value.replace(/\\(["'])/g, "$1");
2852
+ }
2853
+ function quoteCssSelector(value) {
2854
+ return `'${value.replace(/\\/g, "\\\\").replace(/'/g, "\\'")}'`;
2855
+ }
2454
2856
 
2455
2857
  // ../../packages/generators/dist/guidedflow/flowToTestCase.js
2456
2858
  function flowToTestCase(flow) {
@@ -2527,7 +2929,7 @@ function playwrightFlowStep(flow, step) {
2527
2929
  if (step.mode === "timeout")
2528
2930
  return `await page.waitForTimeout(${Math.min(5e3, Math.max(0, Number(step.value) || 0))})`;
2529
2931
  if (step.mode === "url")
2530
- return `await expect(page).toHaveURL(new RegExp(${JSON.stringify(step.value)}))`;
2932
+ return `await page.waitForURL(new RegExp(${JSON.stringify(step.value)}))`;
2531
2933
  if (step.mode === "text")
2532
2934
  return `await expect(page).toContainText(${JSON.stringify(step.value)})`;
2533
2935
  return `await expect(${locator2(step.target)}).toBeVisible()`;
@@ -2540,8 +2942,11 @@ function playwrightFlowStep(flow, step) {
2540
2942
  }
2541
2943
  }
2542
2944
  function locator2(target) {
2945
+ if (preferStableCss(target)) {
2946
+ return `page.locator(${quoteCssSelector2(normalizeCssSelector2(target.cssSelector ?? target.value ?? ""))})`;
2947
+ }
2543
2948
  if (target.strategy === "role" || target.role && target.name)
2544
- return `page.getByRole(${JSON.stringify(target.role ?? "generic")}, { name: ${JSON.stringify(target.name ?? target.value ?? "")}${target.exact ? ", exact: true" : ""} })`;
2949
+ return `page.getByRole(${JSON.stringify(target.role ?? "generic")}, { name: ${JSON.stringify(target.name ?? target.value ?? "")}, exact: true })`;
2545
2950
  if (target.strategy === "label" || target.label)
2546
2951
  return `page.getByLabel(${JSON.stringify(target.label ?? target.value ?? "")}, { exact: true })`;
2547
2952
  if (target.strategy === "placeholder" || target.placeholder)
@@ -2550,7 +2955,16 @@ function locator2(target) {
2550
2955
  return `page.getByTestId(${JSON.stringify(target.testId ?? target.value ?? "")})`;
2551
2956
  if (target.strategy === "text" || target.text)
2552
2957
  return `page.getByText(${JSON.stringify(target.text ?? target.value ?? "")})`;
2553
- return `page.locator(${JSON.stringify(target.cssSelector ?? target.value ?? "")})`;
2958
+ return `page.locator(${quoteCssSelector2(normalizeCssSelector2(target.cssSelector ?? target.value ?? ""))})`;
2959
+ }
2960
+ function preferStableCss(target) {
2961
+ return Boolean(target.cssSelector && (target.strategy === "css" || target.matchCount !== void 0 && target.matchCount > 1 && !target.contextSelector && !target.contextText));
2962
+ }
2963
+ function normalizeCssSelector2(value) {
2964
+ return value.replace(/\\(["'])/g, "$1");
2965
+ }
2966
+ function quoteCssSelector2(value) {
2967
+ return `'${value.replace(/\\/g, "\\\\").replace(/'/g, "\\'")}'`;
2554
2968
  }
2555
2969
 
2556
2970
  // src/commands/scan.ts
@@ -3011,7 +3425,7 @@ function registerAnalyzeRoute(app, workspaceRoot) {
3011
3425
  try {
3012
3426
  const abortController = new AbortController();
3013
3427
  let completed = false;
3014
- request.raw.once("close", () => {
3428
+ reply.raw.once("close", () => {
3015
3429
  if (!completed)
3016
3430
  abortController.abort();
3017
3431
  });
@@ -3950,26 +4364,38 @@ var RecorderSessions = class {
3950
4364
  startUrl: session.startUrl,
3951
4365
  startedAt: session.startedAt,
3952
4366
  browserLabel: session.browserLabel,
3953
- steps: session.finalSteps ?? session.handle.steps()
4367
+ currentUrl: safeDisplayUrl(this.currentPage(session)?.url() ?? session.startUrl),
4368
+ pointerCursor: session.pointerCursor,
4369
+ steps: session.finalSteps ?? session.handle.steps(),
4370
+ inspection: session.inspection
3954
4371
  };
3955
4372
  }
3956
4373
  async start(projectId, startUrl) {
3957
4374
  const launched = await this.launch(projectId);
4375
+ let session;
3958
4376
  const handle = await attachRecorder(launched.context, startUrl, {
3959
4377
  onEnded: () => {
3960
4378
  const current = this.sessions.get(projectId);
3961
4379
  if (current)
3962
4380
  void this.finish(current);
4381
+ },
4382
+ onInspection: (inspection) => {
4383
+ if (session)
4384
+ session.inspection = inspection;
3963
4385
  }
3964
4386
  });
3965
- const session = {
4387
+ session = {
3966
4388
  projectId,
3967
4389
  startUrl,
3968
4390
  startedAt: (/* @__PURE__ */ new Date()).toISOString(),
3969
4391
  browserLabel: launched.label,
4392
+ context: launched.context,
3970
4393
  handle,
3971
4394
  close: launched.close,
3972
- closed: false
4395
+ closed: false,
4396
+ inspectMode: false,
4397
+ pointerCursor: "default",
4398
+ interactionQueue: Promise.resolve()
3973
4399
  };
3974
4400
  this.sessions.set(projectId, session);
3975
4401
  const page = launched.context.pages()[0] ?? await launched.context.newPage();
@@ -3983,6 +4409,59 @@ var RecorderSessions = class {
3983
4409
  await this.finish(session);
3984
4410
  return this.state(projectId);
3985
4411
  }
4412
+ async setInspectMode(projectId, enabled) {
4413
+ const session = this.sessions.get(projectId);
4414
+ if (!session || session.closed)
4415
+ return idleRecorderState(projectId);
4416
+ await session.handle.setInspectMode(enabled);
4417
+ session.inspectMode = enabled;
4418
+ if (!enabled)
4419
+ session.inspection = void 0;
4420
+ return this.state(projectId);
4421
+ }
4422
+ async frame(projectId) {
4423
+ const session = this.runningSession(projectId);
4424
+ const page = this.currentPage(session);
4425
+ if (!page)
4426
+ throw new Error("The recorder page is not available.");
4427
+ return page.screenshot({ type: "jpeg", quality: 78, animations: "disabled", caret: "hide", timeout: 5e3 });
4428
+ }
4429
+ async interact(projectId, interaction) {
4430
+ const session = this.runningSession(projectId);
4431
+ session.interactionQueue = session.interactionQueue.catch(() => void 0).then(async () => {
4432
+ const page = this.currentPage(session);
4433
+ if (!page)
4434
+ throw new Error("The recorder page is not available.");
4435
+ if (interaction.type === "click") {
4436
+ await page.mouse.click(interaction.x, interaction.y);
4437
+ if (session.inspectMode)
4438
+ await page.waitForTimeout(25);
4439
+ } else if (interaction.type === "move") {
4440
+ await page.mouse.move(interaction.x, interaction.y);
4441
+ session.pointerCursor = await pointerCursorAt(page, interaction.x, interaction.y);
4442
+ } else if (interaction.type === "text")
4443
+ await page.keyboard.insertText(interaction.text);
4444
+ else if (interaction.type === "key")
4445
+ await page.keyboard.press(interaction.key);
4446
+ else if (interaction.type === "scroll")
4447
+ await page.mouse.wheel(interaction.deltaX, interaction.deltaY);
4448
+ else if (interaction.type === "navigate") {
4449
+ await page.goto(interaction.url, { waitUntil: "domcontentloaded" });
4450
+ session.handle.recordNavigation(page.url());
4451
+ } else if (interaction.type === "back") {
4452
+ await page.goBack({ waitUntil: "domcontentloaded" });
4453
+ session.handle.recordNavigation(page.url());
4454
+ } else if (interaction.type === "forward") {
4455
+ await page.goForward({ waitUntil: "domcontentloaded" });
4456
+ session.handle.recordNavigation(page.url());
4457
+ } else {
4458
+ await page.reload({ waitUntil: "domcontentloaded" });
4459
+ session.handle.recordNavigation(page.url(), true);
4460
+ }
4461
+ });
4462
+ await session.interactionQueue;
4463
+ return this.state(projectId);
4464
+ }
3986
4465
  /**
3987
4466
  * Forgets a session once the operator has saved or discarded it, so reopening
3988
4467
  * the panel starts a fresh recording instead of the previous one.
@@ -4005,11 +4484,45 @@ var RecorderSessions = class {
4005
4484
  session.closed = true;
4006
4485
  await session.close().catch(() => void 0);
4007
4486
  }
4487
+ runningSession(projectId) {
4488
+ const session = this.sessions.get(projectId);
4489
+ if (!session || session.closed)
4490
+ throw new Error("No recorder is running for this Project.");
4491
+ return session;
4492
+ }
4493
+ currentPage(session) {
4494
+ const pages = session.context.pages().filter((page) => !page.isClosed());
4495
+ return pages[pages.length - 1];
4496
+ }
4008
4497
  };
4498
+ async function pointerCursorAt(page, x, y) {
4499
+ return page.evaluate(`(() => {
4500
+ const element = document.elementFromPoint(${JSON.stringify(x)}, ${JSON.stringify(y)})
4501
+ if (!element) return 'default'
4502
+ const styleCursor = getComputedStyle(element).cursor
4503
+ if (['pointer', 'text', 'not-allowed', 'grab', 'crosshair'].includes(styleCursor)) return styleCursor
4504
+ const interactive = element.closest(
4505
+ 'a[href],button,select,summary,label,[role="button"],[role="link"],[role="tab"],[role="menuitem"],[role="checkbox"],[role="radio"],input[type="button"],input[type="submit"],input[type="checkbox"],input[type="radio"]'
4506
+ )
4507
+ if (interactive) return interactive.matches(':disabled,[aria-disabled="true"]') ? 'not-allowed' : 'pointer'
4508
+ const textInput = element.closest(
4509
+ 'textarea,input:not([type]),input[type="text"],input[type="email"],input[type="password"],input[type="search"],input[type="url"],input[type="tel"],input[type="number"],[contenteditable="true"]'
4510
+ )
4511
+ return textInput ? 'text' : 'default'
4512
+ })()`).catch(() => "default");
4513
+ }
4514
+ function safeDisplayUrl(value) {
4515
+ try {
4516
+ const url = new URL(value);
4517
+ return `${url.origin}${url.pathname}`;
4518
+ } catch {
4519
+ return value.split(/[?#]/, 1)[0];
4520
+ }
4521
+ }
4009
4522
 
4010
4523
  // ../server/dist/routes/recorder.js
4011
4524
  function registerRecorderRoutes(app, workspaceRoot, options = {}) {
4012
- const launch = options.launch ?? (async (projectId) => launchBrowser({ userDataDir: await browserProfileDirectory(workspaceRoot, projectId), headless: false }));
4525
+ const launch = options.launch ?? (async (projectId) => launchBrowser({ userDataDir: await browserProfileDirectory(workspaceRoot, projectId), headless: true }));
4013
4526
  const sessions = new RecorderSessions(launch);
4014
4527
  app.post("/api/recorder/:projectId/start", async (request, reply) => {
4015
4528
  const { projectId } = request.params;
@@ -4041,11 +4554,59 @@ function registerRecorderRoutes(app, workspaceRoot, options = {}) {
4041
4554
  });
4042
4555
  app.get("/api/recorder/:projectId", async (request) => sessions.state(request.params.projectId));
4043
4556
  app.post("/api/recorder/:projectId/stop", async (request, reply) => reply.send(await sessions.stop(request.params.projectId)));
4557
+ app.post("/api/recorder/:projectId/inspect", async (request, reply) => {
4558
+ const body = request.body;
4559
+ return reply.send(await sessions.setInspectMode(request.params.projectId, body?.enabled === true));
4560
+ });
4561
+ app.get("/api/recorder/:projectId/frame", async (request, reply) => {
4562
+ try {
4563
+ const frame = await sessions.frame(request.params.projectId);
4564
+ return reply.header("Content-Type", "image/jpeg").header("Cache-Control", "no-store").send(frame);
4565
+ } catch (error) {
4566
+ return reply.status(409).send({
4567
+ error: { code: "recorder-frame-unavailable", message: error instanceof Error ? error.message : String(error) }
4568
+ });
4569
+ }
4570
+ });
4571
+ app.post("/api/recorder/:projectId/interact", async (request, reply) => {
4572
+ let interaction = request.body;
4573
+ if (!isRecorderInteraction(interaction))
4574
+ return reply.status(400).send({ error: { code: "invalid-recorder-interaction", message: "Invalid interaction." } });
4575
+ if (interaction.type === "navigate") {
4576
+ const check = checkTargetUrl(interaction.url, config.urlPolicy);
4577
+ if (!check.ok)
4578
+ return reply.status(400).send({ error: { code: check.code, message: check.message } });
4579
+ interaction = { type: "navigate", url: check.url.toString() };
4580
+ }
4581
+ try {
4582
+ return reply.send(await sessions.interact(request.params.projectId, interaction));
4583
+ } catch (error) {
4584
+ return reply.status(409).send({
4585
+ error: { code: "recorder-interaction-failed", message: error instanceof Error ? error.message : String(error) }
4586
+ });
4587
+ }
4588
+ });
4044
4589
  app.delete("/api/recorder/:projectId", async (request, reply) => reply.send(await sessions.discard(request.params.projectId)));
4045
4590
  app.addHook("onClose", async () => {
4046
4591
  await sessions.closeAll();
4047
4592
  });
4048
4593
  }
4594
+ function isRecorderInteraction(value) {
4595
+ if (!value || typeof value !== "object")
4596
+ return false;
4597
+ const interaction = value;
4598
+ if (interaction.type === "click" || interaction.type === "move")
4599
+ return Number.isFinite(interaction.x) && Number.isFinite(interaction.y);
4600
+ if (interaction.type === "text")
4601
+ return typeof interaction.text === "string" && interaction.text.length <= 500;
4602
+ if (interaction.type === "key")
4603
+ return typeof interaction.key === "string" && interaction.key.length <= 80;
4604
+ if (interaction.type === "scroll")
4605
+ return Number.isFinite(interaction.deltaX) && Number.isFinite(interaction.deltaY);
4606
+ if (interaction.type === "navigate")
4607
+ return typeof interaction.url === "string" && interaction.url.length <= 2048;
4608
+ return interaction.type === "back" || interaction.type === "forward" || interaction.type === "reload";
4609
+ }
4049
4610
 
4050
4611
  // ../server/dist/routes/guidedFlowRun.js
4051
4612
  var activeRuns2 = /* @__PURE__ */ new Map();
@@ -4192,7 +4753,7 @@ async function openInBrowser(url) {
4192
4753
  }
4193
4754
 
4194
4755
  // src/version.ts
4195
- var VERSION = true ? "0.3.10" : "0.0.0-dev";
4756
+ var VERSION = true ? "0.4.1" : "0.0.0-dev";
4196
4757
 
4197
4758
  // src/commands/serve.ts
4198
4759
  var DEFAULT_PORT = 4321;