diff --git a/manifest.json b/manifest.json index 44a34d21..b4f1ee9d 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.14.1", + "version": "3.14.2", "icons": { "128": "icon128.png" }, diff --git a/package.json b/package.json index 9f7ced38..f5630345 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jdn-ai-chrome-extension", - "version": "3.14.1", + "version": "3.14.2", "description": "jdn-ai chrome extension", "scripts": { "start": "webpack --watch --env devenv", diff --git a/src/__tests__/__mocks__/pageObjectMocks/pageObject.mock.js b/src/__tests__/__mocks__/pageObjectMocks/pageObject.mock.js index c4c3ed9f..19138035 100644 --- a/src/__tests__/__mocks__/pageObjectMocks/pageObject.mock.js +++ b/src/__tests__/__mocks__/pageObjectMocks/pageObject.mock.js @@ -1,4 +1,4 @@ -import { AnnotationType } from "../../../common/types/common"; +import { AnnotationType, LocatorType } from "../../../common/types/common"; export const getLocatorsByAnnotationType = (value) => { return [ @@ -233,8 +233,8 @@ export const locatorsVividus = [ children: [], active: false, generate: true, - annotationType: "@FindBy", - locatorType: "CSS selector", + annotationType: AnnotationType.FindBy, + locatorType: LocatorType.cssSelector, }, { element_id: "0735357117115098156691382591_0", @@ -261,8 +261,8 @@ export const locatorsVividus = [ parent_id: "", children: [], active: false, - locatorType: "xPath", - annotationType: "@FindBy", + locatorType: LocatorType.xPath, + annotationType: AnnotationType.FindBy, library: "HTML5", message: "", isCustomName: true, @@ -294,8 +294,8 @@ export const locatorsVividus = [ parent_id: "", children: [], active: false, - locatorType: "CSS selector", - annotationType: "@UI", + locatorType: LocatorType.cssSelector, + annotationType: AnnotationType.UI, library: "HTML5", message: "", isCustomName: true, @@ -327,8 +327,8 @@ export const locatorsVividus = [ parent_id: "", children: [], active: true, - locatorType: "xPath", - annotationType: "@UI", + locatorType: LocatorType.xPath, + annotationType: AnnotationType.UI, library: "HTML5", message: "", isCustomName: true, @@ -454,7 +454,7 @@ public class HomePage extends WebPage { `; export const pageObjectVividus = `variables.HomePage.url=(/jdi-light/index.html) -variables.HomePage.Label.simpleTable=By.cssSelector(xpath = [index="\\33 "] [index="\\34 "] > a) +variables.HomePage.Label.simpleTable=By.cssSelector(css = [index="\\33 "] [index="\\34 "] > a) variables.HomePage.Label.userTable=By.xPath(xpath = //*[contains(text(), 'User Table ')]) variables.HomePage.TextArea.password=By.cssSelector(#password) variables.HomePage.Label.dates=By.xPath(//a[contains(text(), 'Dates')]) diff --git a/src/features/pageObjects/utils/pageObjectTemplate.ts b/src/features/pageObjects/utils/pageObjectTemplate.ts index c158e2fb..7c8c1dff 100644 --- a/src/features/pageObjects/utils/pageObjectTemplate.ts +++ b/src/features/pageObjects/utils/pageObjectTemplate.ts @@ -29,12 +29,13 @@ export const getPageObjectTemplateForVidus = ( locators.forEach((it) => { const currentAnnotationType = it.annotationType || annotationType || AnnotationType.UI; - const currentLocatorType = _.camelCase(it.locatorType || locatorType || LocatorType.xPath); - pageCode += `variables.${name}.${it.type}.${it.name}=By.${currentLocatorType}(${getLocatorPrefix( + const currentLocatorType: LocatorType = it.locatorType || locatorType || LocatorType.xPath; + const currentLocatorTypeProperty = _.camelCase(currentLocatorType); + pageCode += `variables.${name}.${it.type}.${it.name}=By.${currentLocatorTypeProperty}(${getLocatorPrefix( currentAnnotationType, - currentLocatorType as LocatorType + currentLocatorType // @ts-ignore - )}${it.locator[currentLocatorType]})\n`; + )}${it.locator[currentLocatorTypeProperty]})\n`; }); return { pageCode, title: name };