testplane 8.22.4 → 8.22.5

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testplane",
3
- "version": "8.22.4",
3
+ "version": "8.22.5",
4
4
  "description": "Tests framework based on mocha and wdio",
5
5
  "main": "build/src/index.js",
6
6
  "files": [
@@ -4,7 +4,7 @@
4
4
  "use strict";var lib=require("./lib.compat.js");module.exports=function(r){return lib.queryAll(r)};
5
5
  },{"./lib.compat.js":4}],3:[function(require,module,exports){
6
6
  (function (global){(function (){
7
- "use strict";function prepareScreenshotUnsafe(e,t){var r=t.allowViewportOverflow,i=t.captureElementFromTop,o=t.disableAnimation,n=window;if(t.selectorToScroll&&!(n=document.querySelector(t.selectorToScroll)))return{error:"NOTFOUND",message:'Could not find element with css selector specified in "selectorToScroll" option: '+t.selectorToScroll,selector:t.selectorToScroll};var a,l=util.getMainDocumentElem(),c=l.clientWidth,s=l.clientHeight,u=l.scrollWidth,p=l.scrollHeight,d=new Rect({left:util.getScrollLeft(n),top:util.getScrollTop(n),width:c,height:s}),f=configurePixelRatio(t.usePixelRatio),m=[];if(e.forEach(function(e){Rect.isRect(e)?a=a?a.merge(new Rect(e)):new Rect(e):m.push(e)}),a=getCaptureRect(m,{initialRect:a,allowViewportOverflow:r,scrollElem:n,viewportWidth:c,documentHeight:p}),a.error)return a;if(i&&!d.rectInside(a))util.isSafariMobile()?scrollToCaptureAreaInSafari(d,a,n):n.scrollTo(a.left,a.top);else if(r&&d.rectIntersects(a))a.overflowsTopBound(d)&&a.recalculateHeight(d),a.overflowsLeftBound(d)&&a.recalculateWidth(d);else if(!i&&!r&&!d.rectIntersects(a))return{error:"OUTSIDE_OF_VIEWPORT",message:'Can not capture element, because it is outside of viewport. Try to set "captureElementFromTop=true" to scroll to it before capture or to set "allowViewportOverflow=true" to ignore viewport overflow error.'};return o&&disableFrameAnimationsUnsafe(),{captureArea:a.scale(f).serialize(),ignoreAreas:findIgnoreAreas(t.ignoreSelectors,{scrollElem:n,pixelRatio:f,viewportWidth:c,documentHeight:p}),viewport:new Rect({left:util.getScrollLeft(n),top:util.getScrollTop(n),width:c,height:s}).scale(f).serialize(),documentHeight:Math.ceil(p*f),documentWidth:Math.ceil(u*f),canHaveCaret:isEditable(document.activeElement),pixelRatio:f}}function disableFrameAnimationsUnsafe(){var e=["","::before","::after"].map(function(e){return"*:not(#testplane-q.testplane-w.testplane-e.testplane-r.testplane-t.testplane-y)"+e}).join(", "),t=[];util.forEachRoot(function(r){var i=document.createElement("style");i.innerHTML=e+["{"," animation-delay: 0ms !important;"," animation-duration: 0ms !important;"," animation-timing-function: step-start !important;"," transition-timing-function: step-start !important;"," scroll-behavior: auto !important;"," transition: none !important;","}"].join("\n"),r.appendChild(i),t.push(i)}),window.__cleanupAnimation=function(){for(var e=0;e<t.length;e++)t[e].parentNode.removeChild(t[e]);delete window.__cleanupAnimation}}function getCaptureRect(e,t){for(var r,i,o=t.initialRect,n=0;n<e.length;n++){if(!(r=lib.queryFirst(e[n])))return{error:"NOTFOUND",message:"Could not find element with css selector specified in setCaptureElements: "+e[n],selector:e[n]};i=getElementCaptureRect(r,t),i&&(o=o?o.merge(i):i)}return o?o.round():{error:"HIDDEN",message:"Area with css selector : "+e+" is hidden",selector:e}}function configurePixelRatio(e){return!1===e?1:window.devicePixelRatio?window.devicePixelRatio:window.screen.deviceXDPI/window.screen.logicalXDPI||1}function findIgnoreAreas(e,t){var r=[];return util.each(e,function(e){var i=queryIgnoreAreas(e);util.each(i,function(e){return addIgnoreArea.call(r,e,t)})}),r}function addIgnoreArea(e,t){var r=e&&getElementCaptureRect(e,t);if(r){var i=r.round().scale(t.pixelRatio).serialize();this.push(i)}}function isHidden(e,t){return"none"===e.display||"hidden"===e.visibility||e.opacity<1e-4||t.width<1e-4||t.height<1e-4}function getElementCaptureRect(e,t){var r=[":before",":after"],i=lib.getComputedStyle(e),o=rect.getAbsoluteClientRect(e,t);if(isHidden(i,o))return null;var n=getExtRect(i,o,t.allowViewportOverflow);return util.each(r,function(r){i=lib.getComputedStyle(e,r),n=n.merge(getExtRect(i,o,t.allowViewportOverflow))}),n}function getExtRect(e,t,r){var i=parseBoxShadow(e.boxShadow),o=parseInt(e.outlineWidth,10);return isNaN(o)&&(o=0),adjustRect(t,i,o,r)}function parseBoxShadow(e){e=e||"";var t,r=/[-+]?\d*\.?\d+px/g,i=e.split(","),o=[];return util.each(i,function(e){(t=e.match(r))&&o.push({offsetX:parseFloat(t[0]),offsetY:parseFloat(t[1])||0,blurRadius:parseFloat(t[2])||0,spreadRadius:parseFloat(t[3])||0,inset:-1!==e.indexOf("inset")})}),o}function adjustRect(e,t,r,i){var o=calculateShadowRect(e,t,i),n=calculateOutlineRect(e,r,i);return o.merge(n)}function calculateOutlineRect(e,t,r){var i=e.top-t,o=e.left-t;return new Rect({top:r?i:Math.max(0,i),left:r?o:Math.max(0,o),bottom:e.bottom+t,right:e.right+t})}function calculateShadowRect(e,t,r){var i=calculateShadowExtent(t),o=e.left+i.left,n=e.top+i.top;return new Rect({left:r?o:Math.max(0,o),top:r?n:Math.max(0,n),width:e.width-i.left+i.right,height:e.height-i.top+i.bottom})}function calculateShadowExtent(e){var t={top:0,left:0,right:0,bottom:0};return util.each(e,function(e){if(!e.inset){var r=e.spreadRadius+e.blurRadius;t.left=Math.min(e.offsetX-r,t.left),t.right=Math.max(e.offsetX+r,t.right),t.top=Math.min(e.offsetY-r,t.top),t.bottom=Math.max(e.offsetY+r,t.bottom)}}),t}function isEditable(e){return!!e&&(/^(input|textarea)$/i.test(e.tagName)||e.isContentEditable)}function scrollToCaptureAreaInSafari(e,t,r){var i=util.getMainDocumentElem(),o=Math.round(i.scrollHeight),n=Math.round(i.clientHeight),a=o-n;r.scrollTo(e.left,Math.min(t.top,a))}var util=require("./util"),rect=require("./rect"),lib=require("./lib.compat.js"),queryIgnoreAreas=require("./ignore-areas"),Rect=rect.Rect;"undefined"==typeof window?global.__geminiCore=exports:window.__geminiCore=exports,exports.queryFirst=lib.queryFirst,exports.prepareScreenshot=function(e,t){t=t||{};try{return prepareScreenshotUnsafe(e,t)}catch(r){return{error:"JS",message:r.stack||r.message}}},exports.disableFrameAnimations=function(){try{return disableFrameAnimationsUnsafe()}catch(e){return{error:"JS",message:e.stack||e.message}}},exports.cleanupFrameAnimations=function(){window.__cleanupAnimation&&window.__cleanupAnimation()},exports.resetZoom=function(){var e=lib.queryFirst('meta[name="viewport"]');if(!e){e=document.createElement("meta"),e.name="viewport";var t=lib.queryFirst("head");t&&t.appendChild(e)}e.content="width=device-width,initial-scale=1.0,user-scalable=no"};
7
+ "use strict";function prepareScreenshotUnsafe(e,t){var r=t.allowViewportOverflow,i=t.captureElementFromTop,o=t.disableAnimation,n=window;if(t.selectorToScroll&&!(n=document.querySelector(t.selectorToScroll)))return{error:"NOTFOUND",message:'Could not find element with css selector specified in "selectorToScroll" option: '+t.selectorToScroll,selector:t.selectorToScroll};var a,l=util.getMainDocumentElem(),c=l.clientWidth,s=l.clientHeight,u=l.scrollWidth,d=l.scrollHeight,p=new Rect({left:util.getScrollLeft(n),top:util.getScrollTop(n),width:c,height:s}),f=configurePixelRatio(t.usePixelRatio),m=[];if(e.forEach(function(e){Rect.isRect(e)?a=a?a.merge(new Rect(e)):new Rect(e):m.push(e)}),a=getCaptureRect(m,{initialRect:a,allowViewportOverflow:r,scrollElem:n,viewportWidth:c,documentHeight:d}),a.error)return a;if(i&&!p.rectInside(a))util.isSafariMobile()?scrollToCaptureAreaInSafari(p,a,n):n.scrollTo(a.left,a.top);else if(r&&p.rectIntersects(a))a.overflowsTopBound(p)&&a.recalculateHeight(p),a.overflowsLeftBound(p)&&a.recalculateWidth(p);else if(!i&&!r&&!p.rectIntersects(a))return{error:"OUTSIDE_OF_VIEWPORT",message:'Can not capture element, because it is outside of viewport. Try to set "captureElementFromTop=true" to scroll to it before capture or to set "allowViewportOverflow=true" to ignore viewport overflow error.'};return o&&disableFrameAnimationsUnsafe(),{captureArea:a.scale(f).serialize(),ignoreAreas:findIgnoreAreas(t.ignoreSelectors,{scrollElem:n,pixelRatio:f,viewportWidth:c,documentHeight:d}),viewport:new Rect({left:util.getScrollLeft(n),top:util.getScrollTop(n),width:c,height:s}).scale(f).serialize(),documentHeight:Math.ceil(d*f),documentWidth:Math.ceil(u*f),canHaveCaret:isEditable(document.activeElement),pixelRatio:f}}function disableFrameAnimationsUnsafe(){function e(e){var t=document.createElement("style");t.innerHTML=r+["{"," animation-delay: 0ms !important;"," animation-duration: 0ms !important;"," animation-timing-function: step-start !important;"," transition-timing-function: step-start !important;"," scroll-behavior: auto !important;"," transition: none !important;","}"].join("\n"),e.appendChild(t),i.push(t)}function t(){window.trustedTypes&&window.trustedTypes.createPolicy&&window.trustedTypes.createPolicy("default",{createHTML:function(e){return e}})}var r=["","::before","::after"].map(function(e){return"*:not(#testplane-q.testplane-w.testplane-e.testplane-r.testplane-t.testplane-y)"+e}).join(", "),i=[];util.forEachRoot(function(r){try{e(r)}catch(i){if(!(i&&i.message&&i.message.includes("This document requires 'TrustedHTML' assignment")))throw i;t(),e(r)}}),window.__cleanupAnimation=function(){for(var e=0;e<i.length;e++)i[e].parentNode.removeChild(i[e]);delete window.__cleanupAnimation}}function getCaptureRect(e,t){for(var r,i,o=t.initialRect,n=0;n<e.length;n++){if(!(r=lib.queryFirst(e[n])))return{error:"NOTFOUND",message:"Could not find element with css selector specified in setCaptureElements: "+e[n],selector:e[n]};i=getElementCaptureRect(r,t),i&&(o=o?o.merge(i):i)}return o?o.round():{error:"HIDDEN",message:"Area with css selector : "+e+" is hidden",selector:e}}function configurePixelRatio(e){return!1===e?1:window.devicePixelRatio?window.devicePixelRatio:window.screen.deviceXDPI/window.screen.logicalXDPI||1}function findIgnoreAreas(e,t){var r=[];return util.each(e,function(e){var i=queryIgnoreAreas(e);util.each(i,function(e){return addIgnoreArea.call(r,e,t)})}),r}function addIgnoreArea(e,t){var r=e&&getElementCaptureRect(e,t);if(r){var i=r.round().scale(t.pixelRatio).serialize();this.push(i)}}function isHidden(e,t){return"none"===e.display||"hidden"===e.visibility||e.opacity<1e-4||t.width<1e-4||t.height<1e-4}function getElementCaptureRect(e,t){var r=[":before",":after"],i=lib.getComputedStyle(e),o=rect.getAbsoluteClientRect(e,t);if(isHidden(i,o))return null;var n=getExtRect(i,o,t.allowViewportOverflow);return util.each(r,function(r){i=lib.getComputedStyle(e,r),n=n.merge(getExtRect(i,o,t.allowViewportOverflow))}),n}function getExtRect(e,t,r){var i=parseBoxShadow(e.boxShadow),o=parseInt(e.outlineWidth,10);return isNaN(o)&&(o=0),adjustRect(t,i,o,r)}function parseBoxShadow(e){e=e||"";var t,r=/[-+]?\d*\.?\d+px/g,i=e.split(","),o=[];return util.each(i,function(e){(t=e.match(r))&&o.push({offsetX:parseFloat(t[0]),offsetY:parseFloat(t[1])||0,blurRadius:parseFloat(t[2])||0,spreadRadius:parseFloat(t[3])||0,inset:-1!==e.indexOf("inset")})}),o}function adjustRect(e,t,r,i){var o=calculateShadowRect(e,t,i),n=calculateOutlineRect(e,r,i);return o.merge(n)}function calculateOutlineRect(e,t,r){var i=e.top-t,o=e.left-t;return new Rect({top:r?i:Math.max(0,i),left:r?o:Math.max(0,o),bottom:e.bottom+t,right:e.right+t})}function calculateShadowRect(e,t,r){var i=calculateShadowExtent(t),o=e.left+i.left,n=e.top+i.top;return new Rect({left:r?o:Math.max(0,o),top:r?n:Math.max(0,n),width:e.width-i.left+i.right,height:e.height-i.top+i.bottom})}function calculateShadowExtent(e){var t={top:0,left:0,right:0,bottom:0};return util.each(e,function(e){if(!e.inset){var r=e.spreadRadius+e.blurRadius;t.left=Math.min(e.offsetX-r,t.left),t.right=Math.max(e.offsetX+r,t.right),t.top=Math.min(e.offsetY-r,t.top),t.bottom=Math.max(e.offsetY+r,t.bottom)}}),t}function isEditable(e){return!!e&&(/^(input|textarea)$/i.test(e.tagName)||e.isContentEditable)}function scrollToCaptureAreaInSafari(e,t,r){var i=util.getMainDocumentElem(),o=Math.round(i.scrollHeight),n=Math.round(i.clientHeight),a=o-n;r.scrollTo(e.left,Math.min(t.top,a))}var util=require("./util"),rect=require("./rect"),lib=require("./lib.compat.js"),queryIgnoreAreas=require("./ignore-areas"),Rect=rect.Rect;"undefined"==typeof window?global.__geminiCore=exports:window.__geminiCore=exports,exports.queryFirst=lib.queryFirst,exports.prepareScreenshot=function(e,t){t=t||{};try{return prepareScreenshotUnsafe(e,t)}catch(r){return{error:"JS",message:r.stack||r.message}}},exports.disableFrameAnimations=function(){try{return disableFrameAnimationsUnsafe()}catch(e){return{error:"JS",message:e.stack||e.message}}},exports.cleanupFrameAnimations=function(){window.__cleanupAnimation&&window.__cleanupAnimation()},exports.resetZoom=function(){var e=lib.queryFirst('meta[name="viewport"]');if(!e){e=document.createElement("meta"),e.name="viewport";var t=lib.queryFirst("head");t&&t.appendChild(e)}e.content="width=device-width,initial-scale=1.0,user-scalable=no"};
8
8
  }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
9
9
  },{"./ignore-areas":2,"./lib.compat.js":4,"./rect":7,"./util":8}],4:[function(require,module,exports){
10
10
  "use strict";var Sizzle=require("sizzle"),xpath=require("./xpath");exports.queryFirst=function(e){if(xpath.isXpathSelector(e))return xpath.queryFirst(e);var t=Sizzle(exports.trim(e)+":first");return t.length>0?t[0]:null},exports.queryAll=function(e){return xpath.isXpathSelector(e)?xpath.queryAll(e):Sizzle(e)},exports.trim=function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")},exports.getComputedStyle=require("./polyfills/getComputedStyle").getComputedStyle,exports.matchMedia=require("./polyfills/matchMedia").matchMedia;
@@ -2,7 +2,7 @@
2
2
  "use strict";var lib=require("./lib.native.js");module.exports=function(e){return lib.queryAll(e)};
3
3
  },{"./lib.native.js":3}],2:[function(require,module,exports){
4
4
  (function (global){(function (){
5
- "use strict";function prepareScreenshotUnsafe(e,t){var r=t.allowViewportOverflow,i=t.captureElementFromTop,o=t.disableAnimation,n=window;if(t.selectorToScroll&&!(n=document.querySelector(t.selectorToScroll)))return{error:"NOTFOUND",message:'Could not find element with css selector specified in "selectorToScroll" option: '+t.selectorToScroll,selector:t.selectorToScroll};var a,l=util.getMainDocumentElem(),c=l.clientWidth,s=l.clientHeight,u=l.scrollWidth,p=l.scrollHeight,d=new Rect({left:util.getScrollLeft(n),top:util.getScrollTop(n),width:c,height:s}),f=configurePixelRatio(t.usePixelRatio),m=[];if(e.forEach(function(e){Rect.isRect(e)?a=a?a.merge(new Rect(e)):new Rect(e):m.push(e)}),a=getCaptureRect(m,{initialRect:a,allowViewportOverflow:r,scrollElem:n,viewportWidth:c,documentHeight:p}),a.error)return a;if(i&&!d.rectInside(a))util.isSafariMobile()?scrollToCaptureAreaInSafari(d,a,n):n.scrollTo(a.left,a.top);else if(r&&d.rectIntersects(a))a.overflowsTopBound(d)&&a.recalculateHeight(d),a.overflowsLeftBound(d)&&a.recalculateWidth(d);else if(!i&&!r&&!d.rectIntersects(a))return{error:"OUTSIDE_OF_VIEWPORT",message:'Can not capture element, because it is outside of viewport. Try to set "captureElementFromTop=true" to scroll to it before capture or to set "allowViewportOverflow=true" to ignore viewport overflow error.'};return o&&disableFrameAnimationsUnsafe(),{captureArea:a.scale(f).serialize(),ignoreAreas:findIgnoreAreas(t.ignoreSelectors,{scrollElem:n,pixelRatio:f,viewportWidth:c,documentHeight:p}),viewport:new Rect({left:util.getScrollLeft(n),top:util.getScrollTop(n),width:c,height:s}).scale(f).serialize(),documentHeight:Math.ceil(p*f),documentWidth:Math.ceil(u*f),canHaveCaret:isEditable(document.activeElement),pixelRatio:f}}function disableFrameAnimationsUnsafe(){var e=["","::before","::after"].map(function(e){return"*:not(#testplane-q.testplane-w.testplane-e.testplane-r.testplane-t.testplane-y)"+e}).join(", "),t=[];util.forEachRoot(function(r){var i=document.createElement("style");i.innerHTML=e+["{"," animation-delay: 0ms !important;"," animation-duration: 0ms !important;"," animation-timing-function: step-start !important;"," transition-timing-function: step-start !important;"," scroll-behavior: auto !important;"," transition: none !important;","}"].join("\n"),r.appendChild(i),t.push(i)}),window.__cleanupAnimation=function(){for(var e=0;e<t.length;e++)t[e].parentNode.removeChild(t[e]);delete window.__cleanupAnimation}}function getCaptureRect(e,t){for(var r,i,o=t.initialRect,n=0;n<e.length;n++){if(!(r=lib.queryFirst(e[n])))return{error:"NOTFOUND",message:"Could not find element with css selector specified in setCaptureElements: "+e[n],selector:e[n]};i=getElementCaptureRect(r,t),i&&(o=o?o.merge(i):i)}return o?o.round():{error:"HIDDEN",message:"Area with css selector : "+e+" is hidden",selector:e}}function configurePixelRatio(e){return!1===e?1:window.devicePixelRatio?window.devicePixelRatio:window.screen.deviceXDPI/window.screen.logicalXDPI||1}function findIgnoreAreas(e,t){var r=[];return util.each(e,function(e){var i=queryIgnoreAreas(e);util.each(i,function(e){return addIgnoreArea.call(r,e,t)})}),r}function addIgnoreArea(e,t){var r=e&&getElementCaptureRect(e,t);if(r){var i=r.round().scale(t.pixelRatio).serialize();this.push(i)}}function isHidden(e,t){return"none"===e.display||"hidden"===e.visibility||e.opacity<1e-4||t.width<1e-4||t.height<1e-4}function getElementCaptureRect(e,t){var r=[":before",":after"],i=lib.getComputedStyle(e),o=rect.getAbsoluteClientRect(e,t);if(isHidden(i,o))return null;var n=getExtRect(i,o,t.allowViewportOverflow);return util.each(r,function(r){i=lib.getComputedStyle(e,r),n=n.merge(getExtRect(i,o,t.allowViewportOverflow))}),n}function getExtRect(e,t,r){var i=parseBoxShadow(e.boxShadow),o=parseInt(e.outlineWidth,10);return isNaN(o)&&(o=0),adjustRect(t,i,o,r)}function parseBoxShadow(e){e=e||"";var t,r=/[-+]?\d*\.?\d+px/g,i=e.split(","),o=[];return util.each(i,function(e){(t=e.match(r))&&o.push({offsetX:parseFloat(t[0]),offsetY:parseFloat(t[1])||0,blurRadius:parseFloat(t[2])||0,spreadRadius:parseFloat(t[3])||0,inset:-1!==e.indexOf("inset")})}),o}function adjustRect(e,t,r,i){var o=calculateShadowRect(e,t,i),n=calculateOutlineRect(e,r,i);return o.merge(n)}function calculateOutlineRect(e,t,r){var i=e.top-t,o=e.left-t;return new Rect({top:r?i:Math.max(0,i),left:r?o:Math.max(0,o),bottom:e.bottom+t,right:e.right+t})}function calculateShadowRect(e,t,r){var i=calculateShadowExtent(t),o=e.left+i.left,n=e.top+i.top;return new Rect({left:r?o:Math.max(0,o),top:r?n:Math.max(0,n),width:e.width-i.left+i.right,height:e.height-i.top+i.bottom})}function calculateShadowExtent(e){var t={top:0,left:0,right:0,bottom:0};return util.each(e,function(e){if(!e.inset){var r=e.spreadRadius+e.blurRadius;t.left=Math.min(e.offsetX-r,t.left),t.right=Math.max(e.offsetX+r,t.right),t.top=Math.min(e.offsetY-r,t.top),t.bottom=Math.max(e.offsetY+r,t.bottom)}}),t}function isEditable(e){return!!e&&(/^(input|textarea)$/i.test(e.tagName)||e.isContentEditable)}function scrollToCaptureAreaInSafari(e,t,r){var i=util.getMainDocumentElem(),o=Math.round(i.scrollHeight),n=Math.round(i.clientHeight),a=o-n;r.scrollTo(e.left,Math.min(t.top,a))}var util=require("./util"),rect=require("./rect"),lib=require("./lib.native.js"),queryIgnoreAreas=require("./ignore-areas"),Rect=rect.Rect;"undefined"==typeof window?global.__geminiCore=exports:window.__geminiCore=exports,exports.queryFirst=lib.queryFirst,exports.prepareScreenshot=function(e,t){t=t||{};try{return prepareScreenshotUnsafe(e,t)}catch(r){return{error:"JS",message:r.stack||r.message}}},exports.disableFrameAnimations=function(){try{return disableFrameAnimationsUnsafe()}catch(e){return{error:"JS",message:e.stack||e.message}}},exports.cleanupFrameAnimations=function(){window.__cleanupAnimation&&window.__cleanupAnimation()},exports.resetZoom=function(){var e=lib.queryFirst('meta[name="viewport"]');if(!e){e=document.createElement("meta"),e.name="viewport";var t=lib.queryFirst("head");t&&t.appendChild(e)}e.content="width=device-width,initial-scale=1.0,user-scalable=no"};
5
+ "use strict";function prepareScreenshotUnsafe(e,t){var r=t.allowViewportOverflow,i=t.captureElementFromTop,o=t.disableAnimation,n=window;if(t.selectorToScroll&&!(n=document.querySelector(t.selectorToScroll)))return{error:"NOTFOUND",message:'Could not find element with css selector specified in "selectorToScroll" option: '+t.selectorToScroll,selector:t.selectorToScroll};var a,l=util.getMainDocumentElem(),c=l.clientWidth,s=l.clientHeight,u=l.scrollWidth,d=l.scrollHeight,f=new Rect({left:util.getScrollLeft(n),top:util.getScrollTop(n),width:c,height:s}),p=configurePixelRatio(t.usePixelRatio),m=[];if(e.forEach(function(e){Rect.isRect(e)?a=a?a.merge(new Rect(e)):new Rect(e):m.push(e)}),a=getCaptureRect(m,{initialRect:a,allowViewportOverflow:r,scrollElem:n,viewportWidth:c,documentHeight:d}),a.error)return a;if(i&&!f.rectInside(a))util.isSafariMobile()?scrollToCaptureAreaInSafari(f,a,n):n.scrollTo(a.left,a.top);else if(r&&f.rectIntersects(a))a.overflowsTopBound(f)&&a.recalculateHeight(f),a.overflowsLeftBound(f)&&a.recalculateWidth(f);else if(!i&&!r&&!f.rectIntersects(a))return{error:"OUTSIDE_OF_VIEWPORT",message:'Can not capture element, because it is outside of viewport. Try to set "captureElementFromTop=true" to scroll to it before capture or to set "allowViewportOverflow=true" to ignore viewport overflow error.'};return o&&disableFrameAnimationsUnsafe(),{captureArea:a.scale(p).serialize(),ignoreAreas:findIgnoreAreas(t.ignoreSelectors,{scrollElem:n,pixelRatio:p,viewportWidth:c,documentHeight:d}),viewport:new Rect({left:util.getScrollLeft(n),top:util.getScrollTop(n),width:c,height:s}).scale(p).serialize(),documentHeight:Math.ceil(d*p),documentWidth:Math.ceil(u*p),canHaveCaret:isEditable(document.activeElement),pixelRatio:p}}function disableFrameAnimationsUnsafe(){function e(e){var t=document.createElement("style");t.innerHTML=r+["{"," animation-delay: 0ms !important;"," animation-duration: 0ms !important;"," animation-timing-function: step-start !important;"," transition-timing-function: step-start !important;"," scroll-behavior: auto !important;"," transition: none !important;","}"].join("\n"),e.appendChild(t),i.push(t)}function t(){window.trustedTypes&&window.trustedTypes.createPolicy&&window.trustedTypes.createPolicy("default",{createHTML:function(e){return e}})}var r=["","::before","::after"].map(function(e){return"*:not(#testplane-q.testplane-w.testplane-e.testplane-r.testplane-t.testplane-y)"+e}).join(", "),i=[];util.forEachRoot(function(r){try{e(r)}catch(i){if(!(i&&i.message&&i.message.includes("This document requires 'TrustedHTML' assignment")))throw i;t(),e(r)}}),window.__cleanupAnimation=function(){for(var e=0;e<i.length;e++)i[e].parentNode.removeChild(i[e]);delete window.__cleanupAnimation}}function getCaptureRect(e,t){for(var r,i,o=t.initialRect,n=0;n<e.length;n++){if(!(r=lib.queryFirst(e[n])))return{error:"NOTFOUND",message:"Could not find element with css selector specified in setCaptureElements: "+e[n],selector:e[n]};i=getElementCaptureRect(r,t),i&&(o=o?o.merge(i):i)}return o?o.round():{error:"HIDDEN",message:"Area with css selector : "+e+" is hidden",selector:e}}function configurePixelRatio(e){return!1===e?1:window.devicePixelRatio?window.devicePixelRatio:window.screen.deviceXDPI/window.screen.logicalXDPI||1}function findIgnoreAreas(e,t){var r=[];return util.each(e,function(e){var i=queryIgnoreAreas(e);util.each(i,function(e){return addIgnoreArea.call(r,e,t)})}),r}function addIgnoreArea(e,t){var r=e&&getElementCaptureRect(e,t);if(r){var i=r.round().scale(t.pixelRatio).serialize();this.push(i)}}function isHidden(e,t){return"none"===e.display||"hidden"===e.visibility||e.opacity<1e-4||t.width<1e-4||t.height<1e-4}function getElementCaptureRect(e,t){var r=[":before",":after"],i=lib.getComputedStyle(e),o=rect.getAbsoluteClientRect(e,t);if(isHidden(i,o))return null;var n=getExtRect(i,o,t.allowViewportOverflow);return util.each(r,function(r){i=lib.getComputedStyle(e,r),n=n.merge(getExtRect(i,o,t.allowViewportOverflow))}),n}function getExtRect(e,t,r){var i=parseBoxShadow(e.boxShadow),o=parseInt(e.outlineWidth,10);return isNaN(o)&&(o=0),adjustRect(t,i,o,r)}function parseBoxShadow(e){e=e||"";var t,r=/[-+]?\d*\.?\d+px/g,i=e.split(","),o=[];return util.each(i,function(e){(t=e.match(r))&&o.push({offsetX:parseFloat(t[0]),offsetY:parseFloat(t[1])||0,blurRadius:parseFloat(t[2])||0,spreadRadius:parseFloat(t[3])||0,inset:-1!==e.indexOf("inset")})}),o}function adjustRect(e,t,r,i){var o=calculateShadowRect(e,t,i),n=calculateOutlineRect(e,r,i);return o.merge(n)}function calculateOutlineRect(e,t,r){var i=e.top-t,o=e.left-t;return new Rect({top:r?i:Math.max(0,i),left:r?o:Math.max(0,o),bottom:e.bottom+t,right:e.right+t})}function calculateShadowRect(e,t,r){var i=calculateShadowExtent(t),o=e.left+i.left,n=e.top+i.top;return new Rect({left:r?o:Math.max(0,o),top:r?n:Math.max(0,n),width:e.width-i.left+i.right,height:e.height-i.top+i.bottom})}function calculateShadowExtent(e){var t={top:0,left:0,right:0,bottom:0};return util.each(e,function(e){if(!e.inset){var r=e.spreadRadius+e.blurRadius;t.left=Math.min(e.offsetX-r,t.left),t.right=Math.max(e.offsetX+r,t.right),t.top=Math.min(e.offsetY-r,t.top),t.bottom=Math.max(e.offsetY+r,t.bottom)}}),t}function isEditable(e){return!!e&&(/^(input|textarea)$/i.test(e.tagName)||e.isContentEditable)}function scrollToCaptureAreaInSafari(e,t,r){var i=util.getMainDocumentElem(),o=Math.round(i.scrollHeight),n=Math.round(i.clientHeight),a=o-n;r.scrollTo(e.left,Math.min(t.top,a))}var util=require("./util"),rect=require("./rect"),lib=require("./lib.native.js"),queryIgnoreAreas=require("./ignore-areas"),Rect=rect.Rect;"undefined"==typeof window?global.__geminiCore=exports:window.__geminiCore=exports,exports.queryFirst=lib.queryFirst,exports.prepareScreenshot=function(e,t){t=t||{};try{return prepareScreenshotUnsafe(e,t)}catch(r){return{error:"JS",message:r.stack||r.message}}},exports.disableFrameAnimations=function(){try{return disableFrameAnimationsUnsafe()}catch(e){return{error:"JS",message:e.stack||e.message}}},exports.cleanupFrameAnimations=function(){window.__cleanupAnimation&&window.__cleanupAnimation()},exports.resetZoom=function(){var e=lib.queryFirst('meta[name="viewport"]');if(!e){e=document.createElement("meta"),e.name="viewport";var t=lib.queryFirst("head");t&&t.appendChild(e)}e.content="width=device-width,initial-scale=1.0,user-scalable=no"};
6
6
  }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
7
7
  },{"./ignore-areas":1,"./lib.native.js":3,"./rect":4,"./util":5}],3:[function(require,module,exports){
8
8
  "use strict";var xpath=require("./xpath");exports.queryFirst=function(t){return xpath.isXpathSelector(t)?xpath.queryFirst(t):document.querySelector(t)},exports.queryAll=function(t){return xpath.isXpathSelector(t)?xpath.queryAll(t):document.querySelectorAll(t)},exports.getComputedStyle=function(t,e){return getComputedStyle(t,e)},exports.matchMedia=function(t){return matchMedia(t)},exports.trim=function(t){return t.trim()};
@@ -159,7 +159,7 @@ function disableFrameAnimationsUnsafe() {
159
159
 
160
160
  var styleElements = [];
161
161
 
162
- util.forEachRoot(function (root) {
162
+ function appendDisableAnimationStyleElement(root) {
163
163
  var styleElement = document.createElement("style");
164
164
  styleElement.innerHTML =
165
165
  everythingSelector +
@@ -176,6 +176,30 @@ function disableFrameAnimationsUnsafe() {
176
176
 
177
177
  root.appendChild(styleElement);
178
178
  styleElements.push(styleElement);
179
+ }
180
+
181
+ function createDefaultTrustedTypesPolicy() {
182
+ if (window.trustedTypes && window.trustedTypes.createPolicy) {
183
+ window.trustedTypes.createPolicy("default", {
184
+ createHTML: function (string) {
185
+ return string;
186
+ }
187
+ });
188
+ }
189
+ }
190
+
191
+ util.forEachRoot(function (root) {
192
+ try {
193
+ appendDisableAnimationStyleElement(root);
194
+ } catch (err) {
195
+ if (err && err.message && err.message.includes("This document requires 'TrustedHTML' assignment")) {
196
+ createDefaultTrustedTypesPolicy();
197
+
198
+ appendDisableAnimationStyleElement(root);
199
+ } else {
200
+ throw err;
201
+ }
202
+ }
179
203
  });
180
204
 
181
205
  window.__cleanupAnimation = function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testplane",
3
- "version": "8.22.4",
3
+ "version": "8.22.5",
4
4
  "description": "Tests framework based on mocha and wdio",
5
5
  "main": "build/src/index.js",
6
6
  "files": [