@immense/vue-pom-generator 1.0.8 → 1.0.10
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 +20 -30
- package/class-generation/index.ts +7 -1
- package/class-generation/playwright-types.ts +3 -21
- package/dist/index.cjs +27 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +27 -18
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/RELEASE_NOTES.md
CHANGED
|
@@ -1,38 +1,28 @@
|
|
|
1
1
|
● ## Highlights
|
|
2
|
-
-
|
|
3
|
-
-
|
|
4
|
-
-
|
|
5
|
-
-
|
|
6
|
-
-
|
|
2
|
+
- Adopt native Playwright Page and Locator types for PwPage and PwLocator.
|
|
3
|
+
- Add test for existingIdBehavior error handling.
|
|
4
|
+
- Improve type safety in tests by replacing any with specific types.
|
|
5
|
+
- Fix type error in existing-id-error.test.ts.
|
|
6
|
+
- Updates across class-generation and plugin modules.
|
|
7
7
|
|
|
8
8
|
## Changes
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
-
|
|
21
|
-
- Minor eslint.config.ts adjustments.
|
|
22
|
-
- CI & Tooling
|
|
23
|
-
- Updated .github/workflows/release.yml and agentic-release-notes.lock.yml.
|
|
24
|
-
- Added scripts/git-hooks/pre-push.sh pre-push guard.
|
|
25
|
-
- Cleaned up .gitignore; updated package.json and package-lock.json for git hooks.
|
|
26
|
-
- Documentation & Logs
|
|
27
|
-
- Linted README.md.
|
|
28
|
-
- Added build_v5.log and build_web_v5.log.
|
|
9
|
+
- Types
|
|
10
|
+
- Use native Playwright Page/Locator for PwPage/PwLocator (class-generation/index.ts,
|
|
11
|
+
class-generation/playwright-types.ts)
|
|
12
|
+
- Tests
|
|
13
|
+
- Add tests/existing-id-error.test.ts for existingIdBehavior error handling
|
|
14
|
+
- Fix type error in tests/existing-id-error.test.ts
|
|
15
|
+
- Update tests/utils-coverage.test.ts
|
|
16
|
+
- Plugin
|
|
17
|
+
- Update plugin/vue-plugin.ts
|
|
18
|
+
- Tooling/Config
|
|
19
|
+
- Update eslint.config.ts
|
|
20
|
+
- Update package.json
|
|
29
21
|
|
|
30
22
|
## Pull Requests Included
|
|
31
|
-
- #1 Add PR release-notes preview comments
|
|
32
|
-
by @dkattan
|
|
23
|
+
- #1 Add PR release-notes preview comments — https://github.com/immense/vue-pom-generator/pull/1
|
|
24
|
+
(by @dkattan)
|
|
33
25
|
|
|
34
26
|
## Testing
|
|
35
|
-
-
|
|
36
|
-
MyComp_CancelButtons_InnerText.vue.
|
|
37
|
-
- No new test suites added.
|
|
27
|
+
- New test added and existing tests updated; type errors addressed.
|
|
38
28
|
|
|
@@ -1193,6 +1193,12 @@ async function generateAggregatedFiles(
|
|
|
1193
1193
|
throw new Error(`Failed to read playwright-types.ts at ${typesPath}`);
|
|
1194
1194
|
}
|
|
1195
1195
|
|
|
1196
|
+
// Strip the import from the inlined types.
|
|
1197
|
+
typesSource = typesSource.replace(
|
|
1198
|
+
/import\s+type\s*\{\s*Locator\s+as\s+PwLocator\s*,\s*Page\s+as\s+PwPage\s*\}\s*from\s*["']@playwright\/test["'];?\s*/,
|
|
1199
|
+
"",
|
|
1200
|
+
);
|
|
1201
|
+
|
|
1196
1202
|
return typesSource.trim();
|
|
1197
1203
|
};
|
|
1198
1204
|
|
|
@@ -1555,7 +1561,7 @@ async function generateAggregatedFiles(
|
|
|
1555
1561
|
|
|
1556
1562
|
const base = ensureDir(outDir);
|
|
1557
1563
|
const outputFile = path.join(base, "page-object-models.g.ts");
|
|
1558
|
-
const header = `/// <reference lib="es2015" />\n${eslintSuppressionHeader}/**\n * Aggregated generated POMs\n${AUTO_GENERATED_COMMENT}`;
|
|
1564
|
+
const header = `/// <reference lib="es2015" />\n${eslintSuppressionHeader}import type { Locator as PwLocator, Page as PwPage } from "@playwright/test";\n/**\n * Aggregated generated POMs\n${AUTO_GENERATED_COMMENT}`;
|
|
1559
1565
|
const content = makeAggregatedContent(header, path.dirname(outputFile), [...views, ...components]);
|
|
1560
1566
|
|
|
1561
1567
|
const indexFile = path.join(base, "index.ts");
|
|
@@ -1,23 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
locator: (selector: string) => PwLocator;
|
|
3
|
-
first: () => PwLocator;
|
|
4
|
-
count: () => Promise<number>;
|
|
5
|
-
click: (options?: { force?: boolean }) => Promise<void>;
|
|
6
|
-
fill: (value: string, options?: { force?: boolean; timeout?: number }) => Promise<void>;
|
|
7
|
-
getAttribute: (name: string) => Promise<string | null>;
|
|
8
|
-
scrollIntoViewIfNeeded: (options?: { timeout?: number }) => Promise<void>;
|
|
9
|
-
}
|
|
1
|
+
import type { Locator as PwLocator, Page as PwPage } from "@playwright/test";
|
|
10
2
|
|
|
11
|
-
export type
|
|
3
|
+
export type { PwLocator, PwPage };
|
|
12
4
|
|
|
13
|
-
export
|
|
14
|
-
locator: (selector: string) => PwLocator;
|
|
15
|
-
url: () => string;
|
|
16
|
-
waitForTimeout: (timeout: number) => Promise<void>;
|
|
17
|
-
evaluate: <R, Arg>(pageFunction: (arg: Arg) => R | Promise<R>, arg: Arg) => Promise<R>;
|
|
18
|
-
isVisible: (selector: string, options?: { timeout?: number }) => Promise<boolean>;
|
|
19
|
-
textContent: (selector: string, options?: { timeout?: number }) => Promise<string | null>;
|
|
20
|
-
waitForSelector: (selector: string, options?: { timeout?: number }) => Promise<object | null>;
|
|
21
|
-
hover: (selector: string, options?: { timeout?: number }) => Promise<void>;
|
|
22
|
-
selectOption: (selector: string, values: PwSelectOption | PwSelectOption[], options?: { timeout?: number }) => Promise<string[]>;
|
|
23
|
-
}
|
|
5
|
+
export type PwSelectOption = string | { value?: string; label?: string; index?: number };
|
package/dist/index.cjs
CHANGED
|
@@ -3462,6 +3462,10 @@ async function generateAggregatedFiles(componentHierarchyMap, vueFilesPathMap, b
|
|
|
3462
3462
|
} catch {
|
|
3463
3463
|
throw new Error(`Failed to read playwright-types.ts at ${typesPath}`);
|
|
3464
3464
|
}
|
|
3465
|
+
typesSource = typesSource.replace(
|
|
3466
|
+
/import\s+type\s*\{\s*Locator\s+as\s+PwLocator\s*,\s*Page\s+as\s+PwPage\s*\}\s*from\s*["']@playwright\/test["'];?\s*/,
|
|
3467
|
+
""
|
|
3468
|
+
);
|
|
3465
3469
|
return typesSource.trim();
|
|
3466
3470
|
};
|
|
3467
3471
|
const inlinePointerModule = () => {
|
|
@@ -3727,7 +3731,8 @@ async function generateAggregatedFiles(componentHierarchyMap, vueFilesPathMap, b
|
|
|
3727
3731
|
const base = ensureDir(outDir);
|
|
3728
3732
|
const outputFile = path.join(base, "page-object-models.g.ts");
|
|
3729
3733
|
const header = `/// <reference lib="es2015" />
|
|
3730
|
-
${eslintSuppressionHeader}
|
|
3734
|
+
${eslintSuppressionHeader}import type { Locator as PwLocator, Page as PwPage } from "@playwright/test";
|
|
3735
|
+
/**
|
|
3731
3736
|
* Aggregated generated POMs
|
|
3732
3737
|
${AUTO_GENERATED_COMMENT}`;
|
|
3733
3738
|
const content = makeAggregatedContent(header, path.dirname(outputFile), [...views, ...components]);
|
|
@@ -5365,8 +5370,16 @@ function createVuePluginWithTestIds(options) {
|
|
|
5365
5370
|
...userCompilerOptions,
|
|
5366
5371
|
prefixIdentifiers: true,
|
|
5367
5372
|
nodeTransforms: [
|
|
5368
|
-
|
|
5369
|
-
|
|
5373
|
+
...userNodeTransforms,
|
|
5374
|
+
(node, context) => {
|
|
5375
|
+
const filename = context.filename;
|
|
5376
|
+
if (!filename || !filename.endsWith(".vue") || !isFileInScope(filename)) {
|
|
5377
|
+
return;
|
|
5378
|
+
}
|
|
5379
|
+
const transforms = getNodeTransforms(filename);
|
|
5380
|
+
const ourTransform = transforms[transforms.length - 1];
|
|
5381
|
+
return ourTransform(node, context);
|
|
5382
|
+
}
|
|
5370
5383
|
]
|
|
5371
5384
|
};
|
|
5372
5385
|
const metadataCollectorPlugin = {
|
|
@@ -5382,21 +5395,17 @@ function createVuePluginWithTestIds(options) {
|
|
|
5382
5395
|
}
|
|
5383
5396
|
const componentName = getComponentNameFromPath(cleanPath);
|
|
5384
5397
|
loggerRef.current.debug(`Collecting metadata for ${cleanPath} (component: ${componentName})`);
|
|
5385
|
-
|
|
5386
|
-
|
|
5387
|
-
|
|
5388
|
-
|
|
5389
|
-
|
|
5390
|
-
|
|
5391
|
-
|
|
5392
|
-
|
|
5393
|
-
|
|
5394
|
-
|
|
5395
|
-
|
|
5396
|
-
loggerRef.current.debug(`Metadata collected for ${cleanPath}`);
|
|
5397
|
-
}
|
|
5398
|
-
} catch (e) {
|
|
5399
|
-
loggerRef.current.warn(`Metadata collection failed for ${cleanPath}: ${e}`);
|
|
5398
|
+
const { parse } = await import("@vue/compiler-sfc");
|
|
5399
|
+
const compilerDom2 = await import("@vue/compiler-dom");
|
|
5400
|
+
const compile = compilerDom2.compile;
|
|
5401
|
+
const { descriptor } = parse(code, { filename: cleanPath });
|
|
5402
|
+
if (descriptor.template) {
|
|
5403
|
+
compile(descriptor.template.content, {
|
|
5404
|
+
...userCompilerOptions,
|
|
5405
|
+
filename: cleanPath,
|
|
5406
|
+
nodeTransforms: getNodeTransforms(cleanPath, componentName)
|
|
5407
|
+
});
|
|
5408
|
+
loggerRef.current.debug(`Metadata collected for ${cleanPath}`);
|
|
5400
5409
|
}
|
|
5401
5410
|
return null;
|
|
5402
5411
|
}
|