@applitools/snippets 2.4.24 → 2.4.25
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 +7 -0
- package/dist/index.js +32 -32
- package/package.json +11 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.4.25](https://github.com/applitools/eyes.sdk.javascript1/compare/js/snippets@2.4.24...js/snippets@2.4.25) (2024-01-30)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* losing root context after layout breakpoints reload ([#2113](https://github.com/applitools/eyes.sdk.javascript1/issues/2113)) ([afa1473](https://github.com/applitools/eyes.sdk.javascript1/commit/afa14735e5539ab0f79aa610e6ec1ea8989a5922))
|
|
9
|
+
|
|
3
10
|
## [2.4.24](https://github.com/applitools/eyes.sdk.javascript1/compare/js/snippets@2.4.23...js/snippets@2.4.24) (2023-09-21)
|
|
4
11
|
|
|
5
12
|
|
package/dist/index.js
CHANGED
|
@@ -1,128 +1,128 @@
|
|
|
1
1
|
exports.addElementIds=function(arg){
|
|
2
|
-
var s=function(){"use strict";return function(t){var o=t[0],
|
|
2
|
+
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 o=t[0],e=t[1];return o.map((function(t,o){var r=[t];if(t.getRootNode)for(var a=t.getRootNode();a!==document&&a.constructor&&"ShadowRoot"===a.constructor.name;a=a.host.getRootNode())r.push(a.host);var n=e[o];return r.map((function(t){var o=t.getAttribute("data-applitools-selector"),e=o?o+" "+n:n;return t.setAttribute("data-applitools-selector",e),'[data-applitools-selector~="'+n+'"]'}))}))}))}();
|
|
3
3
|
return s(arg)
|
|
4
4
|
}
|
|
5
5
|
exports.addPageMarker=function(arg){
|
|
6
|
-
var s=function(){"use strict";var
|
|
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=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}}))}();
|
|
7
7
|
return s(arg)
|
|
8
8
|
}
|
|
9
9
|
exports.blurElement=function(arg){
|
|
10
|
-
var s=function(){"use strict";return function(t){var
|
|
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)[0]||document.activeElement;return e&&e.blur(),e}))}();
|
|
11
11
|
return s(arg)
|
|
12
12
|
}
|
|
13
13
|
exports.cleanupElementIds=function(arg){
|
|
14
|
-
var s=function(){"use strict";return function(
|
|
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){t[0].forEach((function(t){if(t.removeAttribute("data-applitools-selector"),t.getRootNode)for(var o=t.getRootNode();o!==document&&o.constructor&&"ShadowRoot"===o.constructor.name;o=o.host.getRootNode())o.host.removeAttribute("data-applitools-selector")}))}))}();
|
|
15
15
|
return s(arg)
|
|
16
16
|
}
|
|
17
17
|
exports.cleanupPageMarker=function(arg){
|
|
18
|
-
var s=function(){"use strict";var
|
|
18
|
+
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)])}))}();
|
|
19
19
|
return s(arg)
|
|
20
20
|
}
|
|
21
21
|
exports.focusElement=function(arg){
|
|
22
|
-
var s=function(){"use strict";return function(
|
|
22
|
+
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()}))}();
|
|
23
23
|
return s(arg)
|
|
24
24
|
}
|
|
25
25
|
exports.getChildFramesInfo=function(arg){
|
|
26
|
-
var s=function(){"use strict";return function(){return function r
|
|
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(){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)}()}))}();
|
|
27
27
|
return s(arg)
|
|
28
28
|
}
|
|
29
29
|
exports.getContextInfo=function(arg){
|
|
30
|
-
var s=function(){"use strict";var
|
|
30
|
+
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]}))}();
|
|
31
31
|
return s(arg)
|
|
32
32
|
}
|
|
33
33
|
exports.getDocumentScrollingElement=function(arg){
|
|
34
|
-
var s=function(){"use strict";return function(){var t="HTML",e=document.scrollingElement;return e&&(t=e.tagName),t.toLowerCase()}}();
|
|
34
|
+
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()}))}();
|
|
35
35
|
return s(arg)
|
|
36
36
|
}
|
|
37
37
|
exports.getDocumentSize=function(arg){
|
|
38
|
-
var s=function(){"use strict";return function(){var t=document.documentElement.scrollWidth,e=document.documentElement.scrollHeight,n=document.documentElement.clientHeight,
|
|
38
|
+
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)}}))}();
|
|
39
39
|
return s(arg)
|
|
40
40
|
}
|
|
41
41
|
exports.getElementComputedStyleProperties=function(arg){
|
|
42
|
-
var s=function(){"use strict";return function(t){var
|
|
42
|
+
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)})):[]}))}();
|
|
43
43
|
return s(arg)
|
|
44
44
|
}
|
|
45
45
|
exports.getElementContentSize=function(arg){
|
|
46
|
-
var s=function(){"use strict";var
|
|
46
|
+
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}))}();
|
|
47
47
|
return s(arg)
|
|
48
48
|
}
|
|
49
49
|
exports.getElementFixedAncestor=function(arg){
|
|
50
|
-
var s=function(){"use strict";return 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}}();
|
|
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){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}))}();
|
|
51
51
|
return s(arg)
|
|
52
52
|
}
|
|
53
53
|
exports.getElementInnerOffset=function(arg){
|
|
54
|
-
var s=function(){"use strict";
|
|
54
|
+
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}}))}();
|
|
55
55
|
return s(arg)
|
|
56
56
|
}
|
|
57
57
|
exports.getElementProperties=function(arg){
|
|
58
|
-
var s=function(){"use strict";return function(
|
|
58
|
+
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}),{})}))}();
|
|
59
59
|
return s(arg)
|
|
60
60
|
}
|
|
61
61
|
exports.getElementRect=function(arg){
|
|
62
|
-
var s=function(){"use strict";
|
|
62
|
+
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}))}();
|
|
63
63
|
return s(arg)
|
|
64
64
|
}
|
|
65
65
|
exports.getElementScrollOffset=function(arg){
|
|
66
|
-
var s=function(){"use strict";return function(o){var
|
|
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}}))}();
|
|
67
67
|
return s(arg)
|
|
68
68
|
}
|
|
69
69
|
exports.getElementStyleProperties=function(arg){
|
|
70
|
-
var s=function(){"use strict";return function(
|
|
70
|
+
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}),{})}))}();
|
|
71
71
|
return s(arg)
|
|
72
72
|
}
|
|
73
73
|
exports.getElementTranslateOffset=function(arg){
|
|
74
|
-
var s=function(){"use strict";var
|
|
74
|
+
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}}))}();
|
|
75
75
|
return s(arg)
|
|
76
76
|
}
|
|
77
77
|
exports.getElementXpath=function(arg){
|
|
78
|
-
var s=function(){"use strict";return function(
|
|
78
|
+
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}))}();
|
|
79
79
|
return s(arg)
|
|
80
80
|
}
|
|
81
81
|
exports.getShadowRoot=function(arg){
|
|
82
|
-
var s=function(){"use strict";return function(t){return(void 0===t?[]:t)[0].shadowRoot}}();
|
|
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){return(void 0===t?[]:t)[0].shadowRoot}))}();
|
|
83
83
|
return s(arg)
|
|
84
84
|
}
|
|
85
85
|
exports.getText=function(arg){
|
|
86
|
-
var s=function(){"use strict";return function(
|
|
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){return t[0].innerText}))}();
|
|
87
87
|
return s(arg)
|
|
88
88
|
}
|
|
89
89
|
exports.getUserAgent=function(arg){
|
|
90
|
-
var s=function(){"use strict";function t(){return t=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var
|
|
90
|
+
var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function n(){return n=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t},n.apply(this,arguments)}var r="__EYES__APPLITOOLS__",e="userAgent";return window[r]=window[r]||{},t((function(){try{if(window[r][e]){var t=window[r][e];return"WIP"!==t.status&&delete window[r][e],JSON.stringify(t)}return window.navigator.userAgentData?(window[r][e]={status:"WIP"},window.navigator.userAgentData.getHighEntropyValues(["brands","platform","platformVersion","model"]).then((function(t){window[r][e]={status:"SUCCESS",value:n({legacy:window.navigator.userAgent},t)}})).catch((function(t){window[r][e]={status:"ERROR",error:t.message}}))):window[r][e]={status:"SUCCESS",value:window.navigator.userAgent},JSON.stringify(window[r][e])}catch(t){return window[r][e]={status:"ERROR",error:t.message},JSON.stringify(window[r][e])}}))}();
|
|
91
91
|
return s(arg)
|
|
92
92
|
}
|
|
93
93
|
exports.getViewport=function(arg){
|
|
94
|
-
var s=function(){"use strict";return function(){var n
|
|
94
|
+
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}}))}();
|
|
95
95
|
return s(arg)
|
|
96
96
|
}
|
|
97
97
|
exports.isElementScrollable=function(arg){
|
|
98
|
-
var s=function(){"use strict";var
|
|
98
|
+
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}))}();
|
|
99
99
|
return s(arg)
|
|
100
100
|
}
|
|
101
101
|
exports.isEqualElements=function(arg){
|
|
102
|
-
var s=function(){"use strict";return function(
|
|
102
|
+
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]}))}();
|
|
103
103
|
return s(arg)
|
|
104
104
|
}
|
|
105
105
|
exports.lazyLoad=function(arg){
|
|
106
|
-
var s=function(){"use strict";var o=function(
|
|
106
|
+
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])}}))}();
|
|
107
107
|
return s(arg)
|
|
108
108
|
}
|
|
109
109
|
exports.reloadPage=function(arg){
|
|
110
|
-
var s=function(){"use strict";return function(){window.location.reload()}}();
|
|
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(){window.location.reload()}))}();
|
|
111
111
|
return s(arg)
|
|
112
112
|
}
|
|
113
113
|
exports.scrollTo=function(arg){
|
|
114
|
-
var s=function(){"use strict";var
|
|
114
|
+
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}}))}();
|
|
115
115
|
return s(arg)
|
|
116
116
|
}
|
|
117
117
|
exports.setElementAttributes=function(arg){
|
|
118
|
-
var s=function(){"use strict";return 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}),{})}}();
|
|
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){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}),{})}))}();
|
|
119
119
|
return s(arg)
|
|
120
120
|
}
|
|
121
121
|
exports.setElementStyleProperties=function(arg){
|
|
122
|
-
var s=function(){"use strict";return function(t){var
|
|
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,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}))}();
|
|
123
123
|
return s(arg)
|
|
124
124
|
}
|
|
125
125
|
exports.translateTo=function(arg){
|
|
126
|
-
var s=function(){"use strict";var
|
|
126
|
+
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}))}();
|
|
127
127
|
return s(arg)
|
|
128
128
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/snippets",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.25",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/applitools/eyes.sdk.javascript1.git",
|
|
@@ -18,18 +18,20 @@
|
|
|
18
18
|
"test": "run --top-level mocha './test/*.spec.js' -r ./test/util/hook.js",
|
|
19
19
|
"test:chrome": "MOCHA_GROUP=chrome run --top-level mocha './test/*.spec.js' --grep chrome -r ./test/util/hook.js",
|
|
20
20
|
"test:ie": "MOCHA_GROUP=ie run --top-level mocha './test/*.spec.js' --grep 'internet explorer' -r ./test/util/hook.js",
|
|
21
|
-
"test:ios": "MOCHA_GROUP=ios run --top-level mocha './test/*.spec.js' --grep 'ios safari' -r ./test/util/hook.js"
|
|
21
|
+
"test:ios": "MOCHA_GROUP=ios run --top-level mocha './test/*.spec.js' --grep 'ios safari' -r ./test/util/hook.js",
|
|
22
|
+
"setup": "run --top-level xvfb:setup && run playwright:setup",
|
|
23
|
+
"playwright:setup": "yarn playwright install --with-deps chromium"
|
|
22
24
|
},
|
|
23
25
|
"devDependencies": {
|
|
24
|
-
"@babel/core": "^7.
|
|
25
|
-
"@babel/preset-env": "^7.
|
|
26
|
-
"@rollup/plugin-babel": "^
|
|
27
|
-
"@rollup/plugin-commonjs": "^
|
|
26
|
+
"@babel/core": "^7.23.2",
|
|
27
|
+
"@babel/preset-env": "^7.23.2",
|
|
28
|
+
"@rollup/plugin-babel": "^6.0.4",
|
|
29
|
+
"@rollup/plugin-commonjs": "^25.0.7",
|
|
30
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
28
31
|
"chalk": "^4.1.0",
|
|
29
32
|
"glob": "^7.1.6",
|
|
30
|
-
"playwright": "^1.
|
|
31
|
-
"rollup": "^
|
|
32
|
-
"rollup-plugin-terser": "^7.0.2",
|
|
33
|
+
"playwright": "^1.39.0",
|
|
34
|
+
"rollup": "^4.1.4",
|
|
33
35
|
"webdriverio": "^7.31.1",
|
|
34
36
|
"yargs": "^17.7.2"
|
|
35
37
|
},
|