Skip to content

Commit

Permalink
remove hash from invalid locator
Browse files Browse the repository at this point in the history
  • Loading branch information
MariiaNebesnova committed Jul 27, 2023
1 parent d2184a9 commit fd872bf
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
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 fd872bf

Please sign in to comment.