allure-cypress 3.3.3 → 3.4.0
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/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +3 -3
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +3 -3
- package/package.json +6 -6
package/dist/esm/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var c=function(t){return t.FAILED="failed",t.BROKEN="broken",t.PASSED="passed",t.SKIPPED="skipped",t}({}),_e=[c.FAILED,c.BROKEN,c.PASSED,c.SKIPPED],Me=function(t){return t.SCHEDULED="scheduled",t.RUNNING="running",t.FINISHED="finished",t.PENDING="pending",t.INTERRUPTED="interrupted",t}({}),l=function(t){return t.ALLURE_ID="ALLURE_ID",t.AS_ID="ALLURE_ID",t.SUITE="suite",t.PARENT_SUITE="parentSuite",t.SUB_SUITE="subSuite",t.EPIC="epic",t.FEATURE="feature",t.STORY="story",t.SEVERITY="severity",t.TAG="tag",t.OWNER="owner",t.LEAD="lead",t.HOST="host",t.THREAD="thread",t.TEST_METHOD="testMethod",t.TEST_CLASS="testClass",t.PACKAGE="package",t.FRAMEWORK="framework",t.LANGUAGE="language",t.LAYER="layer",t}({}),ke=function(t){return t.BLOCKER="blocker",t.CRITICAL="critical",t.NORMAL="normal",t.MINOR="minor",t.TRIVIAL="trivial",t}({}),z=function(t){return t.TEXT="text/plain",t.XML="application/xml",t.HTML="text/html",t.CSV="text/csv",t.TSV="text/tab-separated-values",t.CSS="text/css",t.URI="text/uri-list",t.SVG="image/svg+xml",t.PNG="image/png",t.JSON="application/json",t.ZIP="application/zip",t.WEBM="video/webm",t.JPEG="image/jpeg",t.MP4="video/mp4",t.IMAGEDIFF="application/vnd.allure.image.diff",t}({}),k=function(t){return t.DEFAULT="link",t.ISSUE="issue",t.TMS="tms",t}({});function B(){B=function(o,a){return new r(o,void 0,a)};var t=RegExp.prototype,e=new WeakMap;function r(n,o,a){var p=RegExp(n,o);return e.set(p,a||e.get(n)),w(p,r.prototype)}function s(n,o){var a=e.get(o);return Object.keys(a).reduce(function(p,i){var g=a[i];if(typeof g=="number")p[i]=n[g];else{for(var h=0;n[g[h]]===void 0&&h+1<g.length;)h++;p[i]=n[g[h]]}return p},Object.create(null))}return we(r,RegExp),r.prototype.exec=function(n){var o=t.exec.call(this,n);if(o){o.groups=s(o,this);var a=o.indices;a&&(a.groups=s(a,this))}return o},r.prototype[Symbol.replace]=function(n,o){if(typeof o=="string"){var a=e.get(this);return t[Symbol.replace].call(this,n,o.replace(/\$<([^>]+)(>|$)/g,function(i,g,h){if(h==="")return i;var v=a[g];return Array.isArray(v)?"$"+v.join("$"):typeof v=="number"?"$"+v:""}))}if(typeof o=="function"){var p=this;return t[Symbol.replace].call(this,n,function(){var i=arguments;return typeof i[i.length-1]!="object"&&(i=[].slice.call(i)).push(s(i,p)),o.apply(this,i)})}return t[Symbol.replace].call(this,n,o)},B.apply(this,arguments)}function we(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&w(t,e)}function w(t,e){return w=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},w(t,e)}function vt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,s)}return r}function K(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?vt(Object(r),!0).forEach(function(s){Le(t,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):vt(Object(r)).forEach(function(s){Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(r,s))})}return t}function Le(t,e,r){return(e=Fe(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Fe(t){var e=Ie(t,"string");return typeof e=="symbol"?e:e+""}function Ie(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var s=r.call(t,e||"default");if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var x=t=>{switch(!0){case/assert/gi.test(t.constructor.name):case/expectation/gi.test(t.constructor.name):case(t.name&&/assert/gi.test(t.name)):case(t.message&&/assert/gi.test(t.message)):case(t.stack&&/@vitest\/expect/gi.test(t.stack)):case(t.stack&&/playwright\/lib\/matchers\/expect\.js/gi.test(t.stack)):case"matcherResult"in t:case("inspect"in t&&typeof t.inspect=="function"):return c.FAILED;default:return c.BROKEN}},Oe=function(){var{onlyFirst:e=!1}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(r,e?void 0:"g")},W=t=>{var e=Oe();return t.replace(e,"")},je=t=>{if(!t||typeof t!="object")return{};if("matcherResult"in t&&t.matcherResult!==void 0&&typeof t.matcherResult=="object")return{actual:C(t.matcherResult.actual),expected:C(t.matcherResult.expected)};var e="actual"in t&&t.actual!==void 0?{actual:C(t.actual)}:{},r="expected"in t&&t.expected!==void 0?{expected:C(t.expected)}:{};return K(K({},e),r)},S=t=>{var{message:e,stack:r}=t;return K({message:e?W(e):void 0,trace:r?W(r):void 0},je(t))};var He=B(/(?:^|\s)@?allure\.([^:=\s]+)[:=]("[^"]+"|'[^']+'|`[^`]+`|\S+)/,{type:1}),xt=new RegExp(He,"g");var Ne=t=>t?.[1],Ue=t=>{var e,r=/['"`]/,s=new RegExp("^".concat(r.source)),n=new RegExp("".concat(r.source,"$")),o=(e=t?.[2])!==null&&e!==void 0?e:"";return s.test(o)&&n.test(o)?o.slice(1,-1):o};var $=t=>{var e=[],r=[],s=t.matchAll(xt),n=t.replaceAll(xt,"").split(" ").filter(Boolean).reduce((v,G)=>/^[\n\r]/.test(G)?v+G:"".concat(v," ").concat(G),"").trim();for(var o of s){var a=o,p=Ne(a),i=Ue(a);if(!(!p||!i)){var[g,h]=p.split(".");switch(g){case"id":e.push({name:l.ALLURE_ID,value:i});break;case"label":e.push({name:h,value:i});break;case"link":r.push({type:h,url:i});break}}}return{labels:e,links:r,cleanTitle:n}};var P=t=>!!t&&(typeof t=="object"||typeof t=="function")&&typeof t.then=="function",C=function(e){var{maxDepth:r=0,maxLength:s=0,replacer:n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return We(typeof e=="object"?JSON.stringify(e,Ge(r,n)):String(e),s)},Ge=(t,e)=>{var r=[],s=function(o,a){if(typeof a!="object"||a===null)return a;for(;r.length>0&&!Object.is(r.at(-1),this);)r.pop();if(!(t&&r.length>=t||r.includes(a)))return r.push(a),a instanceof Map?Be(r,a):a instanceof Set?Ke(r,a):a};return e?ze(e,s):s},ze=(t,e)=>function(r,s){return e.call(this,r,t.call(this,r,s))},Be=(t,e)=>Array.from(e).filter(r=>{var[s]=r;return!t.includes(s)}).map(r=>{var[s,n]=r;return[s,t.includes(n)?void 0:n]}),Ke=(t,e)=>Array.from(e).map(r=>t.includes(r)?void 0:r),We=(t,e)=>e&&t.length>e?"".concat(t.substring(0,e),"..."):t;function Tt(t,e,r,s,n,o,a){try{var p=t[o](a),i=p.value}catch(g){return void r(g)}p.done?e(i):Promise.resolve(i).then(s,n)}function f(t){return function(){var e=this,r=arguments;return new Promise(function(s,n){var o=t.apply(e,r);function a(i){Tt(o,s,n,a,p,"next",i)}function p(i){Tt(o,s,n,a,p,"throw",i)}a(void 0)})}}var V=class{attachment(){var e=this;return f(function*(){yield e.warning()})()}attachmentFromPath(){var e=this;return f(function*(){yield e.warning()})()}description(){var e=this;return f(function*(){yield e.warning()})()}descriptionHtml(){var e=this;return f(function*(){yield e.warning()})()}displayName(){var e=this;return f(function*(){yield e.warning()})()}historyId(){var e=this;return f(function*(){yield e.warning()})()}labels(){var e=this;return f(function*(){yield e.warning()})()}links(){var e=this;return f(function*(){yield e.warning()})()}parameter(){var e=this;return f(function*(){yield e.warning()})()}logStep(){var e=this;return f(function*(){yield e.warning()})()}step(e,r){var s=this;return f(function*(){return yield s.warning(),r()})()}stepDisplayName(){var e=this;return f(function*(){yield e.warning()})()}stepParameter(){var e=this;return f(function*(){yield e.warning()})()}testCaseId(){var e=this;return f(function*(){yield e.warning()})()}warning(){return f(function*(){console.log("no test runtime is found. Please check test framework configuration")})()}},E=new V;var Ct="allureTestRuntime",Y=t=>{globalThis[Ct]=()=>t},q=()=>globalThis?.[Ct],J=()=>{var t=q();if(t){var e;return(e=t())!==null&&e!==void 0?e:E}return E},Z=()=>{var t=q();if(t){var e;return(e=t())!==null&&e!==void 0?e:E}try{return(0,eval)("(() => import('allure-playwright/autoconfig'))()").then(()=>{var r,s;return(r=(s=q())===null||s===void 0?void 0:s())!==null&&r!==void 0?r:E})}catch{}return E};var m=function(e){for(var r=arguments.length,s=new Array(r>1?r-1:0),n=1;n<r;n++)s[n-1]=arguments[n];var o=Z();return P(o)?o.then(a=>a[e](...s)):o[e](...s)},y=(t,e)=>m("labels",{name:t,value:e}),$e=function(){for(var e=arguments.length,r=new Array(e),s=0;s<e;s++)r[s]=arguments[s];return m("labels",...r)},X=(t,e,r)=>m("links",{url:t,type:r,name:e}),Ve=function(){for(var e=arguments.length,r=new Array(e),s=0;s<e;s++)r[s]=arguments[s];return m("links",...r)},qe=(t,e,r)=>m("parameter",t,e,r),Ye=t=>m("description",t),Je=t=>m("descriptionHtml",t),Ze=t=>m("displayName",t),Xe=t=>m("historyId",t),Qe=t=>m("testCaseId",t),tr=(t,e,r)=>{var s=typeof r=="string"?{contentType:r}:r;return m("attachment",t,e,s)},er=(t,e)=>m("attachmentFromPath",t,e,{contentType:"application/vnd.allure.playwright-trace"}),rr=(t,e,r)=>{var s=typeof r=="string"?{contentType:r}:r;return m("attachmentFromPath",t,e,s)},sr=()=>({displayName:t=>m("stepDisplayName",t),parameter:(t,e,r)=>m("stepParameter",t,e,r)}),nr=(t,e,r)=>m("logStep",t,e,r),or=(t,e)=>m("step",t,()=>e(sr())),ar=(t,e)=>X(t,e,k.ISSUE),ir=(t,e)=>X(t,e,k.TMS),pr=t=>y(l.ALLURE_ID,t),ur=t=>y(l.EPIC,t),cr=t=>y(l.FEATURE,t),lr=t=>y(l.STORY,t),mr=t=>y(l.SUITE,t),dr=t=>y(l.PARENT_SUITE,t),fr=t=>y(l.SUB_SUITE,t),gr=t=>y(l.OWNER,t),yr=t=>y(l.SEVERITY,t),hr=t=>y(l.LAYER,t),Sr=t=>y(l.TAG,t),vr=function(){for(var e=arguments.length,r=new Array(e),s=0;s<e;s++)r[s]=arguments[s];return m("labels",...r.map(n=>({name:l.TAG,value:n})))};var Et={stepsFromCommands:{maxArgumentLength:128,maxArgumentDepth:3}},At=(t,e)=>{let r=t.findIndex(e);return r!==-1?Q(t.splice(r)):[]},Q=t=>{let e=t.length,r=new Array(e);for(let s=0;s<e;s++)r[e-s-1]=t[s];return r},bt=t=>t[t.length-1],Pt=t=>typeof t<"u";var d=()=>{let t=Cypress.env("allure");return t||(t={config:Et,initialized:!1,messages:[],testPlan:void 0,currentTest:void 0,projectDir:void 0,stepStack:[],stepsToFinalize:[],nextApiStepId:0},Cypress.env("allure",t)),t},Dt=()=>d().initialized,Rt=()=>{d().initialized=!0},tt=()=>d().messages,_t=t=>{d().messages=t},u=t=>{tt().push(t)},Mt=()=>d().testPlan,kt=()=>d().projectDir,wt=()=>d().currentTest,Lt=t=>{d().currentTest=t},Ft=()=>{d().currentTest=void 0},It=()=>d().config,T=()=>d().stepStack,Ot=()=>bt(T()),L=t=>T().push(t);var Tr=t=>Q(T().splice(t)),jt=()=>Tr(0);var F=(t,e)=>d().stepsToFinalize.push([t,e]),Ht=()=>d().stepsToFinalize,Nt=()=>{let t=d();t.stepsToFinalize=[]};var Ut=(t,e)=>{let r=Mt();if(r){let s=Gt(t);for(let n of Cr(e)){let o=Er(r,t,s,n.tests);Ar(n.tests,o)}}},Cr=function*(t){let e=[];for(let r=t;r;r=e.pop()){yield r;for(let s=r.suites.length-1;s>=0;s--)e.push(r.suites[s])}},Er=(t,e,r,s)=>{let n=[];return s.forEach((o,a)=>{let{fullNameSuffix:p,labels:i}=et(o),g=`${r}#${p}`,h=i.find(({name:v})=>v===l.ALLURE_ID)?.value;br(t,g,h)||n.push(a)}),n},Ar=(t,e)=>{for(let r=e.length-1;r>=0;r--)t.splice(e[r],1)},br=(t,e,r)=>t.tests.some(s=>r&&s.id?.toString()===r||s.selector===e);var I="__allure_report_system_hook__",zt=()=>{Cypress.mocha.getRunner().on("start",Pr).on("suite",Dr).on("suite end",qt).on("hook",Rr).on("hook end",_r).on("test",Mr).on("pass",Yt).on("fail",kr).on("pending",Jt).on("test end",at)},Bt=()=>{afterEach(I,it),after(I,wr)},Pr=()=>{Wt(),$t()},Dr=t=>{t.root&&Ut(Cypress.spec,t),Vt(t)},Rr=t=>{A(t)||rt(t)},_r=t=>{A(t)||O(t)},Mr=t=>{D(t)||st(t)},kr=(t,e)=>{let r="hookName"in t;if(r&&Kt(t))return;r&&A(t)&&rt(t,Date.now()-(t.duration??0)),nt(e),r&&ot(t,e)},wr=function(){it(),b(this)};var Zt=Cypress.platform==="win32",Xt=t=>t.substring(t.lastIndexOf(Zt?"\\":"/")+1),Gt=t=>{let e=kt(),r=e?t.absolute.substring(e.length+1):t.relative;return Zt?r.replaceAll("\\","/"):r},Qt=t=>Array.isArray(t)||t.buffer?btoa(String.fromCharCode.apply(null,t)):t,pt=t=>({...et(t),start:typeof t.wallClockStartedAt=="string"?Date.parse(t.wallClockStartedAt):t.wallClockStartedAt?.getTime?.()||Date.now()}),te=t=>({duration:t.duration??0,retries:t._retries??0}),ut=()=>({statusDetails:{message:"This is a pending test"}}),ee=(t,e,r)=>{let s={id:t.id,stop:Date.now(),status:e??ue(t)};return r&&(s.statusDetails=r),s},re=Symbol("The test has been reported to Allure"),ct=t=>{t[re]=!0},D=t=>t[re]===!0,Lr=function*(t){let e=[];for(let r=t;r;r=e.pop()){yield r;for(let s=r.suites.length-1;s>=0;s--)e.push(r.suites[s])}},se=function*(t){for(let e of Lr(t))yield*e.tests},ne=t=>{let e=[];for(let r=t.parent;r;r=r.parent)e.push(r);return e.reverse(),e};var oe=()=>(d().nextApiStepId++).toString(),et=t=>{let e=t.title,{cleanTitle:r,labels:s,links:n}=$(e),a=`${[...t.titlePath().slice(0,-1),r].join(" ")}`;return{name:r,labels:s,links:n,fullNameSuffix:a}},A=t=>t.title.includes(I),Kt=t=>t.parent.root&&t.hookName==="after all",ae=t=>{let e=t.test;return t.test.parent.hooks.findLast(o=>o.hookName==="after all")?.hookId===e.hookId},ie=(t,e,r,s)=>{let n=e?c.SKIPPED:x(r),{message:o,trace:a}=S(r);return{status:n,statusDetails:{message:e?Fr(t,s):o,trace:a}}},Fr=(t,e)=>{let r=e.title?`'${e.title}'`:"root";return`'${t}' defined in the ${r} suite has failed`},R=t=>typeof t.attributes.consoleProps=="function"?t.attributes.consoleProps():t.attributes.consoleProps,pe=t=>typeof t?.attributes?.renderProps=="function"?t.attributes.renderProps():t.attributes?.renderProps;var _={},ce=t=>t.type==="api",M=t=>t.type==="log",lt=t=>N(Ir(),t),Ir=()=>{let t=oe();return L({id:t,type:"api"}),t},le=t=>{let e=x(t),r=S(t);jr(e,r),de(t)},mt=(t,e)=>j(r=>ce(r),t,e),j=(t,e,r)=>me(At(T(),t),e,r),H=(t,e)=>me(jt(),t,e),dt=()=>{H(),Ht().forEach(Or),Nt()},ue=t=>t.error?x(t.error):c.PASSED,Or=([t,e])=>{let{id:r,error:s}=t,n={id:r};s&&(n.statusDetails=S(s)),e?.(n),u({type:"cypress_step_finalize",data:n})},jr=(t,e)=>{let r=T(),s=r.at(r.findLastIndex(M)+1);s&&j(n=>Object.is(n,s),t,e)},Hr=(t,e)=>{if(M(t)){let r=t.log.attributes.error;if(r)return t.error=r}return e&&(t.error=e),t.error},me=(t,e,r)=>{let s;for(let n of t)s=Hr(n,s),Nr(n,e,r);s&&de(s)},de=t=>T().forEach(e=>e.error=t),Nr=(t,e,r)=>{fe(t,e,r),ce(t)&&t.error&&F(t)};var Wt=()=>Y(new ft),gt=()=>J(),ft=class{constructor(){this.#e()}labels(...e){return this.#t({type:"metadata",data:{labels:e}})}links(...e){return this.#t({type:"metadata",data:{links:e}})}parameter(e,r,s){return this.#t({type:"metadata",data:{parameters:[{name:e,value:r,...s}]}})}description(e){return this.#t({type:"metadata",data:{description:e}})}descriptionHtml(e){return this.#t({type:"metadata",data:{descriptionHtml:e}})}displayName(e){return this.#t({type:"metadata",data:{displayName:e}})}historyId(e){return this.#t({type:"metadata",data:{historyId:e}})}testCaseId(e){return this.#t({type:"metadata",data:{testCaseId:e}})}attachment(e,r,s){let n=r?.type==="Buffer"?r.data:r,o=typeof n=="string"?"utf8":"base64",a=Qt(n);return this.#t({type:"attachment_content",data:{name:e,content:a,encoding:o,contentType:s.contentType,fileExtension:s.fileExtension}})}attachmentFromPath(e,r,s){return this.#t({type:"attachment_path",data:{name:e,path:r,contentType:s.contentType,fileExtension:s.fileExtension}})}logStep(e,r=c.PASSED,s){return cy.wrap(_,{log:!1}).then(()=>(lt(e),Cypress.Promise.resolve())).then(()=>(mt(r,s?S(s):void 0),Cypress.Promise.resolve()))}step(e,r){return cy.wrap(_,{log:!1}).then(()=>(lt(e),Cypress.Promise.resolve(r()))).then(s=>(mt(),s))}stepDisplayName(e){return this.#t({type:"step_metadata",data:{name:e}})}stepParameter(e,r,s){return this.#t({type:"step_metadata",data:{parameters:[{name:e,value:r,mode:s}]}})}flushAllureMessagesToTask(e){let r=this.#r();r.length&&cy.task(e,{absolutePath:Cypress.spec.absolute,messages:r},{log:!1})}flushAllureMessagesToTaskAsync(e){let r=this.#r();if(r.length){let s={absolutePath:Cypress.spec.absolute,messages:r,isInteractive:Cypress.config("isInteractive")};return cy.task(e,s,{log:!1})}}#e(){_t([])}#t(e){return u(e),Cypress.Promise.resolve()}#r(){let e=tt();return this.#e(),e}};var $t=()=>{u({type:"cypress_run_start",data:{}})},Vt=t=>{u({type:"cypress_suite_start",data:{id:t.id,name:t.title,root:t.root,start:Date.now()}})},qt=t=>{u({type:"cypress_suite_end",data:{root:t.root,stop:Date.now()}})},rt=(t,e)=>{u({type:"cypress_hook_start",data:{name:t.title,scopeType:t.hookName.includes("each")?"each":"all",position:t.hookName.includes("before")?"before":"after",start:e??Date.now()}})},O=t=>{dt(),u({type:"cypress_hook_end",data:{duration:t.duration??0}})},st=t=>{Lt(t),u({type:"cypress_test_start",data:pt(t)}),ct(t)},N=(t,e)=>{u({type:"cypress_step_start",data:{id:t,name:e,start:Date.now()}})},fe=(t,e,r)=>{u({type:"cypress_step_stop",data:ee(t,e,r)})},Yt=()=>{u({type:"cypress_test_pass",data:{}})},nt=t=>{let e=x(t),r=S(t);H(e,r),u({type:"cypress_fail",data:{status:e,statusDetails:r}})},ot=(t,e)=>{let r=t.hookName.includes("each"),s=t.parent,n=ie(t.title,r,e,s);O(t),Ur(),Gr(s,n)},Jt=t=>{D(t)?H(c.SKIPPED,{message:"The test was skipped before the command was completed"}):st(t),u({type:"cypress_test_skip",data:ut()})},at=t=>{dt(),u({type:"cypress_test_end",data:{duration:t.duration??0,retries:t._retries??0}}),Ft()},ge=(t,e)=>{u({type:"attachment_path",data:{path:t,name:e,contentType:z.PNG}})},b=t=>{if(ae(t)){let e=t.test;return A(e)||O(e),ye()}},yt=(t,e)=>{try{return nt(e),ot(t.test,e),ye()}catch(r){Br(t,r)}},ht=(t,e)=>{if(!yt(t,e)?.then(()=>{throw e}))throw e},it=()=>gt().flushAllureMessagesToTask("reportAllureCypressSpecMessages"),ye=()=>gt().flushAllureMessagesToTaskAsync("reportFinalAllureCypressSpecMessages"),Ur=()=>{let t=wt();t&&at(t)},Gr=(t,e)=>{for(let r of se(t))D(r)||zr(r,r.pending?{...ut(),status:c.SKIPPED}:e)},zr=(t,e)=>{u({type:"cypress_skipped_test",data:{...pt(t),...e,...te(t),suites:ne(t).map(r=>r.id)}}),ct(t)},Br=(t,e)=>{try{console.error(`Unexpected error when reporting the failure of ${t.test?.title??"'after all'"}`),console.error(e)}catch{}};var Se=()=>{let t=Kr();Wr(t),$r(t)},Kr=()=>{let t=0;return{getSuiteDepth:()=>t,incrementSuiteDepth:()=>{t++},decrementSuiteDepth:()=>{t--}}},Wr=({incrementSuiteDepth:t,decrementSuiteDepth:e})=>{let r=o=>(a,p,i)=>{t();try{return Vr(o,a,p,i)}finally{e()}},s=globalThis.describe,n=r(s);n.only=r(s.only),n.skip=r(s.skip),globalThis.describe=n},$r=({getSuiteDepth:t})=>{let e=globalThis.after,r=(s,n)=>typeof s=="string"?e(s,he(t,n)):e(he(t,s));globalThis.after=r},Vr=(t,...e)=>{let[r,s,n]=e;return typeof n>"u"&&typeof s>"u"?t(r):typeof s=="function"?t(r,s):t(r,s,n)},he=(t,e)=>{if(t()===0&&e){let r=e.length?qr(e):Yr(e);return Object.defineProperty(r,"name",{value:e.name}),r}return e},qr=t=>function(e){let r=s=>{if(s){yt(this,s)?.then(()=>e(s))||e(s);return}try{if(b(this)?.then(()=>e()))return}catch(n){e(n);return}e()};return t.bind(this)(r)},Yr=t=>function(){let e,r;try{e=t.bind(this)()}catch(s){r=s}if(r)ht(this,r);else return P(e)?e.then(()=>b(this),s=>ht(this,s)):(b(this),e)};var ve=t=>Zr(t)?xe(t):C(t,Jr()),Jr=()=>{let{stepsFromCommands:{maxArgumentDepth:t,maxArgumentLength:e}}=It();return{maxDepth:t,maxLength:e,nonNullReplacerWithDomSupport:Xr}},Zr=t=>typeof t=="object"&&t!==null&&Cypress.dom.isDom(t),xe=t=>Cypress.dom.stringify(t,"long"),Xr=(t,e)=>{if(typeof e=="object"){if(e===null)return;if(Cypress.dom.isDom(e))return xe(e)}return e};var Te=t=>{let{event:e,instrument:r}=t.attributes;return!(r!=="command"||e||es(t))},Ce=(t,e)=>{let r=Ot();if(r&&M(r)){let{name:s,props:{name:n}}=R(r.log);s==="screenshot"&&n===t&&(r.attachmentName=e)}},Ee=t=>{let e=ps();typeof e<"u"&&us(e.log,t)&&U(e.log.attributes.id),Qr(t),N(t.attributes.id,rs(t)),ts(t)},U=t=>j(({id:e})=>e===t),Qr=t=>{let r={id:t.attributes.id,type:"log",log:t};L(r),F(r,s=>{s.parameters=ss(t),r.attachmentName&&(s.name=r.attachmentName)})},ts=t=>{let{groupStart:e,end:r,id:s}=t.attributes;if(r)U(s);else if(e){let n=t.endGroup;t.endGroup=function(){return U(s),n.call(this)}}else{let n=t.end;t.end=function(){return U(s),n.call(this)}}},es=t=>{let{name:e}=t.attributes;return e==="then"&&Object.is(R(t).props["Applied To"],_)},rs=t=>{let{name:e,message:r,displayName:s}=t.attributes,n=(s??e).trim(),o=(Ae(t)??os(t)??pe(t).message??r).trim();return[n,o].filter(Boolean).join(" ")},ss=t=>as(t).map(([e,r])=>({name:e.toString(),value:ve(r)})).filter(cs(t)),ns=["Given","When","Then","And"],os=t=>{let{attributes:{name:e,message:r}}=t;if(ns.includes(e.trim())&&r.startsWith("**")&&r.endsWith("**"))return r.substring(2,r.length-2)},as=t=>{let e=!!Ae(t),{props:r,name:s}=R(t);return["clearLocalStorage"].includes(s)?[]:Object.entries(r).filter(([n,o])=>Pt(o)&&!(e&&n==="Message"))},Ae=t=>{if(is(t)){let e=R(t).props.Message;if(e&&typeof e=="string")return e}},is=({attributes:{name:t}})=>t==="assert",ps=()=>T().findLast(M),us=(t,e)=>{let{groupStart:r,type:s}=t.attributes,{type:n}=e.attributes;return!r&&(s==="child"||n!=="child")},cs=t=>t.attributes.name==="wrap"?()=>!0:({name:e,value:r})=>e!=="Yielded"||r!=="{}";var be=()=>Cypress.on("fail",Pe).on("log:added",ms),St=()=>Cypress.Screenshot.defaults({onAfterScreenshot:ls}),ls=(...[,{name:t,path:e}])=>{let r=t??Xt(e);ge(e,r),Ce(t,r)},ms=(t,e)=>{Te(e)&&Ee(e)},Pe=t=>{if(le(t),ds())throw t},ds=()=>Object.is(Cypress.listeners("fail").at(-1),Pe);var De=()=>{zt(),be(),Bt(),Se()};var Re=()=>{Dt()||(Rt(),De(),St())};Re();export{z as ContentType,l as LabelName,k as LinkType,ke as Severity,Me as Stage,c as Status,_e as StatusByPriority,pr as allureId,er as attachTrace,tr as attachment,rr as attachmentPath,Ye as description,Je as descriptionHtml,Ze as displayName,ur as epic,cr as feature,Xe as historyId,ar as issue,y as label,$e as labels,hr as layer,X as link,Ve as links,nr as logStep,gr as owner,qe as parameter,dr as parentSuite,yr as severity,or as step,lr as story,fr as subSuite,mr as suite,Sr as tag,vr as tags,Qe as testCaseId,ir as tms};
|
|
1
|
+
var c=function(t){return t.FAILED="failed",t.BROKEN="broken",t.PASSED="passed",t.SKIPPED="skipped",t}({}),_e=[c.FAILED,c.BROKEN,c.PASSED,c.SKIPPED],Me=function(t){return t.SCHEDULED="scheduled",t.RUNNING="running",t.FINISHED="finished",t.PENDING="pending",t.INTERRUPTED="interrupted",t}({}),l=function(t){return t.ALLURE_ID="ALLURE_ID",t.AS_ID="ALLURE_ID",t.SUITE="suite",t.PARENT_SUITE="parentSuite",t.SUB_SUITE="subSuite",t.EPIC="epic",t.FEATURE="feature",t.STORY="story",t.SEVERITY="severity",t.TAG="tag",t.OWNER="owner",t.LEAD="lead",t.HOST="host",t.THREAD="thread",t.TEST_METHOD="testMethod",t.TEST_CLASS="testClass",t.PACKAGE="package",t.FRAMEWORK="framework",t.LANGUAGE="language",t.LAYER="layer",t}({}),we=function(t){return t.BLOCKER="blocker",t.CRITICAL="critical",t.NORMAL="normal",t.MINOR="minor",t.TRIVIAL="trivial",t}({}),z=function(t){return t.TEXT="text/plain",t.XML="application/xml",t.HTML="text/html",t.CSV="text/csv",t.TSV="text/tab-separated-values",t.CSS="text/css",t.URI="text/uri-list",t.SVG="image/svg+xml",t.PNG="image/png",t.JSON="application/json",t.ZIP="application/zip",t.WEBM="video/webm",t.JPEG="image/jpeg",t.MP4="video/mp4",t.IMAGEDIFF="application/vnd.allure.image.diff",t}({}),w=function(t){return t.DEFAULT="link",t.ISSUE="issue",t.TMS="tms",t}({});function B(){B=function(o,a){return new r(o,void 0,a)};var t=RegExp.prototype,e=new WeakMap;function r(n,o,a){var p=RegExp(n,o);return e.set(p,a||e.get(n)),k(p,r.prototype)}function s(n,o){var a=e.get(o);return Object.keys(a).reduce(function(p,i){var g=a[i];if(typeof g=="number")p[i]=n[g];else{for(var h=0;n[g[h]]===void 0&&h+1<g.length;)h++;p[i]=n[g[h]]}return p},Object.create(null))}return ke(r,RegExp),r.prototype.exec=function(n){var o=t.exec.call(this,n);if(o){o.groups=s(o,this);var a=o.indices;a&&(a.groups=s(a,this))}return o},r.prototype[Symbol.replace]=function(n,o){if(typeof o=="string"){var a=e.get(this);return t[Symbol.replace].call(this,n,o.replace(/\$<([^>]+)(>|$)/g,function(i,g,h){if(h==="")return i;var v=a[g];return Array.isArray(v)?"$"+v.join("$"):typeof v=="number"?"$"+v:""}))}if(typeof o=="function"){var p=this;return t[Symbol.replace].call(this,n,function(){var i=arguments;return typeof i[i.length-1]!="object"&&(i=[].slice.call(i)).push(s(i,p)),o.apply(this,i)})}return t[Symbol.replace].call(this,n,o)},B.apply(this,arguments)}function ke(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&k(t,e)}function k(t,e){return k=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},k(t,e)}function vt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,s)}return r}function K(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?vt(Object(r),!0).forEach(function(s){Le(t,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):vt(Object(r)).forEach(function(s){Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(r,s))})}return t}function Le(t,e,r){return(e=Fe(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Fe(t){var e=Ie(t,"string");return typeof e=="symbol"?e:e+""}function Ie(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var s=r.call(t,e||"default");if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var x=t=>{switch(!0){case/assert/gi.test(t.constructor.name):case/expectation/gi.test(t.constructor.name):case(t.name&&/assert/gi.test(t.name)):case(t.message&&/assert/gi.test(t.message)):case(t.stack&&/@vitest\/expect/gi.test(t.stack)):case(t.stack&&/playwright\/lib\/matchers\/expect\.js/gi.test(t.stack)):case"matcherResult"in t:case("inspect"in t&&typeof t.inspect=="function"):return c.FAILED;default:return c.BROKEN}},Oe=function(){var{onlyFirst:e=!1}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(r,e?void 0:"g")},W=t=>{var e=Oe();return t.replace(e,"")},je=t=>{if(!t||typeof t!="object")return{};if("matcherResult"in t&&t.matcherResult!==void 0&&typeof t.matcherResult=="object")return{actual:C(t.matcherResult.actual),expected:C(t.matcherResult.expected)};var e="actual"in t&&t.actual!==void 0?{actual:C(t.actual)}:{},r="expected"in t&&t.expected!==void 0?{expected:C(t.expected)}:{};return K(K({},e),r)},S=t=>{var{message:e,stack:r}=t;return K({message:e?W(e):void 0,trace:r?W(r):void 0},je(t))};var He=B(/(?:^|\s)@?allure\.([^:=\s]+)[:=]("[^"]+"|'[^']+'|`[^`]+`|\S+)/,{type:1}),xt=new RegExp(He,"g");var Ne=t=>t?.[1],Ue=t=>{var e,r=/['"`]/,s=new RegExp("^".concat(r.source)),n=new RegExp("".concat(r.source,"$")),o=(e=t?.[2])!==null&&e!==void 0?e:"";return s.test(o)&&n.test(o)?o.slice(1,-1):o};var $=t=>{var e=[],r=[],s=t.matchAll(xt),n=t.replaceAll(xt,"").split(" ").filter(Boolean).reduce((v,G)=>/^[\n\r]/.test(G)?v+G:"".concat(v," ").concat(G),"").trim();for(var o of s){var a=o,p=Ne(a),i=Ue(a);if(!(!p||!i)){var[g,h]=p.split(".");switch(g){case"id":e.push({name:l.ALLURE_ID,value:i});break;case"label":e.push({name:h,value:i});break;case"link":r.push({type:h,url:i});break}}}return{labels:e,links:r,cleanTitle:n}};var P=t=>!!t&&(typeof t=="object"||typeof t=="function")&&typeof t.then=="function",C=function(e){var{maxDepth:r=0,maxLength:s=0,replacer:n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return We(typeof e=="object"?JSON.stringify(e,Ge(r,n)):String(e),s)},Ge=(t,e)=>{var r=[],s=function(o,a){if(typeof a!="object"||a===null)return a;for(;r.length>0&&!Object.is(r.at(-1),this);)r.pop();if(!(t&&r.length>=t||r.includes(a)))return r.push(a),a instanceof Map?Be(r,a):a instanceof Set?Ke(r,a):a};return e?ze(e,s):s},ze=(t,e)=>function(r,s){return e.call(this,r,t.call(this,r,s))},Be=(t,e)=>Array.from(e).filter(r=>{var[s]=r;return!t.includes(s)}).map(r=>{var[s,n]=r;return[s,t.includes(n)?void 0:n]}),Ke=(t,e)=>Array.from(e).map(r=>t.includes(r)?void 0:r),We=(t,e)=>e&&t.length>e?"".concat(t.substring(0,e),"..."):t;function Tt(t,e,r,s,n,o,a){try{var p=t[o](a),i=p.value}catch(g){return void r(g)}p.done?e(i):Promise.resolve(i).then(s,n)}function f(t){return function(){var e=this,r=arguments;return new Promise(function(s,n){var o=t.apply(e,r);function a(i){Tt(o,s,n,a,p,"next",i)}function p(i){Tt(o,s,n,a,p,"throw",i)}a(void 0)})}}var V=class{attachment(){var e=this;return f(function*(){yield e.warning()})()}attachmentFromPath(){var e=this;return f(function*(){yield e.warning()})()}description(){var e=this;return f(function*(){yield e.warning()})()}descriptionHtml(){var e=this;return f(function*(){yield e.warning()})()}displayName(){var e=this;return f(function*(){yield e.warning()})()}historyId(){var e=this;return f(function*(){yield e.warning()})()}labels(){var e=this;return f(function*(){yield e.warning()})()}links(){var e=this;return f(function*(){yield e.warning()})()}parameter(){var e=this;return f(function*(){yield e.warning()})()}logStep(){var e=this;return f(function*(){yield e.warning()})()}step(e,r){var s=this;return f(function*(){return yield s.warning(),r()})()}stepDisplayName(){var e=this;return f(function*(){yield e.warning()})()}stepParameter(){var e=this;return f(function*(){yield e.warning()})()}testCaseId(){var e=this;return f(function*(){yield e.warning()})()}warning(){return f(function*(){console.log("no test runtime is found. Please check test framework configuration")})()}},E=new V;function $e(t,e){return typeof t=="string"&&/^\.\.?\//.test(t)?t.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+)?)\.([cm]?)ts$/i,function(r,s,n,o,a){return s?e?".jsx":".js":!n||o&&a?n+o+"."+a.toLowerCase()+"js":r}):t}var Ct="allureTestRuntime",Y=t=>{globalThis[Ct]=()=>t},q=()=>globalThis?.[Ct],J=()=>{var t=q();if(t){var e;return(e=t())!==null&&e!==void 0?e:E}return E},Z=()=>{var t=q();if(t){var e;return(e=t())!==null&&e!==void 0?e:E}var r="allure-playwright/autoconfig";return import($e(r)).then(()=>{var s,n;return(s=(n=q())===null||n===void 0?void 0:n())!==null&&s!==void 0?s:E}).catch(()=>E)};var m=function(e){for(var r=arguments.length,s=new Array(r>1?r-1:0),n=1;n<r;n++)s[n-1]=arguments[n];var o=Z();return P(o)?o.then(a=>a[e](...s)):o[e](...s)},y=(t,e)=>m("labels",{name:t,value:e}),Ve=function(){for(var e=arguments.length,r=new Array(e),s=0;s<e;s++)r[s]=arguments[s];return m("labels",...r)},X=(t,e,r)=>m("links",{url:t,type:r,name:e}),qe=function(){for(var e=arguments.length,r=new Array(e),s=0;s<e;s++)r[s]=arguments[s];return m("links",...r)},Ye=(t,e,r)=>m("parameter",t,e,r),Je=t=>m("description",t),Ze=t=>m("descriptionHtml",t),Xe=t=>m("displayName",t),Qe=t=>m("historyId",t),tr=t=>m("testCaseId",t),er=(t,e,r)=>{var s=typeof r=="string"?{contentType:r}:r;return m("attachment",t,e,s)},rr=(t,e)=>m("attachmentFromPath",t,e,{contentType:"application/vnd.allure.playwright-trace"}),sr=(t,e,r)=>{var s=typeof r=="string"?{contentType:r}:r;return m("attachmentFromPath",t,e,s)},nr=()=>({displayName:t=>m("stepDisplayName",t),parameter:(t,e,r)=>m("stepParameter",t,e,r)}),or=(t,e,r)=>m("logStep",t,e,r),ar=(t,e)=>m("step",t,()=>e(nr())),ir=(t,e)=>X(t,e,w.ISSUE),pr=(t,e)=>X(t,e,w.TMS),ur=t=>y(l.ALLURE_ID,t),cr=t=>y(l.EPIC,t),lr=t=>y(l.FEATURE,t),mr=t=>y(l.STORY,t),dr=t=>y(l.SUITE,t),fr=t=>y(l.PARENT_SUITE,t),gr=t=>y(l.SUB_SUITE,t),yr=t=>y(l.OWNER,t),hr=t=>y(l.SEVERITY,t),Sr=t=>y(l.LAYER,t),vr=t=>y(l.TAG,t),xr=function(){for(var e=arguments.length,r=new Array(e),s=0;s<e;s++)r[s]=arguments[s];return m("labels",...r.map(n=>({name:l.TAG,value:n})))};var Et={stepsFromCommands:{maxArgumentLength:128,maxArgumentDepth:3}},At=(t,e)=>{let r=t.findIndex(e);return r!==-1?Q(t.splice(r)):[]},Q=t=>{let e=t.length,r=new Array(e);for(let s=0;s<e;s++)r[e-s-1]=t[s];return r},bt=t=>t[t.length-1],Pt=t=>typeof t<"u";var d=()=>{let t=Cypress.env("allure");return t||(t={config:Et,initialized:!1,messages:[],testPlan:void 0,currentTest:void 0,projectDir:void 0,stepStack:[],stepsToFinalize:[],nextApiStepId:0},Cypress.env("allure",t)),t},Dt=()=>d().initialized,Rt=()=>{d().initialized=!0},tt=()=>d().messages,_t=t=>{d().messages=t},u=t=>{tt().push(t)},Mt=()=>d().testPlan,wt=()=>d().projectDir,kt=()=>d().currentTest,Lt=t=>{d().currentTest=t},Ft=()=>{d().currentTest=void 0},It=()=>d().config,T=()=>d().stepStack,Ot=()=>bt(T()),L=t=>T().push(t);var Cr=t=>Q(T().splice(t)),jt=()=>Cr(0);var F=(t,e)=>d().stepsToFinalize.push([t,e]),Ht=()=>d().stepsToFinalize,Nt=()=>{let t=d();t.stepsToFinalize=[]};var Ut=(t,e)=>{let r=Mt();if(r){let s=Gt(t);for(let n of Er(e)){let o=Ar(r,t,s,n.tests);br(n.tests,o)}}},Er=function*(t){let e=[];for(let r=t;r;r=e.pop()){yield r;for(let s=r.suites.length-1;s>=0;s--)e.push(r.suites[s])}},Ar=(t,e,r,s)=>{let n=[];return s.forEach((o,a)=>{let{fullNameSuffix:p,labels:i}=et(o),g=`${r}#${p}`,h=i.find(({name:v})=>v===l.ALLURE_ID)?.value;Pr(t,g,h)||n.push(a)}),n},br=(t,e)=>{for(let r=e.length-1;r>=0;r--)t.splice(e[r],1)},Pr=(t,e,r)=>t.tests.some(s=>r&&s.id?.toString()===r||s.selector===e);var I="__allure_report_system_hook__",zt=()=>{Cypress.mocha.getRunner().on("start",Dr).on("suite",Rr).on("suite end",qt).on("hook",_r).on("hook end",Mr).on("test",wr).on("pass",Yt).on("fail",kr).on("pending",Jt).on("test end",at)},Bt=()=>{afterEach(I,it),after(I,Lr)},Dr=()=>{Wt(),$t()},Rr=t=>{t.root&&Ut(Cypress.spec,t),Vt(t)},_r=t=>{A(t)||rt(t)},Mr=t=>{A(t)||O(t)},wr=t=>{D(t)||st(t)},kr=(t,e)=>{let r="hookName"in t;if(r&&Kt(t))return;r&&A(t)&&rt(t,Date.now()-(t.duration??0)),nt(e),r&&ot(t,e)},Lr=function(){it(),b(this)};var Zt=Cypress.platform==="win32",Xt=t=>t.substring(t.lastIndexOf(Zt?"\\":"/")+1),Gt=t=>{let e=wt(),r=e?t.absolute.substring(e.length+1):t.relative;return Zt?r.replaceAll("\\","/"):r},Qt=t=>Array.isArray(t)||t.buffer?btoa(String.fromCharCode.apply(null,t)):t,pt=t=>({...et(t),start:typeof t.wallClockStartedAt=="string"?Date.parse(t.wallClockStartedAt):t.wallClockStartedAt?.getTime?.()||Date.now()}),te=t=>({duration:t.duration??0,retries:t._retries??0}),ut=()=>({statusDetails:{message:"This is a pending test"}}),ee=(t,e,r)=>{let s={id:t.id,stop:Date.now(),status:e??ue(t)};return r&&(s.statusDetails=r),s},re=Symbol("The test has been reported to Allure"),ct=t=>{t[re]=!0},D=t=>t[re]===!0,Fr=function*(t){let e=[];for(let r=t;r;r=e.pop()){yield r;for(let s=r.suites.length-1;s>=0;s--)e.push(r.suites[s])}},se=function*(t){for(let e of Fr(t))yield*e.tests},ne=t=>{let e=[];for(let r=t.parent;r;r=r.parent)e.push(r);return e.reverse(),e};var oe=()=>(d().nextApiStepId++).toString(),et=t=>{let e=t.title,{cleanTitle:r,labels:s,links:n}=$(e),a=`${[...t.titlePath().slice(0,-1),r].join(" ")}`;return{name:r,labels:s,links:n,fullNameSuffix:a}},A=t=>t.title.includes(I),Kt=t=>t.parent.root&&t.hookName==="after all",ae=t=>{let e=t.test;return t.test.parent.hooks.findLast(o=>o.hookName==="after all")?.hookId===e.hookId},ie=(t,e,r,s)=>{let n=e?c.SKIPPED:x(r),{message:o,trace:a}=S(r);return{status:n,statusDetails:{message:e?Ir(t,s):o,trace:a}}},Ir=(t,e)=>{let r=e.title?`'${e.title}'`:"root";return`'${t}' defined in the ${r} suite has failed`},R=t=>typeof t.attributes.consoleProps=="function"?t.attributes.consoleProps():t.attributes.consoleProps,pe=t=>typeof t?.attributes?.renderProps=="function"?t.attributes.renderProps():t.attributes?.renderProps;var _={},ce=t=>t.type==="api",M=t=>t.type==="log",lt=t=>N(Or(),t),Or=()=>{let t=oe();return L({id:t,type:"api"}),t},le=t=>{let e=x(t),r=S(t);Hr(e,r),de(t)},mt=(t,e)=>j(r=>ce(r),t,e),j=(t,e,r)=>me(At(T(),t),e,r),H=(t,e)=>me(jt(),t,e),dt=()=>{H(),Ht().forEach(jr),Nt()},ue=t=>t.error?x(t.error):c.PASSED,jr=([t,e])=>{let{id:r,error:s}=t,n={id:r};s&&(n.statusDetails=S(s)),e?.(n),u({type:"cypress_step_finalize",data:n})},Hr=(t,e)=>{let r=T(),s=r.at(r.findLastIndex(M)+1);s&&j(n=>Object.is(n,s),t,e)},Nr=(t,e)=>{if(M(t)){let r=t.log.attributes.error;if(r)return t.error=r}return e&&(t.error=e),t.error},me=(t,e,r)=>{let s;for(let n of t)s=Nr(n,s),Ur(n,e,r);s&&de(s)},de=t=>T().forEach(e=>e.error=t),Ur=(t,e,r)=>{fe(t,e,r),ce(t)&&t.error&&F(t)};var Wt=()=>Y(new ft),gt=()=>J(),ft=class{constructor(){this.#e()}labels(...e){return this.#t({type:"metadata",data:{labels:e}})}links(...e){return this.#t({type:"metadata",data:{links:e}})}parameter(e,r,s){return this.#t({type:"metadata",data:{parameters:[{name:e,value:r,...s}]}})}description(e){return this.#t({type:"metadata",data:{description:e}})}descriptionHtml(e){return this.#t({type:"metadata",data:{descriptionHtml:e}})}displayName(e){return this.#t({type:"metadata",data:{displayName:e}})}historyId(e){return this.#t({type:"metadata",data:{historyId:e}})}testCaseId(e){return this.#t({type:"metadata",data:{testCaseId:e}})}attachment(e,r,s){let n=r?.type==="Buffer"?r.data:r,o=typeof n=="string"?"utf8":"base64",a=Qt(n);return this.#t({type:"attachment_content",data:{name:e,content:a,encoding:o,contentType:s.contentType,fileExtension:s.fileExtension}})}attachmentFromPath(e,r,s){return this.#t({type:"attachment_path",data:{name:e,path:r,contentType:s.contentType,fileExtension:s.fileExtension}})}logStep(e,r=c.PASSED,s){return cy.wrap(_,{log:!1}).then(()=>(lt(e),Cypress.Promise.resolve())).then(()=>(mt(r,s?S(s):void 0),Cypress.Promise.resolve()))}step(e,r){return cy.wrap(_,{log:!1}).then(()=>(lt(e),Cypress.Promise.resolve(r()))).then(s=>(mt(),s))}stepDisplayName(e){return this.#t({type:"step_metadata",data:{name:e}})}stepParameter(e,r,s){return this.#t({type:"step_metadata",data:{parameters:[{name:e,value:r,mode:s}]}})}flushAllureMessagesToTask(e){let r=this.#r();r.length&&cy.task(e,{absolutePath:Cypress.spec.absolute,messages:r},{log:!1})}flushAllureMessagesToTaskAsync(e){let r=this.#r();if(r.length){let s={absolutePath:Cypress.spec.absolute,messages:r,isInteractive:Cypress.config("isInteractive")};return cy.task(e,s,{log:!1})}}#e(){_t([])}#t(e){return u(e),Cypress.Promise.resolve()}#r(){let e=tt();return this.#e(),e}};var $t=()=>{u({type:"cypress_run_start",data:{}})},Vt=t=>{u({type:"cypress_suite_start",data:{id:t.id,name:t.title,root:t.root,start:Date.now()}})},qt=t=>{u({type:"cypress_suite_end",data:{root:t.root,stop:Date.now()}})},rt=(t,e)=>{u({type:"cypress_hook_start",data:{name:t.title,scopeType:t.hookName.includes("each")?"each":"all",position:t.hookName.includes("before")?"before":"after",start:e??Date.now()}})},O=t=>{dt(),u({type:"cypress_hook_end",data:{duration:t.duration??0}})},st=t=>{Lt(t),u({type:"cypress_test_start",data:pt(t)}),ct(t)},N=(t,e)=>{u({type:"cypress_step_start",data:{id:t,name:e,start:Date.now()}})},fe=(t,e,r)=>{u({type:"cypress_step_stop",data:ee(t,e,r)})},Yt=()=>{u({type:"cypress_test_pass",data:{}})},nt=t=>{let e=x(t),r=S(t);H(e,r),u({type:"cypress_fail",data:{status:e,statusDetails:r}})},ot=(t,e)=>{let r=t.hookName.includes("each"),s=t.parent,n=ie(t.title,r,e,s);O(t),Gr(),zr(s,n)},Jt=t=>{D(t)?H(c.SKIPPED,{message:"The test was skipped before the command was completed"}):st(t),u({type:"cypress_test_skip",data:ut()})},at=t=>{dt(),u({type:"cypress_test_end",data:{duration:t.duration??0,retries:t._retries??0}}),Ft()},ge=(t,e)=>{u({type:"attachment_path",data:{path:t,name:e,contentType:z.PNG}})},b=t=>{if(ae(t)){let e=t.test;return A(e)||O(e),ye()}},yt=(t,e)=>{try{return nt(e),ot(t.test,e),ye()}catch(r){Kr(t,r)}},ht=(t,e)=>{if(!yt(t,e)?.then(()=>{throw e}))throw e},it=()=>gt().flushAllureMessagesToTask("reportAllureCypressSpecMessages"),ye=()=>gt().flushAllureMessagesToTaskAsync("reportFinalAllureCypressSpecMessages"),Gr=()=>{let t=kt();t&&at(t)},zr=(t,e)=>{for(let r of se(t))D(r)||Br(r,r.pending?{...ut(),status:c.SKIPPED}:e)},Br=(t,e)=>{u({type:"cypress_skipped_test",data:{...pt(t),...e,...te(t),suites:ne(t).map(r=>r.id)}}),ct(t)},Kr=(t,e)=>{try{console.error(`Unexpected error when reporting the failure of ${t.test?.title??"'after all'"}`),console.error(e)}catch{}};var Se=()=>{let t=Wr();$r(t),Vr(t)},Wr=()=>{let t=0;return{getSuiteDepth:()=>t,incrementSuiteDepth:()=>{t++},decrementSuiteDepth:()=>{t--}}},$r=({incrementSuiteDepth:t,decrementSuiteDepth:e})=>{let r=o=>(a,p,i)=>{t();try{return qr(o,a,p,i)}finally{e()}},s=globalThis.describe,n=r(s);n.only=r(s.only),n.skip=r(s.skip),globalThis.describe=n},Vr=({getSuiteDepth:t})=>{let e=globalThis.after,r=(s,n)=>typeof s=="string"?e(s,he(t,n)):e(he(t,s));globalThis.after=r},qr=(t,...e)=>{let[r,s,n]=e;return typeof n>"u"&&typeof s>"u"?t(r):typeof s=="function"?t(r,s):t(r,s,n)},he=(t,e)=>{if(t()===0&&e){let r=e.length?Yr(e):Jr(e);return Object.defineProperty(r,"name",{value:e.name}),r}return e},Yr=t=>function(e){let r=s=>{if(s){yt(this,s)?.then(()=>e(s))||e(s);return}try{if(b(this)?.then(()=>e()))return}catch(n){e(n);return}e()};return t.bind(this)(r)},Jr=t=>function(){let e,r;try{e=t.bind(this)()}catch(s){r=s}if(r)ht(this,r);else return P(e)?e.then(()=>b(this),s=>ht(this,s)):(b(this),e)};var ve=t=>Xr(t)?xe(t):C(t,Zr()),Zr=()=>{let{stepsFromCommands:{maxArgumentDepth:t,maxArgumentLength:e}}=It();return{maxDepth:t,maxLength:e,nonNullReplacerWithDomSupport:Qr}},Xr=t=>typeof t=="object"&&t!==null&&Cypress.dom.isDom(t),xe=t=>Cypress.dom.stringify(t,"long"),Qr=(t,e)=>{if(typeof e=="object"){if(e===null)return;if(Cypress.dom.isDom(e))return xe(e)}return e};var Te=t=>{let{event:e,instrument:r}=t.attributes;return!(r!=="command"||e||rs(t))},Ce=(t,e)=>{let r=Ot();if(r&&M(r)){let{name:s,props:{name:n}}=R(r.log);s==="screenshot"&&n===t&&(r.attachmentName=e)}},Ee=t=>{let e=us();typeof e<"u"&&cs(e.log,t)&&U(e.log.attributes.id),ts(t),N(t.attributes.id,ss(t)),es(t)},U=t=>j(({id:e})=>e===t),ts=t=>{let r={id:t.attributes.id,type:"log",log:t};L(r),F(r,s=>{s.parameters=ns(t),r.attachmentName&&(s.name=r.attachmentName)})},es=t=>{let{groupStart:e,end:r,id:s}=t.attributes;if(r)U(s);else if(e){let n=t.endGroup;t.endGroup=function(){return U(s),n.call(this)}}else{let n=t.end;t.end=function(){return U(s),n.call(this)}}},rs=t=>{let{name:e}=t.attributes;return e==="then"&&Object.is(R(t).props["Applied To"],_)},ss=t=>{let{name:e,message:r,displayName:s}=t.attributes,n=(s??e).trim(),o=(Ae(t)??as(t)??pe(t).message??r).trim();return[n,o].filter(Boolean).join(" ")},ns=t=>is(t).map(([e,r])=>({name:e.toString(),value:ve(r)})).filter(ls(t)),os=["Given","When","Then","And"],as=t=>{let{attributes:{name:e,message:r}}=t;if(os.includes(e.trim())&&r.startsWith("**")&&r.endsWith("**"))return r.substring(2,r.length-2)},is=t=>{let e=!!Ae(t),{props:r,name:s}=R(t);return["clearLocalStorage"].includes(s)?[]:Object.entries(r).filter(([n,o])=>Pt(o)&&!(e&&n==="Message"))},Ae=t=>{if(ps(t)){let e=R(t).props.Message;if(e&&typeof e=="string")return e}},ps=({attributes:{name:t}})=>t==="assert",us=()=>T().findLast(M),cs=(t,e)=>{let{groupStart:r,type:s}=t.attributes,{type:n}=e.attributes;return!r&&(s==="child"||n!=="child")},ls=t=>t.attributes.name==="wrap"?()=>!0:({name:e,value:r})=>e!=="Yielded"||r!=="{}";var be=()=>Cypress.on("fail",Pe).on("log:added",ds),St=()=>Cypress.Screenshot.defaults({onAfterScreenshot:ms}),ms=(...[,{name:t,path:e}])=>{let r=t??Xt(e);ge(e,r),Ce(t,r)},ds=(t,e)=>{Te(e)&&Ee(e)},Pe=t=>{if(le(t),fs())throw t},fs=()=>Object.is(Cypress.listeners("fail").at(-1),Pe);var De=()=>{zt(),be(),Bt(),Se()};var Re=()=>{Dt()||(Rt(),De(),St())};Re();export{z as ContentType,l as LabelName,w as LinkType,we as Severity,Me as Stage,c as Status,_e as StatusByPriority,ur as allureId,rr as attachTrace,er as attachment,sr as attachmentPath,Je as description,Ze as descriptionHtml,Xe as displayName,cr as epic,lr as feature,Qe as historyId,ir as issue,y as label,Ve as labels,Sr as layer,X as link,qe as links,or as logStep,yr as owner,Ye as parameter,fr as parentSuite,hr as severity,ar as step,mr as story,gr as subSuite,dr as suite,vr as tag,xr as tags,tr as testCaseId,pr as tms};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|