From fd872bfb9c43f3b3a28ebe02af5e56324a921919 Mon Sep 17 00:00:00 2001 From: MariiaNebesnova Date: Thu, 27 Jul 2023 16:22:34 +0300 Subject: [PATCH 1/2] remove hash from invalid locator --- .../components/notification/useNotifications.tsx | 1 - src/features/locators/locators.slice.ts | 3 +++ src/pageServices/contentScripts/selectable.js | 12 +++++++----- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/common/components/notification/useNotifications.tsx b/src/common/components/notification/useNotifications.tsx index e04669f4..2478c3f2 100644 --- a/src/common/components/notification/useNotifications.tsx +++ b/src/common/components/notification/useNotifications.tsx @@ -56,7 +56,6 @@ export const useNotifications = (container?: HTMLElement | null) => { notification[type]({ message: _message, description, - duration: 500, getContainer: () => container || document.body, placement: "bottom", bottom, diff --git a/src/features/locators/locators.slice.ts b/src/features/locators/locators.slice.ts index 142c4988..4039447b 100644 --- a/src/features/locators/locators.slice.ts +++ b/src/features/locators/locators.slice.ts @@ -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"; @@ -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) { diff --git a/src/pageServices/contentScripts/selectable.js b/src/pageServices/contentScripts/selectable.js index 97590e62..25fce3e1 100644 --- a/src/pageServices/contentScripts/selectable.js +++ b/src/pageServices/contentScripts/selectable.js @@ -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) { From 4afc54f2b7f5b755ae322db51a1e9a3257c0d54d Mon Sep 17 00:00:00 2001 From: MariiaNebesnova Date: Fri, 28 Jul 2023 11:39:48 +0300 Subject: [PATCH 2/2] ver up --- manifest.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index 22e76a5b..63406781 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.13.536", + "version": "3.13.537", "icons": { "128": "icon128.png" }, diff --git a/package.json b/package.json index 21c95c3e..e494cb79 100644 --- a/package.json +++ b/package.json @@ -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",