Skip to content

Commit

Permalink
Merge pull request #1416 from jdi-testing/issue_1372
Browse files Browse the repository at this point in the history
issue 1372: remove hash from invalid locator
  • Loading branch information
MariiaNebesnova authored Jul 28, 2023
2 parents 14d118a + 4afc54f commit 7e24a81
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 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.536",
"version": "3.13.537",
"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.536",
"version": "3.13.537",
"description": "jdn-ai chrome extension",
"scripts": {
"start": "webpack --watch --env devenv",
Expand Down
1 change: 0 additions & 1 deletion src/common/components/notification/useNotifications.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ export const useNotifications = (container?: HTMLElement | null) => {
notification[type]({
message: _message,
description,
duration: 500,
getContainer: () => container || document.body,
placement: "bottom",
bottom,
Expand Down
3 changes: 3 additions & 0 deletions src/features/locators/locators.slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
LocatorCalculationPriority,
JDNHash,
LocatorValue,
LocatorValidationWarnings,
} from "./types/locator.types";
import { checkLocatorsValidityReducer } from "./reducers/checkLocatorValidity.thunk";
import { LocatorType } from "../../common/types/common";
Expand Down Expand Up @@ -73,6 +74,8 @@ const locatorsSlice = createSlice({
newValue.locator.xPath = locator;
}

if (rest.message === LocatorValidationWarnings.NotFound) newValue.jdnHash = "";

locatorsAdapter.upsertOne(state, newValue);
},
changeIdentificationStatus(state, { payload }: PayloadAction<IdentificationStatus>) {
Expand Down
12 changes: 7 additions & 5 deletions src/pageServices/contentScripts/selectable.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@ export const selectable = () => {
});
} else query = `[id='${payload.jdnHash}']`;

this.foreach(document.querySelectorAll(query), (element) => {
if (element.classList.contains(opt.selectedClass)) {
element.classList.remove(opt.selectedClass);
}
});
if (query.length) {
this.foreach(document.querySelectorAll(query), (element) => {
if (element.classList.contains(opt.selectedClass)) {
element.classList.remove(opt.selectedClass);
}
});
}
};

Selectables.prototype.setSelect = function (payload) {
Expand Down

0 comments on commit 7e24a81

Please sign in to comment.