From b7300022019590ab7282aacf5238f48feb26b600 Mon Sep 17 00:00:00 2001 From: Igor Kostrubin Date: Thu, 27 Jul 2023 18:12:12 +0200 Subject: [PATCH 1/5] dynamic annotation type for downloaded template --- src/features/pageObjects/utils/pageObjectTemplate.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/features/pageObjects/utils/pageObjectTemplate.ts b/src/features/pageObjects/utils/pageObjectTemplate.ts index 7eb8d093..d4487773 100644 --- a/src/features/pageObjects/utils/pageObjectTemplate.ts +++ b/src/features/pageObjects/utils/pageObjectTemplate.ts @@ -2,7 +2,6 @@ import { ElementLibrary } from "../../locators/types/generationClasses.types"; import { camelCase, upperFirst } from "lodash"; import transliterate from "@sindresorhus/transliterate"; import { Locator } from "../../locators/types/locator.types"; -import { AnnotationType } from "../../../common/types/common"; export const getClassName = (title: string) => { let className = transliterate(title); @@ -20,7 +19,7 @@ export const pageObjectTemplate = (locators: Locator[], title: string, library: const className = title; const locatorsCode = locators.map((loc) => { const locatorEscaped = loc.locator.output?.replace(/\\/g, "\\\\").replace(/"/g, '\\"'); - return ` ${AnnotationType.UI}("${locatorEscaped}")\n public ${loc.type} ${loc.name};`; + return ` ${loc.annotationType}("${locatorEscaped}")\n public ${loc.type} ${loc.name};`; }); const pageCode = `package site.pages; From 05ca53e291d1ba42269b6e3a220e88cd4ea69989 Mon Sep 17 00:00:00 2001 From: Igor Kostrubin Date: Thu, 27 Jul 2023 18:41:14 +0200 Subject: [PATCH 2/5] added prefix for template --- src/features/pageObjects/utils/pageObjectTemplate.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/features/pageObjects/utils/pageObjectTemplate.ts b/src/features/pageObjects/utils/pageObjectTemplate.ts index d4487773..751f25c1 100644 --- a/src/features/pageObjects/utils/pageObjectTemplate.ts +++ b/src/features/pageObjects/utils/pageObjectTemplate.ts @@ -2,6 +2,7 @@ import { ElementLibrary } from "../../locators/types/generationClasses.types"; import { camelCase, upperFirst } from "lodash"; import transliterate from "@sindresorhus/transliterate"; import { Locator } from "../../locators/types/locator.types"; +import { getLocatorPrefix } from "../../locators/utils/locatorOutput"; export const getClassName = (title: string) => { let className = transliterate(title); @@ -19,7 +20,10 @@ export const pageObjectTemplate = (locators: Locator[], title: string, library: const className = title; const locatorsCode = locators.map((loc) => { const locatorEscaped = loc.locator.output?.replace(/\\/g, "\\\\").replace(/"/g, '\\"'); - return ` ${loc.annotationType}("${locatorEscaped}")\n public ${loc.type} ${loc.name};`; + return ` ${loc.annotationType}(${getLocatorPrefix( + loc.annotationType, + loc.locatorType + )}"${locatorEscaped}")\n public ${loc.type} ${loc.name};`; }); const pageCode = `package site.pages; From 7ffe9d3e2f620f68141f4ea3cf3a0a2131ad948c Mon Sep 17 00:00:00 2001 From: Igor Kostrubin Date: Fri, 28 Jul 2023 12:15:06 +0200 Subject: [PATCH 3/5] fixed mock data --- src/__tests__/__mocks__/pageObjectMocks/pageObject.mock.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/__tests__/__mocks__/pageObjectMocks/pageObject.mock.js b/src/__tests__/__mocks__/pageObjectMocks/pageObject.mock.js index 6663753c..3dab4e3d 100644 --- a/src/__tests__/__mocks__/pageObjectMocks/pageObject.mock.js +++ b/src/__tests__/__mocks__/pageObjectMocks/pageObject.mock.js @@ -11,6 +11,7 @@ export const locators = [ robulaXpath: "//*[@class='uui-navigation nav navbar-nav m-l8']", output: "//*[@class='uui-navigation nav navbar-nav m-l8']", }, + annotationType: AnnotationType.UI, name: "listUl", predictedAttrId: "", predicted_label: "list", @@ -32,6 +33,7 @@ export const locators = [ robulaXpath: "//*[@class='footer-menu']", output: "//*[@class='footer-menu']", }, + annotationType: AnnotationType.UI, name: "listUl7", predictedAttrId: "", predicted_label: "list", @@ -52,6 +54,7 @@ export const locators = [ output: "/html/body/div/div[1]/div/div[1]/div/div[1]/ul/li[1]/a", taskStatus: "REVOKED", }, + annotationType: AnnotationType.UI, name: "badge", predictedAttrId: "", predicted_label: "badge", From 91dc19cebca73b4054e3060945dc3edc672ce961 Mon Sep 17 00:00:00 2001 From: Igor Kostrubin Date: Fri, 28 Jul 2023 12:15:44 +0200 Subject: [PATCH 4/5] version updated --- manifest.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index 22e76a5b..63406781 100644 --- a/manifest.json +++ b/manifest.json @@ -3,7 +3,7 @@ "name": "JDN", "description": "JDN – helps Test Automation Engineer to create Page Objects in the test automation framework and speed up test development", "devtools_page": "index.html", - "version": "3.13.536", + "version": "3.13.537", "icons": { "128": "icon128.png" }, diff --git a/package.json b/package.json index 21c95c3e..e494cb79 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jdn-ai-chrome-extension", - "version": "3.13.536", + "version": "3.13.537", "description": "jdn-ai chrome extension", "scripts": { "start": "webpack --watch --env devenv", From 50f654e204e6398d76fe6ecb0fbff38610f04682 Mon Sep 17 00:00:00 2001 From: Igor Kostrubin Date: Fri, 28 Jul 2023 12:18:42 +0200 Subject: [PATCH 5/5] version updated --- manifest.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index 63406781..c22f9c8e 100644 --- a/manifest.json +++ b/manifest.json @@ -3,7 +3,7 @@ "name": "JDN", "description": "JDN – helps Test Automation Engineer to create Page Objects in the test automation framework and speed up test development", "devtools_page": "index.html", - "version": "3.13.537", + "version": "3.13.539", "icons": { "128": "icon128.png" }, diff --git a/package.json b/package.json index e494cb79..ea644150 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jdn-ai-chrome-extension", - "version": "3.13.537", + "version": "3.13.539", "description": "jdn-ai chrome extension", "scripts": { "start": "webpack --watch --env devenv",