@applitools/snippets 2.1.7 → 2.1.11
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 +18 -0
- package/dist/commands.json +7 -7
- package/dist/index.js +7 -7
- package/package.json +7 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,24 @@
|
|
|
4
4
|
## Unreleased
|
|
5
5
|
|
|
6
6
|
|
|
7
|
+
## 2.1.11 - 2021/12/22
|
|
8
|
+
|
|
9
|
+
- add neutral color border around marker in `addPageMarker`
|
|
10
|
+
- improve handling of pages without viewport tag in `addPageMarker` and `getViewportSize`
|
|
11
|
+
|
|
12
|
+
## 2.1.10 - 2021/12/20
|
|
13
|
+
|
|
14
|
+
- overwrite `transform` style property with `!important` in `translateTo`
|
|
15
|
+
|
|
16
|
+
## 2.1.9 - 2021/12/17
|
|
17
|
+
|
|
18
|
+
- fix `scrollTo` which was returning the wrong actual scroll position due to `scroll-behavior: smooth` style on the scrollable element
|
|
19
|
+
|
|
20
|
+
## 2.1.8 - 2021/12/16
|
|
21
|
+
|
|
22
|
+
- fix `addPageMarker` to handle different pixel densities
|
|
23
|
+
- change shape and size of marker added by `addPageMarker`
|
|
24
|
+
|
|
7
25
|
## 2.1.7 - 2021/9/9
|
|
8
26
|
|
|
9
27
|
- fix `getShadowRoot` to follow convention for arguments
|
package/dist/commands.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"addElementIds": "function(arg){var s=function(){\"use strict\";return 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=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+'\"]'}))}))}}();\nreturn s(arg)}",
|
|
3
|
-
"addPageMarker": "function(arg){var s=function(){\"use strict\";var t=function(t){var e=void 0===t?[]:t,r=e[0],o=e[1],n=Object.keys(o).sort(),i=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\":\"\")})),i};return function(){var e=
|
|
3
|
+
"addPageMarker": "function(arg){var s=function(){\"use strict\";var t=function(t){var e=void 0===t?[]:t,r=e[0],o=e[1],n=Object.keys(o).sort(),i=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\":\"\")})),i};return function(){var e=[1,0,1,1,0,1,1,0,1,0,1,0,1,1,0,1,0,0,1,1,1],r={1:\"rgb(0, 0, 0)\",0:\"rgb(255, 255, 255)\"},o=visualViewport?visualViewport.scale:1,n=o>=1?1:2,i=n,a=document.createElement(\"div\");a.setAttribute(\"data-applitools-marker\",\"\"),a.style.setProperty(\"position\",\"fixed\",\"important\"),a.style.setProperty(\"top\",\"0\",\"important\"),a.style.setProperty(\"left\",\"0\",\"important\"),a.style.setProperty(\"box-sizing\",\"content-box\",\"important\"),a.style.setProperty(\"padding\",i/o+\"px\",\"important\"),a.style.setProperty(\"background\",\"rgb(128, 128, 128)\",\"important\"),a.style.setProperty(\"z-index\",\"2147483647\",\"important\");for(var s,p=0;p<e.length;p+=s){for(s=1;e[p]===e[p+s];)++s;var l=e[p],y=document.createElement(\"div\");y.style.setProperty(\"display\",\"block\",\"important\"),y.style.setProperty(\"float\",\"left\",\"important\"),y.style.setProperty(\"width\",s*(n/o)+\"px\",\"important\"),y.style.setProperty(\"height\",n/o+\"px\",\"important\"),y.style.setProperty(\"background\",r[l],\"important\"),a.appendChild(y)}var m={value:\"none\",important:!0},d=t([document.documentElement,{transform:m,\"-webkit-transform\":m}]),u=t([document.body,{transform:m,\"-webkit-transform\":m}]);return document.documentElement.setAttribute(\"data-applitools-original-transforms\",JSON.stringify(d)),document.body.setAttribute(\"data-applitools-original-transforms\",JSON.stringify(u)),document.body.appendChild(a),{mask:e,size:n,offset:i}}}();\nreturn s(arg)}",
|
|
4
4
|
"blurElement": "function(arg){var s=function(){\"use strict\";return function(t){var n=(void 0===t?[]:t)[0]||document.activeElement;return n&&n.blur(),n}}();\nreturn s(arg)}",
|
|
5
5
|
"cleanupElementIds": "function(arg){var s=function(){\"use strict\";return function(t){t[0].forEach((function(t){if(t.removeAttribute(\"data-applitools-selector\"),t.getRootNode)for(var o=t.getRootNode();o!==document;o=o.host.getRootNode())o.host.removeAttribute(\"data-applitools-selector\")}))}}();\nreturn s(arg)}",
|
|
6
6
|
"cleanupPageMarker": "function(arg){var s=function(){\"use strict\";var t=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 function(){var e=document.querySelector(\"[data-applitools-marker]\");e&&document.body.removeChild(e);var r=document.documentElement.getAttribute(\"data-applitools-original-transforms\"),o=document.body.getAttribute(\"data-applitools-original-transforms\");r&&t([document.documentElement,JSON.parse(r)]),o&&t([document.body,JSON.parse(o)])}}();\nreturn s(arg)}",
|
|
@@ -11,21 +11,21 @@
|
|
|
11
11
|
"getElementComputedStyleProperties": "function(arg){var s=function(){\"use strict\";return function(t){var r=void 0===t?[]:t,e=r[0],n=r[1],u=void 0===n?[]:n,o=window.getComputedStyle(e);return o?u.map((function(t){return o.getPropertyValue(t)})):[]}}();\nreturn s(arg)}",
|
|
12
12
|
"getElementContentSize": "function(arg){var s=function(){\"use strict\";var t=function(t){var r=void 0===t?[]:t,e=r[0],n=r[1],o=Object.keys(n).sort(),i=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\":\"\")})),i};return function(r){var e,n=(void 0===r?[]:r)[0];n===document.documentElement&&(e=t([n,{transform:\"none\"}]));var o={width:n.scrollWidth,height:n.scrollHeight};return e&&t([n,e]),o}}();\nreturn s(arg)}",
|
|
13
13
|
"getElementFixedAncestor": "function(arg){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}}();\nreturn s(arg)}",
|
|
14
|
-
"getElementInnerOffset": "function(arg){var s=function(){\"use strict\";var r=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}};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 e=(void 0===r?[]:r)[0],o=void 0===e?document.
|
|
14
|
+
"getElementInnerOffset": "function(arg){var s=function(){\"use strict\";var r=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}};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 e=(void 0===r?[]:r)[0],o=void 0===e?document.documentElement:e,n=t([o,[\"transform\",\"-webkit-transform\"]]),i=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 i=o[1],a=void 0!==o[3]?o[3]:0;r.push({x:Math.round(-parseFloat(i)),y:Math.round(-parseFloat(a))})}else r.push({x:0,y:0})}return r}),[]);if(!i.every((function(r){return i[0].x===r.x||i[0].y===r.y})))throw new Error(\"Got different css positions!\");return i[0]||{x:0,y:0}};return function(t){var o=(void 0===t?[]:t)[0],n=r([o]),i=e([o]);return{x:n.x+i.x,y:n.y+i.y}}}();\nreturn s(arg)}",
|
|
15
15
|
"getElementProperties": "function(arg){var s=function(){\"use strict\";return function(r){var n=void 0===r?[]:r,t=n[0],u=n[1];return(void 0===u?[]:u).reduce((function(r,n){return r[n]=t[n],r}),{})}}();\nreturn s(arg)}",
|
|
16
|
-
"getElementRect": "function(arg){var s=function(){\"use strict\";var 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};var e=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}};var r=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 o=function(t){var e=(void 0===t?[]:t)[0],o=void 0===e?document.
|
|
16
|
+
"getElementRect": "function(arg){var s=function(){\"use strict\";var 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};var e=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}};var r=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 o=function(t){var e=(void 0===t?[]:t)[0],o=void 0===e?document.documentElement:e,n=r([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){var r=(void 0===t?[]:t)[0],n=e([r]),i=o([r]);return{x:n.x+i.x,y:n.y+i.y}};return function(e){var r=void 0===e?[]:e,o=r[0],i=r[1],a=void 0!==i&&i;if(o===document.scrollingElement)return{x:0,y:0,width:o.clientWidth,height:o.clientHeight};var d=o.getBoundingClientRect(),u={x:d.left,y:d.top,width:d.width,height:d.height};if(a){var f=window.getComputedStyle(o);u.x+=parseInt(f.getPropertyValue(\"border-left-width\")),u.y+=parseInt(f.getPropertyValue(\"border-top-width\")),u.width=o.clientWidth,u.height=o.clientHeight}var l=t([o]);if(l){if(l!==o){var s=n([l]);u.x+=s.x,u.y+=s.y}}else{var v=n();u.x+=v.x,u.y+=v.y}return u}}();\nreturn s(arg)}",
|
|
17
17
|
"getElementScrollOffset": "function(arg){var s=function(){\"use strict\";return function(o){var r=(void 0===o?[]:o)[0];return r?{x:r.scrollLeft,y:r.scrollTop}:{x:window.scrollX||window.pageXOffset,y:window.scrollY||window.pageYOffset}}}();\nreturn s(arg)}",
|
|
18
18
|
"getElementStyleProperties": "function(arg){var s=function(){\"use strict\";return 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}),{})}}();\nreturn s(arg)}",
|
|
19
|
-
"getElementTranslateOffset": "function(arg){var s=function(){\"use strict\";var r=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 function(t){var e=(void 0===t?[]:t)[0],n=void 0===e?document.
|
|
19
|
+
"getElementTranslateOffset": "function(arg){var s=function(){\"use strict\";var r=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 function(t){var e=(void 0===t?[]:t)[0],n=void 0===e?document.documentElement:e,o=r([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}}}();\nreturn s(arg)}",
|
|
20
20
|
"getElementXpath": "function(arg){var s=function(){\"use strict\";return function(r){var e=(void 0===r?[]:r)[0],t=\"\",n=e.ownerDocument;if(!n)return t;for(var a=e;a!==n;){var o=Array.prototype.filter.call(a.parentNode.childNodes,(function(r){return r.tagName===a.tagName})).indexOf(a);t=\"/\"+a.tagName+\"[\"+(o+1)+\"]\"+t,a=a.parentNode}return t}}();\nreturn s(arg)}",
|
|
21
21
|
"getPixelRatio": "function(arg){var s=function(){\"use strict\";return function(){return window.devicePixelRatio}}();\nreturn s(arg)}",
|
|
22
22
|
"getShadowRoot": "function(arg){var s=function(){\"use strict\";return function(t){return(void 0===t?[]:t)[0].shadowRoot}}();\nreturn s(arg)}",
|
|
23
23
|
"getUserAgent": "function(arg){var s=function(){\"use strict\";return function(){return window.navigator.userAgent}}();\nreturn s(arg)}",
|
|
24
|
-
"getViewportSize": "function(arg){var s=function(){\"use strict\";return function(){var e=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?e=window.innerWidth:document.documentElement&&document.documentElement.clientWidth?e=document.documentElement.clientWidth:document.body&&document.body.clientWidth&&(e=document.body.clientWidth),{width:e,height:t}}}();\nreturn s(arg)}",
|
|
24
|
+
"getViewportSize": "function(arg){var s=function(){\"use strict\";return function(){var e=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?e=window.innerWidth:document.documentElement&&document.documentElement.clientWidth?e=document.documentElement.clientWidth:document.body&&document.body.clientWidth&&(e=document.body.clientWidth),window.visualViewport&&(e*=window.visualViewport.scale,t*=window.visualViewport.scale),{width:e,height:t}}}();\nreturn s(arg)}",
|
|
25
25
|
"isElementScrollable": "function(arg){var s=function(){\"use strict\";return function(t){var i=(void 0===t?[]:t)[0];return i.scrollWidth>i.clientWidth||i.scrollHeight>i.clientHeight}}();\nreturn s(arg)}",
|
|
26
26
|
"isEqualElements": "function(arg){var s=function(){\"use strict\";return function(r){var n=void 0===r?[]:r;return n[0]===n[1]}}();\nreturn s(arg)}",
|
|
27
|
-
"scrollTo": "function(arg){var s=function(){\"use strict\";
|
|
27
|
+
"scrollTo": "function(arg){var s=function(){\"use strict\";var t=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 function(r){var o=void 0===r?[]:r,e=o[0],l=o[1];e=e||document.documentElement;var n=t([e,{\"scroll-behavior\":{value:\"auto\",important:!0}}]);return e.scrollTo?e.scrollTo(l.x,l.y):(e.scrollLeft=l.x,e.scrollTop=l.y),t([e,n]),{x:e.scrollLeft,y:e.scrollTop}}}();\nreturn s(arg)}",
|
|
28
28
|
"setElementAttributes": "function(arg){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}),{})}}();\nreturn s(arg)}",
|
|
29
29
|
"setElementStyleProperties": "function(arg){var s=function(){\"use strict\";return function(t){var r=void 0===t?[]:t,e=r[0],o=r[1],n=Object.keys(o).sort(),i=n.reduce((function(t,r){return t[r]={value:e.style.getPropertyValue(r),important:Boolean(e.style.getPropertyPriority(r))},t}),{});return n.forEach((function(t){e.style.setProperty(t,\"string\"!=typeof o[t]&&o[t]?o[t].value:o[t],o[t]&&o[t].important?\"important\":\"\")})),i}}();\nreturn s(arg)}",
|
|
30
|
-
"translateTo": "function(arg){var s=function(){\"use strict\";var t=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 function(r){var e=void 0===r?[]:r,n=e[0],o=e[1];n=n||document.documentElement;var a
|
|
30
|
+
"translateTo": "function(arg){var s=function(){\"use strict\";var t=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 function(r){var e=void 0===r?[]:r,n=e[0],o=e[1];n=n||document.documentElement;var a={value:\"translate(\"+-o.x+\"px, \"+-o.y+\"px)\",important:!0};return t([n,{transform:a,\"-webkit-transform\":a}]),o}}();\nreturn s(arg)}"
|
|
31
31
|
}
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var s=function(){"use strict";return function(t){var o=t[0],e=t[1];return o.map(
|
|
|
3
3
|
return s(arg)
|
|
4
4
|
}
|
|
5
5
|
exports.addPageMarker=function(arg){
|
|
6
|
-
var s=function(){"use strict";var t=function(t){var e=void 0===t?[]:t,r=e[0],o=e[1],n=Object.keys(o).sort(),i=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":"")})),i};return function(){var e=
|
|
6
|
+
var s=function(){"use strict";var t=function(t){var e=void 0===t?[]:t,r=e[0],o=e[1],n=Object.keys(o).sort(),i=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":"")})),i};return function(){var e=[1,0,1,1,0,1,1,0,1,0,1,0,1,1,0,1,0,0,1,1,1],r={1:"rgb(0, 0, 0)",0:"rgb(255, 255, 255)"},o=visualViewport?visualViewport.scale:1,n=o>=1?1:2,i=n,a=document.createElement("div");a.setAttribute("data-applitools-marker",""),a.style.setProperty("position","fixed","important"),a.style.setProperty("top","0","important"),a.style.setProperty("left","0","important"),a.style.setProperty("box-sizing","content-box","important"),a.style.setProperty("padding",i/o+"px","important"),a.style.setProperty("background","rgb(128, 128, 128)","important"),a.style.setProperty("z-index","2147483647","important");for(var s,p=0;p<e.length;p+=s){for(s=1;e[p]===e[p+s];)++s;var l=e[p],y=document.createElement("div");y.style.setProperty("display","block","important"),y.style.setProperty("float","left","important"),y.style.setProperty("width",s*(n/o)+"px","important"),y.style.setProperty("height",n/o+"px","important"),y.style.setProperty("background",r[l],"important"),a.appendChild(y)}var m={value:"none",important:!0},d=t([document.documentElement,{transform:m,"-webkit-transform":m}]),u=t([document.body,{transform:m,"-webkit-transform":m}]);return document.documentElement.setAttribute("data-applitools-original-transforms",JSON.stringify(d)),document.body.setAttribute("data-applitools-original-transforms",JSON.stringify(u)),document.body.appendChild(a),{mask:e,size:n,offset:i}}}();
|
|
7
7
|
return s(arg)
|
|
8
8
|
}
|
|
9
9
|
exports.blurElement=function(arg){
|
|
@@ -47,7 +47,7 @@ var s=function(){"use strict";return function(t){for(var e=(void 0===t?[]:t)[0];
|
|
|
47
47
|
return s(arg)
|
|
48
48
|
}
|
|
49
49
|
exports.getElementInnerOffset=function(arg){
|
|
50
|
-
var s=function(){"use strict";var r=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}};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 e=(void 0===r?[]:r)[0],o=void 0===e?document.
|
|
50
|
+
var s=function(){"use strict";var r=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}};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 e=(void 0===r?[]:r)[0],o=void 0===e?document.documentElement:e,n=t([o,["transform","-webkit-transform"]]),i=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 i=o[1],a=void 0!==o[3]?o[3]:0;r.push({x:Math.round(-parseFloat(i)),y:Math.round(-parseFloat(a))})}else r.push({x:0,y:0})}return r}),[]);if(!i.every((function(r){return i[0].x===r.x||i[0].y===r.y})))throw new Error("Got different css positions!");return i[0]||{x:0,y:0}};return function(t){var o=(void 0===t?[]:t)[0],n=r([o]),i=e([o]);return{x:n.x+i.x,y:n.y+i.y}}}();
|
|
51
51
|
return s(arg)
|
|
52
52
|
}
|
|
53
53
|
exports.getElementProperties=function(arg){
|
|
@@ -55,7 +55,7 @@ var s=function(){"use strict";return function(r){var n=void 0===r?[]:r,t=n[0],u=
|
|
|
55
55
|
return s(arg)
|
|
56
56
|
}
|
|
57
57
|
exports.getElementRect=function(arg){
|
|
58
|
-
var s=function(){"use strict";var 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};var e=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}};var r=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 o=function(t){var e=(void 0===t?[]:t)[0],o=void 0===e?document.
|
|
58
|
+
var s=function(){"use strict";var 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};var e=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}};var r=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 o=function(t){var e=(void 0===t?[]:t)[0],o=void 0===e?document.documentElement:e,n=r([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){var r=(void 0===t?[]:t)[0],n=e([r]),i=o([r]);return{x:n.x+i.x,y:n.y+i.y}};return function(e){var r=void 0===e?[]:e,o=r[0],i=r[1],a=void 0!==i&&i;if(o===document.scrollingElement)return{x:0,y:0,width:o.clientWidth,height:o.clientHeight};var d=o.getBoundingClientRect(),u={x:d.left,y:d.top,width:d.width,height:d.height};if(a){var f=window.getComputedStyle(o);u.x+=parseInt(f.getPropertyValue("border-left-width")),u.y+=parseInt(f.getPropertyValue("border-top-width")),u.width=o.clientWidth,u.height=o.clientHeight}var l=t([o]);if(l){if(l!==o){var s=n([l]);u.x+=s.x,u.y+=s.y}}else{var v=n();u.x+=v.x,u.y+=v.y}return u}}();
|
|
59
59
|
return s(arg)
|
|
60
60
|
}
|
|
61
61
|
exports.getElementScrollOffset=function(arg){
|
|
@@ -67,7 +67,7 @@ var s=function(){"use strict";return function(r){var t=void 0===r?[]:r,e=t[0],n=
|
|
|
67
67
|
return s(arg)
|
|
68
68
|
}
|
|
69
69
|
exports.getElementTranslateOffset=function(arg){
|
|
70
|
-
var s=function(){"use strict";var r=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 function(t){var e=(void 0===t?[]:t)[0],n=void 0===e?document.
|
|
70
|
+
var s=function(){"use strict";var r=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 function(t){var e=(void 0===t?[]:t)[0],n=void 0===e?document.documentElement:e,o=r([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}}}();
|
|
71
71
|
return s(arg)
|
|
72
72
|
}
|
|
73
73
|
exports.getElementXpath=function(arg){
|
|
@@ -87,7 +87,7 @@ var s=function(){"use strict";return function(){return window.navigator.userAgen
|
|
|
87
87
|
return s(arg)
|
|
88
88
|
}
|
|
89
89
|
exports.getViewportSize=function(arg){
|
|
90
|
-
var s=function(){"use strict";return function(){var e=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?e=window.innerWidth:document.documentElement&&document.documentElement.clientWidth?e=document.documentElement.clientWidth:document.body&&document.body.clientWidth&&(e=document.body.clientWidth),{width:e,height:t}}}();
|
|
90
|
+
var s=function(){"use strict";return function(){var e=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?e=window.innerWidth:document.documentElement&&document.documentElement.clientWidth?e=document.documentElement.clientWidth:document.body&&document.body.clientWidth&&(e=document.body.clientWidth),window.visualViewport&&(e*=window.visualViewport.scale,t*=window.visualViewport.scale),{width:e,height:t}}}();
|
|
91
91
|
return s(arg)
|
|
92
92
|
}
|
|
93
93
|
exports.isElementScrollable=function(arg){
|
|
@@ -99,7 +99,7 @@ var s=function(){"use strict";return function(r){var n=void 0===r?[]:r;return n[
|
|
|
99
99
|
return s(arg)
|
|
100
100
|
}
|
|
101
101
|
exports.scrollTo=function(arg){
|
|
102
|
-
var s=function(){"use strict";
|
|
102
|
+
var s=function(){"use strict";var t=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 function(r){var o=void 0===r?[]:r,e=o[0],l=o[1];e=e||document.documentElement;var n=t([e,{"scroll-behavior":{value:"auto",important:!0}}]);return e.scrollTo?e.scrollTo(l.x,l.y):(e.scrollLeft=l.x,e.scrollTop=l.y),t([e,n]),{x:e.scrollLeft,y:e.scrollTop}}}();
|
|
103
103
|
return s(arg)
|
|
104
104
|
}
|
|
105
105
|
exports.setElementAttributes=function(arg){
|
|
@@ -111,6 +111,6 @@ var s=function(){"use strict";return function(t){var r=void 0===t?[]:t,e=r[0],o=
|
|
|
111
111
|
return s(arg)
|
|
112
112
|
}
|
|
113
113
|
exports.translateTo=function(arg){
|
|
114
|
-
var s=function(){"use strict";var t=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 function(r){var e=void 0===r?[]:r,n=e[0],o=e[1];n=n||document.documentElement;var a="translate("+-o.x+"px, "+-o.y+"px)";return t([n,{transform:
|
|
114
|
+
var s=function(){"use strict";var t=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 function(r){var e=void 0===r?[]:r,n=e[0],o=e[1];n=n||document.documentElement;var a={value:"translate("+-o.x+"px, "+-o.y+"px)",important:!0};return t([n,{transform:a,"-webkit-transform":a}]),o}}();
|
|
115
115
|
return s(arg)
|
|
116
116
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/snippets",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.11",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -24,6 +24,11 @@
|
|
|
24
24
|
"pre-push": "yarn bongo lint"
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "https://github.com/applitools/eyes.sdk.javascript1.git",
|
|
30
|
+
"directory": "packages/snippets"
|
|
31
|
+
},
|
|
27
32
|
"dependencies": {},
|
|
28
33
|
"devDependencies": {
|
|
29
34
|
"@applitools/sdk-release-kit": "^0.3.3",
|
|
@@ -39,7 +44,7 @@
|
|
|
39
44
|
"glob": "^7.1.6",
|
|
40
45
|
"husky": "^4.3.7",
|
|
41
46
|
"mocha": "^8.1.3",
|
|
42
|
-
"playwright": "1.
|
|
47
|
+
"playwright": "1.16.3",
|
|
43
48
|
"prettier": "1.19.0",
|
|
44
49
|
"rollup": "^2.26.11",
|
|
45
50
|
"rollup-plugin-terser": "^7.0.2",
|