@applitools/dom-capture
Advanced tools
Comparing version 8.0.0 to 8.0.1
@@ -7,2 +7,6 @@ | ||
## 8.0.1 - 2020/10/23 | ||
- rename script `captureDomPollForIE` back to `captureDomAndPollForIE` | ||
## 8.0.0 - 2020/10/6 | ||
@@ -9,0 +13,0 @@ |
@@ -1,7 +0,7 @@ | ||
/* @applitools/dom-capture@8.0.0 */ | ||
/* @applitools/dom-capture@8.0.1 */ | ||
function __captureDom() { | ||
var captureDom=function(){"use strict";function e(e,t=0){const n=e.charCodeAt(t);if(n>=55296&&n<56320){return 1024*(n-55296)+(e.charCodeAt(t+1)-56320)+65536}return 56320<=n&&n<=57343?-1:n}var t=function(t,n){const r=[];let o=0;for(let s=0;s<t.length;++s){const a=e(t,s);let c=0;a>0&&(c=a<128?1:a<2048?2:a<65536?3:a<2097152?4:a<67108864?5:6),o+c>n?(r.push(s),o=c):o+=c}return r};const n="WIP",r="SUCCESS",o="SUCCESS_CHUNKED",s="ERROR";var a=function(e,a,c={}){const u=function(e,{chunkByteLength:a=0}={}){if(e){if(e.value){if(a){if(!e.chunks){const n=JSON.stringify(e.value);e.chunks=t(n,a),e.chunks.length>0&&(e.from=0,e.value=n)}if(e.from>=0)return{status:o,value:e.value.substring(e.from,e.from=e.chunks.shift()),done:!e.from}}return{status:r,value:e.value}}return e.error?{status:s,error:e.error}:{status:n}}return{status:s,error:"unexpected poll request received - cannot find state of current operation"}}((e=e||{})[a],c);return(u.status===r||u.status===s||u.status===o&&u.done)&&(e[a]=null),u};var c=function(e,t){return new URL(e,t).href};var u=function(e){return!/^https?:.+/.test(e.src)||e.contentDocument&&e.contentDocument.location&&(["about:blank","about:srcdoc"].includes(e.contentDocument.location.href)||""===e.getAttribute("src")&&e.contentDocument.location.href===c(e.getAttribute("src"),e.ownerDocument.location.href))};var i={chunkify:t,pollify:function(e,t,n){return r=>function(){return t[n]||(t[n]={},e.apply(null,arguments).then(e=>t[n].value=e).catch(e=>t[n].error=e.message)),a(t,n,r)}},poll:a,absolutizeUrl:c,isInlineFrame:u,isAccessibleFrame:function(e){try{const t=e.contentDocument;return Boolean(t&&t.defaultView&&t.defaultView.frameElement)}catch(e){return!1}}};const l=/url\((?!['"]?:)['"]?([^'")]*)['"]?\)/;var f=function(e){const t=e?e.match(l):void 0;return t?t[1]:t};var d=async function({bgImages:e,timeout:t=5e3,Image:n=window.Image}){return(await Promise.all(Array.from(e).map(e=>{return Promise.race([new Promise(t=>{const r=new n;r.onload=()=>t({url:e,width:r.naturalWidth,height:r.naturalHeight}),r.onerror=()=>t(),r.src=e}),(r=t,new Promise(e=>{setTimeout(e,r)}))]);var r}))).reduce((e,t)=>(t&&(e[t.url]={width:t.width,height:t.height}),e),{})};function m(e){return Array.prototype.filter.call(e.parentNode.childNodes,t=>t.tagName===e.tagName).indexOf(e)+1}var h=function e(t){if(!t.ownerDocument)return"";let n="",r=t,o=t.ownerDocument,s=o.defaultView.frameElement;for(;r!==o;)n=`${r.tagName}[${m(r)}]/${n}`,r=r.parentNode;return s&&(n=`${e(s)},${n}`),n.replace(/\/$/,"")};var g=function({parseCss:e,CSSImportRule:t,absolutizeUrl:n,getCssFromCache:r,unfetchedToken:o}){return function s(a,c){let u,i="";try{const l=e(a);for(const e of Array.from(l.cssRules))if(e instanceof t){const t=n(e.href,c),a=r(t);if(void 0!==a){const{bundledCss:e,unfetchedResources:n}=s(a,t);n&&(u=new Set(n)),i=`${e}${i}`}else u=new Set([t]),i=`\n${o}${t}${o}`}}catch(e){console.log("error during getBundledCssFromCssText, styleBaseUrl="+c,e)}var l,f;return i=`${i}${l=a,f=c,`\n/** ${f} **/\n${l}`}`,{bundledCss:i,unfetchedResources:u}}};var p=function(e){var t=document.implementation.createHTMLDocument(""),n=t.createElement("style");return n.textContent=e,t.body.appendChild(n),n.sheet};var y=function(e,{fetchTimeLimit:t}={}){return async function(n){const r=new AbortController,o=[e(n,{cache:"force-cache",signal:r.signal}).then(e=>{if(e.ok)return e.text();console.log("/failed to fetch (status "+e.status+") css from: "+n+"/")}).catch(e=>{console.log("/failed to fetch (error "+e.toString()+") css from: "+n+"/")})];return Number.isNaN(Number(t))||o.push(new Promise(e=>setTimeout(e,t)).then(()=>r.abort())),Promise.race(o)}},C=function(e){const t=Array.from(e.attributes).find(e=>"href"===e.name.toLowerCase());return t&&t.value},w=function(e){if(e.nodeName&&"LINK"===e.nodeName.toUpperCase()&&e.attributes){const t=new Map(Array.from(e.attributes,e=>[e.name.toLowerCase(),e.value.toLowerCase()]));return"stylesheet"===t.get("rel")||"style"===t.get("as")&&["preload","prefetch"].includes(t.get("rel"))}return!1};var E=function(e){return e&&e.startsWith("data:")};var T=function({getCssFromCache:e,absolutizeUrl:t}){return function(n,r){let o,s,a;if(function(e){return e.nodeName&&"STYLE"===e.nodeName.toUpperCase()}(n))o=Array.from(n.childNodes).map(e=>e.nodeValue).join(""),s=r;else if(w(n)){const c=C(n);E(c)?(s=r,o=c.match(/,(.+)/)[1]):(s=t(c,r),o=e(s)),a=void 0===o}return{cssText:o,styleBaseUrl:s,isUnfetched:a}}};var N=function({extractCssFromNode:e,getBundledCssFromCssText:t,unfetchedToken:n}){return function(r,o){const{styleBaseUrl:s,cssText:a,isUnfetched:c}=e(r,o);let u,i="";if(a){const{bundledCss:e,unfetchedResources:n}=t(a,s);i+=e,u=new Set(n)}else c&&(i+=`${n}${s}${n}`,u=new Set([s]));return{bundledCss:i,unfetchedResources:u}}},b={EYES_NAMESPACE:"__EYES__APPLITOOLS__",DOM_CAPTURE_KEY:"domCaptureResult",NODE_TYPES:{ELEMENT:1,TEXT:3,DOCUMENT_FRAGMENT:11},DEFAULT_STYLE_PROPS:["background-repeat","background-origin","background-position","background-color","background-image","background-size","border-width","border-color","border-style","color","display","font-size","font-weight","line-height","margin","opacity","overflow","padding","visibility"],DEFAULT_RECT_PROPS:["width","height","top","left"],DEFAULT_IGNORED_TAG_NAMES:["HEAD","SCRIPT"]};const{absolutizeUrl:S,isInlineFrame:v}=i,{NODE_TYPES:A}=b;var D=function(e){return async function(t=document){const n={},r=Date.now(),o=[];return function t(n,r,o,s){function a(t){switch(s.push(async function(t,n,r){let o,s;w(t)&&(s=S(C(t),n),o=await e(s),void 0!==o&&(r[s]=o));o&&await async function t(n,r,o){try{const s=p(n),a=[];for(const n of Array.from(s.cssRules))n instanceof CSSImportRule&&a.push((async()=>{const s=S(n.href,r),a=await e(s);o[s]=a,void 0!==a&&await t(a,s,o)})());await Promise.all(a)}catch(e){console.log("error during fetchBundledCss, resourceUrl="+r,e)}}(o,s,r)}(t,r,o)),t.nodeType){case A.ELEMENT:return"IFRAME"===t.tagName.toUpperCase()?u(t):c(t)}}async function c(e){Array.prototype.map.call(e.childNodes,a)}async function u(e){if(c(e),e.contentDocument)try{const n=v(e)?e.baseURI:e.contentDocument.location.href;t(e.contentDocument,n,o,s)}catch(e){console.log(e)}}a(n.documentElement)}(t,t.location.href,n,o),await Promise.all(o),console.log("[prefetchAllCss]",Date.now()-r),function(e){return n[e]}}};const{absolutizeUrl:R,isInlineFrame:P}=i,{NODE_TYPES:$,DEFAULT_STYLE_PROPS:U,DEFAULT_RECT_PROPS:_,DEFAULT_IGNORED_TAG_NAMES:F}=b;return async function({doc:e=document,styleProps:t=U,rectProps:n=_,ignoredTagNames:r=F,addStats:o=!1,fetchTimeLimit:s=3e4}={}){arguments[1]&&(e=arguments[1]),arguments[2]&&(o=arguments[2]),arguments[3]&&(s=arguments[3]);const a={total:{},prefetchCss:{},doCaptureDoc:{},waitForImages:{}};function c(e){e.startTime=Date.now()}function u(e){e.endTime=Date.now(),e.elapsedTime=e.endTime-e.startTime}const i=[];c(a.total);const l=new Set,m=[],C="@@@@@",w="#####",E="-----";c(a.prefetchCss);const b=D(y(fetch,{fetchTimeLimit:s})),S=await b(e);u(a.prefetchCss);const v=g({parseCss:p,CSSImportRule:CSSImportRule,getCssFromCache:S,absolutizeUrl:R,unfetchedToken:w}),A=T({getCssFromCache:S,absolutizeUrl:R}),k=N({extractCssFromNode:A,getBundledCssFromCssText:v,unfetchedToken:w});c(a.doCaptureDoc);const I=Y(e);u(a.doCaptureDoc),c(a.waitForImages),await Promise.all(i),u(a.waitForImages),I.version="1.3.0",I.scriptVersion="8.0.0";const L=m.length?m.join("\n")+"\n":"",O=l.size?Array.from(l).join("\n")+"\n":"",x=JSON.stringify({separator:E,cssStartToken:w,cssEndToken:w,iframeStartToken:'"'+C,iframeEndToken:C+'"'});function M(){return o?`\n${E}\n${JSON.stringify(a)}`:""}u(a.total);const B=`${x}\n${O}${E}\n${L}${E}\n${JSON.stringify(I)}${M()}`;return console.log("[captureFrame]",JSON.stringify(a)),B;function V(e){return Object.keys(e).length?e:void 0}function z(e){return{tagName:"#text",text:e.textContent}}function Y(e,o=e.location&&e.location.href){const s=new Set;let a="";const c=u(e.documentElement||e);return c.css=a,i.push(d({bgImages:s}).then(e=>c.images=e)),c;function u(e){const{bundledCss:t,unfetchedResources:n}=k(e,o);if(a+=t,n)for(const e of n)l.add(e);switch(e.nodeType){case $.TEXT:return z(e);case $.ELEMENT:return"IFRAME"===e.tagName.toUpperCase()?function(e){const t=g(e);let n;try{n=e.contentDocument}catch(e){return r(),t}try{n?t.childNodes=[Y(n,P(e)?e.baseURI:n.location.href)]:r()}catch(e){console.log("error in iframeToJSON",e)}return t;function r(){const n=h(e);m.push(n),t.childNodes=[`${C}${n}${C}`]}}(e):g(e);case $.DOCUMENT_FRAGMENT:return{childNodes:Array.prototype.map.call(e.childNodes,u).filter(Boolean)};default:return null}}function g(e){const a=Array.prototype.map.call(e.childNodes,u).filter(Boolean),c=e.shadowRoot&&Y(e.shadowRoot,o),i=e.tagName.toUpperCase();if(r.indexOf(i)>-1)return null;const l=window.getComputedStyle(e),d=e.getBoundingClientRect(),m={};for(const e of t)m[e]=l.getPropertyValue(e);m["border-width"]||(m["border-width"]=`${l.getPropertyValue("border-top-width")} ${l.getPropertyValue("border-right-width")} ${l.getPropertyValue("border-bottom-width")} ${l.getPropertyValue("border-left-width")}`);const h={};for(const e of n)h[e]=d[e];const g=Array.from(e.attributes).map(e=>({key:e.name,value:e.value})).reduce((e,t)=>(e[t.key]=t.value,e),{}),p=f(l.getPropertyValue("background-image"));p&&s.add(p);const y={tagName:i,style:V(m),rect:V(h),attributes:V(g),childNodes:a};return c&&(y.shadowRoot=c),y}}}}(); | ||
var captureDom=function(){"use strict";function e(e,t=0){const n=e.charCodeAt(t);if(n>=55296&&n<56320){return 1024*(n-55296)+(e.charCodeAt(t+1)-56320)+65536}return 56320<=n&&n<=57343?-1:n}var t=function(t,n){const r=[];let o=0;for(let s=0;s<t.length;++s){const a=e(t,s);let c=0;a>0&&(c=a<128?1:a<2048?2:a<65536?3:a<2097152?4:a<67108864?5:6),o+c>n?(r.push(s),o=c):o+=c}return r};const n="WIP",r="SUCCESS",o="SUCCESS_CHUNKED",s="ERROR";var a=function(e,a,c={}){const u=function(e,{chunkByteLength:a=0}={}){if(e){if(e.value){if(a){if(!e.chunks){const n=JSON.stringify(e.value);e.chunks=t(n,a),e.chunks.length>0&&(e.from=0,e.value=n)}if(e.from>=0)return{status:o,value:e.value.substring(e.from,e.from=e.chunks.shift()),done:!e.from}}return{status:r,value:e.value}}return e.error?{status:s,error:e.error}:{status:n}}return{status:s,error:"unexpected poll request received - cannot find state of current operation"}}((e=e||{})[a],c);return(u.status===r||u.status===s||u.status===o&&u.done)&&(e[a]=null),u};var c=function(e,t){return new URL(e,t).href};var u=function(e){return!/^https?:.+/.test(e.src)||e.contentDocument&&e.contentDocument.location&&(["about:blank","about:srcdoc"].includes(e.contentDocument.location.href)||""===e.getAttribute("src")&&e.contentDocument.location.href===c(e.getAttribute("src"),e.ownerDocument.location.href))};var i={chunkify:t,pollify:function(e,t,n){return r=>function(){return t[n]||(t[n]={},e.apply(null,arguments).then(e=>t[n].value=e).catch(e=>t[n].error=e.message)),a(t,n,r)}},poll:a,absolutizeUrl:c,isInlineFrame:u,isAccessibleFrame:function(e){try{const t=e.contentDocument;return Boolean(t&&t.defaultView&&t.defaultView.frameElement)}catch(e){return!1}}};const l=/url\((?!['"]?:)['"]?([^'")]*)['"]?\)/;var f=function(e){const t=e?e.match(l):void 0;return t?t[1]:t};var d=async function({bgImages:e,timeout:t=5e3,Image:n=window.Image}){return(await Promise.all(Array.from(e).map(e=>{return Promise.race([new Promise(t=>{const r=new n;r.onload=()=>t({url:e,width:r.naturalWidth,height:r.naturalHeight}),r.onerror=()=>t(),r.src=e}),(r=t,new Promise(e=>{setTimeout(e,r)}))]);var r}))).reduce((e,t)=>(t&&(e[t.url]={width:t.width,height:t.height}),e),{})};function m(e){return Array.prototype.filter.call(e.parentNode.childNodes,t=>t.tagName===e.tagName).indexOf(e)+1}var h=function e(t){if(!t.ownerDocument)return"";let n="",r=t,o=t.ownerDocument,s=o.defaultView.frameElement;for(;r!==o;)n=`${r.tagName}[${m(r)}]/${n}`,r=r.parentNode;return s&&(n=`${e(s)},${n}`),n.replace(/\/$/,"")};var g=function({parseCss:e,CSSImportRule:t,absolutizeUrl:n,getCssFromCache:r,unfetchedToken:o}){return function s(a,c){let u,i="";try{const l=e(a);for(const e of Array.from(l.cssRules))if(e instanceof t){const t=n(e.href,c),a=r(t);if(void 0!==a){const{bundledCss:e,unfetchedResources:n}=s(a,t);n&&(u=new Set(n)),i=`${e}${i}`}else u=new Set([t]),i=`\n${o}${t}${o}`}}catch(e){console.log("error during getBundledCssFromCssText, styleBaseUrl="+c,e)}var l,f;return i=`${i}${l=a,f=c,`\n/** ${f} **/\n${l}`}`,{bundledCss:i,unfetchedResources:u}}};var p=function(e){var t=document.implementation.createHTMLDocument(""),n=t.createElement("style");return n.textContent=e,t.body.appendChild(n),n.sheet};var y=function(e,{fetchTimeLimit:t}={}){return async function(n){const r=new AbortController,o=[e(n,{cache:"force-cache",signal:r.signal}).then(e=>{if(e.ok)return e.text();console.log("/failed to fetch (status "+e.status+") css from: "+n+"/")}).catch(e=>{console.log("/failed to fetch (error "+e.toString()+") css from: "+n+"/")})];return Number.isNaN(Number(t))||o.push(new Promise(e=>setTimeout(e,t)).then(()=>r.abort())),Promise.race(o)}},C=function(e){const t=Array.from(e.attributes).find(e=>"href"===e.name.toLowerCase());return t&&t.value},w=function(e){if(e.nodeName&&"LINK"===e.nodeName.toUpperCase()&&e.attributes){const t=new Map(Array.from(e.attributes,e=>[e.name.toLowerCase(),e.value.toLowerCase()]));return"stylesheet"===t.get("rel")||"style"===t.get("as")&&["preload","prefetch"].includes(t.get("rel"))}return!1};var E=function(e){return e&&e.startsWith("data:")};var T=function({getCssFromCache:e,absolutizeUrl:t}){return function(n,r){let o,s,a;if(function(e){return e.nodeName&&"STYLE"===e.nodeName.toUpperCase()}(n))o=Array.from(n.childNodes).map(e=>e.nodeValue).join(""),s=r;else if(w(n)){const c=C(n);E(c)?(s=r,o=c.match(/,(.+)/)[1]):(s=t(c,r),o=e(s)),a=void 0===o}return{cssText:o,styleBaseUrl:s,isUnfetched:a}}};var N=function({extractCssFromNode:e,getBundledCssFromCssText:t,unfetchedToken:n}){return function(r,o){const{styleBaseUrl:s,cssText:a,isUnfetched:c}=e(r,o);let u,i="";if(a){const{bundledCss:e,unfetchedResources:n}=t(a,s);i+=e,u=new Set(n)}else c&&(i+=`${n}${s}${n}`,u=new Set([s]));return{bundledCss:i,unfetchedResources:u}}},b={EYES_NAMESPACE:"__EYES__APPLITOOLS__",DOM_CAPTURE_KEY:"domCaptureResult",NODE_TYPES:{ELEMENT:1,TEXT:3,DOCUMENT_FRAGMENT:11},DEFAULT_STYLE_PROPS:["background-repeat","background-origin","background-position","background-color","background-image","background-size","border-width","border-color","border-style","color","display","font-size","font-weight","line-height","margin","opacity","overflow","padding","visibility"],DEFAULT_RECT_PROPS:["width","height","top","left"],DEFAULT_IGNORED_TAG_NAMES:["HEAD","SCRIPT"]};const{absolutizeUrl:S,isInlineFrame:v}=i,{NODE_TYPES:A}=b;var D=function(e){return async function(t=document){const n={},r=Date.now(),o=[];return function t(n,r,o,s){function a(t){switch(s.push(async function(t,n,r){let o,s;w(t)&&(s=S(C(t),n),o=await e(s),void 0!==o&&(r[s]=o));o&&await async function t(n,r,o){try{const s=p(n),a=[];for(const n of Array.from(s.cssRules))n instanceof CSSImportRule&&a.push((async()=>{const s=S(n.href,r),a=await e(s);o[s]=a,void 0!==a&&await t(a,s,o)})());await Promise.all(a)}catch(e){console.log("error during fetchBundledCss, resourceUrl="+r,e)}}(o,s,r)}(t,r,o)),t.nodeType){case A.ELEMENT:return"IFRAME"===t.tagName.toUpperCase()?u(t):c(t)}}async function c(e){Array.prototype.map.call(e.childNodes,a)}async function u(e){if(c(e),e.contentDocument)try{const n=v(e)?e.baseURI:e.contentDocument.location.href;t(e.contentDocument,n,o,s)}catch(e){console.log(e)}}a(n.documentElement)}(t,t.location.href,n,o),await Promise.all(o),console.log("[prefetchAllCss]",Date.now()-r),function(e){return n[e]}}};const{absolutizeUrl:R,isInlineFrame:P}=i,{NODE_TYPES:$,DEFAULT_STYLE_PROPS:U,DEFAULT_RECT_PROPS:_,DEFAULT_IGNORED_TAG_NAMES:F}=b;return async function({doc:e=document,styleProps:t=U,rectProps:n=_,ignoredTagNames:r=F,addStats:o=!1,fetchTimeLimit:s=3e4}={}){arguments[1]&&(e=arguments[1]),arguments[2]&&(o=arguments[2]),arguments[3]&&(s=arguments[3]);const a={total:{},prefetchCss:{},doCaptureDoc:{},waitForImages:{}};function c(e){e.startTime=Date.now()}function u(e){e.endTime=Date.now(),e.elapsedTime=e.endTime-e.startTime}const i=[];c(a.total);const l=new Set,m=[],C="@@@@@",w="#####",E="-----";c(a.prefetchCss);const b=D(y(fetch,{fetchTimeLimit:s})),S=await b(e);u(a.prefetchCss);const v=g({parseCss:p,CSSImportRule:CSSImportRule,getCssFromCache:S,absolutizeUrl:R,unfetchedToken:w}),A=T({getCssFromCache:S,absolutizeUrl:R}),k=N({extractCssFromNode:A,getBundledCssFromCssText:v,unfetchedToken:w});c(a.doCaptureDoc);const I=Y(e);u(a.doCaptureDoc),c(a.waitForImages),await Promise.all(i),u(a.waitForImages),I.version="1.3.0",I.scriptVersion="8.0.1";const L=m.length?m.join("\n")+"\n":"",O=l.size?Array.from(l).join("\n")+"\n":"",x=JSON.stringify({separator:E,cssStartToken:w,cssEndToken:w,iframeStartToken:'"'+C,iframeEndToken:C+'"'});function M(){return o?`\n${E}\n${JSON.stringify(a)}`:""}u(a.total);const B=`${x}\n${O}${E}\n${L}${E}\n${JSON.stringify(I)}${M()}`;return console.log("[captureFrame]",JSON.stringify(a)),B;function V(e){return Object.keys(e).length?e:void 0}function z(e){return{tagName:"#text",text:e.textContent}}function Y(e,o=e.location&&e.location.href){const s=new Set;let a="";const c=u(e.documentElement||e);return c.css=a,i.push(d({bgImages:s}).then(e=>c.images=e)),c;function u(e){const{bundledCss:t,unfetchedResources:n}=k(e,o);if(a+=t,n)for(const e of n)l.add(e);switch(e.nodeType){case $.TEXT:return z(e);case $.ELEMENT:return"IFRAME"===e.tagName.toUpperCase()?function(e){const t=g(e);let n;try{n=e.contentDocument}catch(e){return r(),t}try{n?t.childNodes=[Y(n,P(e)?e.baseURI:n.location.href)]:r()}catch(e){console.log("error in iframeToJSON",e)}return t;function r(){const n=h(e);m.push(n),t.childNodes=[`${C}${n}${C}`]}}(e):g(e);case $.DOCUMENT_FRAGMENT:return{childNodes:Array.prototype.map.call(e.childNodes,u).filter(Boolean)};default:return null}}function g(e){const a=Array.prototype.map.call(e.childNodes,u).filter(Boolean),c=e.shadowRoot&&Y(e.shadowRoot,o),i=e.tagName.toUpperCase();if(r.indexOf(i)>-1)return null;const l=window.getComputedStyle(e),d=e.getBoundingClientRect(),m={};for(const e of t)m[e]=l.getPropertyValue(e);m["border-width"]||(m["border-width"]=`${l.getPropertyValue("border-top-width")} ${l.getPropertyValue("border-right-width")} ${l.getPropertyValue("border-bottom-width")} ${l.getPropertyValue("border-left-width")}`);const h={};for(const e of n)h[e]=d[e];const g=Array.from(e.attributes).map(e=>({key:e.name,value:e.value})).reduce((e,t)=>(e[t.key]=t.value,e),{}),p=f(l.getPropertyValue("background-image"));p&&s.add(p);const y={tagName:i,style:V(m),rect:V(h),attributes:V(g),childNodes:a};return c&&(y.shadowRoot=c),y}}}}(); | ||
return captureDom.apply(this, arguments); | ||
} |
@@ -1,7 +0,7 @@ | ||
/* @applitools/dom-capture@8.0.0 */ | ||
/* @applitools/dom-capture@8.0.1 */ | ||
function __captureDomAndPoll() { | ||
var captureDomAndPoll=function(){"use strict";function e(e,t=0){const n=e.charCodeAt(t);if(n>=55296&&n<56320){return 1024*(n-55296)+(e.charCodeAt(t+1)-56320)+65536}return 56320<=n&&n<=57343?-1:n}var t=function(t,n){const o=[];let r=0;for(let s=0;s<t.length;++s){const a=e(t,s);let c=0;a>0&&(c=a<128?1:a<2048?2:a<65536?3:a<2097152?4:a<67108864?5:6),r+c>n?(o.push(s),r=c):r+=c}return o};const n="WIP",o="SUCCESS",r="SUCCESS_CHUNKED",s="ERROR";var a=function(e,a,c={}){const i=function(e,{chunkByteLength:a=0}={}){if(e){if(e.value){if(a){if(!e.chunks){const n=JSON.stringify(e.value);e.chunks=t(n,a),e.chunks.length>0&&(e.from=0,e.value=n)}if(e.from>=0)return{status:r,value:e.value.substring(e.from,e.from=e.chunks.shift()),done:!e.from}}return{status:o,value:e.value}}return e.error?{status:s,error:e.error}:{status:n}}return{status:s,error:"unexpected poll request received - cannot find state of current operation"}}((e=e||{})[a],c);return(i.status===o||i.status===s||i.status===r&&i.done)&&(e[a]=null),i};var c=function(e,t){return new URL(e,t).href};var i=function(e){return!/^https?:.+/.test(e.src)||e.contentDocument&&e.contentDocument.location&&(["about:blank","about:srcdoc"].includes(e.contentDocument.location.href)||""===e.getAttribute("src")&&e.contentDocument.location.href===c(e.getAttribute("src"),e.ownerDocument.location.href))};var u={chunkify:t,pollify:function(e,t,n){return o=>function(){return t[n]||(t[n]={},e.apply(null,arguments).then(e=>t[n].value=e).catch(e=>t[n].error=e.message)),a(t,n,o)}},poll:a,absolutizeUrl:c,isInlineFrame:i,isAccessibleFrame:function(e){try{const t=e.contentDocument;return Boolean(t&&t.defaultView&&t.defaultView.frameElement)}catch(e){return!1}}},l={EYES_NAMESPACE:"__EYES__APPLITOOLS__",DOM_CAPTURE_KEY:"domCaptureResult",NODE_TYPES:{ELEMENT:1,TEXT:3,DOCUMENT_FRAGMENT:11},DEFAULT_STYLE_PROPS:["background-repeat","background-origin","background-position","background-color","background-image","background-size","border-width","border-color","border-style","color","display","font-size","font-weight","line-height","margin","opacity","overflow","padding","visibility"],DEFAULT_RECT_PROPS:["width","height","top","left"],DEFAULT_IGNORED_TAG_NAMES:["HEAD","SCRIPT"]};const f=/url\((?!['"]?:)['"]?([^'")]*)['"]?\)/;var d=function(e){const t=e?e.match(f):void 0;return t?t[1]:t};var m=async function({bgImages:e,timeout:t=5e3,Image:n=window.Image}){return(await Promise.all(Array.from(e).map(e=>{return Promise.race([new Promise(t=>{const o=new n;o.onload=()=>t({url:e,width:o.naturalWidth,height:o.naturalHeight}),o.onerror=()=>t(),o.src=e}),(o=t,new Promise(e=>{setTimeout(e,o)}))]);var o}))).reduce((e,t)=>(t&&(e[t.url]={width:t.width,height:t.height}),e),{})};function h(e){return Array.prototype.filter.call(e.parentNode.childNodes,t=>t.tagName===e.tagName).indexOf(e)+1}var g=function e(t){if(!t.ownerDocument)return"";let n="",o=t,r=t.ownerDocument,s=r.defaultView.frameElement;for(;o!==r;)n=`${o.tagName}[${h(o)}]/${n}`,o=o.parentNode;return s&&(n=`${e(s)},${n}`),n.replace(/\/$/,"")};var p=function({parseCss:e,CSSImportRule:t,absolutizeUrl:n,getCssFromCache:o,unfetchedToken:r}){return function s(a,c){let i,u="";try{const l=e(a);for(const e of Array.from(l.cssRules))if(e instanceof t){const t=n(e.href,c),a=o(t);if(void 0!==a){const{bundledCss:e,unfetchedResources:n}=s(a,t);n&&(i=new Set(n)),u=`${e}${u}`}else i=new Set([t]),u=`\n${r}${t}${r}`}}catch(e){console.log("error during getBundledCssFromCssText, styleBaseUrl="+c,e)}var l,f;return u=`${u}${l=a,f=c,`\n/** ${f} **/\n${l}`}`,{bundledCss:u,unfetchedResources:i}}};var y=function(e){var t=document.implementation.createHTMLDocument(""),n=t.createElement("style");return n.textContent=e,t.body.appendChild(n),n.sheet};var w=function(e,{fetchTimeLimit:t}={}){return async function(n){const o=new AbortController,r=[e(n,{cache:"force-cache",signal:o.signal}).then(e=>{if(e.ok)return e.text();console.log("/failed to fetch (status "+e.status+") css from: "+n+"/")}).catch(e=>{console.log("/failed to fetch (error "+e.toString()+") css from: "+n+"/")})];return Number.isNaN(Number(t))||r.push(new Promise(e=>setTimeout(e,t)).then(()=>o.abort())),Promise.race(r)}},C=function(e){const t=Array.from(e.attributes).find(e=>"href"===e.name.toLowerCase());return t&&t.value},E=function(e){if(e.nodeName&&"LINK"===e.nodeName.toUpperCase()&&e.attributes){const t=new Map(Array.from(e.attributes,e=>[e.name.toLowerCase(),e.value.toLowerCase()]));return"stylesheet"===t.get("rel")||"style"===t.get("as")&&["preload","prefetch"].includes(t.get("rel"))}return!1};var T=function(e){return e&&e.startsWith("data:")};var N=function({getCssFromCache:e,absolutizeUrl:t}){return function(n,o){let r,s,a;if(function(e){return e.nodeName&&"STYLE"===e.nodeName.toUpperCase()}(n))r=Array.from(n.childNodes).map(e=>e.nodeValue).join(""),s=o;else if(E(n)){const c=C(n);T(c)?(s=o,r=c.match(/,(.+)/)[1]):(s=t(c,o),r=e(s)),a=void 0===r}return{cssText:r,styleBaseUrl:s,isUnfetched:a}}};var b=function({extractCssFromNode:e,getBundledCssFromCssText:t,unfetchedToken:n}){return function(o,r){const{styleBaseUrl:s,cssText:a,isUnfetched:c}=e(o,r);let i,u="";if(a){const{bundledCss:e,unfetchedResources:n}=t(a,s);u+=e,i=new Set(n)}else c&&(u+=`${n}${s}${n}`,i=new Set([s]));return{bundledCss:u,unfetchedResources:i}}};const{absolutizeUrl:S,isInlineFrame:v}=u,{NODE_TYPES:A}=l;var D=function(e){return async function(t=document){const n={},o=Date.now(),r=[];return function t(n,o,r,s){function a(t){switch(s.push(async function(t,n,o){let r,s;E(t)&&(s=S(C(t),n),r=await e(s),void 0!==r&&(o[s]=r));r&&await async function t(n,o,r){try{const s=y(n),a=[];for(const n of Array.from(s.cssRules))n instanceof CSSImportRule&&a.push((async()=>{const s=S(n.href,o),a=await e(s);r[s]=a,void 0!==a&&await t(a,s,r)})());await Promise.all(a)}catch(e){console.log("error during fetchBundledCss, resourceUrl="+o,e)}}(r,s,o)}(t,o,r)),t.nodeType){case A.ELEMENT:return"IFRAME"===t.tagName.toUpperCase()?i(t):c(t)}}async function c(e){Array.prototype.map.call(e.childNodes,a)}async function i(e){if(c(e),e.contentDocument)try{const n=v(e)?e.baseURI:e.contentDocument.location.href;t(e.contentDocument,n,r,s)}catch(e){console.log(e)}}a(n.documentElement)}(t,t.location.href,n,r),await Promise.all(r),console.log("[prefetchAllCss]",Date.now()-o),function(e){return n[e]}}};const{absolutizeUrl:P,isInlineFrame:R}=u,{NODE_TYPES:U,DEFAULT_STYLE_PROPS:$,DEFAULT_RECT_PROPS:_,DEFAULT_IGNORED_TAG_NAMES:F}=l;var k=async function({doc:e=document,styleProps:t=$,rectProps:n=_,ignoredTagNames:o=F,addStats:r=!1,fetchTimeLimit:s=3e4}={}){arguments[1]&&(e=arguments[1]),arguments[2]&&(r=arguments[2]),arguments[3]&&(s=arguments[3]);const a={total:{},prefetchCss:{},doCaptureDoc:{},waitForImages:{}};function c(e){e.startTime=Date.now()}function i(e){e.endTime=Date.now(),e.elapsedTime=e.endTime-e.startTime}const u=[];c(a.total);const l=new Set,f=[],h="@@@@@",C="#####",E="-----";c(a.prefetchCss);const T=D(w(fetch,{fetchTimeLimit:s})),S=await T(e);i(a.prefetchCss);const v=p({parseCss:y,CSSImportRule:CSSImportRule,getCssFromCache:S,absolutizeUrl:P,unfetchedToken:C}),A=N({getCssFromCache:S,absolutizeUrl:P}),k=b({extractCssFromNode:A,getBundledCssFromCssText:v,unfetchedToken:C});c(a.doCaptureDoc);const O=z(e);i(a.doCaptureDoc),c(a.waitForImages),await Promise.all(u),i(a.waitForImages),O.version="1.3.0",O.scriptVersion="8.0.0";const I=f.length?f.join("\n")+"\n":"",L=l.size?Array.from(l).join("\n")+"\n":"",M=JSON.stringify({separator:E,cssStartToken:C,cssEndToken:C,iframeStartToken:'"'+h,iframeEndToken:h+'"'});function x(){return r?`\n${E}\n${JSON.stringify(a)}`:""}i(a.total);const B=`${M}\n${L}${E}\n${I}${E}\n${JSON.stringify(O)}${x()}`;return console.log("[captureFrame]",JSON.stringify(a)),B;function V(e){return Object.keys(e).length?e:void 0}function Y(e){return{tagName:"#text",text:e.textContent}}function z(e,r=e.location&&e.location.href){const s=new Set;let a="";const c=i(e.documentElement||e);return c.css=a,u.push(m({bgImages:s}).then(e=>c.images=e)),c;function i(e){const{bundledCss:t,unfetchedResources:n}=k(e,r);if(a+=t,n)for(const e of n)l.add(e);switch(e.nodeType){case U.TEXT:return Y(e);case U.ELEMENT:return"IFRAME"===e.tagName.toUpperCase()?function(e){const t=p(e);let n;try{n=e.contentDocument}catch(e){return o(),t}try{n?t.childNodes=[z(n,R(e)?e.baseURI:n.location.href)]:o()}catch(e){console.log("error in iframeToJSON",e)}return t;function o(){const n=g(e);f.push(n),t.childNodes=[`${h}${n}${h}`]}}(e):p(e);case U.DOCUMENT_FRAGMENT:return{childNodes:Array.prototype.map.call(e.childNodes,i).filter(Boolean)};default:return null}}function p(e){const a=Array.prototype.map.call(e.childNodes,i).filter(Boolean),c=e.shadowRoot&&z(e.shadowRoot,r),u=e.tagName.toUpperCase();if(o.indexOf(u)>-1)return null;const l=window.getComputedStyle(e),f=e.getBoundingClientRect(),m={};for(const e of t)m[e]=l.getPropertyValue(e);m["border-width"]||(m["border-width"]=`${l.getPropertyValue("border-top-width")} ${l.getPropertyValue("border-right-width")} ${l.getPropertyValue("border-bottom-width")} ${l.getPropertyValue("border-left-width")}`);const h={};for(const e of n)h[e]=f[e];const g=Array.from(e.attributes).map(e=>({key:e.name,value:e.value})).reduce((e,t)=>(e[t.key]=t.value,e),{}),p=d(l.getPropertyValue("background-image"));p&&s.add(p);const y={tagName:u,style:V(m),rect:V(h),attributes:V(g),childNodes:a};return c&&(y.shadowRoot=c),y}}};const{pollify:O}=u,{EYES_NAMESPACE:I,DOM_CAPTURE_KEY:L}=l;window[I]=window[I]||{};const M=O(k,window[I],L);return function(e){return JSON.stringify(M(e)(e))}}(); | ||
var captureDomAndPoll=function(){"use strict";function e(e,t=0){const n=e.charCodeAt(t);if(n>=55296&&n<56320){return 1024*(n-55296)+(e.charCodeAt(t+1)-56320)+65536}return 56320<=n&&n<=57343?-1:n}var t=function(t,n){const o=[];let r=0;for(let s=0;s<t.length;++s){const a=e(t,s);let c=0;a>0&&(c=a<128?1:a<2048?2:a<65536?3:a<2097152?4:a<67108864?5:6),r+c>n?(o.push(s),r=c):r+=c}return o};const n="WIP",o="SUCCESS",r="SUCCESS_CHUNKED",s="ERROR";var a=function(e,a,c={}){const i=function(e,{chunkByteLength:a=0}={}){if(e){if(e.value){if(a){if(!e.chunks){const n=JSON.stringify(e.value);e.chunks=t(n,a),e.chunks.length>0&&(e.from=0,e.value=n)}if(e.from>=0)return{status:r,value:e.value.substring(e.from,e.from=e.chunks.shift()),done:!e.from}}return{status:o,value:e.value}}return e.error?{status:s,error:e.error}:{status:n}}return{status:s,error:"unexpected poll request received - cannot find state of current operation"}}((e=e||{})[a],c);return(i.status===o||i.status===s||i.status===r&&i.done)&&(e[a]=null),i};var c=function(e,t){return new URL(e,t).href};var i=function(e){return!/^https?:.+/.test(e.src)||e.contentDocument&&e.contentDocument.location&&(["about:blank","about:srcdoc"].includes(e.contentDocument.location.href)||""===e.getAttribute("src")&&e.contentDocument.location.href===c(e.getAttribute("src"),e.ownerDocument.location.href))};var u={chunkify:t,pollify:function(e,t,n){return o=>function(){return t[n]||(t[n]={},e.apply(null,arguments).then(e=>t[n].value=e).catch(e=>t[n].error=e.message)),a(t,n,o)}},poll:a,absolutizeUrl:c,isInlineFrame:i,isAccessibleFrame:function(e){try{const t=e.contentDocument;return Boolean(t&&t.defaultView&&t.defaultView.frameElement)}catch(e){return!1}}},l={EYES_NAMESPACE:"__EYES__APPLITOOLS__",DOM_CAPTURE_KEY:"domCaptureResult",NODE_TYPES:{ELEMENT:1,TEXT:3,DOCUMENT_FRAGMENT:11},DEFAULT_STYLE_PROPS:["background-repeat","background-origin","background-position","background-color","background-image","background-size","border-width","border-color","border-style","color","display","font-size","font-weight","line-height","margin","opacity","overflow","padding","visibility"],DEFAULT_RECT_PROPS:["width","height","top","left"],DEFAULT_IGNORED_TAG_NAMES:["HEAD","SCRIPT"]};const f=/url\((?!['"]?:)['"]?([^'")]*)['"]?\)/;var d=function(e){const t=e?e.match(f):void 0;return t?t[1]:t};var m=async function({bgImages:e,timeout:t=5e3,Image:n=window.Image}){return(await Promise.all(Array.from(e).map(e=>{return Promise.race([new Promise(t=>{const o=new n;o.onload=()=>t({url:e,width:o.naturalWidth,height:o.naturalHeight}),o.onerror=()=>t(),o.src=e}),(o=t,new Promise(e=>{setTimeout(e,o)}))]);var o}))).reduce((e,t)=>(t&&(e[t.url]={width:t.width,height:t.height}),e),{})};function h(e){return Array.prototype.filter.call(e.parentNode.childNodes,t=>t.tagName===e.tagName).indexOf(e)+1}var g=function e(t){if(!t.ownerDocument)return"";let n="",o=t,r=t.ownerDocument,s=r.defaultView.frameElement;for(;o!==r;)n=`${o.tagName}[${h(o)}]/${n}`,o=o.parentNode;return s&&(n=`${e(s)},${n}`),n.replace(/\/$/,"")};var p=function({parseCss:e,CSSImportRule:t,absolutizeUrl:n,getCssFromCache:o,unfetchedToken:r}){return function s(a,c){let i,u="";try{const l=e(a);for(const e of Array.from(l.cssRules))if(e instanceof t){const t=n(e.href,c),a=o(t);if(void 0!==a){const{bundledCss:e,unfetchedResources:n}=s(a,t);n&&(i=new Set(n)),u=`${e}${u}`}else i=new Set([t]),u=`\n${r}${t}${r}`}}catch(e){console.log("error during getBundledCssFromCssText, styleBaseUrl="+c,e)}var l,f;return u=`${u}${l=a,f=c,`\n/** ${f} **/\n${l}`}`,{bundledCss:u,unfetchedResources:i}}};var y=function(e){var t=document.implementation.createHTMLDocument(""),n=t.createElement("style");return n.textContent=e,t.body.appendChild(n),n.sheet};var w=function(e,{fetchTimeLimit:t}={}){return async function(n){const o=new AbortController,r=[e(n,{cache:"force-cache",signal:o.signal}).then(e=>{if(e.ok)return e.text();console.log("/failed to fetch (status "+e.status+") css from: "+n+"/")}).catch(e=>{console.log("/failed to fetch (error "+e.toString()+") css from: "+n+"/")})];return Number.isNaN(Number(t))||r.push(new Promise(e=>setTimeout(e,t)).then(()=>o.abort())),Promise.race(r)}},C=function(e){const t=Array.from(e.attributes).find(e=>"href"===e.name.toLowerCase());return t&&t.value},E=function(e){if(e.nodeName&&"LINK"===e.nodeName.toUpperCase()&&e.attributes){const t=new Map(Array.from(e.attributes,e=>[e.name.toLowerCase(),e.value.toLowerCase()]));return"stylesheet"===t.get("rel")||"style"===t.get("as")&&["preload","prefetch"].includes(t.get("rel"))}return!1};var T=function(e){return e&&e.startsWith("data:")};var N=function({getCssFromCache:e,absolutizeUrl:t}){return function(n,o){let r,s,a;if(function(e){return e.nodeName&&"STYLE"===e.nodeName.toUpperCase()}(n))r=Array.from(n.childNodes).map(e=>e.nodeValue).join(""),s=o;else if(E(n)){const c=C(n);T(c)?(s=o,r=c.match(/,(.+)/)[1]):(s=t(c,o),r=e(s)),a=void 0===r}return{cssText:r,styleBaseUrl:s,isUnfetched:a}}};var b=function({extractCssFromNode:e,getBundledCssFromCssText:t,unfetchedToken:n}){return function(o,r){const{styleBaseUrl:s,cssText:a,isUnfetched:c}=e(o,r);let i,u="";if(a){const{bundledCss:e,unfetchedResources:n}=t(a,s);u+=e,i=new Set(n)}else c&&(u+=`${n}${s}${n}`,i=new Set([s]));return{bundledCss:u,unfetchedResources:i}}};const{absolutizeUrl:S,isInlineFrame:v}=u,{NODE_TYPES:A}=l;var D=function(e){return async function(t=document){const n={},o=Date.now(),r=[];return function t(n,o,r,s){function a(t){switch(s.push(async function(t,n,o){let r,s;E(t)&&(s=S(C(t),n),r=await e(s),void 0!==r&&(o[s]=r));r&&await async function t(n,o,r){try{const s=y(n),a=[];for(const n of Array.from(s.cssRules))n instanceof CSSImportRule&&a.push((async()=>{const s=S(n.href,o),a=await e(s);r[s]=a,void 0!==a&&await t(a,s,r)})());await Promise.all(a)}catch(e){console.log("error during fetchBundledCss, resourceUrl="+o,e)}}(r,s,o)}(t,o,r)),t.nodeType){case A.ELEMENT:return"IFRAME"===t.tagName.toUpperCase()?i(t):c(t)}}async function c(e){Array.prototype.map.call(e.childNodes,a)}async function i(e){if(c(e),e.contentDocument)try{const n=v(e)?e.baseURI:e.contentDocument.location.href;t(e.contentDocument,n,r,s)}catch(e){console.log(e)}}a(n.documentElement)}(t,t.location.href,n,r),await Promise.all(r),console.log("[prefetchAllCss]",Date.now()-o),function(e){return n[e]}}};const{absolutizeUrl:P,isInlineFrame:R}=u,{NODE_TYPES:U,DEFAULT_STYLE_PROPS:$,DEFAULT_RECT_PROPS:_,DEFAULT_IGNORED_TAG_NAMES:F}=l;var k=async function({doc:e=document,styleProps:t=$,rectProps:n=_,ignoredTagNames:o=F,addStats:r=!1,fetchTimeLimit:s=3e4}={}){arguments[1]&&(e=arguments[1]),arguments[2]&&(r=arguments[2]),arguments[3]&&(s=arguments[3]);const a={total:{},prefetchCss:{},doCaptureDoc:{},waitForImages:{}};function c(e){e.startTime=Date.now()}function i(e){e.endTime=Date.now(),e.elapsedTime=e.endTime-e.startTime}const u=[];c(a.total);const l=new Set,f=[],h="@@@@@",C="#####",E="-----";c(a.prefetchCss);const T=D(w(fetch,{fetchTimeLimit:s})),S=await T(e);i(a.prefetchCss);const v=p({parseCss:y,CSSImportRule:CSSImportRule,getCssFromCache:S,absolutizeUrl:P,unfetchedToken:C}),A=N({getCssFromCache:S,absolutizeUrl:P}),k=b({extractCssFromNode:A,getBundledCssFromCssText:v,unfetchedToken:C});c(a.doCaptureDoc);const O=z(e);i(a.doCaptureDoc),c(a.waitForImages),await Promise.all(u),i(a.waitForImages),O.version="1.3.0",O.scriptVersion="8.0.1";const I=f.length?f.join("\n")+"\n":"",L=l.size?Array.from(l).join("\n")+"\n":"",M=JSON.stringify({separator:E,cssStartToken:C,cssEndToken:C,iframeStartToken:'"'+h,iframeEndToken:h+'"'});function x(){return r?`\n${E}\n${JSON.stringify(a)}`:""}i(a.total);const B=`${M}\n${L}${E}\n${I}${E}\n${JSON.stringify(O)}${x()}`;return console.log("[captureFrame]",JSON.stringify(a)),B;function V(e){return Object.keys(e).length?e:void 0}function Y(e){return{tagName:"#text",text:e.textContent}}function z(e,r=e.location&&e.location.href){const s=new Set;let a="";const c=i(e.documentElement||e);return c.css=a,u.push(m({bgImages:s}).then(e=>c.images=e)),c;function i(e){const{bundledCss:t,unfetchedResources:n}=k(e,r);if(a+=t,n)for(const e of n)l.add(e);switch(e.nodeType){case U.TEXT:return Y(e);case U.ELEMENT:return"IFRAME"===e.tagName.toUpperCase()?function(e){const t=p(e);let n;try{n=e.contentDocument}catch(e){return o(),t}try{n?t.childNodes=[z(n,R(e)?e.baseURI:n.location.href)]:o()}catch(e){console.log("error in iframeToJSON",e)}return t;function o(){const n=g(e);f.push(n),t.childNodes=[`${h}${n}${h}`]}}(e):p(e);case U.DOCUMENT_FRAGMENT:return{childNodes:Array.prototype.map.call(e.childNodes,i).filter(Boolean)};default:return null}}function p(e){const a=Array.prototype.map.call(e.childNodes,i).filter(Boolean),c=e.shadowRoot&&z(e.shadowRoot,r),u=e.tagName.toUpperCase();if(o.indexOf(u)>-1)return null;const l=window.getComputedStyle(e),f=e.getBoundingClientRect(),m={};for(const e of t)m[e]=l.getPropertyValue(e);m["border-width"]||(m["border-width"]=`${l.getPropertyValue("border-top-width")} ${l.getPropertyValue("border-right-width")} ${l.getPropertyValue("border-bottom-width")} ${l.getPropertyValue("border-left-width")}`);const h={};for(const e of n)h[e]=f[e];const g=Array.from(e.attributes).map(e=>({key:e.name,value:e.value})).reduce((e,t)=>(e[t.key]=t.value,e),{}),p=d(l.getPropertyValue("background-image"));p&&s.add(p);const y={tagName:u,style:V(m),rect:V(h),attributes:V(g),childNodes:a};return c&&(y.shadowRoot=c),y}}};const{pollify:O}=u,{EYES_NAMESPACE:I,DOM_CAPTURE_KEY:L}=l;window[I]=window[I]||{};const M=O(k,window[I],L);return function(e){return JSON.stringify(M(e)(e))}}(); | ||
return captureDomAndPoll.apply(this, arguments); | ||
} |
@@ -1,2 +0,2 @@ | ||
/* @applitools/dom-capture@8.0.0 */ | ||
"use strict";function e(e,t=0){const n=e.charCodeAt(t);if(n>=55296&&n<56320){return 1024*(n-55296)+(e.charCodeAt(t+1)-56320)+65536}return 56320<=n&&n<=57343?-1:n}var t=function(t,n){const o=[];let r=0;for(let s=0;s<t.length;++s){const a=e(t,s);let c=0;a>0&&(c=a<128?1:a<2048?2:a<65536?3:a<2097152?4:a<67108864?5:6),r+c>n?(o.push(s),r=c):r+=c}return o};const n="WIP",o="SUCCESS",r="SUCCESS_CHUNKED",s="ERROR";var a=function(e,a,c={}){const u=function(e,{chunkByteLength:a=0}={}){if(e){if(e.value){if(a){if(!e.chunks){const n=JSON.stringify(e.value);e.chunks=t(n,a),e.chunks.length>0&&(e.from=0,e.value=n)}if(e.from>=0)return{status:r,value:e.value.substring(e.from,e.from=e.chunks.shift()),done:!e.from}}return{status:o,value:e.value}}return e.error?{status:s,error:e.error}:{status:n}}return{status:s,error:"unexpected poll request received - cannot find state of current operation"}}((e=e||{})[a],c);return(u.status===o||u.status===s||u.status===r&&u.done)&&(e[a]=null),u};var c=function(e,t){return new URL(e,t).href};var u=function(e){return!/^https?:.+/.test(e.src)||e.contentDocument&&e.contentDocument.location&&(["about:blank","about:srcdoc"].includes(e.contentDocument.location.href)||""===e.getAttribute("src")&&e.contentDocument.location.href===c(e.getAttribute("src"),e.ownerDocument.location.href))};var i={chunkify:t,pollify:function(e,t,n){return o=>function(){return t[n]||(t[n]={},e.apply(null,arguments).then(e=>t[n].value=e).catch(e=>t[n].error=e.message)),a(t,n,o)}},poll:a,absolutizeUrl:c,isInlineFrame:u,isAccessibleFrame:function(e){try{const t=e.contentDocument;return Boolean(t&&t.defaultView&&t.defaultView.frameElement)}catch(e){return!1}}};const l=/url\((?!['"]?:)['"]?([^'")]*)['"]?\)/;var f=function(e){const t=e?e.match(l):void 0;return t?t[1]:t};var d=async function({bgImages:e,timeout:t=5e3,Image:n=window.Image}){return(await Promise.all(Array.from(e).map(e=>{return Promise.race([new Promise(t=>{const o=new n;o.onload=()=>t({url:e,width:o.naturalWidth,height:o.naturalHeight}),o.onerror=()=>t(),o.src=e}),(o=t,new Promise(e=>{setTimeout(e,o)}))]);var o}))).reduce((e,t)=>(t&&(e[t.url]={width:t.width,height:t.height}),e),{})};function m(e){return Array.prototype.filter.call(e.parentNode.childNodes,t=>t.tagName===e.tagName).indexOf(e)+1}var h=function e(t){if(!t.ownerDocument)return"";let n="",o=t,r=t.ownerDocument,s=r.defaultView.frameElement;for(;o!==r;)n=`${o.tagName}[${m(o)}]/${n}`,o=o.parentNode;return s&&(n=`${e(s)},${n}`),n.replace(/\/$/,"")};var g=function({parseCss:e,CSSImportRule:t,absolutizeUrl:n,getCssFromCache:o,unfetchedToken:r}){return function s(a,c){let u,i="";try{const l=e(a);for(const e of Array.from(l.cssRules))if(e instanceof t){const t=n(e.href,c),a=o(t);if(void 0!==a){const{bundledCss:e,unfetchedResources:n}=s(a,t);n&&(u=new Set(n)),i=`${e}${i}`}else u=new Set([t]),i=`\n${r}${t}${r}`}}catch(e){console.log("error during getBundledCssFromCssText, styleBaseUrl="+c,e)}var l,f;return i=`${i}${l=a,f=c,`\n/** ${f} **/\n${l}`}`,{bundledCss:i,unfetchedResources:u}}};var p=function(e){var t=document.implementation.createHTMLDocument(""),n=t.createElement("style");return n.textContent=e,t.body.appendChild(n),n.sheet};var y=function(e,{fetchTimeLimit:t}={}){return async function(n){const o=new AbortController,r=[e(n,{cache:"force-cache",signal:o.signal}).then(e=>{if(e.ok)return e.text();console.log("/failed to fetch (status "+e.status+") css from: "+n+"/")}).catch(e=>{console.log("/failed to fetch (error "+e.toString()+") css from: "+n+"/")})];return Number.isNaN(Number(t))||r.push(new Promise(e=>setTimeout(e,t)).then(()=>o.abort())),Promise.race(r)}},C=function(e){const t=Array.from(e.attributes).find(e=>"href"===e.name.toLowerCase());return t&&t.value},w=function(e){if(e.nodeName&&"LINK"===e.nodeName.toUpperCase()&&e.attributes){const t=new Map(Array.from(e.attributes,e=>[e.name.toLowerCase(),e.value.toLowerCase()]));return"stylesheet"===t.get("rel")||"style"===t.get("as")&&["preload","prefetch"].includes(t.get("rel"))}return!1};var E=function(e){return e&&e.startsWith("data:")};var T=function({getCssFromCache:e,absolutizeUrl:t}){return function(n,o){let r,s,a;if(function(e){return e.nodeName&&"STYLE"===e.nodeName.toUpperCase()}(n))r=Array.from(n.childNodes).map(e=>e.nodeValue).join(""),s=o;else if(w(n)){const c=C(n);E(c)?(s=o,r=c.match(/,(.+)/)[1]):(s=t(c,o),r=e(s)),a=void 0===r}return{cssText:r,styleBaseUrl:s,isUnfetched:a}}};var N=function({extractCssFromNode:e,getBundledCssFromCssText:t,unfetchedToken:n}){return function(o,r){const{styleBaseUrl:s,cssText:a,isUnfetched:c}=e(o,r);let u,i="";if(a){const{bundledCss:e,unfetchedResources:n}=t(a,s);i+=e,u=new Set(n)}else c&&(i+=`${n}${s}${n}`,u=new Set([s]));return{bundledCss:i,unfetchedResources:u}}},b={EYES_NAMESPACE:"__EYES__APPLITOOLS__",DOM_CAPTURE_KEY:"domCaptureResult",NODE_TYPES:{ELEMENT:1,TEXT:3,DOCUMENT_FRAGMENT:11},DEFAULT_STYLE_PROPS:["background-repeat","background-origin","background-position","background-color","background-image","background-size","border-width","border-color","border-style","color","display","font-size","font-weight","line-height","margin","opacity","overflow","padding","visibility"],DEFAULT_RECT_PROPS:["width","height","top","left"],DEFAULT_IGNORED_TAG_NAMES:["HEAD","SCRIPT"]};const{absolutizeUrl:S,isInlineFrame:v}=i,{NODE_TYPES:A}=b;var D=function(e){return async function(t=document){const n={},o=Date.now(),r=[];return function t(n,o,r,s){function a(t){switch(s.push(async function(t,n,o){let r,s;w(t)&&(s=S(C(t),n),r=await e(s),void 0!==r&&(o[s]=r));r&&await async function t(n,o,r){try{const s=p(n),a=[];for(const n of Array.from(s.cssRules))n instanceof CSSImportRule&&a.push((async()=>{const s=S(n.href,o),a=await e(s);r[s]=a,void 0!==a&&await t(a,s,r)})());await Promise.all(a)}catch(e){console.log("error during fetchBundledCss, resourceUrl="+o,e)}}(r,s,o)}(t,o,r)),t.nodeType){case A.ELEMENT:return"IFRAME"===t.tagName.toUpperCase()?u(t):c(t)}}async function c(e){Array.prototype.map.call(e.childNodes,a)}async function u(e){if(c(e),e.contentDocument)try{const n=v(e)?e.baseURI:e.contentDocument.location.href;t(e.contentDocument,n,r,s)}catch(e){console.log(e)}}a(n.documentElement)}(t,t.location.href,n,r),await Promise.all(r),console.log("[prefetchAllCss]",Date.now()-o),function(e){return n[e]}}};const{absolutizeUrl:R,isInlineFrame:P}=i,{NODE_TYPES:$,DEFAULT_STYLE_PROPS:U,DEFAULT_RECT_PROPS:_,DEFAULT_IGNORED_TAG_NAMES:F}=b;var k=async function({doc:e=document,styleProps:t=U,rectProps:n=_,ignoredTagNames:o=F,addStats:r=!1,fetchTimeLimit:s=3e4}={}){arguments[1]&&(e=arguments[1]),arguments[2]&&(r=arguments[2]),arguments[3]&&(s=arguments[3]);const a={total:{},prefetchCss:{},doCaptureDoc:{},waitForImages:{}};function c(e){e.startTime=Date.now()}function u(e){e.endTime=Date.now(),e.elapsedTime=e.endTime-e.startTime}const i=[];c(a.total);const l=new Set,m=[],C="@@@@@",w="#####",E="-----";c(a.prefetchCss);const b=D(y(fetch,{fetchTimeLimit:s})),S=await b(e);u(a.prefetchCss);const v=g({parseCss:p,CSSImportRule:CSSImportRule,getCssFromCache:S,absolutizeUrl:R,unfetchedToken:w}),A=T({getCssFromCache:S,absolutizeUrl:R}),k=N({extractCssFromNode:A,getBundledCssFromCssText:v,unfetchedToken:w});c(a.doCaptureDoc);const I=Y(e);u(a.doCaptureDoc),c(a.waitForImages),await Promise.all(i),u(a.waitForImages),I.version="1.3.0",I.scriptVersion="8.0.0";const L=m.length?m.join("\n")+"\n":"",O=l.size?Array.from(l).join("\n")+"\n":"",x=JSON.stringify({separator:E,cssStartToken:w,cssEndToken:w,iframeStartToken:'"'+C,iframeEndToken:C+'"'});function M(){return r?`\n${E}\n${JSON.stringify(a)}`:""}u(a.total);const B=`${x}\n${O}${E}\n${L}${E}\n${JSON.stringify(I)}${M()}`;return console.log("[captureFrame]",JSON.stringify(a)),B;function V(e){return Object.keys(e).length?e:void 0}function z(e){return{tagName:"#text",text:e.textContent}}function Y(e,r=e.location&&e.location.href){const s=new Set;let a="";const c=u(e.documentElement||e);return c.css=a,i.push(d({bgImages:s}).then(e=>c.images=e)),c;function u(e){const{bundledCss:t,unfetchedResources:n}=k(e,r);if(a+=t,n)for(const e of n)l.add(e);switch(e.nodeType){case $.TEXT:return z(e);case $.ELEMENT:return"IFRAME"===e.tagName.toUpperCase()?function(e){const t=g(e);let n;try{n=e.contentDocument}catch(e){return o(),t}try{n?t.childNodes=[Y(n,P(e)?e.baseURI:n.location.href)]:o()}catch(e){console.log("error in iframeToJSON",e)}return t;function o(){const n=h(e);m.push(n),t.childNodes=[`${C}${n}${C}`]}}(e):g(e);case $.DOCUMENT_FRAGMENT:return{childNodes:Array.prototype.map.call(e.childNodes,u).filter(Boolean)};default:return null}}function g(e){const a=Array.prototype.map.call(e.childNodes,u).filter(Boolean),c=e.shadowRoot&&Y(e.shadowRoot,r),i=e.tagName.toUpperCase();if(o.indexOf(i)>-1)return null;const l=window.getComputedStyle(e),d=e.getBoundingClientRect(),m={};for(const e of t)m[e]=l.getPropertyValue(e);m["border-width"]||(m["border-width"]=`${l.getPropertyValue("border-top-width")} ${l.getPropertyValue("border-right-width")} ${l.getPropertyValue("border-bottom-width")} ${l.getPropertyValue("border-left-width")}`);const h={};for(const e of n)h[e]=d[e];const g=Array.from(e.attributes).map(e=>({key:e.name,value:e.value})).reduce((e,t)=>(e[t.key]=t.value,e),{}),p=f(l.getPropertyValue("background-image"));p&&s.add(p);const y={tagName:i,style:V(m),rect:V(h),attributes:V(g),childNodes:a};return c&&(y.shadowRoot=c),y}}};module.exports=k; | ||
/* @applitools/dom-capture@8.0.1 */ | ||
"use strict";function e(e,t=0){const n=e.charCodeAt(t);if(n>=55296&&n<56320){return 1024*(n-55296)+(e.charCodeAt(t+1)-56320)+65536}return 56320<=n&&n<=57343?-1:n}var t=function(t,n){const o=[];let r=0;for(let s=0;s<t.length;++s){const a=e(t,s);let c=0;a>0&&(c=a<128?1:a<2048?2:a<65536?3:a<2097152?4:a<67108864?5:6),r+c>n?(o.push(s),r=c):r+=c}return o};const n="WIP",o="SUCCESS",r="SUCCESS_CHUNKED",s="ERROR";var a=function(e,a,c={}){const u=function(e,{chunkByteLength:a=0}={}){if(e){if(e.value){if(a){if(!e.chunks){const n=JSON.stringify(e.value);e.chunks=t(n,a),e.chunks.length>0&&(e.from=0,e.value=n)}if(e.from>=0)return{status:r,value:e.value.substring(e.from,e.from=e.chunks.shift()),done:!e.from}}return{status:o,value:e.value}}return e.error?{status:s,error:e.error}:{status:n}}return{status:s,error:"unexpected poll request received - cannot find state of current operation"}}((e=e||{})[a],c);return(u.status===o||u.status===s||u.status===r&&u.done)&&(e[a]=null),u};var c=function(e,t){return new URL(e,t).href};var u=function(e){return!/^https?:.+/.test(e.src)||e.contentDocument&&e.contentDocument.location&&(["about:blank","about:srcdoc"].includes(e.contentDocument.location.href)||""===e.getAttribute("src")&&e.contentDocument.location.href===c(e.getAttribute("src"),e.ownerDocument.location.href))};var i={chunkify:t,pollify:function(e,t,n){return o=>function(){return t[n]||(t[n]={},e.apply(null,arguments).then(e=>t[n].value=e).catch(e=>t[n].error=e.message)),a(t,n,o)}},poll:a,absolutizeUrl:c,isInlineFrame:u,isAccessibleFrame:function(e){try{const t=e.contentDocument;return Boolean(t&&t.defaultView&&t.defaultView.frameElement)}catch(e){return!1}}};const l=/url\((?!['"]?:)['"]?([^'")]*)['"]?\)/;var f=function(e){const t=e?e.match(l):void 0;return t?t[1]:t};var d=async function({bgImages:e,timeout:t=5e3,Image:n=window.Image}){return(await Promise.all(Array.from(e).map(e=>{return Promise.race([new Promise(t=>{const o=new n;o.onload=()=>t({url:e,width:o.naturalWidth,height:o.naturalHeight}),o.onerror=()=>t(),o.src=e}),(o=t,new Promise(e=>{setTimeout(e,o)}))]);var o}))).reduce((e,t)=>(t&&(e[t.url]={width:t.width,height:t.height}),e),{})};function m(e){return Array.prototype.filter.call(e.parentNode.childNodes,t=>t.tagName===e.tagName).indexOf(e)+1}var h=function e(t){if(!t.ownerDocument)return"";let n="",o=t,r=t.ownerDocument,s=r.defaultView.frameElement;for(;o!==r;)n=`${o.tagName}[${m(o)}]/${n}`,o=o.parentNode;return s&&(n=`${e(s)},${n}`),n.replace(/\/$/,"")};var g=function({parseCss:e,CSSImportRule:t,absolutizeUrl:n,getCssFromCache:o,unfetchedToken:r}){return function s(a,c){let u,i="";try{const l=e(a);for(const e of Array.from(l.cssRules))if(e instanceof t){const t=n(e.href,c),a=o(t);if(void 0!==a){const{bundledCss:e,unfetchedResources:n}=s(a,t);n&&(u=new Set(n)),i=`${e}${i}`}else u=new Set([t]),i=`\n${r}${t}${r}`}}catch(e){console.log("error during getBundledCssFromCssText, styleBaseUrl="+c,e)}var l,f;return i=`${i}${l=a,f=c,`\n/** ${f} **/\n${l}`}`,{bundledCss:i,unfetchedResources:u}}};var p=function(e){var t=document.implementation.createHTMLDocument(""),n=t.createElement("style");return n.textContent=e,t.body.appendChild(n),n.sheet};var y=function(e,{fetchTimeLimit:t}={}){return async function(n){const o=new AbortController,r=[e(n,{cache:"force-cache",signal:o.signal}).then(e=>{if(e.ok)return e.text();console.log("/failed to fetch (status "+e.status+") css from: "+n+"/")}).catch(e=>{console.log("/failed to fetch (error "+e.toString()+") css from: "+n+"/")})];return Number.isNaN(Number(t))||r.push(new Promise(e=>setTimeout(e,t)).then(()=>o.abort())),Promise.race(r)}},C=function(e){const t=Array.from(e.attributes).find(e=>"href"===e.name.toLowerCase());return t&&t.value},w=function(e){if(e.nodeName&&"LINK"===e.nodeName.toUpperCase()&&e.attributes){const t=new Map(Array.from(e.attributes,e=>[e.name.toLowerCase(),e.value.toLowerCase()]));return"stylesheet"===t.get("rel")||"style"===t.get("as")&&["preload","prefetch"].includes(t.get("rel"))}return!1};var E=function(e){return e&&e.startsWith("data:")};var T=function({getCssFromCache:e,absolutizeUrl:t}){return function(n,o){let r,s,a;if(function(e){return e.nodeName&&"STYLE"===e.nodeName.toUpperCase()}(n))r=Array.from(n.childNodes).map(e=>e.nodeValue).join(""),s=o;else if(w(n)){const c=C(n);E(c)?(s=o,r=c.match(/,(.+)/)[1]):(s=t(c,o),r=e(s)),a=void 0===r}return{cssText:r,styleBaseUrl:s,isUnfetched:a}}};var N=function({extractCssFromNode:e,getBundledCssFromCssText:t,unfetchedToken:n}){return function(o,r){const{styleBaseUrl:s,cssText:a,isUnfetched:c}=e(o,r);let u,i="";if(a){const{bundledCss:e,unfetchedResources:n}=t(a,s);i+=e,u=new Set(n)}else c&&(i+=`${n}${s}${n}`,u=new Set([s]));return{bundledCss:i,unfetchedResources:u}}},b={EYES_NAMESPACE:"__EYES__APPLITOOLS__",DOM_CAPTURE_KEY:"domCaptureResult",NODE_TYPES:{ELEMENT:1,TEXT:3,DOCUMENT_FRAGMENT:11},DEFAULT_STYLE_PROPS:["background-repeat","background-origin","background-position","background-color","background-image","background-size","border-width","border-color","border-style","color","display","font-size","font-weight","line-height","margin","opacity","overflow","padding","visibility"],DEFAULT_RECT_PROPS:["width","height","top","left"],DEFAULT_IGNORED_TAG_NAMES:["HEAD","SCRIPT"]};const{absolutizeUrl:S,isInlineFrame:v}=i,{NODE_TYPES:A}=b;var D=function(e){return async function(t=document){const n={},o=Date.now(),r=[];return function t(n,o,r,s){function a(t){switch(s.push(async function(t,n,o){let r,s;w(t)&&(s=S(C(t),n),r=await e(s),void 0!==r&&(o[s]=r));r&&await async function t(n,o,r){try{const s=p(n),a=[];for(const n of Array.from(s.cssRules))n instanceof CSSImportRule&&a.push((async()=>{const s=S(n.href,o),a=await e(s);r[s]=a,void 0!==a&&await t(a,s,r)})());await Promise.all(a)}catch(e){console.log("error during fetchBundledCss, resourceUrl="+o,e)}}(r,s,o)}(t,o,r)),t.nodeType){case A.ELEMENT:return"IFRAME"===t.tagName.toUpperCase()?u(t):c(t)}}async function c(e){Array.prototype.map.call(e.childNodes,a)}async function u(e){if(c(e),e.contentDocument)try{const n=v(e)?e.baseURI:e.contentDocument.location.href;t(e.contentDocument,n,r,s)}catch(e){console.log(e)}}a(n.documentElement)}(t,t.location.href,n,r),await Promise.all(r),console.log("[prefetchAllCss]",Date.now()-o),function(e){return n[e]}}};const{absolutizeUrl:R,isInlineFrame:P}=i,{NODE_TYPES:$,DEFAULT_STYLE_PROPS:U,DEFAULT_RECT_PROPS:_,DEFAULT_IGNORED_TAG_NAMES:F}=b;var k=async function({doc:e=document,styleProps:t=U,rectProps:n=_,ignoredTagNames:o=F,addStats:r=!1,fetchTimeLimit:s=3e4}={}){arguments[1]&&(e=arguments[1]),arguments[2]&&(r=arguments[2]),arguments[3]&&(s=arguments[3]);const a={total:{},prefetchCss:{},doCaptureDoc:{},waitForImages:{}};function c(e){e.startTime=Date.now()}function u(e){e.endTime=Date.now(),e.elapsedTime=e.endTime-e.startTime}const i=[];c(a.total);const l=new Set,m=[],C="@@@@@",w="#####",E="-----";c(a.prefetchCss);const b=D(y(fetch,{fetchTimeLimit:s})),S=await b(e);u(a.prefetchCss);const v=g({parseCss:p,CSSImportRule:CSSImportRule,getCssFromCache:S,absolutizeUrl:R,unfetchedToken:w}),A=T({getCssFromCache:S,absolutizeUrl:R}),k=N({extractCssFromNode:A,getBundledCssFromCssText:v,unfetchedToken:w});c(a.doCaptureDoc);const I=Y(e);u(a.doCaptureDoc),c(a.waitForImages),await Promise.all(i),u(a.waitForImages),I.version="1.3.0",I.scriptVersion="8.0.1";const L=m.length?m.join("\n")+"\n":"",O=l.size?Array.from(l).join("\n")+"\n":"",x=JSON.stringify({separator:E,cssStartToken:w,cssEndToken:w,iframeStartToken:'"'+C,iframeEndToken:C+'"'});function M(){return r?`\n${E}\n${JSON.stringify(a)}`:""}u(a.total);const B=`${x}\n${O}${E}\n${L}${E}\n${JSON.stringify(I)}${M()}`;return console.log("[captureFrame]",JSON.stringify(a)),B;function V(e){return Object.keys(e).length?e:void 0}function z(e){return{tagName:"#text",text:e.textContent}}function Y(e,r=e.location&&e.location.href){const s=new Set;let a="";const c=u(e.documentElement||e);return c.css=a,i.push(d({bgImages:s}).then(e=>c.images=e)),c;function u(e){const{bundledCss:t,unfetchedResources:n}=k(e,r);if(a+=t,n)for(const e of n)l.add(e);switch(e.nodeType){case $.TEXT:return z(e);case $.ELEMENT:return"IFRAME"===e.tagName.toUpperCase()?function(e){const t=g(e);let n;try{n=e.contentDocument}catch(e){return o(),t}try{n?t.childNodes=[Y(n,P(e)?e.baseURI:n.location.href)]:o()}catch(e){console.log("error in iframeToJSON",e)}return t;function o(){const n=h(e);m.push(n),t.childNodes=[`${C}${n}${C}`]}}(e):g(e);case $.DOCUMENT_FRAGMENT:return{childNodes:Array.prototype.map.call(e.childNodes,u).filter(Boolean)};default:return null}}function g(e){const a=Array.prototype.map.call(e.childNodes,u).filter(Boolean),c=e.shadowRoot&&Y(e.shadowRoot,r),i=e.tagName.toUpperCase();if(o.indexOf(i)>-1)return null;const l=window.getComputedStyle(e),d=e.getBoundingClientRect(),m={};for(const e of t)m[e]=l.getPropertyValue(e);m["border-width"]||(m["border-width"]=`${l.getPropertyValue("border-top-width")} ${l.getPropertyValue("border-right-width")} ${l.getPropertyValue("border-bottom-width")} ${l.getPropertyValue("border-left-width")}`);const h={};for(const e of n)h[e]=d[e];const g=Array.from(e.attributes).map(e=>({key:e.name,value:e.value})).reduce((e,t)=>(e[t.key]=t.value,e),{}),p=f(l.getPropertyValue("background-image"));p&&s.add(p);const y={tagName:i,style:V(m),rect:V(h),attributes:V(g),childNodes:a};return c&&(y.shadowRoot=c),y}}};module.exports=k; |
@@ -1,2 +0,2 @@ | ||
/* @applitools/dom-capture@8.0.0 */ | ||
/* @applitools/dom-capture@8.0.1 */ | ||
@@ -3,0 +3,0 @@ function __pollResult() { |
{ | ||
"name": "@applitools/dom-capture", | ||
"version": "8.0.0", | ||
"version": "8.0.1", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "license": "SEE LICENSE IN LICENSE", |
@@ -20,5 +20,5 @@ # dom-capture | ||
```js | ||
const {getCaptureDomScript} = require('@applitools/dom-capture'); | ||
const captureDomScript = await getCaptureDomScript(); | ||
const returnValue = await page.evaluate(`(${captureDomScript})()`); // puppeteer | ||
const {getCaptureDom} = require('@applitools/dom-capture'); | ||
const captureDom = await getCaptureDom(); | ||
const returnValue = await page.evaluate(`(${captureDom})()`); // puppeteer | ||
``` | ||
@@ -44,7 +44,22 @@ | ||
This script receives information about what should be captured, and a document from which to capture the information. The first argument is an object with the following properties: `{styleProps, rectProps, ignoredTagNames}`: | ||
This script receives information about what should be captured, and a document from which to capture the information. | ||
Here are the available arguments with their defaults (values can be found in `src/browser/constants.js`): | ||
```js | ||
captureFrame({ | ||
doc = document, | ||
styleProps = DEFAULT_STYLE_PROPS, | ||
rectProps = DEFAULT_RECT_PROPS, | ||
ignoredTagNames = DEFAULT_IGNORED_TAG_NAMES, | ||
addStats = false, | ||
fetchTimeLimit = 30000, | ||
} | ||
``` | ||
- `styleProps` - an array containing the css properties that should be captured for computed style. E.g. `['background']`. | ||
- `rectProps` - an array containing the bounding client rect properties that should be captured. E.g. `['top', 'left']`. | ||
- `ignoredTagNames` - an array containing tag names that should not be captured. E.g. `['head']`. | ||
- `addStats` | ||
- `fetchTimeLimit` | ||
@@ -51,0 +66,0 @@ The script returns an object representing the DOM in hierarchical structure (as opposed to the flat structure of CDT), with computed style and bounding client rect information for each element. |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
164
5
479918
14
1777