Skip to content

Commit

Permalink
Merge branch 'master' into issue_1415
Browse files Browse the repository at this point in the history
  • Loading branch information
MariiaNebesnova committed Jul 28, 2023
2 parents af1af6b + 51b9874 commit dda3ca3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 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.13.538",
"version": "3.13.539",
"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.13.538",
"version": "3.13.539",
"description": "jdn-ai chrome extension",
"scripts": {
"start": "webpack --watch --env devenv",
Expand Down
3 changes: 3 additions & 0 deletions src/__tests__/__mocks__/pageObjectMocks/pageObject.mock.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -32,6 +33,7 @@ export const locators = [
robulaXpath: "//*[@class='footer-menu']",
output: "//*[@class='footer-menu']",
},
annotationType: AnnotationType.UI,
name: "listUl7",
predictedAttrId: "",
predicted_label: "list",
Expand All @@ -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",
Expand Down
7 changes: 5 additions & 2 deletions src/features/pageObjects/utils/pageObjectTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +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 { AnnotationType } from "../../../common/types/common";
import { getLocatorPrefix } from "../../locators/utils/locatorOutput";

export const getClassName = (title: string) => {
let className = transliterate(title);
Expand All @@ -20,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 ` ${AnnotationType.UI}("${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;
Expand Down

0 comments on commit dda3ca3

Please sign in to comment.