Skip to content

Commit

Permalink
Hotfix 1480: Fixed locator type for Vividus
Browse files Browse the repository at this point in the history
  • Loading branch information
kostrubin authored Aug 24, 2023
2 parents 2ef5463 + 0c93f8d commit 909d825
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
20 changes: 10 additions & 10 deletions src/__tests__/__mocks__/pageObjectMocks/pageObject.mock.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AnnotationType } from "../../../common/types/common";
import { AnnotationType, LocatorType } from "../../../common/types/common";

export const getLocatorsByAnnotationType = (value) => {
return [
Expand Down Expand Up @@ -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",
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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')])
Expand Down
9 changes: 5 additions & 4 deletions src/features/pageObjects/utils/pageObjectTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down

0 comments on commit 909d825

Please sign in to comment.