@immense/vue-pom-generator 1.0.84 → 1.0.85
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/RELEASE_NOTES.md +53 -48
- package/class-generation/index.ts +234 -26
- package/dist/class-generation/index.d.ts +13 -0
- package/dist/class-generation/index.d.ts.map +1 -1
- package/dist/eslint/index.cjs +16 -3
- package/dist/eslint/index.cjs.map +1 -1
- package/dist/eslint/index.mjs +16 -3
- package/dist/eslint/index.mjs.map +1 -1
- package/dist/eslint/no-raw-playwright-apis.d.ts.map +1 -1
- package/dist/index.cjs +143 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +143 -23
- package/dist/index.mjs.map +1 -1
- package/dist/router-introspection.d.ts +5 -0
- package/dist/router-introspection.d.ts.map +1 -1
- package/package.json +1 -1
package/RELEASE_NOTES.md
CHANGED
|
@@ -1,72 +1,77 @@
|
|
|
1
|
-
I'll
|
|
1
|
+
I'll gather more context on the changes in this release range before writing the notes.
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Git log confirms only two commits in the v1.0.84..HEAD range (no release bump commit to exclude). I
|
|
4
|
+
now have full PR context. Here are the release notes:
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
v1.0.85
|
|
6
7
|
|
|
7
8
|
Highlights
|
|
8
9
|
|
|
9
|
-
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
-
|
|
16
|
-
|
|
17
|
-
-
|
|
18
|
-
|
|
19
|
-
-
|
|
20
|
-
|
|
10
|
+
- Generated view POMs now emit a parametrized goTo(params) that drives the consumer's live Vue
|
|
11
|
+
Router at runtime via router.push({ name, params }), replacing the broken goToSelf() literal
|
|
12
|
+
template (#51)
|
|
13
|
+
- All route shapes are supported: paramless, required-param, all-optional-param, dual-route
|
|
14
|
+
overloads, and multi-param routes, with unnamed-route fallback to token substitution + page.goto
|
|
15
|
+
(#51)
|
|
16
|
+
- Cold-page navigation performs a full-load after router resolve to ensure interactive elements are
|
|
17
|
+
ready; warm-page uses pure SPA router.push with no reload (#51)
|
|
18
|
+
- router-introspection.ts now captures the Vue Router route name, enabling router.push/resolve by
|
|
19
|
+
name (#51)
|
|
20
|
+
- no-raw-playwright-apis ESLint rule now bans getByTestId as a raw locator-filter method (#49)
|
|
21
|
+
- Closes a computed-member bypass that let page["getByTestId"], page["locator"], and page["click"]
|
|
22
|
+
slip past the rule (#49)
|
|
21
23
|
|
|
22
24
|
Changes
|
|
23
25
|
|
|
24
|
-
|
|
26
|
+
Class Generation
|
|
25
27
|
|
|
26
|
-
-
|
|
27
|
-
|
|
28
|
-
-
|
|
29
|
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
|
|
28
|
+
- Replace goToSelf() with parametrized goTo(params) using router.push({ name, params }) at runtime
|
|
29
|
+
via globalThis.__appRouter (dev-gated by import.meta.env.DEV) (#51)
|
|
30
|
+
- Generate correct signatures per route shape: no-arg goTo() for paramless, goTo(params: { id })
|
|
31
|
+
for required, goTo(params?: { id? }) for all-optional, overloaded goTo()/goTo(params) for dual
|
|
32
|
+
routes, and multi-param goTo(params: { orgId; userId }) (#51)
|
|
33
|
+
- Cold-page regime: boot with page.goto("/"), waitForFunction for the router, resolve the href,
|
|
34
|
+
then full-load it to guarantee interactive readiness before force-clicks (#51)
|
|
35
|
+
- Warm-page regime: pure SPA router.push({ name, params }) with no reload (#51)
|
|
33
36
|
|
|
34
|
-
|
|
37
|
+
Router Introspection
|
|
35
38
|
|
|
36
|
-
-
|
|
37
|
-
|
|
38
|
-
casts.
|
|
39
|
-
- Added an ESLint override turning ts/method-signature-style off for playwright-types.ts to keep
|
|
40
|
-
shorthand method signatures bivariant.
|
|
41
|
-
- Promoted no-explicit-any from off to error for the test config; replaced all as any casts with
|
|
42
|
-
typed construction via tests/helpers/typed-mocks.ts (hookFn, makeElementNode, makeTransformContext,
|
|
43
|
-
makeVNodeCall, …) and tests/broad/helpers/fake-runtime.ts (MockPage/MockLocator).
|
|
39
|
+
- routeMetaEntries now include name: string | null (the Vue Router route name) for
|
|
40
|
+
router.push/resolve by name; token substitution retained only as the unnamed-route fallback (#51)
|
|
44
41
|
|
|
45
|
-
|
|
42
|
+
ESLint
|
|
43
|
+
|
|
44
|
+
- Ban getByTestId as a raw locator-filter method alongside locator, getByRole, getByText, and
|
|
45
|
+
getByLabel — callable on Page, Locator, and Frame (#49)
|
|
46
|
+
- Replace early callee.computed return with resolveMemberPropertyName, which resolves the accessed
|
|
47
|
+
name from both Identifier form (page.getByTestId) and computed string-Literal form
|
|
48
|
+
(page["getByTestId"]) (#49)
|
|
49
|
+
- Dynamic computed keys (non-Literal, e.g. obj[dynamicKey]()) remain unresolvable and are left
|
|
50
|
+
alone (#49)
|
|
51
|
+
|
|
52
|
+
Tests
|
|
46
53
|
|
|
47
|
-
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
- Updated existing tests (base-page, build-serve-parity, class-generation-coverage,
|
|
53
|
-
class-generation, existing-id-error, generated-tsc, metadata-collector, router-introspection,
|
|
54
|
-
transform, utils-coverage, utils, virtual-testids) to use typed mocks.
|
|
54
|
+
- Add TDD coverage for all goTo shapes: paramless, required, all-optional, dual-route overload, and
|
|
55
|
+
multi-param — asserting emitted signatures, cold/warm branches, routeParams construction, and
|
|
56
|
+
inlined dual-route name (#51)
|
|
57
|
+
- Add RuleTester cases for getByTestId bans (plain, on locator, with template-literal arg),
|
|
58
|
+
computed access to banned APIs, and negative cases for non-banned/dynamic computed access (#49)
|
|
55
59
|
|
|
56
60
|
Breaking Changes
|
|
57
61
|
|
|
58
|
-
|
|
59
|
-
createPomStringPattern now requires a 3rd argument (pattern kind). These are internal
|
|
60
|
-
code-generation utilities not part of the consumer-facing public API (defineVuePomGeneratorConfig /
|
|
61
|
-
vuePomGenerator), so downstream consumers are unaffected.
|
|
62
|
+
None in this release.
|
|
62
63
|
|
|
63
64
|
Pull Requests Included
|
|
64
65
|
|
|
65
|
-
- ]8;id=md-
|
|
66
|
+
- ]8;id=md-1gcu8tw;https://github.com/immense/vue-pom-generator/pull/51#51 feat: emit parametrized goTo(params) for routes with declared params]8;;]8;; (@dkattan)]8;;
|
|
67
|
+
- ]8;id=md-diaq7t;https://github.com/immense/vue-pom-generator/pull/49#49 feat(eslint): ban getByTestId and close computed-member bypass in no-raw-playwright-apis]8;;]8;; ]8;;
|
|
66
68
|
(@dkattan)
|
|
67
|
-
- ]8;id=md-ga6r5j;https://github.com/immense/vue-pom-generator/pull/47#47 — test: add broad coverage for class-generation and plugin internals]8;;]8;; (@dkattan)]8;;
|
|
68
69
|
|
|
69
70
|
Testing
|
|
70
71
|
|
|
71
|
-
|
|
72
|
+
- All 373 tests pass; npm run typecheck and npm run build are green (#51)
|
|
73
|
+
- RuleTester: 10 passed; tsc --noEmit and eslint . clean (#49)
|
|
74
|
+
- Three pre-existing DOM-environment suite failures (base-page, pointer,
|
|
75
|
+
broad/class-generation-base-page-ts) are environmental (jsdom under local vitest) and unrelated to
|
|
76
|
+
these changes (#49)
|
|
72
77
|
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
type PomStringPattern,
|
|
29
29
|
} from "../pom-patterns";
|
|
30
30
|
import { buildPomLocatorDescription, stripPomActionPrefix } from "../pom-discoverability";
|
|
31
|
-
import { introspectNuxtPages, parseRouterFileFromCwd } from "../router-introspection";
|
|
31
|
+
import { getParamToken, introspectNuxtPages, parseRouterFileFromCwd } from "../router-introspection";
|
|
32
32
|
import {
|
|
33
33
|
addExportAll,
|
|
34
34
|
addNamedImport,
|
|
@@ -108,8 +108,23 @@ function resolveRouterEntry(projectRoot?: string, routerEntry?: string) {
|
|
|
108
108
|
return path.isAbsolute(routerEntry) ? routerEntry : path.resolve(root, routerEntry);
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
+
interface RouteParamMeta {
|
|
112
|
+
name: string;
|
|
113
|
+
optional: boolean;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
interface RouteEntry {
|
|
117
|
+
/** Vue Router route `name`, when declared. Enables runtime `router.push({ name, params })`. */
|
|
118
|
+
name: string | null;
|
|
119
|
+
template: string;
|
|
120
|
+
params: RouteParamMeta[];
|
|
121
|
+
}
|
|
122
|
+
|
|
111
123
|
interface RouteMeta {
|
|
124
|
+
/** Shortest route template — used for the static `route` property. */
|
|
112
125
|
template: string;
|
|
126
|
+
/** Every route that renders this component (name + template + declared params). */
|
|
127
|
+
routes: RouteEntry[];
|
|
113
128
|
}
|
|
114
129
|
|
|
115
130
|
type CustomPomMethodSignatureMap = Map<string, PomMethodSignature>;
|
|
@@ -277,27 +292,40 @@ async function getRouteMetaByComponent(
|
|
|
277
292
|
},
|
|
278
293
|
});
|
|
279
294
|
|
|
280
|
-
const map = new Map<string,
|
|
295
|
+
const map = new Map<string, RouteEntry[]>();
|
|
281
296
|
for (const entry of routeMetaEntries) {
|
|
282
297
|
const list = map.get(entry.componentName) ?? [];
|
|
283
|
-
list.push({ template: entry.pathTemplate });
|
|
298
|
+
list.push({ name: entry.name, template: entry.pathTemplate, params: entry.params });
|
|
284
299
|
map.set(entry.componentName, list);
|
|
285
300
|
}
|
|
286
301
|
|
|
287
|
-
const
|
|
302
|
+
const dedupeRoutes = (entries: RouteEntry[]): RouteEntry[] => {
|
|
303
|
+
const seen = new Set<string>();
|
|
304
|
+
const unique: RouteEntry[] = [];
|
|
305
|
+
for (const entry of entries) {
|
|
306
|
+
if (seen.has(entry.template))
|
|
307
|
+
continue;
|
|
308
|
+
seen.add(entry.template);
|
|
309
|
+
unique.push(entry);
|
|
310
|
+
}
|
|
311
|
+
return unique;
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
const choosePrimaryTemplate = (entries: RouteEntry[]): string | null => {
|
|
288
315
|
if (!entries.length)
|
|
289
316
|
return null;
|
|
290
317
|
return entries
|
|
291
318
|
.slice()
|
|
292
|
-
.sort((a, b) => a.template.length - b.template.length || a.template.localeCompare(b.template))[0];
|
|
319
|
+
.sort((a, b) => a.template.length - b.template.length || a.template.localeCompare(b.template))[0].template;
|
|
293
320
|
};
|
|
294
321
|
|
|
295
322
|
const sorted = Array.from(map.entries()).sort((a, b) => a[0].localeCompare(b[0]));
|
|
296
323
|
return Object.fromEntries(
|
|
297
324
|
sorted
|
|
298
|
-
.map(([componentName,
|
|
299
|
-
const
|
|
300
|
-
|
|
325
|
+
.map(([componentName, rawEntries]) => {
|
|
326
|
+
const routes = dedupeRoutes(rawEntries);
|
|
327
|
+
const primaryTemplate = choosePrimaryTemplate(routes);
|
|
328
|
+
return primaryTemplate ? [componentName, { template: primaryTemplate, routes }] : null;
|
|
301
329
|
})
|
|
302
330
|
.filter((entry): entry is [string, RouteMeta] => !!entry),
|
|
303
331
|
);
|
|
@@ -317,28 +345,208 @@ function generateRouteProperty(routeMeta: RouteMeta | null): TypeScriptClassMemb
|
|
|
317
345
|
];
|
|
318
346
|
}
|
|
319
347
|
|
|
320
|
-
function
|
|
348
|
+
function buildParamTypeString(params: RouteParamMeta[]): string {
|
|
349
|
+
return `{ ${params.map(p => `${p.name}${p.optional ? "?" : ""}: string | number`).join("; ")} }`;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
function chooseParamlessRoute(routes: RouteEntry[]): RouteEntry | null {
|
|
353
|
+
const paramless = routes.filter(r => r.params.length === 0);
|
|
354
|
+
if (!paramless.length)
|
|
355
|
+
return null;
|
|
356
|
+
return paramless
|
|
357
|
+
.slice()
|
|
358
|
+
.sort((a, b) => a.template.length - b.template.length || a.template.localeCompare(b.template))[0];
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
function chooseParametrizedRoute(routes: RouteEntry[]): RouteEntry | null {
|
|
362
|
+
const parametrized = routes.filter(r => r.params.length > 0);
|
|
363
|
+
if (!parametrized.length)
|
|
364
|
+
return null;
|
|
365
|
+
return parametrized
|
|
366
|
+
.slice()
|
|
367
|
+
.sort((a, b) => a.params.length - b.params.length || a.template.length - b.template.length || a.template.localeCompare(b.template))[0];
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
const GOTO_RUNTIME_LINES = [
|
|
371
|
+
"const runtimeEnv = (globalThis as { process?: { env?: Record<string, string | undefined> } }).process?.env;",
|
|
372
|
+
"const runtimeBaseUrl = runtimeEnv?.PLAYWRIGHT_RUNTIME_BASE_URL ?? runtimeEnv?.PLAYWRIGHT_TEST_BASE_URL ?? runtimeEnv?.VITE_PLAYWRIGHT_BASE_URL;",
|
|
373
|
+
"const resolvedUrl = runtimeBaseUrl ? new URL(targetUrl, runtimeBaseUrl).toString() : targetUrl;",
|
|
374
|
+
"await this.page.goto(resolvedUrl);",
|
|
375
|
+
];
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* The `window`/`globalThis` key the consumer exposes the live Vue Router instance under
|
|
379
|
+
* (dev-gated), so generated `goTo()` can drive `router.push({ name, params })` instead of
|
|
380
|
+
* reconstructing URLs from opaque path-template tokens. The consumer is responsible for
|
|
381
|
+
* installing `globalThis[ROUTER_GLOBAL_NAME] = router` in test/dev builds.
|
|
382
|
+
*/
|
|
383
|
+
const ROUTER_GLOBAL_NAME = "__appRouter";
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* Emits the router-driven `goTo()` body for a named route. Two regimes:
|
|
387
|
+
*
|
|
388
|
+
* - **Cold page** (fresh Playwright page on `about:blank` — the SPA hasn't booted, so the
|
|
389
|
+
* router global is `undefined`): boot the app with a cheap `page.goto("/")`, wait for the
|
|
390
|
+
* router to install, then **full-load the resolved target URL** (`router.resolve({ name,
|
|
391
|
+
* params }).href` + `page.goto`). A full load is unavoidable here — you cannot `push`
|
|
392
|
+
* before the router exists — and resolving the target (rather than stopping at "/") means
|
|
393
|
+
* the route's component mounts via a stable page load, exactly as the original
|
|
394
|
+
* `page.goto`-based tests did. This matters because the POM runtime clicks with
|
|
395
|
+
* `force: true` (skipping Playwright's actionability check): a SPA `push` into a freshly
|
|
396
|
+
* mounted view can resolve before radios/inputs are interactive, so a force-click fired
|
|
397
|
+
* the instant the push resolves can miss (the control's handler isn't attached yet). A
|
|
398
|
+
* full load gives a fully-rendered, interactive page.
|
|
399
|
+
* - **Warm page** (the app is already mounted — any later `goTo()` in the same test): the
|
|
400
|
+
* guard is a single cheap `evaluate` that finds the router present, so the navigation is a
|
|
401
|
+
* pure SPA `router.push({ name, params })` — no reload — the intended fast path.
|
|
402
|
+
*
|
|
403
|
+
* `routeNameExpr` is a TS expression yielding the route name (a string literal for single
|
|
404
|
+
* routes, or `params ? "edit" : "new"` for the dual-route overload). `paramsExpr` is the
|
|
405
|
+
* params source (`"undefined"` for a paramless route, `"params"` otherwise); `nullable` is
|
|
406
|
+
* true only when that source may itself be `undefined` (the all-optional-params overload),
|
|
407
|
+
* gating the `?? {}` guard that TS2871 would otherwise flag on a required param.
|
|
408
|
+
*/
|
|
409
|
+
const pushBlock = (routeNameExpr: string, paramsExpr: string, nullable: boolean): string[] => {
|
|
410
|
+
const routerType = `{ ${ROUTER_GLOBAL_NAME}?: { push: (to: { name: string; params: Record<string, unknown> }) => Promise<unknown>; resolve: (to: { name: string; params: Record<string, unknown> }) => { href: string } } }`;
|
|
411
|
+
const routeParamsLine = paramsExpr === "undefined"
|
|
412
|
+
? "const routeParams = {};"
|
|
413
|
+
: nullable
|
|
414
|
+
? `const routeParams = Object.fromEntries(Object.entries(${paramsExpr} ?? {}).filter(([, v]) => v !== undefined));`
|
|
415
|
+
: `const routeParams = Object.fromEntries(Object.entries(${paramsExpr}).filter(([, v]) => v !== undefined));`;
|
|
416
|
+
return [
|
|
417
|
+
routeParamsLine,
|
|
418
|
+
`const isCold = await this.page.evaluate(() => typeof (globalThis as { ${ROUTER_GLOBAL_NAME}?: unknown }).${ROUTER_GLOBAL_NAME} === "undefined");`,
|
|
419
|
+
`if (isCold) {`,
|
|
420
|
+
` await this.page.goto("/", { waitUntil: "commit" });`,
|
|
421
|
+
` await this.page.waitForFunction(() => typeof (globalThis as { ${ROUTER_GLOBAL_NAME}?: unknown }).${ROUTER_GLOBAL_NAME} !== "undefined", { timeout: 15000 });`,
|
|
422
|
+
` const href = await this.page.evaluate(({ name, params }) => (globalThis as ${routerType}).${ROUTER_GLOBAL_NAME}?.resolve({ name, params })?.href, { name: ${routeNameExpr}, params: routeParams });`,
|
|
423
|
+
` if (href) { await this.page.goto(href, { waitUntil: "domcontentloaded" }); }`,
|
|
424
|
+
`} else {`,
|
|
425
|
+
` await this.page.evaluate(async ({ name, params }) => {`,
|
|
426
|
+
` await (globalThis as ${routerType}).${ROUTER_GLOBAL_NAME}?.push({ name, params });`,
|
|
427
|
+
` }, { name: ${routeNameExpr}, params: routeParams });`,
|
|
428
|
+
`}`,
|
|
429
|
+
];
|
|
430
|
+
};
|
|
431
|
+
|
|
432
|
+
function generateGoToMethod(componentName: string, routeMeta: RouteMeta | null): TypeScriptClassMember[] {
|
|
433
|
+
// No route metadata: emit a goTo() that fails loudly when invoked.
|
|
434
|
+
if (!routeMeta) {
|
|
435
|
+
return [
|
|
436
|
+
createClassMethod({
|
|
437
|
+
name: "goTo",
|
|
438
|
+
isAsync: true,
|
|
439
|
+
statements: [
|
|
440
|
+
`throw new Error("[pom] No router path found for component/page-object '${componentName}'.");`,
|
|
441
|
+
],
|
|
442
|
+
}),
|
|
443
|
+
];
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
const paramless = chooseParamlessRoute(routeMeta.routes);
|
|
447
|
+
const parametrized = chooseParametrizedRoute(routeMeta.routes);
|
|
448
|
+
const hasParamless = paramless !== null;
|
|
449
|
+
const hasParametrized = parametrized !== null;
|
|
450
|
+
|
|
451
|
+
// Neither a paramless nor a parametrized route (shouldn't happen — routeMeta is non-null — but guard anyway).
|
|
452
|
+
if (!hasParamless && !hasParametrized) {
|
|
453
|
+
return [
|
|
454
|
+
createClassMethod({
|
|
455
|
+
name: "goTo",
|
|
456
|
+
isAsync: true,
|
|
457
|
+
statements: [
|
|
458
|
+
`throw new Error("[pom] No router path found for component/page-object '${componentName}'.");`,
|
|
459
|
+
],
|
|
460
|
+
}),
|
|
461
|
+
];
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
// Fallback (unnamed routes, e.g. Nuxt file-based routes whose names the static walk
|
|
465
|
+
// cannot recover): reconstruct the URL from the tokenized template and `page.goto` it.
|
|
466
|
+
const paramStatements = (entry: RouteEntry): string[] => {
|
|
467
|
+
const lines: string[] = [];
|
|
468
|
+
for (const param of entry.params) {
|
|
469
|
+
const token = getParamToken(param.name);
|
|
470
|
+
if (param.optional) {
|
|
471
|
+
// An omitted optional param drops its entire path segment (including the leading "/"),
|
|
472
|
+
// so `/persons/:personId/:tabName?` with tabName omitted resolves to `/persons/123`.
|
|
473
|
+
lines.push(`targetUrl = params.${param.name} === undefined ? targetUrl.replaceAll(${JSON.stringify(`/${token}`)}, "") : targetUrl.replaceAll(${JSON.stringify(token)}, String(params.${param.name}));`);
|
|
474
|
+
}
|
|
475
|
+
else {
|
|
476
|
+
lines.push(`targetUrl = targetUrl.replaceAll(${JSON.stringify(token)}, String(params.${param.name}));`);
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
return lines;
|
|
480
|
+
};
|
|
481
|
+
|
|
482
|
+
// Preferred path: the route is named, so hand the param object straight to the runtime
|
|
483
|
+
// router. `undefined` values are stripped first — omitted optional params are simply not
|
|
484
|
+
// passed, and the router builds the URL (handling optional segments, redirects, and param
|
|
485
|
+
// coercion) itself. No opaque tokens, no string substitution. See `pushBlock` for the
|
|
486
|
+
// cold-start (full-load resolved target) vs warm (SPA `router.push`) regimes.
|
|
487
|
+
// Paramless-only: simple no-arg goTo().
|
|
488
|
+
if (hasParamless && !hasParametrized) {
|
|
489
|
+
const route = paramless!;
|
|
490
|
+
return [
|
|
491
|
+
createClassMethod({
|
|
492
|
+
name: "goTo",
|
|
493
|
+
isAsync: true,
|
|
494
|
+
statements: route.name !== null
|
|
495
|
+
? pushBlock(JSON.stringify(route.name), "undefined", false)
|
|
496
|
+
: [`const targetUrl = ${JSON.stringify(route.template)};`, ...GOTO_RUNTIME_LINES],
|
|
497
|
+
}),
|
|
498
|
+
];
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
const paramType = buildParamTypeString(parametrized!.params);
|
|
502
|
+
|
|
503
|
+
// Parametrized-only: goTo(params). When every declared param is optional, the params
|
|
504
|
+
// object itself is optional too — `goTo()` is a valid call that navigates to the route
|
|
505
|
+
// with all optional params omitted (e.g. `/preferences/:tabName?` -> `/preferences`).
|
|
506
|
+
if (hasParametrized && !hasParamless) {
|
|
507
|
+
const route = parametrized!;
|
|
508
|
+
const allOptional = route.params.every(p => p.optional);
|
|
509
|
+
return [
|
|
510
|
+
createClassMethod({
|
|
511
|
+
name: "goTo",
|
|
512
|
+
isAsync: true,
|
|
513
|
+
parameters: [{ name: "params", type: paramType, hasQuestionToken: allOptional }],
|
|
514
|
+
statements: route.name !== null
|
|
515
|
+
? pushBlock(JSON.stringify(route.name), "params", allOptional)
|
|
516
|
+
: [`let targetUrl = ${JSON.stringify(route.template)};`, ...paramStatements(route), ...GOTO_RUNTIME_LINES],
|
|
517
|
+
}),
|
|
518
|
+
];
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
// Both routes present. Use the runtime router only when both chosen routes are named;
|
|
522
|
+
// otherwise fall back to token reconstruction for consistency across the overloads.
|
|
523
|
+
const paramlessRoute = paramless!;
|
|
524
|
+
const parametrizedRoute = parametrized!;
|
|
525
|
+
const usePush = paramlessRoute.name !== null && parametrizedRoute.name !== null;
|
|
526
|
+
|
|
321
527
|
return [
|
|
322
528
|
createClassMethod({
|
|
323
529
|
name: "goTo",
|
|
324
530
|
isAsync: true,
|
|
325
|
-
|
|
326
|
-
"
|
|
327
|
-
|
|
328
|
-
}),
|
|
329
|
-
createClassMethod({
|
|
330
|
-
name: "goToSelf",
|
|
331
|
-
isAsync: true,
|
|
332
|
-
statements: [
|
|
333
|
-
`const route = ${componentName}.route;`,
|
|
334
|
-
"if (!route) {",
|
|
335
|
-
` throw new Error("[pom] No router path found for component/page-object '${componentName}'.");`,
|
|
336
|
-
"}",
|
|
337
|
-
"const runtimeEnv = (globalThis as { process?: { env?: Record<string, string | undefined> } }).process?.env;",
|
|
338
|
-
"const runtimeBaseUrl = runtimeEnv?.PLAYWRIGHT_RUNTIME_BASE_URL ?? runtimeEnv?.PLAYWRIGHT_TEST_BASE_URL ?? runtimeEnv?.VITE_PLAYWRIGHT_BASE_URL;",
|
|
339
|
-
"const targetUrl = runtimeBaseUrl ? new URL(route.template, runtimeBaseUrl).toString() : route.template;",
|
|
340
|
-
"await this.page.goto(targetUrl);",
|
|
531
|
+
overloads: [
|
|
532
|
+
{ parameters: [], returnType: "Promise<void>" },
|
|
533
|
+
{ parameters: [{ name: "params", type: paramType }], returnType: "Promise<void>" },
|
|
341
534
|
],
|
|
535
|
+
parameters: [{ name: "params", type: paramType, hasQuestionToken: true }],
|
|
536
|
+
statements: usePush
|
|
537
|
+
? pushBlock(
|
|
538
|
+
`params ? ${JSON.stringify(parametrizedRoute.name)} : ${JSON.stringify(paramlessRoute.name)}`,
|
|
539
|
+
"params",
|
|
540
|
+
true,
|
|
541
|
+
)
|
|
542
|
+
: [
|
|
543
|
+
`const template = params ? ${JSON.stringify(parametrizedRoute.template)} : ${JSON.stringify(paramlessRoute.template)};`,
|
|
544
|
+
"let targetUrl = template;",
|
|
545
|
+
`if (params) {`,
|
|
546
|
+
...paramStatements(parametrizedRoute).map(line => ` ${line}`),
|
|
547
|
+
"}",
|
|
548
|
+
...GOTO_RUNTIME_LINES,
|
|
549
|
+
],
|
|
342
550
|
}),
|
|
343
551
|
];
|
|
344
552
|
}
|
|
@@ -1795,7 +2003,7 @@ function prepareViewObjectModelClass(
|
|
|
1795
2003
|
if (isView && options.vueRouterFluentChaining) {
|
|
1796
2004
|
const routeMeta = options.routeMetaByComponent?.[componentName] ?? null;
|
|
1797
2005
|
members.push(...generateRouteProperty(routeMeta));
|
|
1798
|
-
members.push(...
|
|
2006
|
+
members.push(...generateGoToMethod(className, routeMeta));
|
|
1799
2007
|
}
|
|
1800
2008
|
|
|
1801
2009
|
members.push(...generateMethodsContentForDependencies(componentName, dependencies));
|
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
import { generateViewObjectModelMethodContent } from "../method-generation";
|
|
2
2
|
import { IComponentDependencies } from "../utils";
|
|
3
3
|
export { generateViewObjectModelMethodContent };
|
|
4
|
+
interface RouteParamMeta {
|
|
5
|
+
name: string;
|
|
6
|
+
optional: boolean;
|
|
7
|
+
}
|
|
8
|
+
interface RouteEntry {
|
|
9
|
+
/** Vue Router route `name`, when declared. Enables runtime `router.push({ name, params })`. */
|
|
10
|
+
name: string | null;
|
|
11
|
+
template: string;
|
|
12
|
+
params: RouteParamMeta[];
|
|
13
|
+
}
|
|
4
14
|
interface RouteMeta {
|
|
15
|
+
/** Shortest route template — used for the static `route` property. */
|
|
5
16
|
template: string;
|
|
17
|
+
/** Every route that renders this component (name + template + declared params). */
|
|
18
|
+
routes: RouteEntry[];
|
|
6
19
|
}
|
|
7
20
|
interface CustomPomAttachment {
|
|
8
21
|
className: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../class-generation/index.ts"],"names":[],"mappings":"AAUA,OAAO,EAAkC,oCAAoC,EAAE,MAAM,sBAAsB,CAAC;AAwC5G,OAAO,EACL,sBAAsB,EAQvB,MAAM,UAAU,CAAC;AAQlB,OAAO,EAAE,oCAAoC,EAAE,CAAC;AA2ChD,UAAU,SAAS;IACjB,QAAQ,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../class-generation/index.ts"],"names":[],"mappings":"AAUA,OAAO,EAAkC,oCAAoC,EAAE,MAAM,sBAAsB,CAAC;AAwC5G,OAAO,EACL,sBAAsB,EAQvB,MAAM,UAAU,CAAC;AAQlB,OAAO,EAAE,oCAAoC,EAAE,CAAC;AA2ChD,UAAU,cAAc;IACt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AC,EAAE,MAAM,CAAC;IAEzB,uDAAuD;IACvD,aAAa,CAAC,EAAE,KAAK,CAAC,IAAI,GAAG,QAAQ,CAAC,CAAC;IAEvC;;;;;OAKG;IACH,yBAAyB,CAAC,EAAE,yBAAyB,CAAC;IAEtD,6BAA6B;IAC7B,MAAM,CAAC,EAAE;QACP,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;IAEF,6EAA6E;IAC7E,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAElC,2FAA2F;IAC3F,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,mDAAmD;IACnD,UAAU,CAAC,EAAE,YAAY,GAAG,MAAM,CAAC;IAEnC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IAEtB,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CAClD;AAsCD,wBAAsB,aAAa,CACjC,qBAAqB,EAAE,GAAG,CAAC,MAAM,EAAE,sBAAsB,CAAC,EAC1D,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EACpC,iBAAiB,EAAE,MAAM,EACzB,OAAO,GAAE,oBAAyB,iBAyGnC"}
|
package/dist/eslint/index.cjs
CHANGED
|
@@ -81,7 +81,7 @@ const noPageFixtureInSpecsRule = {
|
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
83
|
};
|
|
84
|
-
const bannedPlaywrightApis = /* @__PURE__ */ new Set(["locator", "getByRole", "getByText", "getByLabel"]);
|
|
84
|
+
const bannedPlaywrightApis = /* @__PURE__ */ new Set(["locator", "getByRole", "getByText", "getByLabel", "getByTestId"]);
|
|
85
85
|
const bannedPageApis = /* @__PURE__ */ new Set([
|
|
86
86
|
"$eval",
|
|
87
87
|
"$$eval",
|
|
@@ -95,6 +95,16 @@ const SPEC_FILE_SUFFIXES = [".spec.ts", ".spec.tsx", ".spec.js", ".spec.jsx"];
|
|
|
95
95
|
function isSpecFile(filename) {
|
|
96
96
|
return SPEC_FILE_SUFFIXES.some((suffix) => filename.endsWith(suffix));
|
|
97
97
|
}
|
|
98
|
+
function resolveMemberPropertyName(callee) {
|
|
99
|
+
const { property, computed } = callee;
|
|
100
|
+
if (!computed && property.type === "Identifier") {
|
|
101
|
+
return property.name;
|
|
102
|
+
}
|
|
103
|
+
if (computed && property.type === "Literal" && typeof property.value === "string") {
|
|
104
|
+
return property.value;
|
|
105
|
+
}
|
|
106
|
+
return void 0;
|
|
107
|
+
}
|
|
98
108
|
const noRawPlaywrightApisRule = {
|
|
99
109
|
meta: {
|
|
100
110
|
type: "problem",
|
|
@@ -125,11 +135,14 @@ const noRawPlaywrightApisRule = {
|
|
|
125
135
|
});
|
|
126
136
|
return;
|
|
127
137
|
}
|
|
128
|
-
if (node.callee.type !== "MemberExpression"
|
|
138
|
+
if (node.callee.type !== "MemberExpression") {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
const apiName = resolveMemberPropertyName(node.callee);
|
|
142
|
+
if (apiName === void 0) {
|
|
129
143
|
return;
|
|
130
144
|
}
|
|
131
145
|
const objectText = sourceCode.getText(node.callee.object);
|
|
132
|
-
const apiName = node.callee.property.name;
|
|
133
146
|
if ((objectText === "page" || objectText === "playwrightPage") && bannedPageApis.has(apiName)) {
|
|
134
147
|
context.report({
|
|
135
148
|
node: node.callee.property,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../eslint/no-page-fixture-in-specs.ts","../../eslint/no-raw-playwright-apis.ts","../../eslint/remove-existing-test-id-attributes.ts","../../eslint/index.ts"],"sourcesContent":["import path from \"node:path\";\nimport type { Rule } from \"eslint\";\nimport type { ArrowFunctionExpression, CallExpression, FunctionExpression } from \"estree\";\n\nconst DIRECT_TEST_CALLS = new Set([\"test\", \"it\"]);\nconst TEST_WRAPPER_CALLS = new Set([\"only\", \"skip\", \"fixme\", \"fail\"]);\nconst TEST_HOOK_CALLS = new Set([\"beforeEach\", \"beforeAll\", \"afterEach\", \"afterAll\"]);\nconst SPEC_FILE_SUFFIXES = new Set([\n\t\".spec.ts\",\n\t\".spec.tsx\",\n\t\".spec.js\",\n\t\".spec.jsx\",\n\t\".spec.cts\",\n\t\".spec.ctsx\",\n\t\".spec.cjs\",\n\t\".spec.cjsx\",\n\t\".spec.mts\",\n\t\".spec.mtsx\",\n\t\".spec.mjs\",\n\t\".spec.mjsx\",\n]);\n\nfunction isSpecFile(filename: string): boolean {\n\tconst basename = path.basename(filename);\n\treturn Array.from(SPEC_FILE_SUFFIXES).some(suffix => basename.endsWith(suffix));\n}\n\nfunction isFunctionExpression(\n\tnode: CallExpression[\"arguments\"][number] | null | undefined,\n): node is ArrowFunctionExpression | FunctionExpression {\n\treturn node != null\n\t\t&& typeof node === \"object\"\n\t\t&& \"type\" in node\n\t\t&& (node.type === \"ArrowFunctionExpression\" || node.type === \"FunctionExpression\");\n}\n\nfunction getCallbackArgIndex(callee: CallExpression[\"callee\"]): number | null {\n\tif (callee.type === \"Identifier\" && DIRECT_TEST_CALLS.has(callee.name))\n\t\treturn 1;\n\n\tif (\n\t\tcallee.type === \"MemberExpression\"\n\t\t&& !callee.computed\n\t\t&& callee.object.type === \"Identifier\"\n\t\t&& DIRECT_TEST_CALLS.has(callee.object.name)\n\t\t&& callee.property.type === \"Identifier\"\n\t) {\n\t\tif (TEST_WRAPPER_CALLS.has(callee.property.name))\n\t\t\treturn 1;\n\n\t\tif (TEST_HOOK_CALLS.has(callee.property.name))\n\t\t\treturn 0;\n\t}\n\n\treturn null;\n}\n\nfunction getPageFixtureProperty(param: ArrowFunctionExpression[\"params\"][0] | FunctionExpression[\"params\"][0]) {\n\tif (!param || param.type !== \"ObjectPattern\")\n\t\treturn null;\n\n\tfor (const property of param.properties) {\n\t\tif (property.type !== \"Property\" || property.computed)\n\t\t\tcontinue;\n\n\t\tif (property.key.type === \"Identifier\" && property.key.name === \"page\")\n\t\t\treturn property;\n\t}\n\n\treturn null;\n}\n\nexport const noPageFixtureInSpecsRule: Rule.RuleModule = {\n\tmeta: {\n\t\ttype: \"problem\",\n\t\tdocs: {\n\t\t\tdescription:\n\t\t\t\t\"Disallow Playwright's default `page` fixture in spec callbacks. Prefer generated fixtures and POMs instead.\",\n\t\t},\n\t\tmessages: {\n\t\t\tnoPageFixture:\n\t\t\t\t\"Do not destructure the default `page` fixture in spec callbacks. Use generated fixtures and POMs instead.\",\n\t\t},\n\t\tschema: [],\n\t},\n\tcreate(context) {\n\t\tconst filename = context.getFilename();\n\t\tif (!isSpecFile(filename))\n\t\t\treturn {};\n\n\t\treturn {\n\t\t\tCallExpression(node: CallExpression) {\n\t\t\t\tconst callbackArgIndex = getCallbackArgIndex(node.callee);\n\t\t\t\tif (callbackArgIndex == null)\n\t\t\t\t\treturn;\n\n\t\t\t\tconst callback = node.arguments[callbackArgIndex];\n\t\t\t\tif (!isFunctionExpression(callback))\n\t\t\t\t\treturn;\n\n\t\t\t\tconst pageFixtureProperty = getPageFixtureProperty(callback.params[0]);\n\t\t\t\tif (!pageFixtureProperty)\n\t\t\t\t\treturn;\n\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode: pageFixtureProperty,\n\t\t\t\t\tmessageId: \"noPageFixture\",\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t},\n};\n","import type { Rule } from \"eslint\";\n\nconst bannedPlaywrightApis = new Set([\"locator\", \"getByRole\", \"getByText\", \"getByLabel\"]);\n\nconst bannedPageApis = new Set([\n\t\"$eval\",\n\t\"$$eval\",\n\t\"click\",\n\t\"evaluate\",\n\t\"isHidden\",\n\t\"isVisible\",\n\t\"waitForSelector\",\n]);\n\nconst SPEC_FILE_SUFFIXES = [\".spec.ts\", \".spec.tsx\", \".spec.js\", \".spec.jsx\"];\n\nfunction isSpecFile(filename: string): boolean {\n\treturn SPEC_FILE_SUFFIXES.some((suffix) => filename.endsWith(suffix));\n}\n\nexport const noRawPlaywrightApisRule: Rule.RuleModule = {\n\tmeta: {\n\t\ttype: \"problem\",\n\t\tdocs: {\n\t\t\tdescription:\n\t\t\t\t\"Ban raw Playwright APIs in spec files. Use generated fixtures/POMs or a custom POM for unsupported surfaces instead.\",\n\t\t},\n\t\tmessages: {\n\t\t\tlegacyCursorHelper:\n\t\t\t\t\"Do not use {{name}} in Playwright spec files. Prefer generated fixtures/POMs or a custom POM for unsupported surfaces.\",\n\t\t\trawPlaywrightApi:\n\t\t\t\t\"Do not call {{name}} directly in Playwright spec files. Prefer generated fixtures/POM methods or a custom POM for unsupported surfaces.\",\n\t\t\trawPlaywrightPageApi:\n\t\t\t\t\"Do not call page.{{name}} directly in Playwright spec files. Prefer generated fixtures/POM methods or a custom POM for unsupported surfaces.\",\n\t\t},\n\t\tschema: [],\n\t},\n\tcreate(context) {\n\t\tif (!isSpecFile(context.filename)) {\n\t\t\treturn {};\n\t\t}\n\n\t\tconst sourceCode = context.sourceCode;\n\n\t\treturn {\n\t\t\tCallExpression(node) {\n\t\t\t\tif (node.callee.type === \"Identifier\" && node.callee.name.includes(\"animateCursor\")) {\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tnode: node.callee,\n\t\t\t\t\t\tmessageId: \"legacyCursorHelper\",\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\tname: node.callee.name,\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\tnode.callee.type !== \"MemberExpression\"\n\t\t\t\t\t|| node.callee.computed\n\t\t\t\t\t|| node.callee.property.type !== \"Identifier\"\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst objectText = sourceCode.getText(node.callee.object);\n\t\t\t\tconst apiName = node.callee.property.name;\n\n\t\t\t\tif (\n\t\t\t\t\t(objectText === \"page\" || objectText === \"playwrightPage\")\n\t\t\t\t\t&& bannedPageApis.has(apiName)\n\t\t\t\t) {\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tnode: node.callee.property,\n\t\t\t\t\t\tmessageId: \"rawPlaywrightPageApi\",\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\tname: apiName,\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (!bannedPlaywrightApis.has(apiName)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode: node.callee.property,\n\t\t\t\t\tmessageId: \"rawPlaywrightApi\",\n\t\t\t\t\tdata: {\n\t\t\t\t\t\tname: apiName,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t},\n};\n","import type { Rule } from \"eslint\";\nimport type { AST as VueAST } from \"vue-eslint-parser\";\n\ntype VAttribute = VueAST.VAttribute;\ntype VDirective = VueAST.VDirective;\ntype VElement = VueAST.VElement;\ntype VueAttribute = VAttribute | VDirective;\ntype VueTemplateVisitor = {\n\tVElement: (node: VElement) => void;\n};\n\nfunction isVueTemplateFile(filename: string): boolean {\n\treturn filename.endsWith(\".vue\");\n}\n\nfunction isWhitespaceCharacter(character: string): boolean {\n\treturn character === \" \"\n\t\t|| character === \"\\t\"\n\t\t|| character === \"\\n\"\n\t\t|| character === \"\\r\"\n\t\t|| character === \"\\f\";\n}\n\nfunction removeAttributeWithWhitespace(\n\tattribute: VueAttribute,\n\tcontext: Rule.RuleContext,\n\tfixer: Rule.RuleFixer,\n): Rule.Fix {\n\tconst sourceText = context.sourceCode.getText();\n\tconst [start, end] = attribute.range;\n\n\tlet adjustedStart = start;\n\twhile (adjustedStart > 0 && isWhitespaceCharacter(sourceText[adjustedStart - 1])) {\n\t\tadjustedStart -= 1;\n\t}\n\n\treturn fixer.removeRange([adjustedStart, end]);\n}\n\nfunction isTargetAttribute(attribute: VueAttribute, attributeName: string): boolean {\n\tif (!attribute.directive) {\n\t\treturn attribute.key.type === \"VIdentifier\" && attribute.key.name === attributeName;\n\t}\n\n\tif (attribute.key.type !== \"VDirectiveKey\") {\n\t\treturn false;\n\t}\n\n\tconst directiveName = attribute.key.name;\n\tconst argument = attribute.key.argument;\n\n\treturn directiveName.type === \"VIdentifier\"\n\t\t&& directiveName.name === \"bind\"\n\t\t&& argument?.type === \"VIdentifier\"\n\t\t&& argument.name === attributeName;\n}\n\nfunction findExistingTestIdAttribute(node: VElement, attributeName: string): VueAttribute | undefined {\n\treturn node.startTag.attributes.find(attribute => isTargetAttribute(attribute, attributeName));\n}\n\nfunction defineVueTemplateVisitor(\n\tcontext: Rule.RuleContext,\n\ttemplateVisitor: VueTemplateVisitor,\n): Rule.RuleListener {\n\tconst parserServices = context.sourceCode.parserServices as {\n\t\tdefineTemplateBodyVisitor?: (\n\t\t\ttemplateBodyVisitor: VueTemplateVisitor,\n\t\t\tscriptVisitor: Rule.RuleListener,\n\t\t\toptions: { templateBodyTriggerSelector: \"Program\" },\n\t\t) => Rule.RuleListener;\n\t};\n\n\tif (!parserServices.defineTemplateBodyVisitor) {\n\t\treturn {};\n\t}\n\n\treturn parserServices.defineTemplateBodyVisitor(\n\t\ttemplateVisitor,\n\t\t{},\n\t\t{ templateBodyTriggerSelector: \"Program\" },\n\t);\n}\n\nexport const removeExistingTestIdAttributesRule: Rule.RuleModule = {\n\tmeta: {\n\t\ttype: \"suggestion\",\n\t\tdocs: {\n\t\t\tdescription:\n\t\t\t\t\"Remove existing test-id attributes from Vue templates so vue-pom-generator can generate them consistently.\",\n\t\t},\n\t\tfixable: \"code\",\n\t\tmessages: {\n\t\t\tremoveExistingTestIdAttribute:\n\t\t\t\t\"Remove explicit {{attribute}}. vue-pom-generator can generate it; run this rule with --fix to clean legacy attributes project-wide.\",\n\t\t},\n\t\tschema: [\n\t\t\t{\n\t\t\t\ttype: \"object\",\n\t\t\t\tproperties: {\n\t\t\t\t\tattribute: {\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tdescription: \"Attribute name to remove. Defaults to data-testid.\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tadditionalProperties: false,\n\t\t\t},\n\t\t],\n\t},\n\tcreate(context): Rule.RuleListener {\n\t\tif (!isVueTemplateFile(context.filename)) {\n\t\t\treturn {};\n\t\t}\n\n\t\tconst options = (context.options[0] ?? {}) as { attribute?: string };\n\t\tconst attributeName = (options.attribute ?? \"data-testid\").trim() || \"data-testid\";\n\n\t\treturn defineVueTemplateVisitor(context, {\n\t\t\tVElement(node: VElement) {\n\t\t\t\tconst existingAttribute = findExistingTestIdAttribute(node, attributeName);\n\t\t\t\tif (!existingAttribute) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode: existingAttribute,\n\t\t\t\t\tmessageId: \"removeExistingTestIdAttribute\",\n\t\t\t\t\tdata: { attribute: attributeName },\n\t\t\t\t\tfix(fixer) {\n\t\t\t\t\t\treturn removeAttributeWithWhitespace(existingAttribute, context, fixer);\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t},\n\t\t});\n\t},\n};","import type { Rule } from \"eslint\";\nimport type { CallExpression, Expression, MemberExpression } from \"estree\";\n\nimport { noPageFixtureInSpecsRule } from \"./no-page-fixture-in-specs\";\nimport { noRawPlaywrightApisRule } from \"./no-raw-playwright-apis\";\nimport { removeExistingTestIdAttributesRule } from \"./remove-existing-test-id-attributes\";\n\n/**\n * Playwright locator action methods that should be called via generated POM\n * methods rather than directly on element getters.\n */\nconst LOCATOR_ACTIONS = new Set([\n\t\"click\",\n\t\"dblclick\",\n\t\"fill\",\n\t\"check\",\n\t\"uncheck\",\n\t\"type\",\n\t\"clear\",\n\t\"selectOption\",\n\t\"setInputFiles\",\n\t\"tap\",\n\t\"hover\",\n\t\"focus\",\n\t\"dispatchEvent\",\n\t\"press\",\n\t\"selectText\",\n]);\n\n/**\n * Locator chain methods that are transparent for the purposes of this rule —\n * `.last().click()` is still a raw action on a POM getter.\n */\nconst CHAIN_METHODS = new Set([\"last\", \"first\", \"nth\", \"filter\"]);\n\nfunction startsWithUppercaseLetter(value: string): boolean {\n\tconst first = value.charCodeAt(0);\n\treturn first >= 65 && first <= 90;\n}\n\n/**\n * Returns the PascalCase getter name if `node` is (or chains from) a direct\n * PascalCase member-expression access. Returns null otherwise.\n *\n * Handles:\n * pom.SubmitButton → \"SubmitButton\"\n * pom.SubmitButton.last() → \"SubmitButton\"\n * pom.SubmitButton.nth(0) → \"SubmitButton\"\n */\nfunction getPomGetterName(node: Expression): string | null {\n\tif (node.type === \"MemberExpression\" && !node.computed && node.property.type === \"Identifier\") {\n\t\tconst name = node.property.name;\n\t\tif (startsWithUppercaseLetter(name)) return name;\n\t}\n\n\tif (\n\t\tnode.type === \"CallExpression\"\n\t\t&& node.callee.type === \"MemberExpression\"\n\t\t&& !node.callee.computed\n\t\t&& node.callee.property.type === \"Identifier\"\n\t\t&& CHAIN_METHODS.has(node.callee.property.name)\n\t) {\n\t\treturn getPomGetterName((node.callee as MemberExpression).object as Expression);\n\t}\n\n\treturn null;\n}\n\nexport const noRawLocatorActionRule: Rule.RuleModule = {\n\tmeta: {\n\t\ttype: \"suggestion\",\n\t\tdocs: {\n\t\t\tdescription:\n\t\t\t\t\"Disallow calling raw Playwright action methods directly on POM element getters. Use the generated typed POM methods instead (e.g. `clickSubmitButton()`).\",\n\t\t},\n\t\tmessages: {\n\t\t\tnoRawAction:\n\t\t\t\t\"Use the generated POM method instead of `{{getter}}.{{method}}()`. \"\n\t\t\t\t+ \"Call `click{{getter}}()` / `type{{getter}}(text)` or similar.\",\n\t\t},\n\t\tschema: [],\n\t},\n\tcreate(context) {\n\t\treturn {\n\t\t\tCallExpression(node: CallExpression) {\n\t\t\t\tif (node.callee.type !== \"MemberExpression\") return;\n\t\t\t\tconst callee = node.callee as MemberExpression;\n\t\t\t\tif (callee.computed || callee.property.type !== \"Identifier\") return;\n\n\t\t\t\tconst methodName = callee.property.name;\n\t\t\t\tif (!LOCATOR_ACTIONS.has(methodName)) return;\n\n\t\t\t\tconst getterName = getPomGetterName(callee.object as Expression);\n\t\t\t\tif (!getterName) return;\n\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode,\n\t\t\t\t\tmessageId: \"noRawAction\",\n\t\t\t\t\tdata: { getter: getterName, method: methodName },\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t},\n};\n\nexport const plugin = {\n\trules: {\n\t\t\"no-page-fixture-in-specs\": noPageFixtureInSpecsRule,\n\t\t\"no-raw-locator-action\": noRawLocatorActionRule,\n\t\t\"no-raw-playwright-apis\": noRawPlaywrightApisRule,\n\t\t\"remove-existing-test-id-attributes\": removeExistingTestIdAttributesRule,\n\t},\n} satisfies { rules: Record<string, Rule.RuleModule> };\n\nexport { noPageFixtureInSpecsRule };\nexport { noRawPlaywrightApisRule };\nexport { removeExistingTestIdAttributesRule };\n"],"names":["SPEC_FILE_SUFFIXES","isSpecFile"],"mappings":";;;AAIA,MAAM,oBAAoB,oBAAI,IAAI,CAAC,QAAQ,IAAI,CAAC;AAChD,MAAM,yCAAyB,IAAI,CAAC,QAAQ,QAAQ,SAAS,MAAM,CAAC;AACpE,MAAM,sCAAsB,IAAI,CAAC,cAAc,aAAa,aAAa,UAAU,CAAC;AACpF,MAAMA,2CAAyB,IAAI;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,CAAC;AAED,SAASC,aAAW,UAA2B;AAC9C,QAAM,WAAW,KAAK,SAAS,QAAQ;AACvC,SAAO,MAAM,KAAKD,oBAAkB,EAAE,KAAK,CAAA,WAAU,SAAS,SAAS,MAAM,CAAC;AAC/E;AAEA,SAAS,qBACR,MACuD;AACvD,SAAO,QAAQ,QACX,OAAO,SAAS,YAChB,UAAU,SACT,KAAK,SAAS,6BAA6B,KAAK,SAAS;AAC/D;AAEA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ACd;AAAA,UACA,WAAW;AAAA,UACX,MAAM,EAAE,QAAQ,YAAY,QAAQ,WAAA;AAAA,QAAW,CAC/C;AAAA,MACF;AAAA,IAAA;AAAA,EAEF;AACD;AAEO,MAAM,SAAS;AAAA,EACrB,OAAO;AAAA,IACN,4BAA4B;AAAA,IAC5B,yBAAyB;AAAA,IACzB,0BAA0B;AAAA,IAC1B,sCAAsC;AAAA,EAAA;AAExC;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../eslint/no-page-fixture-in-specs.ts","../../eslint/no-raw-playwright-apis.ts","../../eslint/remove-existing-test-id-attributes.ts","../../eslint/index.ts"],"sourcesContent":["import path from \"node:path\";\nimport type { Rule } from \"eslint\";\nimport type { ArrowFunctionExpression, CallExpression, FunctionExpression } from \"estree\";\n\nconst DIRECT_TEST_CALLS = new Set([\"test\", \"it\"]);\nconst TEST_WRAPPER_CALLS = new Set([\"only\", \"skip\", \"fixme\", \"fail\"]);\nconst TEST_HOOK_CALLS = new Set([\"beforeEach\", \"beforeAll\", \"afterEach\", \"afterAll\"]);\nconst SPEC_FILE_SUFFIXES = new Set([\n\t\".spec.ts\",\n\t\".spec.tsx\",\n\t\".spec.js\",\n\t\".spec.jsx\",\n\t\".spec.cts\",\n\t\".spec.ctsx\",\n\t\".spec.cjs\",\n\t\".spec.cjsx\",\n\t\".spec.mts\",\n\t\".spec.mtsx\",\n\t\".spec.mjs\",\n\t\".spec.mjsx\",\n]);\n\nfunction isSpecFile(filename: string): boolean {\n\tconst basename = path.basename(filename);\n\treturn Array.from(SPEC_FILE_SUFFIXES).some(suffix => basename.endsWith(suffix));\n}\n\nfunction isFunctionExpression(\n\tnode: CallExpression[\"arguments\"][number] | null | undefined,\n): node is ArrowFunctionExpression | FunctionExpression {\n\treturn node != null\n\t\t&& typeof node === \"object\"\n\t\t&& \"type\" in node\n\t\t&& (node.type === \"ArrowFunctionExpression\" || node.type === \"FunctionExpression\");\n}\n\nfunction getCallbackArgIndex(callee: CallExpression[\"callee\"]): number | null {\n\tif (callee.type === \"Identifier\" && DIRECT_TEST_CALLS.has(callee.name))\n\t\treturn 1;\n\n\tif (\n\t\tcallee.type === \"MemberExpression\"\n\t\t&& !callee.computed\n\t\t&& callee.object.type === \"Identifier\"\n\t\t&& DIRECT_TEST_CALLS.has(callee.object.name)\n\t\t&& callee.property.type === \"Identifier\"\n\t) {\n\t\tif (TEST_WRAPPER_CALLS.has(callee.property.name))\n\t\t\treturn 1;\n\n\t\tif (TEST_HOOK_CALLS.has(callee.property.name))\n\t\t\treturn 0;\n\t}\n\n\treturn null;\n}\n\nfunction getPageFixtureProperty(param: ArrowFunctionExpression[\"params\"][0] | FunctionExpression[\"params\"][0]) {\n\tif (!param || param.type !== \"ObjectPattern\")\n\t\treturn null;\n\n\tfor (const property of param.properties) {\n\t\tif (property.type !== \"Property\" || property.computed)\n\t\t\tcontinue;\n\n\t\tif (property.key.type === \"Identifier\" && property.key.name === \"page\")\n\t\t\treturn property;\n\t}\n\n\treturn null;\n}\n\nexport const noPageFixtureInSpecsRule: Rule.RuleModule = {\n\tmeta: {\n\t\ttype: \"problem\",\n\t\tdocs: {\n\t\t\tdescription:\n\t\t\t\t\"Disallow Playwright's default `page` fixture in spec callbacks. Prefer generated fixtures and POMs instead.\",\n\t\t},\n\t\tmessages: {\n\t\t\tnoPageFixture:\n\t\t\t\t\"Do not destructure the default `page` fixture in spec callbacks. Use generated fixtures and POMs instead.\",\n\t\t},\n\t\tschema: [],\n\t},\n\tcreate(context) {\n\t\tconst filename = context.getFilename();\n\t\tif (!isSpecFile(filename))\n\t\t\treturn {};\n\n\t\treturn {\n\t\t\tCallExpression(node: CallExpression) {\n\t\t\t\tconst callbackArgIndex = getCallbackArgIndex(node.callee);\n\t\t\t\tif (callbackArgIndex == null)\n\t\t\t\t\treturn;\n\n\t\t\t\tconst callback = node.arguments[callbackArgIndex];\n\t\t\t\tif (!isFunctionExpression(callback))\n\t\t\t\t\treturn;\n\n\t\t\t\tconst pageFixtureProperty = getPageFixtureProperty(callback.params[0]);\n\t\t\t\tif (!pageFixtureProperty)\n\t\t\t\t\treturn;\n\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode: pageFixtureProperty,\n\t\t\t\t\tmessageId: \"noPageFixture\",\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t},\n};\n","import type { Rule } from \"eslint\";\nimport type { MemberExpression } from \"estree\";\n\n// Locator-filter methods available on Page/Locator/Frame etc. Banned regardless of\n// the receiver object. `getByTestId` is the generator's own test-id contract — specs\n// should reach it through a generated POM accessor, never a raw `*.getByTestId(...)`.\nconst bannedPlaywrightApis = new Set([\"locator\", \"getByRole\", \"getByText\", \"getByLabel\", \"getByTestId\"]);\n\nconst bannedPageApis = new Set([\n\t\"$eval\",\n\t\"$$eval\",\n\t\"click\",\n\t\"evaluate\",\n\t\"isHidden\",\n\t\"isVisible\",\n\t\"waitForSelector\",\n]);\n\nconst SPEC_FILE_SUFFIXES = [\".spec.ts\", \".spec.tsx\", \".spec.js\", \".spec.jsx\"];\n\nfunction isSpecFile(filename: string): boolean {\n\treturn SPEC_FILE_SUFFIXES.some((suffix) => filename.endsWith(suffix));\n}\n\n/**\n * Resolve the accessed property name from a MemberExpression callee, covering both\n * the usual member access (`page.getByTestId(...)`) and the computed equivalent\n * (`page[\"getByTestId\"](...)`). A computed access whose key is a non-Literal\n * (e.g. `obj[dynamicKey]()`) cannot be resolved to a name, so it returns\n * `undefined` and is left alone — it could be anything at runtime.\n */\nfunction resolveMemberPropertyName(callee: MemberExpression): string | undefined {\n\tconst { property, computed } = callee;\n\tif (!computed && property.type === \"Identifier\") {\n\t\treturn property.name;\n\t}\n\tif (computed && property.type === \"Literal\" && typeof property.value === \"string\") {\n\t\treturn property.value;\n\t}\n\treturn undefined;\n}\n\nexport const noRawPlaywrightApisRule: Rule.RuleModule = {\n\tmeta: {\n\t\ttype: \"problem\",\n\t\tdocs: {\n\t\t\tdescription:\n\t\t\t\t\"Ban raw Playwright APIs in spec files. Use generated fixtures/POMs or a custom POM for unsupported surfaces instead.\",\n\t\t},\n\t\tmessages: {\n\t\t\tlegacyCursorHelper:\n\t\t\t\t\"Do not use {{name}} in Playwright spec files. Prefer generated fixtures/POMs or a custom POM for unsupported surfaces.\",\n\t\t\trawPlaywrightApi:\n\t\t\t\t\"Do not call {{name}} directly in Playwright spec files. Prefer generated fixtures/POM methods or a custom POM for unsupported surfaces.\",\n\t\t\trawPlaywrightPageApi:\n\t\t\t\t\"Do not call page.{{name}} directly in Playwright spec files. Prefer generated fixtures/POM methods or a custom POM for unsupported surfaces.\",\n\t\t},\n\t\tschema: [],\n\t},\n\tcreate(context) {\n\t\tif (!isSpecFile(context.filename)) {\n\t\t\treturn {};\n\t\t}\n\n\t\tconst sourceCode = context.sourceCode;\n\n\t\treturn {\n\t\t\tCallExpression(node) {\n\t\t\t\tif (node.callee.type === \"Identifier\" && node.callee.name.includes(\"animateCursor\")) {\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tnode: node.callee,\n\t\t\t\t\t\tmessageId: \"legacyCursorHelper\",\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\tname: node.callee.name,\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (node.callee.type !== \"MemberExpression\") {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst apiName = resolveMemberPropertyName(node.callee as MemberExpression);\n\t\t\t\tif (apiName === undefined) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst objectText = sourceCode.getText(node.callee.object);\n\n\t\t\t\tif (\n\t\t\t\t\t(objectText === \"page\" || objectText === \"playwrightPage\")\n\t\t\t\t\t&& bannedPageApis.has(apiName)\n\t\t\t\t) {\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tnode: node.callee.property,\n\t\t\t\t\t\tmessageId: \"rawPlaywrightPageApi\",\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\tname: apiName,\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (!bannedPlaywrightApis.has(apiName)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode: node.callee.property,\n\t\t\t\t\tmessageId: \"rawPlaywrightApi\",\n\t\t\t\t\tdata: {\n\t\t\t\t\t\tname: apiName,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t},\n};\n","import type { Rule } from \"eslint\";\nimport type { AST as VueAST } from \"vue-eslint-parser\";\n\ntype VAttribute = VueAST.VAttribute;\ntype VDirective = VueAST.VDirective;\ntype VElement = VueAST.VElement;\ntype VueAttribute = VAttribute | VDirective;\ntype VueTemplateVisitor = {\n\tVElement: (node: VElement) => void;\n};\n\nfunction isVueTemplateFile(filename: string): boolean {\n\treturn filename.endsWith(\".vue\");\n}\n\nfunction isWhitespaceCharacter(character: string): boolean {\n\treturn character === \" \"\n\t\t|| character === \"\\t\"\n\t\t|| character === \"\\n\"\n\t\t|| character === \"\\r\"\n\t\t|| character === \"\\f\";\n}\n\nfunction removeAttributeWithWhitespace(\n\tattribute: VueAttribute,\n\tcontext: Rule.RuleContext,\n\tfixer: Rule.RuleFixer,\n): Rule.Fix {\n\tconst sourceText = context.sourceCode.getText();\n\tconst [start, end] = attribute.range;\n\n\tlet adjustedStart = start;\n\twhile (adjustedStart > 0 && isWhitespaceCharacter(sourceText[adjustedStart - 1])) {\n\t\tadjustedStart -= 1;\n\t}\n\n\treturn fixer.removeRange([adjustedStart, end]);\n}\n\nfunction isTargetAttribute(attribute: VueAttribute, attributeName: string): boolean {\n\tif (!attribute.directive) {\n\t\treturn attribute.key.type === \"VIdentifier\" && attribute.key.name === attributeName;\n\t}\n\n\tif (attribute.key.type !== \"VDirectiveKey\") {\n\t\treturn false;\n\t}\n\n\tconst directiveName = attribute.key.name;\n\tconst argument = attribute.key.argument;\n\n\treturn directiveName.type === \"VIdentifier\"\n\t\t&& directiveName.name === \"bind\"\n\t\t&& argument?.type === \"VIdentifier\"\n\t\t&& argument.name === attributeName;\n}\n\nfunction findExistingTestIdAttribute(node: VElement, attributeName: string): VueAttribute | undefined {\n\treturn node.startTag.attributes.find(attribute => isTargetAttribute(attribute, attributeName));\n}\n\nfunction defineVueTemplateVisitor(\n\tcontext: Rule.RuleContext,\n\ttemplateVisitor: VueTemplateVisitor,\n): Rule.RuleListener {\n\tconst parserServices = context.sourceCode.parserServices as {\n\t\tdefineTemplateBodyVisitor?: (\n\t\t\ttemplateBodyVisitor: VueTemplateVisitor,\n\t\t\tscriptVisitor: Rule.RuleListener,\n\t\t\toptions: { templateBodyTriggerSelector: \"Program\" },\n\t\t) => Rule.RuleListener;\n\t};\n\n\tif (!parserServices.defineTemplateBodyVisitor) {\n\t\treturn {};\n\t}\n\n\treturn parserServices.defineTemplateBodyVisitor(\n\t\ttemplateVisitor,\n\t\t{},\n\t\t{ templateBodyTriggerSelector: \"Program\" },\n\t);\n}\n\nexport const removeExistingTestIdAttributesRule: Rule.RuleModule = {\n\tmeta: {\n\t\ttype: \"suggestion\",\n\t\tdocs: {\n\t\t\tdescription:\n\t\t\t\t\"Remove existing test-id attributes from Vue templates so vue-pom-generator can generate them consistently.\",\n\t\t},\n\t\tfixable: \"code\",\n\t\tmessages: {\n\t\t\tremoveExistingTestIdAttribute:\n\t\t\t\t\"Remove explicit {{attribute}}. vue-pom-generator can generate it; run this rule with --fix to clean legacy attributes project-wide.\",\n\t\t},\n\t\tschema: [\n\t\t\t{\n\t\t\t\ttype: \"object\",\n\t\t\t\tproperties: {\n\t\t\t\t\tattribute: {\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tdescription: \"Attribute name to remove. Defaults to data-testid.\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tadditionalProperties: false,\n\t\t\t},\n\t\t],\n\t},\n\tcreate(context): Rule.RuleListener {\n\t\tif (!isVueTemplateFile(context.filename)) {\n\t\t\treturn {};\n\t\t}\n\n\t\tconst options = (context.options[0] ?? {}) as { attribute?: string };\n\t\tconst attributeName = (options.attribute ?? \"data-testid\").trim() || \"data-testid\";\n\n\t\treturn defineVueTemplateVisitor(context, {\n\t\t\tVElement(node: VElement) {\n\t\t\t\tconst existingAttribute = findExistingTestIdAttribute(node, attributeName);\n\t\t\t\tif (!existingAttribute) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode: existingAttribute,\n\t\t\t\t\tmessageId: \"removeExistingTestIdAttribute\",\n\t\t\t\t\tdata: { attribute: attributeName },\n\t\t\t\t\tfix(fixer) {\n\t\t\t\t\t\treturn removeAttributeWithWhitespace(existingAttribute, context, fixer);\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t},\n\t\t});\n\t},\n};","import type { Rule } from \"eslint\";\nimport type { CallExpression, Expression, MemberExpression } from \"estree\";\n\nimport { noPageFixtureInSpecsRule } from \"./no-page-fixture-in-specs\";\nimport { noRawPlaywrightApisRule } from \"./no-raw-playwright-apis\";\nimport { removeExistingTestIdAttributesRule } from \"./remove-existing-test-id-attributes\";\n\n/**\n * Playwright locator action methods that should be called via generated POM\n * methods rather than directly on element getters.\n */\nconst LOCATOR_ACTIONS = new Set([\n\t\"click\",\n\t\"dblclick\",\n\t\"fill\",\n\t\"check\",\n\t\"uncheck\",\n\t\"type\",\n\t\"clear\",\n\t\"selectOption\",\n\t\"setInputFiles\",\n\t\"tap\",\n\t\"hover\",\n\t\"focus\",\n\t\"dispatchEvent\",\n\t\"press\",\n\t\"selectText\",\n]);\n\n/**\n * Locator chain methods that are transparent for the purposes of this rule —\n * `.last().click()` is still a raw action on a POM getter.\n */\nconst CHAIN_METHODS = new Set([\"last\", \"first\", \"nth\", \"filter\"]);\n\nfunction startsWithUppercaseLetter(value: string): boolean {\n\tconst first = value.charCodeAt(0);\n\treturn first >= 65 && first <= 90;\n}\n\n/**\n * Returns the PascalCase getter name if `node` is (or chains from) a direct\n * PascalCase member-expression access. Returns null otherwise.\n *\n * Handles:\n * pom.SubmitButton → \"SubmitButton\"\n * pom.SubmitButton.last() → \"SubmitButton\"\n * pom.SubmitButton.nth(0) → \"SubmitButton\"\n */\nfunction getPomGetterName(node: Expression): string | null {\n\tif (node.type === \"MemberExpression\" && !node.computed && node.property.type === \"Identifier\") {\n\t\tconst name = node.property.name;\n\t\tif (startsWithUppercaseLetter(name)) return name;\n\t}\n\n\tif (\n\t\tnode.type === \"CallExpression\"\n\t\t&& node.callee.type === \"MemberExpression\"\n\t\t&& !node.callee.computed\n\t\t&& node.callee.property.type === \"Identifier\"\n\t\t&& CHAIN_METHODS.has(node.callee.property.name)\n\t) {\n\t\treturn getPomGetterName((node.callee as MemberExpression).object as Expression);\n\t}\n\n\treturn null;\n}\n\nexport const noRawLocatorActionRule: Rule.RuleModule = {\n\tmeta: {\n\t\ttype: \"suggestion\",\n\t\tdocs: {\n\t\t\tdescription:\n\t\t\t\t\"Disallow calling raw Playwright action methods directly on POM element getters. Use the generated typed POM methods instead (e.g. `clickSubmitButton()`).\",\n\t\t},\n\t\tmessages: {\n\t\t\tnoRawAction:\n\t\t\t\t\"Use the generated POM method instead of `{{getter}}.{{method}}()`. \"\n\t\t\t\t+ \"Call `click{{getter}}()` / `type{{getter}}(text)` or similar.\",\n\t\t},\n\t\tschema: [],\n\t},\n\tcreate(context) {\n\t\treturn {\n\t\t\tCallExpression(node: CallExpression) {\n\t\t\t\tif (node.callee.type !== \"MemberExpression\") return;\n\t\t\t\tconst callee = node.callee as MemberExpression;\n\t\t\t\tif (callee.computed || callee.property.type !== \"Identifier\") return;\n\n\t\t\t\tconst methodName = callee.property.name;\n\t\t\t\tif (!LOCATOR_ACTIONS.has(methodName)) return;\n\n\t\t\t\tconst getterName = getPomGetterName(callee.object as Expression);\n\t\t\t\tif (!getterName) return;\n\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode,\n\t\t\t\t\tmessageId: \"noRawAction\",\n\t\t\t\t\tdata: { getter: getterName, method: methodName },\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t},\n};\n\nexport const plugin = {\n\trules: {\n\t\t\"no-page-fixture-in-specs\": noPageFixtureInSpecsRule,\n\t\t\"no-raw-locator-action\": noRawLocatorActionRule,\n\t\t\"no-raw-playwright-apis\": noRawPlaywrightApisRule,\n\t\t\"remove-existing-test-id-attributes\": removeExistingTestIdAttributesRule,\n\t},\n} satisfies { rules: Record<string, Rule.RuleModule> };\n\nexport { noPageFixtureInSpecsRule };\nexport { noRawPlaywrightApisRule };\nexport { removeExistingTestIdAttributesRule };\n"],"names":["SPEC_FILE_SUFFIXES","isSpecFile"],"mappings":";;;AAIA,MAAM,oBAAoB,oBAAI,IAAI,CAAC,QAAQ,IAAI,CAAC;AAChD,MAAM,yCAAyB,IAAI,CAAC,QAAQ,QAAQ,SAAS,MAAM,CAAC;AACpE,MAAM,sCAAsB,IAAI,CAAC,cAAc,aAAa,aAAa,UAAU,CAAC;AACpF,MAAMA,2CAAyB,IAAI;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,CAAC;AAED,SAASC,aAAW,UAA2B;AAC9C,QAAM,WAAW,KAAK,SAAS,QAAQ;AACvC,SAAO,MAAM,KAAKD,oBAAkB,EAAE,KAAK,CAAA,WAAU,SAAS,SAAS,MAAM,CAAC;AAC/E;AAEA,SAAS,qBACR,MACuD;AACvD,SAAO,QAAQ,QACX,OAAO,SAAS,YAChB,UAAU,SACT,KAAK,SAAS,6BAA6B,KAAK,SAAS;AAC/D;AAEA,SAAS,oBAAoB,QAAiD;AAC7E,MAAI,OAAO,SAAS,gBAAgB,kBAAkB,IAAI,OAAO,IAAI;AACpE,WAAO;AAER,MACC,OAAO,SAAS,sBACb,CAAC,OAAO,YACR,OAA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