@applitools/snippets 2.4.27 → 2.5.1

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 CHANGED
@@ -1,5 +1,24 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.5.1](https://github.com/Applitools-Dev/sdk/compare/js/snippets@2.5.0...js/snippets@2.5.1) (2024-10-21)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * isStaleElement error ([#2567](https://github.com/Applitools-Dev/sdk/issues/2567)) ([2675086](https://github.com/Applitools-Dev/sdk/commit/2675086aa28589082249e2958942ee29a5f2ef12))
9
+
10
+ ## [2.5.0](https://github.com/Applitools-Dev/sdk/compare/js/snippets@2.4.27...js/snippets@2.5.0) (2024-09-16)
11
+
12
+
13
+ ### Features
14
+
15
+ * add playwright fixture ([#2412](https://github.com/Applitools-Dev/sdk/issues/2412)) ([0632e93](https://github.com/Applitools-Dev/sdk/commit/0632e93dd7f53029a8c5f4230d22a05abf5fefd4))
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * stale layout breakpoints elements ([#2479](https://github.com/Applitools-Dev/sdk/issues/2479)) ([f5e4b5a](https://github.com/Applitools-Dev/sdk/commit/f5e4b5ac8077b8c4b7ba67a38c4e58050a55ce75))
21
+
3
22
  ## [2.4.27](https://github.com/Applitools-Dev/sdk/compare/js/snippets@2.4.26...js/snippets@2.4.27) (2024-06-26)
4
23
 
5
24
 
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  exports.addElementIds=function(arg){
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+'"]'}))}))}))}();
2
+ 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?[null]:t)[0];if(!e||!e.nodeType)return!0;for(var o=e;o;){if(o===document)return!1;if(null===o.parentNode&&o!==document)return!0;o=(null==o.getRootNode?void 0:o.getRootNode().host)||o.parentNode||o.host}return!0};function o(t,r){if(e([t])){var n=function(t){if(null==t||!t.getAttribute)throw new Error("invalid element: "+JSON.stringify(t));var e=t.getAttribute("data-applitools-fallback-selector");if(!e)throw new Error("Failed to recover from stale element");return e}(t),a=document.querySelector(n);if(!a)throw new Error("Failed to recover from stale element - selector found: "+n);return a.setAttribute("data-applitools-selector",r),a.setAttribute("data-applitools-recovered",!0),o(a,r)}!function(t){t.hasAttribute("data-applitools-fallback-selector")||t.setAttribute("data-applitools-fallback-selector",function(t){var e=[];for(;t&&t.nodeType===Node.ELEMENT_NODE;){var o=t.tagName.toLowerCase(),r=[].slice.call(t.parentNode.children||[]).indexOf(t)+1;r>1&&(o+=":nth-child("+r+")"),e.unshift(o),t=t.parentNode}return e.length?e.join(" > "):"html"}(t))}(t);var l=t.getAttribute("data-applitools-selector"),u=l?l+" "+r:r;return t.setAttribute("data-applitools-selector",u),'[data-applitools-selector~="'+r+'"]'}return t((function(t){return t.map((function(t){var e=t[0],r=t[1];return e.map((function(t){var e=function(t){var e=[t];if(t.getRootNode)for(var o=t.getRootNode();o!==document&&o.constructor&&"ShadowRoot"===o.constructor.name;o=o.host.getRootNode())e.push(o.host);return e}(t);return e.map((function(t){return o(t,r)}))}))}))}))}();
3
3
  return s(arg)
4
4
  }
5
5
  exports.addPageMarker=function(arg){
@@ -102,6 +102,10 @@ exports.isEqualElements=function(arg){
102
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
+ exports.isStaleElement=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(t){var e=(void 0===t?[null]:t)[0];if(!e||!e.nodeType)return!0;for(var o=e;o;){if(o===document)return!1;if(null===o.parentNode&&o!==document)return!0;o=(null==o.getRootNode?void 0:o.getRootNode().host)||o.parentNode||o.host}return!0}))}();
107
+ return s(arg)
108
+ }
105
109
  exports.lazyLoad=function(arg){
106
110
  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
111
  return s(arg)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/snippets",
3
- "version": "2.4.27",
3
+ "version": "2.5.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/applitools/eyes.sdk.javascript1.git",
@@ -30,7 +30,7 @@
30
30
  "@rollup/plugin-terser": "^0.4.4",
31
31
  "chalk": "^4.1.0",
32
32
  "glob": "^7.1.6",
33
- "playwright": "^1.39.0",
33
+ "playwright": "1.39.0",
34
34
  "rollup": "^4.1.4",
35
35
  "webdriverio": "^7.31.1",
36
36
  "yargs": "^17.7.2"