@immense/vue-pom-generator 1.0.43 → 1.0.44
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 +14 -18
- package/class-generation/Pointer.ts +43 -2
- package/class-generation/index.ts +27 -4
- package/dist/class-generation/Pointer.d.ts +2 -0
- package/dist/class-generation/Pointer.d.ts.map +1 -1
- package/dist/index.cjs +26 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +26 -3
- package/dist/index.mjs.map +1 -1
- package/dist/plugin/types.d.ts +1 -1
- package/dist/plugin/types.d.ts.map +1 -1
- package/dist/tests/pointer.test.d.ts +2 -0
- package/dist/tests/pointer.test.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3671,6 +3671,26 @@ function generateAggregatedCSharpFiles(componentHierarchyMap, outDir, options =
|
|
|
3671
3671
|
" protected IPage Page { get; }",
|
|
3672
3672
|
` protected ILocator LocatorByTestId(string testId) => Page.Locator($"[${testIdAttribute}=\\"{testId}\\"]");`,
|
|
3673
3673
|
" protected ILocator LocatorWithinTestIdByLabel(string rootTestId, string label, bool exact = true) => LocatorByTestId(rootTestId).GetByLabel(label, new() { Exact = exact });",
|
|
3674
|
+
" protected async Task<ILocator> ResolveEditableLocatorAsync(ILocator locator)",
|
|
3675
|
+
" {",
|
|
3676
|
+
' var isEditable = await locator.EvaluateAsync<bool>(@"el => {',
|
|
3677
|
+
" if (!el || !(el instanceof HTMLElement)) return false;",
|
|
3678
|
+
" const tagName = el.tagName.toLowerCase();",
|
|
3679
|
+
" return tagName === 'input' || tagName === 'textarea' || tagName === 'select' || el.isContentEditable;",
|
|
3680
|
+
' }");',
|
|
3681
|
+
" if (isEditable)",
|
|
3682
|
+
" {",
|
|
3683
|
+
" return locator;",
|
|
3684
|
+
" }",
|
|
3685
|
+
"",
|
|
3686
|
+
` var descendant = locator.Locator("input, textarea, select, [contenteditable=''], [contenteditable='true'], [contenteditable]:not([contenteditable='false'])").First;`,
|
|
3687
|
+
" if (await descendant.CountAsync() > 0)",
|
|
3688
|
+
" {",
|
|
3689
|
+
" return descendant;",
|
|
3690
|
+
" }",
|
|
3691
|
+
"",
|
|
3692
|
+
" return locator;",
|
|
3693
|
+
" }",
|
|
3674
3694
|
" protected async Task ClickWithinTestIdByLabelAsync(string rootTestId, string label, bool exact = true)",
|
|
3675
3695
|
" {",
|
|
3676
3696
|
" await LocatorWithinTestIdByLabel(rootTestId, label, exact).ClickAsync();",
|
|
@@ -3772,7 +3792,8 @@ function generateAggregatedCSharpFiles(componentHierarchyMap, outDir, options =
|
|
|
3772
3792
|
const callSuffix = pom.formattedDataTestId.includes("${") ? `(${args})` : "";
|
|
3773
3793
|
const emitActionCall = (locatorAccess) => {
|
|
3774
3794
|
if (pom.nativeRole === "input") {
|
|
3775
|
-
chunks.push(` await ${locatorAccess}
|
|
3795
|
+
chunks.push(` var editableLocator = await ResolveEditableLocatorAsync(${locatorAccess});`);
|
|
3796
|
+
chunks.push(" await editableLocator.FillAsync(text);");
|
|
3776
3797
|
} else if (pom.nativeRole === "select") {
|
|
3777
3798
|
chunks.push(` await ${locatorAccess}.SelectOptionAsync(value);`);
|
|
3778
3799
|
} else if (pom.nativeRole === "vselect") {
|
|
@@ -3800,7 +3821,8 @@ function generateAggregatedCSharpFiles(componentHierarchyMap, outDir, options =
|
|
|
3800
3821
|
chunks.push(" if (await locator.CountAsync() > 0)");
|
|
3801
3822
|
chunks.push(" {");
|
|
3802
3823
|
if (pom.nativeRole === "input") {
|
|
3803
|
-
chunks.push(" await locator
|
|
3824
|
+
chunks.push(" var editableLocator = await ResolveEditableLocatorAsync(locator);");
|
|
3825
|
+
chunks.push(" await editableLocator.FillAsync(text);");
|
|
3804
3826
|
} else if (pom.nativeRole === "select") {
|
|
3805
3827
|
chunks.push(" await locator.SelectOptionAsync(value);");
|
|
3806
3828
|
} else {
|
|
@@ -4024,7 +4046,8 @@ function generateViewObjectModelContent(componentName, dependencies, componentHi
|
|
|
4024
4046
|
if (!Object.prototype.hasOwnProperty.call(customPomClassIdentifierMap, a.className))
|
|
4025
4047
|
return false;
|
|
4026
4048
|
const scope = a.attachTo ?? "views";
|
|
4027
|
-
const
|
|
4049
|
+
const scopeMatchesBoth = scope === "both" || scope === "pagesAndComponents";
|
|
4050
|
+
const scopeOk = isView ? scope === "views" || scopeMatchesBoth : scope === "components" || scopeMatchesBoth;
|
|
4028
4051
|
if (!scopeOk)
|
|
4029
4052
|
return false;
|
|
4030
4053
|
return a.attachWhenUsesComponents.some((c) => hasChildComponent(c));
|