@dev-blinq/cucumber_client 1.0.1532-dev → 1.0.1534-dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -486,12 +486,16 @@ class LocatorGenerator {
|
|
|
486
486
|
categorizeLocators(element, locators, options) {
|
|
487
487
|
const unique = [];
|
|
488
488
|
const nonUnique = [];
|
|
489
|
+
const visible = options?.visible ?? true;
|
|
489
490
|
try {
|
|
490
491
|
for (const locator of locators) {
|
|
491
492
|
if (!locator || !locator.css || typeof locator.css !== "string") {
|
|
492
493
|
console.error("Locator must have a valid css selector found: ", locator);
|
|
493
494
|
continue;
|
|
494
495
|
}
|
|
496
|
+
if (visible === false) {
|
|
497
|
+
locator.visible = false;
|
|
498
|
+
}
|
|
495
499
|
const elements = this.getMatchingElements(locator.css, options);
|
|
496
500
|
if (elements.length === 0) {
|
|
497
501
|
console.warn(`No elements found for locator: ${locator.css}`);
|
|
@@ -812,7 +816,20 @@ class LocatorGenerator {
|
|
|
812
816
|
return [];
|
|
813
817
|
}
|
|
814
818
|
}
|
|
819
|
+
isElementVisible(element) {
|
|
820
|
+
if (!(element instanceof Element)) return false;
|
|
821
|
+
const style = window.getComputedStyle(element);
|
|
822
|
+
if (style.display === "none" || style.visibility === "hidden" || style.opacity === "0") return false;
|
|
823
|
+
const rect = element.getBoundingClientRect();
|
|
824
|
+
if (rect.width === 0 || rect.height === 0) return false;
|
|
825
|
+
return true;
|
|
826
|
+
}
|
|
815
827
|
getElementLocators(element, options = {}) {
|
|
828
|
+
const isVisible = this.isElementVisible(element);
|
|
829
|
+
if (isVisible === false) {
|
|
830
|
+
console.warn("Element is not visible: ", element);
|
|
831
|
+
options.visible = isVisible;
|
|
832
|
+
}
|
|
816
833
|
try {
|
|
817
834
|
const {
|
|
818
835
|
excludeText = false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dev-blinq/cucumber_client",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1534-dev",
|
|
4
4
|
"description": " ",
|
|
5
5
|
"main": "bin/index.js",
|
|
6
6
|
"types": "bin/index.d.ts",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@cucumber/tag-expressions": "^6.1.1",
|
|
40
40
|
"@dev-blinq/cucumber-js": "1.0.195-dev",
|
|
41
41
|
"@faker-js/faker": "^8.4.1",
|
|
42
|
-
"automation_model": "1.0.
|
|
42
|
+
"automation_model": "1.0.877-dev",
|
|
43
43
|
"axios": "^1.7.4",
|
|
44
44
|
"chokidar": "^3.6.0",
|
|
45
45
|
"create-require": "^1.1.1",
|