diff --git a/manifest.json b/manifest.json index 8037c2da..0692b855 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.14.34", + "version": "3.14.35", "icons": { "128": "icon128.png" }, diff --git a/package-lock.json b/package-lock.json index beef7a6b..236e5646 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "jdn-ai-chrome-extension", - "version": "3.14.34", + "version": "3.14.35", "lockfileVersion": 3, "requires": true, "packages": { @@ -18630,4 +18630,4 @@ } } } -} +} \ No newline at end of file diff --git a/package.json b/package.json index 83c98fa0..38dcbeba 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jdn-ai-chrome-extension", - "version": "3.14.34", + "version": "3.14.35", "description": "jdn-ai chrome extension", "scripts": { "start": "webpack --watch --env devenv", @@ -107,7 +107,6 @@ "eslint-plugin-react": "^7.33.2", "eslint-plugin-react-hooks": "^4.6.0", "file-loader": "6.2.0", - "html-webpack-plugin": "5.5.3", "husky": "^8.0.2", "jest": "^29.7.0", diff --git a/src/features/locators/utils/createLocatorTypeOptions.tsx b/src/features/locators/utils/createLocatorTypeOptions.tsx index b8400d4b..0b85097b 100644 --- a/src/features/locators/utils/createLocatorTypeOptions.tsx +++ b/src/features/locators/utils/createLocatorTypeOptions.tsx @@ -144,6 +144,7 @@ const splitUniqueAndNonUniqueAttributes = ( Object.entries(attributes).forEach(([key, value]) => { const keyType = key as keyof ElementAttributes; + const isValueEmpty = value === '' || value === null || value === undefined; if (keyType === 'dataAttributes' && value) { // Check and unpacked data-attributes: @@ -152,10 +153,13 @@ const splitUniqueAndNonUniqueAttributes = ( const nonUniqueDataAttributes: { [key: string]: string | null } = {}; Object.entries(dataAttributes).forEach(([dataKey, dataValue]) => { - if (!attributesHashMap.has(dataKey) || !attributesHashMap.get(dataKey)?.has(dataValue)) { - uniqueDataAttributes[dataKey] = dataValue; - } else { + const isDataValueEmpty = dataValue === '' || dataValue === null || dataValue === undefined; + const isNonUnique = + isDataValueEmpty || !attributesHashMap.has(dataKey) || !attributesHashMap.get(dataKey)?.has(dataValue); + if (isNonUnique) { nonUniqueDataAttributes[dataKey] = dataValue; + } else { + uniqueDataAttributes[dataKey] = dataValue; } }); @@ -167,12 +171,11 @@ const splitUniqueAndNonUniqueAttributes = ( mergeObjects(nonUniqueAttributes, nonUniqueDataAttributes); } } else { - const isUnique = !attributesHashMap.has(key) || !attributesHashMap.get(key)?.has(value); - - if (isUnique) { - uniqueAttributes[keyType] = value; - } else { + const isNonUnique = isValueEmpty || !attributesHashMap.has(key) || !attributesHashMap.get(key)?.has(value); + if (isNonUnique) { nonUniqueAttributes[keyType] = value; + } else { + uniqueAttributes[keyType] = value; } } });