@applitools/snippets 2.8.0 → 2.8.2
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.
- package/CHANGELOG.md +14 -0
- package/dist/index.js +68 -68
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.8.2](https://github.com/Applitools-Dev/sdk/compare/js/snippets@2.8.1...js/snippets@2.8.2) (2026-04-16)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* remediate npm security vulnerabilities (FLD-4179) ([#3764](https://github.com/Applitools-Dev/sdk/issues/3764)) ([4bc0ef9](https://github.com/Applitools-Dev/sdk/commit/4bc0ef915e8ad606627c6074de582bec53397738))
|
|
9
|
+
|
|
10
|
+
## [2.8.1](https://github.com/Applitools-Dev/sdk/compare/js/snippets@2.8.0...js/snippets@2.8.1) (2026-03-29)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* exclude CHANGELOG.md from all published npm packages | AD-10793 ([#3682](https://github.com/Applitools-Dev/sdk/issues/3682)) ([95a0a80](https://github.com/Applitools-Dev/sdk/commit/95a0a8063fc2e1809c1bef1fc651d6deceda6e7e))
|
|
16
|
+
|
|
3
17
|
## [2.8.0](https://github.com/Applitools-Dev/sdk/compare/js/snippets@2.7.1...js/snippets@2.8.0) (2026-03-12)
|
|
4
18
|
|
|
5
19
|
|
package/dist/index.js
CHANGED
|
@@ -1,136 +1,136 @@
|
|
|
1
|
-
exports.
|
|
2
|
-
var s=function(){"use strict";function
|
|
3
|
-
return s(arg)
|
|
4
|
-
}
|
|
5
|
-
exports.addFallbackSelectorIfNeeded=function(arg){
|
|
6
|
-
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var e=function(t){var e=t&&t[0]||null;return!e||("isConnected"in window.Node.prototype?!e.isConnected:document.documentElement.contains?!document.documentElement.contains(e):!e.ownerDocument.documentElement.contains(e))};return t((function(t){if(!t.hasAttribute("data-applitools-fallback-selector")){if(e([t]))throw new Error("The element is not connected to the DOM: "+function(t){var e=t.attributes,n=t.tagName,o=t.children.length,r=[].slice.call(e).map((function(t){return t.name+'="'+t.value+'"'})).join(" ");return"<"+n+" "+r+(o?">":"/>")}(t));t.setAttribute("data-applitools-fallback-selector",function(t){var e=[];for(;t&&t.nodeType===Node.ELEMENT_NODE;)try{var n,o=t.tagName.toLowerCase(),r=[].slice.call((null==(n=t.parentNode)?void 0:n.children)||[]).indexOf(t);r>-1&&(o+=":nth-child("+(r+1)+")"),e.unshift(o),t=t.parentNode}catch(t){break}return e.length?e.join(" > "):"html"}(t))}}))}();
|
|
1
|
+
exports.translateTo=function(arg){
|
|
2
|
+
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var r=function(t){var r=void 0===t?[]:t,e=r[0],n=r[1],o=Object.keys(n).sort(),a=o.reduce((function(t,r){return t[r]={value:e.style.getPropertyValue(r),important:Boolean(e.style.getPropertyPriority(r))},t}),{});return o.forEach((function(t){e.style.setProperty(t,"string"!=typeof n[t]&&n[t]?n[t].value:n[t],n[t]&&n[t].important?"important":"")})),a};return t((function(t){var e=void 0===t?[]:t,n=e[0],o=e[1];n=n||document.documentElement;var a={value:"translate("+-o.x+"px, "+-o.y+"px)",important:!0};return r([n,{transform:a,"-webkit-transform":a}]),o}))}();
|
|
7
3
|
return s(arg)
|
|
8
4
|
}
|
|
9
|
-
exports.
|
|
10
|
-
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}
|
|
5
|
+
exports.setElementStyleProperties=function(arg){
|
|
6
|
+
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}return t((function(t){var e=void 0===t?[]:t,r=e[0],o=e[1],n=Object.keys(o).sort(),u=n.reduce((function(t,e){return t[e]={value:r.style.getPropertyValue(e),important:Boolean(r.style.getPropertyPriority(e))},t}),{});return n.forEach((function(t){r.style.setProperty(t,"string"!=typeof o[t]&&o[t]?o[t].value:o[t],o[t]&&o[t].important?"important":"")})),u}))}();
|
|
11
7
|
return s(arg)
|
|
12
8
|
}
|
|
13
|
-
exports.
|
|
14
|
-
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}return t((function(t){var e=
|
|
9
|
+
exports.setElementAttributes=function(arg){
|
|
10
|
+
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}return t((function(t){var e=void 0===t?[]:t,r=e[0],u=e[1];return Object.keys(u).reduce((function(t,e){return t[e]=r.getAttribute(e),r.setAttribute(e,u[e]),t}),{})}))}();
|
|
15
11
|
return s(arg)
|
|
16
12
|
}
|
|
17
|
-
exports.
|
|
18
|
-
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}
|
|
13
|
+
exports.scrollTo=function(arg){
|
|
14
|
+
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var r=function(t){var r=void 0===t?[]:t,o=r[0],e=r[1],l=Object.keys(e).sort(),n=l.reduce((function(t,r){return t[r]={value:o.style.getPropertyValue(r),important:Boolean(o.style.getPropertyPriority(r))},t}),{});return l.forEach((function(t){o.style.setProperty(t,"string"!=typeof e[t]&&e[t]?e[t].value:e[t],e[t]&&e[t].important?"important":"")})),n};return t((function(t){var o=void 0===t?[]:t,e=o[0],l=o[1];e=e||document.documentElement;var n=r([e,{"scroll-behavior":{value:"auto",important:!0}}]);return e.scrollTo?e.scrollTo(l.x,l.y):(e.scrollLeft=l.x,e.scrollTop=l.y),r([e,n]),{x:e.scrollLeft,y:e.scrollTop}}))}();
|
|
19
15
|
return s(arg)
|
|
20
16
|
}
|
|
21
|
-
exports.
|
|
22
|
-
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}
|
|
17
|
+
exports.reloadPage=function(arg){
|
|
18
|
+
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}return t((function(){window.location.reload()}))}();
|
|
23
19
|
return s(arg)
|
|
24
20
|
}
|
|
25
|
-
exports.
|
|
26
|
-
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}return t((function(t){var
|
|
21
|
+
exports.lazyLoad=function(arg){
|
|
22
|
+
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var o=function(t){var o=(void 0===t?[]:t)[0];return o?{x:o.scrollLeft,y:o.scrollTop}:{x:window.scrollX||window.pageXOffset,y:window.scrollY||window.pageYOffset}};var r=function(t){var o=void 0===t?[]:t,r=o[0],n=o[1],e=Object.keys(n).sort(),i=e.reduce((function(t,o){return t[o]={value:r.style.getPropertyValue(o),important:Boolean(r.style.getPropertyPriority(o))},t}),{});return e.forEach((function(t){r.style.setProperty(t,"string"!=typeof n[t]&&n[t]?n[t].value:n[t],n[t]&&n[t].important?"important":"")})),i};var n=function(t){var o=void 0===t?[]:t,n=o[0],e=o[1];n=n||document.documentElement;var i=r([n,{"scroll-behavior":{value:"auto",important:!0}}]);return n.scrollTo?n.scrollTo(e.x,e.y):(n.scrollLeft=e.x,n.scrollTop=e.y),r([n,i]),{x:n.scrollLeft,y:n.scrollTop}},e="__EYES__APPLITOOLS__",i="lazyLoadResult";window[e]=window[e]||{};var l=o,a=n;return t((function(t){var o=void 0===t?[]:t,r=o[0],n=o[1],s=void 0===n?{}:n,u=s.scrollLength,c=s.waitingTime,w=s.maxAmountToScroll;try{if(window[e][i]){var d=window[e][i];return"WIP"!==d.status&&delete window[e][i],JSON.stringify(d)}window[e][i]={status:"WIP"};var v=l(),y=[];y.push({maxAmountToScroll:w,scrollLength:u,waitingTime:c,startingScrollPositionX:v.x,startingScrollPositionY:v.y});var f=Date.now();return function t(o){var n=void 0===o?{}:o,l=n.doneScrolling,s=n.previousScrollResult,d=void 0===s?{}:s;setTimeout((function(){try{if(l){var o=a([r,v]),n=o.x,s=o.y;return y.push({x:n,y:s,msSinceStart:Date.now()-f}),void(window[e][i]={status:"SUCCESS",value:y})}var c=a([r,{x:v.x,y:d.y+u}]),p=c.x,S=c.y;y.push({x:p,y:S,msSinceStart:Date.now()-f}),t({doneScrolling:S===d.y||S===w,previousScrollResult:{x:p,y:S}})}catch(t){window[e][i]={status:"ERROR",error:t}}}),c)}(),JSON.stringify(window[e][i])}catch(t){return window[e][i]={status:"ERROR",error:t},JSON.stringify(window[e][i])}}))}();
|
|
27
23
|
return s(arg)
|
|
28
24
|
}
|
|
29
|
-
exports.
|
|
30
|
-
var s=function(){"use strict";function
|
|
25
|
+
exports.isStaleElement=function(arg){
|
|
26
|
+
var s=function(){"use strict";function n(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}return n((function(n){var e=n&&n[0]||null;return!e||("isConnected"in window.Node.prototype?!e.isConnected:document.documentElement.contains?!document.documentElement.contains(e):!e.ownerDocument.documentElement.contains(e))}))}();
|
|
31
27
|
return s(arg)
|
|
32
28
|
}
|
|
33
|
-
exports.
|
|
34
|
-
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}
|
|
29
|
+
exports.isEqualElements=function(arg){
|
|
30
|
+
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}return t((function(t){var r=void 0===t?[]:t;return r[0]===r[1]}))}();
|
|
35
31
|
return s(arg)
|
|
36
32
|
}
|
|
37
|
-
exports.
|
|
38
|
-
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}
|
|
33
|
+
exports.isElementScrollable=function(arg){
|
|
34
|
+
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var e=function(t){var e=void 0===t?[]:t,o=e[0],r=e[1],n=void 0===r?[]:r,l=window.getComputedStyle(o);return l?n.map((function(t){return l.getPropertyValue(t)})):[]};return t((function(t){var o=(void 0===t?[]:t)[0],r=e([o,["overflow-x","overflow-y","overflow"]]);return("scroll"===r[0]||"auto"===r[0]||"hidden"===r[2])&&o.scrollWidth>o.clientWidth||("scroll"===r[1]||"auto"===r[1]||"hidden"===r[2])&&o.scrollHeight>o.clientHeight}))}();
|
|
39
35
|
return s(arg)
|
|
40
36
|
}
|
|
41
|
-
exports.
|
|
42
|
-
var s=function(){"use strict";function
|
|
37
|
+
exports.getViewport=function(arg){
|
|
38
|
+
var s=function(){"use strict";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}return e((function(){var e,n=0,t=0;return window.innerHeight?t=window.innerHeight:document.documentElement&&document.documentElement.clientHeight?t=document.documentElement.clientHeight:document.body&&document.body.clientHeight&&(t=document.body.clientHeight),window.innerWidth?n=window.innerWidth:document.documentElement&&document.documentElement.clientWidth?n=document.documentElement.clientWidth:document.body&&document.body.clientWidth&&(n=document.body.clientWidth),window.screen&&window.screen.orientation?e=window.screen.orientation.type.replace(/-primary$/,""):null!=window.orientation&&(0===window.orientation?e="portrait":180===window.orientation?e="portrait-secondary":90===window.orientation?e="landscape":-90===window.orientation&&(e="landscape-secondary")),{viewportSize:{width:n,height:t},pixelRatio:window.devicePixelRatio,viewportScale:window.visualViewport&&window.visualViewport.scale,orientation:e}}))}();
|
|
43
39
|
return s(arg)
|
|
44
40
|
}
|
|
45
|
-
exports.
|
|
46
|
-
var s=function(){"use strict";function
|
|
41
|
+
exports.getUserAgent=function(arg){
|
|
42
|
+
var s=function(){"use strict";function n(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function t(){return t=Object.assign?Object.assign.bind():function(n){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var e in r)({}).hasOwnProperty.call(r,e)&&(n[e]=r[e])}return n},t.apply(null,arguments)}var r="__EYES__APPLITOOLS__",e="userAgent";return window[r]=window[r]||{},n((function(){try{if(window[r][e]){var n=window[r][e];return"WIP"!==n.status&&delete window[r][e],JSON.stringify(n)}return window.navigator.userAgentData?(window[r][e]={status:"WIP"},window.navigator.userAgentData.getHighEntropyValues(["brands","platform","platformVersion","model"]).then((function(n){window[r][e]={status:"SUCCESS",value:t({legacy:window.navigator.userAgent},n)}})).catch((function(n){window[r][e]={status:"ERROR",error:n.message}}))):window[r][e]={status:"SUCCESS",value:window.navigator.userAgent},JSON.stringify(window[r][e])}catch(n){return window[r][e]={status:"ERROR",error:n.message},JSON.stringify(window[r][e])}}))}();
|
|
47
43
|
return s(arg)
|
|
48
44
|
}
|
|
49
|
-
exports.
|
|
50
|
-
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}
|
|
45
|
+
exports.getText=function(arg){
|
|
46
|
+
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}return t((function(t){return t[0].innerText}))}();
|
|
51
47
|
return s(arg)
|
|
52
48
|
}
|
|
53
|
-
exports.
|
|
54
|
-
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}return t((function(t){
|
|
49
|
+
exports.getShadowRoot=function(arg){
|
|
50
|
+
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}return t((function(t){return(void 0===t?[]:t)[0].shadowRoot}))}();
|
|
55
51
|
return s(arg)
|
|
56
52
|
}
|
|
57
|
-
exports.
|
|
58
|
-
var s=function(){"use strict";function
|
|
53
|
+
exports.getElementXpath=function(arg){
|
|
54
|
+
var s=function(){"use strict";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}return e((function(e){var r=(void 0===e?[]:e)[0],t="",n=r.ownerDocument;if(!n)return t;for(var a=r;a!==n;){var o=Array.prototype.filter.call(a.parentNode.childNodes,(function(e){return e.tagName===a.tagName})).indexOf(a);t="/"+a.tagName+"["+(o+1)+"]"+t,a=a.parentNode}return t}))}();
|
|
59
55
|
return s(arg)
|
|
60
56
|
}
|
|
61
|
-
exports.
|
|
62
|
-
var s=function(){"use strict";function
|
|
57
|
+
exports.getElementTranslateOffset=function(arg){
|
|
58
|
+
var s=function(){"use strict";function r(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var t=function(r){var t=void 0===r?[]:r,e=t[0],n=t[1];return(void 0===n?[]:n).reduce((function(r,t){return r[t]={value:e.style.getPropertyValue(t),important:Boolean(e.style.getPropertyPriority(t))},r}),{})};return r((function(r){var e=(void 0===r?[]:r)[0],n=void 0===e?document.documentElement:e,o=t([n,["transform","-webkit-transform"]]),u=Object.keys(o).reduce((function(r,t){var e=o[t].value;if(e){var n=e.match(/^translate\s*\(\s*(\-?[\d, \.]+)px\s*(,\s*(-?[\d, \.]+)px)?\s*\)/);if(n){var u=n[1],a=void 0!==n[3]?n[3]:0;r.push({x:Math.round(-parseFloat(u)),y:Math.round(-parseFloat(a))})}else r.push({x:0,y:0})}return r}),[]);if(!u.every((function(r){return u[0].x===r.x||u[0].y===r.y})))throw new Error("Got different css positions!");return u[0]||{x:0,y:0}}))}();
|
|
63
59
|
return s(arg)
|
|
64
60
|
}
|
|
65
|
-
exports.
|
|
66
|
-
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}
|
|
61
|
+
exports.getElementStyleProperties=function(arg){
|
|
62
|
+
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}return t((function(t){var e=void 0===t?[]:t,r=e[0],o=e[1];return(void 0===o?[]:o).reduce((function(t,e){return t[e]={value:r.style.getPropertyValue(e),important:Boolean(r.style.getPropertyPriority(e))},t}),{})}))}();
|
|
67
63
|
return s(arg)
|
|
68
64
|
}
|
|
69
65
|
exports.getElementScrollOffset=function(arg){
|
|
70
66
|
var s=function(){"use strict";function o(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}return o((function(o){var t=(void 0===o?[]:o)[0];return t?{x:t.scrollLeft,y:t.scrollTop}:{x:window.scrollX||window.pageXOffset,y:window.scrollY||window.pageYOffset}}))}();
|
|
71
67
|
return s(arg)
|
|
72
68
|
}
|
|
73
|
-
exports.
|
|
74
|
-
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}
|
|
69
|
+
exports.getElementRect=function(arg){
|
|
70
|
+
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var e=function(t){var e=void 0===t?[]:t,r=e[0],o=e[1];return(void 0===o?[]:o).reduce((function(t,e){return t[e]={value:r.style.getPropertyValue(e),important:Boolean(r.style.getPropertyPriority(e))},t}),{})};var r=function(t){var e=(void 0===t?[]:t)[0];return e?{x:e.scrollLeft,y:e.scrollTop}:{x:window.scrollX||window.pageXOffset,y:window.scrollY||window.pageYOffset}},o=function(t){var r=(void 0===t?[]:t)[0],o=void 0===r?document.documentElement:r,n=e([o,["transform","-webkit-transform"]]),i=Object.keys(n).reduce((function(t,e){var r=n[e].value;if(r){var o=r.match(/^translate\s*\(\s*(\-?[\d, \.]+)px\s*(,\s*(-?[\d, \.]+)px)?\s*\)/);if(o){var i=o[1],a=void 0!==o[3]?o[3]:0;t.push({x:Math.round(-parseFloat(i)),y:Math.round(-parseFloat(a))})}else t.push({x:0,y:0})}return t}),[]);if(!i.every((function(t){return i[0].x===t.x||i[0].y===t.y})))throw new Error("Got different css positions!");return i[0]||{x:0,y:0}};var n=function(t){for(var e=(void 0===t?[]:t)[0];e.offsetParent&&e.offsetParent!==document.body&&e.offsetParent!==document.documentElement;)e=e.offsetParent;return"fixed"===window.getComputedStyle(e).getPropertyValue("position")?e:null},i=function(t){var e=(void 0===t?[]:t)[0],n=r([e]),i=o([e]);return{x:n.x+i.x,y:n.y+i.y}},a=function(){var t="HTML",e=document.scrollingElement;return e&&(t=e.tagName),t.toLowerCase()};return t((function(t){var e=void 0===t?[]:t,r=e[0],o=e[1],u=void 0!==o&&o;if(r===document.documentElement||r.tagName.toLowerCase()===a())return{x:0,y:0,width:r.clientWidth,height:r.clientHeight};var d=r.getBoundingClientRect(),l={x:d.left,y:d.top,width:d.width,height:d.height};if(u){var f=window.getComputedStyle(r);l.x+=parseInt(f.getPropertyValue("border-left-width")),l.y+=parseInt(f.getPropertyValue("border-top-width")),l.width=r.clientWidth,l.height=r.clientHeight}var s=n([r]);if(s){if(s!==r){var c=i([s]);l.x+=c.x,l.y+=c.y}}else{var v=i();l.x+=v.x,l.y+=v.y}return l}))}();
|
|
75
71
|
return s(arg)
|
|
76
72
|
}
|
|
77
|
-
exports.
|
|
78
|
-
var s=function(){"use strict";function
|
|
73
|
+
exports.getElementProperties=function(arg){
|
|
74
|
+
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}return t((function(t){var r=void 0===t?[]:t,e=r[0],n=r[1];return(void 0===n?[]:n).reduce((function(t,r){return t[r]=e[r],t}),{})}))}();
|
|
79
75
|
return s(arg)
|
|
80
76
|
}
|
|
81
|
-
exports.
|
|
82
|
-
var s=function(){"use strict";function
|
|
77
|
+
exports.getElementInnerOffset=function(arg){
|
|
78
|
+
var s=function(){"use strict";function r(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var t=function(r){var t=void 0===r?[]:r,e=t[0],o=t[1];return(void 0===o?[]:o).reduce((function(r,t){return r[t]={value:e.style.getPropertyValue(t),important:Boolean(e.style.getPropertyPriority(t))},r}),{})};var e=function(r){var t=(void 0===r?[]:r)[0];return t?{x:t.scrollLeft,y:t.scrollTop}:{x:window.scrollX||window.pageXOffset,y:window.scrollY||window.pageYOffset}},o=function(r){var e=(void 0===r?[]:r)[0],o=void 0===e?document.documentElement:e,n=t([o,["transform","-webkit-transform"]]),u=Object.keys(n).reduce((function(r,t){var e=n[t].value;if(e){var o=e.match(/^translate\s*\(\s*(\-?[\d, \.]+)px\s*(,\s*(-?[\d, \.]+)px)?\s*\)/);if(o){var u=o[1],a=void 0!==o[3]?o[3]:0;r.push({x:Math.round(-parseFloat(u)),y:Math.round(-parseFloat(a))})}else r.push({x:0,y:0})}return r}),[]);if(!u.every((function(r){return u[0].x===r.x||u[0].y===r.y})))throw new Error("Got different css positions!");return u[0]||{x:0,y:0}};return r((function(r){var t=(void 0===r?[]:r)[0],n=e([t]),u=o([t]);return{x:n.x+u.x,y:n.y+u.y}}))}();
|
|
83
79
|
return s(arg)
|
|
84
80
|
}
|
|
85
|
-
exports.
|
|
86
|
-
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}return t((function(t){
|
|
81
|
+
exports.getElementFixedAncestor=function(arg){
|
|
82
|
+
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}return t((function(t){for(var e=(void 0===t?[]:t)[0];e.offsetParent&&e.offsetParent!==document.body&&e.offsetParent!==document.documentElement;)e=e.offsetParent;return"fixed"===window.getComputedStyle(e).getPropertyValue("position")?e:null}))}();
|
|
87
83
|
return s(arg)
|
|
88
84
|
}
|
|
89
|
-
exports.
|
|
90
|
-
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}return t((function(t){return t[0].
|
|
85
|
+
exports.getElementContentSize=function(arg){
|
|
86
|
+
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var e=function(t){var e=void 0===t?[]:t,r=e[0],o=e[1],n=Object.keys(o).sort(),a=n.reduce((function(t,e){return t[e]={value:r.style.getPropertyValue(e),important:Boolean(r.style.getPropertyPriority(e))},t}),{});return n.forEach((function(t){r.style.setProperty(t,"string"!=typeof o[t]&&o[t]?o[t].value:o[t],o[t]&&o[t].important?"important":"")})),a},r=function(){var t="HTML",e=document.scrollingElement;return e&&(t=e.tagName),t.toLowerCase()};return t((function(t){var o,n=(void 0===t?[]:t)[0];n!==document.documentElement&&n.tagName.toLowerCase()!==r()||(o=e([n,{transform:"none"}]));var a={width:n.scrollWidth,height:n.scrollHeight};return o&&e([n,o]),a}))}();
|
|
91
87
|
return s(arg)
|
|
92
88
|
}
|
|
93
|
-
exports.
|
|
94
|
-
var s=function(){"use strict";function
|
|
89
|
+
exports.getElementComputedStyleProperties=function(arg){
|
|
90
|
+
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}return t((function(t){var e=void 0===t?[]:t,r=e[0],n=e[1],u=void 0===n?[]:n,o=window.getComputedStyle(r);return o?u.map((function(t){return o.getPropertyValue(t)})):[]}))}();
|
|
95
91
|
return s(arg)
|
|
96
92
|
}
|
|
97
|
-
exports.
|
|
98
|
-
var s=function(){"use strict";function
|
|
93
|
+
exports.getDocumentSize=function(arg){
|
|
94
|
+
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}return t((function(){var t=document.documentElement.scrollWidth,e=document.documentElement.scrollHeight,n=document.documentElement.clientHeight,o=document.body.scrollWidth,c=document.body.scrollHeight,u=document.body.clientHeight;return{width:Math.max(t,o),height:Math.max(n,e,u,c)}}))}();
|
|
99
95
|
return s(arg)
|
|
100
96
|
}
|
|
101
|
-
exports.
|
|
102
|
-
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}
|
|
97
|
+
exports.getDocumentScrollingElement=function(arg){
|
|
98
|
+
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}return t((function(){var t="HTML",e=document.scrollingElement;return e&&(t=e.tagName),t.toLowerCase()}))}();
|
|
103
99
|
return s(arg)
|
|
104
100
|
}
|
|
105
|
-
exports.
|
|
106
|
-
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}
|
|
101
|
+
exports.getContextInfo=function(arg){
|
|
102
|
+
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var e=function(t){var e=(void 0===t?[]:t)[0],n="",r=e.ownerDocument;if(!r)return n;for(var o=e;o!==r;){var a=Array.prototype.filter.call(o.parentNode.childNodes,(function(t){return t.tagName===o.tagName})).indexOf(o);n="/"+o.tagName+"["+(a+1)+"]"+n,o=o.parentNode}return n};return t((function(){var t,n,r;try{t=window.top.document===window.document||"root-context"===window.parent.document["applitools-marker"]}catch(e){t=!1}try{n=!window.parent.document===window.document}catch(t){n=!0}if(!n)try{r=e([window.frameElement])}catch(t){r=null}return[document.documentElement,r,t,n]}))}();
|
|
107
103
|
return s(arg)
|
|
108
104
|
}
|
|
109
|
-
exports.
|
|
110
|
-
var s=function(){"use strict";function
|
|
105
|
+
exports.getChildFramesInfo=function(arg){
|
|
106
|
+
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}return t((function(){return function t(r){r=r||document;var e=[];r.querySelectorAll("frame, iframe").forEach((function(t){return e.push([t,!t.contentDocument,t.src])}));var n=Array.prototype.filter.call(r.querySelectorAll("*"),(function(t){return t.shadowRoot})).map((function(r){return t(r.shadowRoot)}));return e.concat.apply(e,n)}()}))}();
|
|
111
107
|
return s(arg)
|
|
112
108
|
}
|
|
113
|
-
exports.
|
|
114
|
-
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}
|
|
109
|
+
exports.focusElement=function(arg){
|
|
110
|
+
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}return t((function(t){var e=(void 0===t?[]:t)[0];e&&e.focus()}))}();
|
|
115
111
|
return s(arg)
|
|
116
112
|
}
|
|
117
|
-
exports.
|
|
118
|
-
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}return t((function(){
|
|
113
|
+
exports.cleanupPageMarker=function(arg){
|
|
114
|
+
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var e=function(t){var e=void 0===t?[]:t,r=e[0],o=e[1],n=Object.keys(o).sort(),a=n.reduce((function(t,e){return t[e]={value:r.style.getPropertyValue(e),important:Boolean(r.style.getPropertyPriority(e))},t}),{});return n.forEach((function(t){r.style.setProperty(t,"string"!=typeof o[t]&&o[t]?o[t].value:o[t],o[t]&&o[t].important?"important":"")})),a};return t((function(){var t=document.querySelector("[data-applitools-marker]");t&&document.body.removeChild(t);var r=document.documentElement.getAttribute("data-applitools-original-transforms"),o=document.body.getAttribute("data-applitools-original-transforms");r&&e([document.documentElement,JSON.parse(r)]),o&&e([document.body,JSON.parse(o)])}))}();
|
|
119
115
|
return s(arg)
|
|
120
116
|
}
|
|
121
|
-
exports.
|
|
122
|
-
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}
|
|
117
|
+
exports.cleanupElementIds=function(arg){
|
|
118
|
+
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}return t((function(t){(t=t&&t[0])&&"function"==typeof t.forEach&&t.forEach((function(t){t.removeAttribute("data-applitools-selector");var o=t;if(o.getRootNode)try{for(;o;){var e=o.getRootNode();if(!e)break;(o=e.constructor&&"ShadowRoot"===e.constructor.name?e.host:e.defaultView?e.defaultView.frameElement:null)&&o.removeAttribute("data-applitools-selector")}}catch(t){}}))}))}();
|
|
123
119
|
return s(arg)
|
|
124
120
|
}
|
|
125
|
-
exports.
|
|
126
|
-
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}return t((function(t){var e=void 0===t?[]:t
|
|
121
|
+
exports.blurElement=function(arg){
|
|
122
|
+
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}return t((function(t){var e=(void 0===t?[]:t)[0]||document.activeElement;return e&&e.blur(),e}))}();
|
|
127
123
|
return s(arg)
|
|
128
124
|
}
|
|
129
|
-
exports.
|
|
130
|
-
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}
|
|
125
|
+
exports.addPageMarker=function(arg){
|
|
126
|
+
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var e=function(t){var e=void 0===t?[]:t,r=e[0],o=e[1],n=Object.keys(o).sort(),a=n.reduce((function(t,e){return t[e]={value:r.style.getPropertyValue(e),important:Boolean(r.style.getPropertyPriority(e))},t}),{});return n.forEach((function(t){r.style.setProperty(t,"string"!=typeof o[t]&&o[t]?o[t].value:o[t],o[t]&&o[t].important?"important":"")})),a};return t((function(t){var r=t[0],o=r.mask,n=r.size,a=void 0===n?1:n,i={1:"rgb(0, 0, 0)",0:"rgb(255, 255, 255)"},s=a,p=document.createElement("div");p.setAttribute("data-applitools-marker",""),p.style.setProperty("position","fixed","important"),p.style.setProperty("top","0","important"),p.style.setProperty("left","0","important"),p.style.setProperty("box-sizing","content-box","important"),p.style.setProperty("padding",s+"px","important"),p.style.setProperty("background","rgb(128, 128, 128)","important"),p.style.setProperty("z-index","2147483647","important");for(var l,y=0;y<o.length;y+=l){for(l=1;o[y]===o[y+l];)++l;var m=o[y],d=document.createElement("div");d.style.setProperty("display","block","important"),d.style.setProperty("float","left","important"),d.style.setProperty("width",l*a+"px","important"),d.style.setProperty("height",a+"px","important"),d.style.setProperty("background",i[m],"important"),p.appendChild(d)}var u={value:"none",important:!0},c=e([document.documentElement,{transform:u,"-webkit-transform":u}]),f=e([document.body,{transform:u,"-webkit-transform":u}]);return document.documentElement.setAttribute("data-applitools-original-transforms",JSON.stringify(c)),document.body.setAttribute("data-applitools-original-transforms",JSON.stringify(f)),document.body.appendChild(p),{mask:o,size:a,offset:s}}))}();
|
|
131
127
|
return s(arg)
|
|
132
128
|
}
|
|
133
|
-
exports.
|
|
134
|
-
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var
|
|
129
|
+
exports.addFallbackSelectorIfNeeded=function(arg){
|
|
130
|
+
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var e=function(t){var e=t&&t[0]||null;return!e||("isConnected"in window.Node.prototype?!e.isConnected:document.documentElement.contains?!document.documentElement.contains(e):!e.ownerDocument.documentElement.contains(e))};return t((function(t){if(!t.hasAttribute("data-applitools-fallback-selector")){if(e([t]))throw new Error("The element is not connected to the DOM: "+function(t){var e=t.attributes,n=t.tagName,o=t.children.length,r=[].slice.call(e).map((function(t){return t.name+'="'+t.value+'"'})).join(" ");return"<"+n+" "+r+(o?">":"/>")}(t));t.setAttribute("data-applitools-fallback-selector",function(t){var e=[];for(;t&&t.nodeType===Node.ELEMENT_NODE;)try{var n,o=t.tagName.toLowerCase(),r=[].slice.call((null==(n=t.parentNode)?void 0:n.children)||[]).indexOf(t);r>-1&&(o+=":nth-child("+(r+1)+")"),e.unshift(o),t=t.parentNode}catch(t){break}return e.length?e.join(" > "):"html"}(t))}}))}();
|
|
131
|
+
return s(arg)
|
|
132
|
+
}
|
|
133
|
+
exports.addElementIds=function(arg){
|
|
134
|
+
var s=function(){"use strict";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t=function(e){var t=e&&e[0]||null;return!t||("isConnected"in window.Node.prototype?!t.isConnected:document.documentElement.contains?!document.documentElement.contains(t):!t.ownerDocument.documentElement.contains(t))},r=t;var n=function(e){if(!e.hasAttribute("data-applitools-fallback-selector")){if(r([e]))throw new Error("The element is not connected to the DOM: "+function(e){var t=e.attributes,r=e.tagName,n=e.children.length,o=[].slice.call(t).map((function(e){return e.name+'="'+e.value+'"'})).join(" ");return"<"+r+" "+o+(n?">":"/>")}(e));e.setAttribute("data-applitools-fallback-selector",function(e){var t=[];for(;e&&e.nodeType===Node.ELEMENT_NODE;)try{var r,n=e.tagName.toLowerCase(),o=[].slice.call((null==(r=e.parentNode)?void 0:r.children)||[]).indexOf(e);o>-1&&(n+=":nth-child("+(o+1)+")"),t.unshift(n),e=e.parentNode}catch(e){break}return t.length?t.join(" > "):"html"}(e))}},o=t;function a(e,t){if(o([e])){var r=function(e){if(null==e||!e.getAttribute)return{error:"invalid element: "+JSON.stringify(e)};var t=e.getAttribute("data-applitools-fallback-selector");return t}(e);if(!r)return{error:"Failed to recover from stale element"};if(r.error)return r;var l=document.querySelectorAll(r);if(!l||1!==l.length)return{error:"Failed to recover from stale element - selector found: "+r};var i=l[0];return i.setAttribute("data-applitools-selector",t),i.setAttribute("data-applitools-recovered",!0),a(i,t)}n(e);var u=e.getAttribute("data-applitools-selector"),c=u?u+" "+t:t;return e.setAttribute("data-applitools-selector",c),'[data-applitools-selector~="'+t+'"]'}return e((function(e){return e.map((function(e){var t=e[0],r=e[1];return t.map((function(e){var t=function(e){var t=[{element:e,kind:"root"}],r=new Set([e]),n=e;for(;n;){var o,a=n.getRootNode&&n.getRootNode();if(!a)break;if(a.constructor&&"ShadowRoot"===a.constructor.name?(n=a.host,o="shadow"):(n=a.defaultView?a.defaultView.frameElement:null,o="frame"),n){if(r.has(n))break;r.add(n),t.push({element:n,kind:o})}}return t}(e);return t.map((function(e){return{selector:a(e.element,r),kind:e.kind}}))}))}))}))}();
|
|
135
135
|
return s(arg)
|
|
136
136
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/snippets",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/applitools/eyes.sdk.javascript1.git",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@rollup/plugin-commonjs": "^25.0.7",
|
|
30
30
|
"@rollup/plugin-terser": "^0.4.4",
|
|
31
31
|
"chalk": "^4.1.0",
|
|
32
|
-
"glob": "^
|
|
32
|
+
"glob": "^10.3.10",
|
|
33
33
|
"playwright": "1.47.0",
|
|
34
34
|
"rollup": "^4.1.4",
|
|
35
35
|
"webdriverio": "^7.31.1",
|