allure-cypress 3.0.0-beta.11 → 3.0.0-beta.12
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/README.md +61 -8
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +4 -4
- package/dist/cjs/model.js.map +1 -1
- package/dist/cjs/reporter.js +21 -12
- package/dist/cjs/reporter.js.map +1 -1
- package/dist/cjs/runtime.js +10 -1
- package/dist/cjs/runtime.js.map +1 -1
- package/dist/cjs/state.js +5 -1
- package/dist/cjs/state.js.map +1 -1
- package/dist/cjs/utils.js +7 -1
- package/dist/cjs/utils.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +4 -4
- package/dist/esm/model.js.map +1 -1
- package/dist/esm/reporter.js +21 -11
- package/dist/esm/reporter.js.map +1 -1
- package/dist/esm/runtime.js +12 -3
- package/dist/esm/runtime.js.map +1 -1
- package/dist/esm/state.js +3 -0
- package/dist/esm/state.js.map +1 -1
- package/dist/esm/utils.js +6 -0
- package/dist/esm/utils.js.map +1 -1
- package/dist/types/model.d.ts +7 -0
- package/dist/types/reporter.d.ts +0 -5
- package/dist/types/state.d.ts +6 -0
- package/dist/types/utils.d.ts +6 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -71,13 +71,30 @@ Learn more about Allure Cypress from the official documentation at
|
|
|
71
71
|
|
|
72
72
|
|
|
73
73
|
## Allure Cypress options
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
|
74
|
+
|
|
75
|
+
Customize Allure Cypress by providing a configuration object as the third argument
|
|
76
|
+
of `allureCypress`.
|
|
77
|
+
|
|
78
|
+
The following options are supported:
|
|
79
|
+
|
|
80
|
+
| Option | Description | Default |
|
|
81
|
+
|-------------------|----------------------------------------------------------------------------------------------------------------------|---------------------------------|
|
|
82
|
+
| resultsDir | The path of the results folder. | `./allure-results` |
|
|
83
|
+
| videoOnFailOnly | When video capturing is enabled, set this option to `true` to attach the video to failed specs only. | `false` |
|
|
84
|
+
| links | Allure Runtime API link templates. | `undefined` |
|
|
85
|
+
| stepsFromCommands | Options that affect how Allure creates steps from Cypress commands | See [below](#stepsfromcommands) |
|
|
86
|
+
| environmentInfo | A set of key-value pairs to display in the Environment section of the report | `undefined` |
|
|
87
|
+
| categories | An array of category definitions, each describing a [category of defects](https://allurereport.org/docs/categories/) | `undefined` |
|
|
88
|
+
|
|
89
|
+
### stepsFromCommands
|
|
90
|
+
|
|
91
|
+
| Property | Description | Default |
|
|
92
|
+
|-------------------|---------------------------------------------------------------------------------------------------------------------------------------------|---------|
|
|
93
|
+
| maxArgumentLength | The maximum length of the parameter value created from Cypress command argument. The rest of the characters are replaces with `...`. | 128 |
|
|
94
|
+
| maxArgumentDepth | The maximum depth of the Cypress command argument (an array or an object) that will be converted to the corresponding step parameter value. | 3 |
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
### Example
|
|
81
98
|
|
|
82
99
|
Here is an example of the Allure Cypress configuration:
|
|
83
100
|
|
|
@@ -100,6 +117,10 @@ export default defineConfig({
|
|
|
100
117
|
nameTemplate: "ISSUE-%s",
|
|
101
118
|
},
|
|
102
119
|
},
|
|
120
|
+
stepsFromCommands: {
|
|
121
|
+
maxArgumentLength: 64,
|
|
122
|
+
maxArgumentDepth: 5,
|
|
123
|
+
},
|
|
103
124
|
environmentInfo: {
|
|
104
125
|
OS: os.platform(),
|
|
105
126
|
Architecture: os.arch(),
|
|
@@ -157,7 +178,39 @@ export default defineConfig({
|
|
|
157
178
|
});
|
|
158
179
|
```
|
|
159
180
|
|
|
160
|
-
##
|
|
181
|
+
## Common issues
|
|
182
|
+
|
|
183
|
+
### The test plan feature doesn't work
|
|
184
|
+
|
|
185
|
+
Make sure you pass the Cypress config as the second argument of `allureCypress`.
|
|
186
|
+
|
|
187
|
+
Correct:
|
|
188
|
+
|
|
189
|
+
```javascript
|
|
190
|
+
allureCypress(on, config);
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Also correct:
|
|
194
|
+
|
|
195
|
+
```javascript
|
|
196
|
+
allureCypress(on, config, {
|
|
197
|
+
resultsDir: "output",
|
|
198
|
+
});
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Incorrect (the test plan won't work):
|
|
202
|
+
|
|
203
|
+
```javascript
|
|
204
|
+
allureCypress(on);
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
Also incorrect (the legacy style; the test plan won't work either):
|
|
208
|
+
|
|
209
|
+
```javascript
|
|
210
|
+
allureCypress(on, {
|
|
211
|
+
resultsDir: "output",
|
|
212
|
+
});
|
|
213
|
+
```
|
|
161
214
|
|
|
162
215
|
### `setupNodeEvents` limitations
|
|
163
216
|
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var H=Object.defineProperty;var dt=Object.getOwnPropertyDescriptor;var mt=Object.getOwnPropertyNames;var yt=Object.prototype.hasOwnProperty;var gt=(e,t)=>{for(var s in t)H(e,s,{get:t[s],enumerable:!0})},ft=(e,t,s,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of mt(t))!yt.call(e,n)&&n!==s&&H(e,n,{get:()=>t[n],enumerable:!(r=dt(t,n))||r.enumerable});return e};var ht=e=>ft(H({},"__esModule",{value:!0}),e);var Qt={};gt(Qt,{ContentType:()=>P,LabelName:()=>l,LinkType:()=>x,Severity:()=>re,Stage:()=>se,Status:()=>u,StatusByPriority:()=>te,allureId:()=>xe,attachment:()=>fe,attachmentPath:()=>he,description:()=>ce,descriptionHtml:()=>de,displayName:()=>me,epic:()=>Ee,feature:()=>_e,historyId:()=>ye,issue:()=>Te,label:()=>y,labels:()=>pe,layer:()=>we,link:()=>D,links:()=>ue,logStep:()=>Se,owner:()=>Pe,parameter:()=>le,parentSuite:()=>Ae,severity:()=>ke,step:()=>ve,story:()=>Me,subSuite:()=>Re,suite:()=>be,tag:()=>De,tags:()=>Ie,testCaseId:()=>ge,tms:()=>Ce});module.exports=ht(Qt);var u=function(e){return e.FAILED="failed",e.BROKEN="broken",e.PASSED="passed",e.SKIPPED="skipped",e}({}),te=[u.FAILED,u.BROKEN,u.PASSED,u.SKIPPED],se=function(e){return e.SCHEDULED="scheduled",e.RUNNING="running",e.FINISHED="finished",e.PENDING="pending",e.INTERRUPTED="interrupted",e}({}),l=function(e){return e.ALLURE_ID="ALLURE_ID",e.AS_ID="ALLURE_ID",e.SUITE="suite",e.PARENT_SUITE="parentSuite",e.SUB_SUITE="subSuite",e.EPIC="epic",e.FEATURE="feature",e.STORY="story",e.SEVERITY="severity",e.TAG="tag",e.OWNER="owner",e.LEAD="lead",e.HOST="host",e.THREAD="thread",e.TEST_METHOD="testMethod",e.TEST_CLASS="testClass",e.PACKAGE="package",e.FRAMEWORK="framework",e.LANGUAGE="language",e.LAYER="layer",e}({}),re=function(e){return e.BLOCKER="blocker",e.CRITICAL="critical",e.NORMAL="normal",e.MINOR="minor",e.TRIVIAL="trivial",e}({}),P=function(e){return e.TEXT="text/plain",e.XML="application/xml",e.HTML="text/html",e.CSV="text/csv",e.TSV="text/tab-separated-values",e.CSS="text/css",e.URI="text/uri-list",e.SVG="image/svg+xml",e.PNG="image/png",e.JSON="application/json",e.ZIP="application/zip",e.WEBM="video/webm",e.JPEG="image/jpeg",e.MP4="video/mp4",e.IMAGEDIFF="application/vnd.allure.image.diff",e}({}),x=function(e){return e.DEFAULT="link",e.ISSUE="issue",e.TMS="tms",e}({});function k(){k=function(a,o){return new s(a,void 0,o)};var e=RegExp.prototype,t=new WeakMap;function s(n,a,o){var i=RegExp(n,a);return t.set(i,o||t.get(n)),w(i,s.prototype)}function r(n,a){var o=t.get(a);return Object.keys(o).reduce(function(i,p){var g=o[p];if(typeof g=="number")i[p]=n[g];else{for(var h=0;n[g[h]]===void 0&&h+1<g.length;)h++;i[p]=n[g[h]]}return i},Object.create(null))}return St(s,RegExp),s.prototype.exec=function(n){var a=e.exec.call(this,n);if(a){a.groups=r(a,this);var o=a.indices;o&&(o.groups=r(o,this))}return a},s.prototype[Symbol.replace]=function(n,a){if(typeof a=="string"){var o=t.get(this);return e[Symbol.replace].call(this,n,a.replace(/\$<([^>]+)>/g,function(p,g){var h=o[g];return"$"+(Array.isArray(h)?h.join("$"):h)}))}if(typeof a=="function"){var i=this;return e[Symbol.replace].call(this,n,function(){var p=arguments;return typeof p[p.length-1]!="object"&&(p=[].slice.call(p)).push(r(p,i)),a.apply(this,p)})}return e[Symbol.replace].call(this,n,a)},k.apply(this,arguments)}function St(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&w(e,t)}function w(e,t){return w=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,r){return s.__proto__=r,s},w(e,t)}var S=e=>{switch(!0){case/assert/gi.test(e.constructor.name):case/expectation/gi.test(e.constructor.name):case/assert/gi.test(e.name):case/assert/gi.test(e.message):case(e.stack&&/@vitest\/expect/gi.test(e.stack)):return u.FAILED;default:return u.BROKEN}},vt=function(){var{onlyFirst:t=!1}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=["[\\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(s,t?void 0:"g")},F=e=>{var t=vt();return e.replace(t,"")},f=e=>{var{message:t,stack:s}=e;return{message:t?F(t):void 0,trace:s?F(s):void 0}},ne=k(/(?:^|\s)@?allure\.id[:=]([^\s]+)/,{id:1}),Tt=new RegExp(ne,"g"),ae=k(/(?:^|\s)@?allure\.label\.([^:=\s]+)[:=]([^\s]+)/,{name:1,value:2}),Ct=new RegExp(ae,"g");var O=e=>{var t=[];e.split(" ").forEach(r=>{var n,a=(n=r.match(ne))===null||n===void 0||(n=n.groups)===null||n===void 0?void 0:n.id;a&&t.push({name:l.ALLURE_ID,value:a});var o=r.match(ae),{name:i,value:p}=o?.groups||{};i&&p&&t?.push({name:i,value:p})});var s=e.replace(Ct,"").replace(Tt,"").trim();return{labels:t,cleanTitle:s}};var xt=e=>e.reduce((t,s)=>{if(s.type!=="step_start"&&s.type!=="step_stop")return t;if(s.type==="step_start")return t.push([s]),t;var r=t.findLastIndex(n=>n.length===1);return r===-1||t[r].push(s),t},[]),N=e=>{var t=xt(e);return t.filter(s=>s.length===1)},E=e=>!!e&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function";var _="__allure_report_system_hook__",M="__allure_report_step_command__";function oe(e,t,s,r,n,a,o){try{var i=e[a](o),p=i.value}catch(g){return void s(g)}i.done?t(p):Promise.resolve(p).then(r,n)}function m(e){return function(){var t=this,s=arguments;return new Promise(function(r,n){var a=e.apply(t,s);function o(p){oe(a,r,n,o,i,"next",p)}function i(p){oe(a,r,n,o,i,"throw",p)}o(void 0)})}}var L=class{attachment(){var t=this;return m(function*(){yield t.warning()})()}attachmentFromPath(){var t=this;return m(function*(){yield t.warning()})()}description(){var t=this;return m(function*(){yield t.warning()})()}descriptionHtml(){var t=this;return m(function*(){yield t.warning()})()}displayName(){var t=this;return m(function*(){yield t.warning()})()}historyId(){var t=this;return m(function*(){yield t.warning()})()}labels(){var t=this;return m(function*(){yield t.warning()})()}links(){var t=this;return m(function*(){yield t.warning()})()}parameter(){var t=this;return m(function*(){yield t.warning()})()}logStep(){var t=this;return m(function*(){yield t.warning()})()}step(t,s){var r=this;return m(function*(){return yield r.warning(),s()})()}stepDisplayName(){var t=this;return m(function*(){yield t.warning()})()}stepParameter(){var t=this;return m(function*(){yield t.warning()})()}testCaseId(){var t=this;return m(function*(){yield t.warning()})()}warning(){return m(function*(){console.log("no test runtime is found. Please check test framework configuration")})()}},T=new L;var ie="allureTestRuntime",j=e=>{globalThis[ie]=()=>e},U=()=>globalThis?.[ie],G=()=>{var e=U();if(e){var t;return(t=e())!==null&&t!==void 0?t:T}return T},B=()=>{var e=U();if(e){var t;return(t=e())!==null&&t!==void 0?t:T}if("_playwrightInstance"in globalThis)try{return(0,eval)("(() => import('allure-playwright/autoconfig'))()").then(()=>{var s,r;return(s=(r=U())===null||r===void 0?void 0:r())!==null&&s!==void 0?s:T})}catch(s){return console.log("can't execute allure-playwright/autoconfig",s),T}return T};var d=function(t){for(var s=arguments.length,r=new Array(s>1?s-1:0),n=1;n<s;n++)r[n-1]=arguments[n];var a=B();return E(a)?a.then(o=>o[t](...r)):a[t](...r)},y=(e,t)=>d("labels",{name:e,value:t}),pe=function(){for(var t=arguments.length,s=new Array(t),r=0;r<t;r++)s[r]=arguments[r];return d("labels",...s)},D=(e,t,s)=>d("links",{url:e,type:s,name:t}),ue=function(){for(var t=arguments.length,s=new Array(t),r=0;r<t;r++)s[r]=arguments[r];return d("links",...s)},le=(e,t,s)=>d("parameter",e,t,s),ce=e=>d("description",e),de=e=>d("descriptionHtml",e),me=e=>d("displayName",e),ye=e=>d("historyId",e),ge=e=>d("testCaseId",e),fe=(e,t,s)=>{var r=typeof s=="string"?{contentType:s}:s;return d("attachment",e,t,r)},he=(e,t,s)=>{var r=typeof s=="string"?{contentType:s}:s;return d("attachmentFromPath",e,t,r)},Et=()=>({displayName:e=>d("stepDisplayName",e),parameter:(e,t,s)=>d("stepParameter",e,t,s)}),Se=(e,t,s)=>d("logStep",e,t,s),ve=(e,t)=>d("step",e,()=>t(Et())),Te=(e,t)=>D(e,t,x.ISSUE),Ce=(e,t)=>D(e,t,x.TMS),xe=e=>y(l.ALLURE_ID,e),Ee=e=>y(l.EPIC,e),_e=e=>y(l.FEATURE,e),Me=e=>y(l.STORY,e),be=e=>y(l.SUITE,e),Ae=e=>y(l.PARENT_SUITE,e),Re=e=>y(l.SUB_SUITE,e),Pe=e=>y(l.OWNER,e),ke=e=>y(l.SEVERITY,e),we=e=>y(l.LAYER,e),De=e=>y(l.TAG,e),Ie=function(){for(var t=arguments.length,s=new Array(t),r=0;r<t;r++)s[r]=arguments[r];return d("labels",...s.map(n=>({name:l.TAG,value:n})))};var v=()=>{let e=Cypress.env("allure");return e||(e={initialized:!1,messages:[],testPlan:void 0,currentTest:void 0},Cypress.env("allure",e)),e},He=()=>v().initialized,Fe=()=>{v().initialized=!0},b=()=>v().messages,Oe=e=>{v().messages=e},c=e=>{b().push(e)},Ne=()=>v().testPlan,Le=()=>v().currentTest,Ue=e=>{v().currentTest=e},je=()=>{v().currentTest=void 0};var Ge=e=>Array.isArray(e)||e.buffer?btoa(String.fromCharCode.apply(null,e)):e,Be=e=>{let t=[];for(let s=e.parent;s;s=s.parent)t.push(s);return t.reverse(),t};var V=e=>Mt(e.attributes.args)?.log===!1||e.attributes.name==="task"&&e.attributes.args[0]==="reportAllureRuntimeMessages"||e.attributes.name==="then"||e.attributes.name==="wrap"&&e.attributes.args[0]===M;var Mt=e=>e[e.length-1],Ve=(e,t)=>{let s=t.title,{cleanTitle:r,labels:n}=O(s),a=t.titlePath().slice(0,-1),o=`${e.relative}#${[...a,r].join(" ")}`;return{name:r,labels:n,fullName:o}},K=e=>({...Ve(Cypress.spec,e),start:e.wallClockStartedAt?.getTime()||Date.now()}),Ke=e=>({duration:e.duration??0,retries:e._retries??0}),z=()=>({statusDetails:{message:"This is a pending test"}}),ze=(e,t)=>{let s=Ne();if(s)for(let r of $e(t)){let n=At(s,e,r.tests);Rt(r.tests,n)}};var We=Symbol("The test was reported to Allure"),W=e=>{e[We]=!0},A=e=>e[We]===!0,$e=function*(e){let t=[];for(let s=e;s;s=t.pop()){yield s;for(let r=s.suites.length-1;r>=0;r--)t.push(s.suites[r])}},Ye=function*(e){for(let t of $e(e))yield*t.tests},C=e=>e.title.includes(_),qe=e=>e.parent.root&&e.hookName==="after all",bt=(e,t,s)=>e.tests.some(r=>s&&r.id?.toString()===s||r.selector===t),At=(e,t,s)=>{let r=[];return s.forEach((n,a)=>{let{fullName:o,labels:i}=Ve(t,n),p=i.find(({name:g})=>g===l.ALLURE_ID)?.value;bt(e,o,p)||r.push(a)}),r},Rt=(e,t)=>{for(let s=t.length-1;s>=0;s--)e.splice(t[s],1)};var $=class{constructor(){this.#t()}labels(...t){return this.#e({type:"metadata",data:{labels:t}})}links(...t){return this.#e({type:"metadata",data:{links:t}})}parameter(t,s,r){return this.#e({type:"metadata",data:{parameters:[{name:t,value:s,...r}]}})}description(t){return this.#e({type:"metadata",data:{description:t}})}descriptionHtml(t){return this.#e({type:"metadata",data:{descriptionHtml:t}})}displayName(t){return this.#e({type:"metadata",data:{displayName:t}})}historyId(t){return this.#e({type:"metadata",data:{historyId:t}})}testCaseId(t){return this.#e({type:"metadata",data:{testCaseId:t}})}attachment(t,s,r){let n=s?.type==="Buffer"?s.data:s,a=typeof n=="string"?"utf8":"base64",o=Ge(n);return this.#e({type:"attachment_content",data:{name:t,content:o,encoding:a,contentType:r.contentType,fileExtension:r.fileExtension}})}attachmentFromPath(t,s,r){return this.#e({type:"attachment_path",data:{name:t,path:s,contentType:r.contentType,fileExtension:r.fileExtension}})}logStep(t,s=u.PASSED,r){return cy.wrap(M,{log:!1}).then(()=>(this.#e({type:"step_start",data:{name:t,start:Date.now()}}),Cypress.Promise.resolve())).then(()=>this.#e({type:"step_stop",data:{status:s,stop:Date.now(),statusDetails:r?{...f(r)}:void 0}}))}step(t,s){return cy.wrap(M,{log:!1}).then(()=>(this.#e({type:"step_start",data:{name:t,start:Date.now()}}),Cypress.Promise.resolve(s()))).then(r=>this.#e({type:"step_stop",data:{status:u.PASSED,stop:Date.now()}}).then(()=>r))}stepDisplayName(t){return this.#e({type:"step_metadata",data:{name:t}})}stepParameter(t,s,r){return this.#e({type:"step_metadata",data:{parameters:[{name:t,value:s,mode:r}]}})}flushAllureMessagesToTask=t=>{let s=this.#s();s.length&&cy.task(t,{absolutePath:Cypress.spec.absolute,messages:s},{log:!1})};flushAllureMessagesToTaskAsync=t=>{let s=this.#s();if(s.length){let r={absolutePath:Cypress.spec.absolute,messages:s,isInteractive:Cypress.config("isInteractive")};return cy.task(t,r,{log:!1})}};#t=()=>Oe([]);#e=t=>(c(t),Cypress.Promise.resolve());#s=()=>{let t=b();return this.#t(),t}},Xe=()=>j(new $),Qe=()=>G(),et=()=>{c({type:"cypress_run_start",data:{}})},tt=e=>{c({type:"cypress_suite_start",data:{id:e.id,name:e.title,root:e.root,start:Date.now()}})},st=e=>{c({type:"cypress_suite_end",data:{root:e.root,stop:Date.now()}})},Y=(e,t)=>{c({type:"cypress_hook_start",data:{name:e.title,scopeType:e.hookName.includes("each")?"each":"all",position:e.hookName.includes("before")?"before":"after",start:t??Date.now()}})},I=e=>{c({type:"cypress_hook_end",data:{duration:e.duration??0}})},q=e=>{Ue(e),c({type:"cypress_test_start",data:K(e)}),W(e)},Z=(e,t)=>{let s=b();N(s).forEach(()=>{c({type:"step_stop",data:{stop:Date.now(),status:e,statusDetails:t}})})},rt=()=>{Z(u.PASSED),c({type:"cypress_test_pass",data:{}})},nt=e=>{A(e)?pt(u.SKIPPED,{message:"The test was skipped before the command was completed"}):q(e),c({type:"cypress_test_skip",data:z()})},at=e=>{c({type:"cypress_command_start",data:{name:`Command "${e.attributes.name}"`,args:e.attributes.args.map(t=>typeof t=="string"?t:JSON.stringify(t,null,2)),start:Date.now()}})},ot=()=>{c({type:"cypress_command_end",data:{status:u.PASSED,stop:Date.now()}})},it=(e,t)=>{c({type:"attachment_path",data:{path:e,name:t||"Screenshot",contentType:P.PNG}})},pt=(e,t)=>{let s=b(),r=s.toReversed().findIndex(({type:i})=>i==="cypress_command_start"),n=s.toReversed().findIndex(({type:i})=>i==="cypress_command_end"),a=r>n,o={status:e,stop:Date.now()};t&&(o.statusDetails=t),a&&c({type:"cypress_command_end",data:o})},J=e=>{let t=S(e),s=f(e);pt(t,s),c({type:"cypress_fail",data:{status:t,statusDetails:s}})},X=e=>{c({type:"cypress_test_end",data:{duration:e.duration??0,retries:e._retries??0}}),je()},Q=(e,t)=>{let s=e.hookName.includes("each"),r=e.parent,n=Dt(e.title,s,t,r);I(e),Pt(),kt(r,n)},ut=()=>{let[e,t,s]=Ot();Ft(t,s),Nt(e)},ee=()=>Qe().flushAllureMessagesToTask("reportAllureCypressSpecMessages"),lt=()=>Qe().flushAllureMessagesToTaskAsync("reportFinalAllureCypressSpecMessages"),R=e=>{if(Gt(e)){let t=e.test;return C(t)||I(t),lt()}},ct=(e,t)=>{try{return J(t),Q(e.test,t),lt()}catch(s){jt(e,s)}},Pt=()=>{let e=Le();e&&X(e)},kt=(e,t)=>{for(let s of Ye(e))A(s)||wt(s,s.pending?{...z(),status:u.SKIPPED}:t)},wt=(e,t)=>{c({type:"cypress_skipped_test",data:{...K(e),...t,...Ke(e),suites:Be(e).map(s=>s.id)}}),W(e)},Dt=(e,t,s,r)=>{let n=t?u.SKIPPED:S(s),{message:a,trace:o}=f(s);return{status:n,statusDetails:{message:t?It(e,r):a,trace:o}}},It=(e,t)=>{let s=t.title?`'${t.title}'`:"root";return`'${e}' defined in the ${s} suite has failed`},Ht=(e,...t)=>{let[s,r,n]=t;return typeof n>"u"&&typeof r>"u"?e(s):typeof r=="function"?e(s,r):e(s,r,n)},Ft=(e,t)=>{let s=a=>(o,i,p)=>{e();try{return Ht(a,o,i,p)}finally{t()}},r=globalThis.describe,n=s(r);n.only=s(r.only),n.skip=s(r.skip),globalThis.describe=n},Ot=()=>{let e=0;return[()=>e,()=>{e++},()=>{e--}]},Nt=e=>{let t=globalThis.after,s=(r,n)=>typeof r=="string"?t(r,Ze(e,n)):t(Ze(e,r));globalThis.after=s},Ze=(e,t)=>{if(e()===0&&t){let s=t.length?Lt(t):Ut(t);return Object.defineProperty(s,"name",{value:t.name}),s}return t},Lt=e=>function(t){let s=r=>{if(r){ct(this,r)?.then(()=>t(r))||t(r);return}try{if(R(this)?.then(()=>t()))return}catch(n){t(n);return}t()};return e.bind(this)(s)},Ut=e=>function(){let t,s;try{t=e.bind(this)()}catch(r){s=r}if(s)Je(this,s);else return E(t)?t.then(()=>R(this),r=>Je(this,r)):(R(this),t)},Je=(e,t)=>{if(!ct(e,t)?.then(()=>{throw t}))throw t},jt=(e,t)=>{try{console.error(`Unexpected error when reporting the failure of ${e.test?.title??"'after all'"}`),console.error(t)}catch{}},Gt=e=>{let t=e.test;return e.test.parent.hooks.findLast(a=>a.hookName==="after all")?.hookId===t.hookId};var{EVENT_RUN_BEGIN:Bt,EVENT_SUITE_BEGIN:Vt,EVENT_SUITE_END:Kt,EVENT_HOOK_BEGIN:zt,EVENT_HOOK_END:Wt,EVENT_TEST_BEGIN:$t,EVENT_TEST_PASS:Yt,EVENT_TEST_FAIL:qt,EVENT_TEST_PENDING:Zt,EVENT_TEST_END:Jt}=Mocha.Runner.constants,Xt=()=>{He()||(Fe(),Cypress.mocha.getRunner().on(Bt,()=>{Xe(),et()}).on(Vt,e=>{e.root&&ze(Cypress.spec,e),tt(e)}).on(Kt,e=>{st(e)}).on(zt,e=>{C(e)||Y(e)}).on(Wt,e=>{C(e)||I(e)}).on($t,e=>{A(e)||q(e)}).on(Yt,()=>{rt()}).on(qt,(e,t)=>{let s="hookName"in e;if(s&&qe(e))return;s&&C(e)&&Y(e,Date.now()-(e.duration??0)),J(t),s&&Q(e,t)}).on(Zt,e=>{nt(e)}).on(Jt,e=>{X(e)}),Cypress.Screenshot.defaults({onAfterScreenshot:(e,{path:t,name:s})=>{it(t,s)}}),Cypress.on("fail",e=>{let t=S(e),s=f(e);throw Z(t,s),e}),Cypress.on("command:start",e=>{V(e)||at(e)}),Cypress.on("command:end",e=>{V(e)||ot()}),afterEach(_,ee),after(_,function(){ee(),R(this)}),ut())};Xt();
|
|
1
|
+
"use strict";var F=Object.defineProperty;var gt=Object.getOwnPropertyDescriptor;var ft=Object.getOwnPropertyNames;var ht=Object.prototype.hasOwnProperty;var St=(e,t)=>{for(var r in t)F(e,r,{get:t[r],enumerable:!0})},Tt=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of ft(t))!ht.call(e,n)&&n!==r&&F(e,n,{get:()=>t[n],enumerable:!(s=gt(t,n))||s.enumerable});return e};var vt=e=>Tt(F({},"__esModule",{value:!0}),e);var or={};St(or,{ContentType:()=>P,LabelName:()=>l,LinkType:()=>x,Severity:()=>ne,Stage:()=>se,Status:()=>u,StatusByPriority:()=>re,allureId:()=>Ee,attachment:()=>he,attachmentPath:()=>Se,description:()=>de,descriptionHtml:()=>me,displayName:()=>ye,epic:()=>_e,feature:()=>Ae,historyId:()=>ge,issue:()=>Ce,label:()=>y,labels:()=>ue,layer:()=>we,link:()=>w,links:()=>le,logStep:()=>Te,owner:()=>ke,parameter:()=>ce,parentSuite:()=>Re,severity:()=>De,step:()=>ve,story:()=>Me,subSuite:()=>Pe,suite:()=>be,tag:()=>Ie,tags:()=>Fe,testCaseId:()=>fe,tms:()=>xe});module.exports=vt(or);var u=function(e){return e.FAILED="failed",e.BROKEN="broken",e.PASSED="passed",e.SKIPPED="skipped",e}({}),re=[u.FAILED,u.BROKEN,u.PASSED,u.SKIPPED],se=function(e){return e.SCHEDULED="scheduled",e.RUNNING="running",e.FINISHED="finished",e.PENDING="pending",e.INTERRUPTED="interrupted",e}({}),l=function(e){return e.ALLURE_ID="ALLURE_ID",e.AS_ID="ALLURE_ID",e.SUITE="suite",e.PARENT_SUITE="parentSuite",e.SUB_SUITE="subSuite",e.EPIC="epic",e.FEATURE="feature",e.STORY="story",e.SEVERITY="severity",e.TAG="tag",e.OWNER="owner",e.LEAD="lead",e.HOST="host",e.THREAD="thread",e.TEST_METHOD="testMethod",e.TEST_CLASS="testClass",e.PACKAGE="package",e.FRAMEWORK="framework",e.LANGUAGE="language",e.LAYER="layer",e}({}),ne=function(e){return e.BLOCKER="blocker",e.CRITICAL="critical",e.NORMAL="normal",e.MINOR="minor",e.TRIVIAL="trivial",e}({}),P=function(e){return e.TEXT="text/plain",e.XML="application/xml",e.HTML="text/html",e.CSV="text/csv",e.TSV="text/tab-separated-values",e.CSS="text/css",e.URI="text/uri-list",e.SVG="image/svg+xml",e.PNG="image/png",e.JSON="application/json",e.ZIP="application/zip",e.WEBM="video/webm",e.JPEG="image/jpeg",e.MP4="video/mp4",e.IMAGEDIFF="application/vnd.allure.image.diff",e}({}),x=function(e){return e.DEFAULT="link",e.ISSUE="issue",e.TMS="tms",e}({});function k(){k=function(a,o){return new r(a,void 0,o)};var e=RegExp.prototype,t=new WeakMap;function r(n,a,o){var i=RegExp(n,a);return t.set(i,o||t.get(n)),D(i,r.prototype)}function s(n,a){var o=t.get(a);return Object.keys(o).reduce(function(i,p){var g=o[p];if(typeof g=="number")i[p]=n[g];else{for(var S=0;n[g[S]]===void 0&&S+1<g.length;)S++;i[p]=n[g[S]]}return i},Object.create(null))}return Ct(r,RegExp),r.prototype.exec=function(n){var a=e.exec.call(this,n);if(a){a.groups=s(a,this);var o=a.indices;o&&(o.groups=s(o,this))}return a},r.prototype[Symbol.replace]=function(n,a){if(typeof a=="string"){var o=t.get(this);return e[Symbol.replace].call(this,n,a.replace(/\$<([^>]+)>/g,function(p,g){var S=o[g];return"$"+(Array.isArray(S)?S.join("$"):S)}))}if(typeof a=="function"){var i=this;return e[Symbol.replace].call(this,n,function(){var p=arguments;return typeof p[p.length-1]!="object"&&(p=[].slice.call(p)).push(s(p,i)),a.apply(this,p)})}return e[Symbol.replace].call(this,n,a)},k.apply(this,arguments)}function Ct(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&D(e,t)}function D(e,t){return D=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},D(e,t)}var T=e=>{switch(!0){case/assert/gi.test(e.constructor.name):case/expectation/gi.test(e.constructor.name):case/assert/gi.test(e.name):case/assert/gi.test(e.message):case(e.stack&&/@vitest\/expect/gi.test(e.stack)):return u.FAILED;default:return u.BROKEN}},xt=function(){var{onlyFirst:t=!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,t?void 0:"g")},O=e=>{var t=xt();return e.replace(t,"")},f=e=>{var{message:t,stack:r}=e;return{message:t?O(t):void 0,trace:r?O(r):void 0}},ae=k(/(?:^|\s)@?allure\.id[:=]([^\s]+)/,{id:1}),Et=new RegExp(ae,"g"),oe=k(/(?:^|\s)@?allure\.label\.([^:=\s]+)[:=]([^\s]+)/,{name:1,value:2}),_t=new RegExp(oe,"g");var H=e=>{var t=[];e.split(" ").forEach(s=>{var n,a=(n=s.match(ae))===null||n===void 0||(n=n.groups)===null||n===void 0?void 0:n.id;a&&t.push({name:l.ALLURE_ID,value:a});var o=s.match(oe),{name:i,value:p}=o?.groups||{};i&&p&&t?.push({name:i,value:p})});var r=e.replace(_t,"").replace(Et,"").trim();return{labels:t,cleanTitle:r}};var At=e=>e.reduce((t,r)=>{if(r.type!=="step_start"&&r.type!=="step_stop")return t;if(r.type==="step_start")return t.push([r]),t;var s=t.findLastIndex(n=>n.length===1);return s===-1||t[s].push(r),t},[]),N=e=>{var t=At(e);return t.filter(r=>r.length===1)},E=e=>!!e&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function",L=function(t){var{maxDepth:r=0,maxLength:s=0}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Pt(typeof t=="object"?JSON.stringify(t,Mt(r)):String(t),s)},Mt=e=>{var t=[];return function(r,s){if(typeof s!="object"||s===null)return s;for(;t.length>0&&!Object.is(t.at(-1),this);)t.pop();if(!(e&&t.length>=e||t.includes(s)))return t.push(s),s instanceof Map?bt(t,s):s instanceof Set?Rt(t,s):s}},bt=(e,t)=>Array.from(t).filter(r=>{var[s]=r;return!e.includes(s)}).map(r=>{var[s,n]=r;return[s,e.includes(n)?void 0:n]}),Rt=(e,t)=>Array.from(t).map(r=>e.includes(r)?void 0:r),Pt=(e,t)=>t&&e.length>t?"".concat(e.substring(0,t),"..."):e;var _="__allure_report_system_hook__",A="__allure_report_step_command__";function ie(e,t,r,s,n,a,o){try{var i=e[a](o),p=i.value}catch(g){return void r(g)}i.done?t(p):Promise.resolve(p).then(s,n)}function m(e){return function(){var t=this,r=arguments;return new Promise(function(s,n){var a=e.apply(t,r);function o(p){ie(a,s,n,o,i,"next",p)}function i(p){ie(a,s,n,o,i,"throw",p)}o(void 0)})}}var U=class{attachment(){var t=this;return m(function*(){yield t.warning()})()}attachmentFromPath(){var t=this;return m(function*(){yield t.warning()})()}description(){var t=this;return m(function*(){yield t.warning()})()}descriptionHtml(){var t=this;return m(function*(){yield t.warning()})()}displayName(){var t=this;return m(function*(){yield t.warning()})()}historyId(){var t=this;return m(function*(){yield t.warning()})()}labels(){var t=this;return m(function*(){yield t.warning()})()}links(){var t=this;return m(function*(){yield t.warning()})()}parameter(){var t=this;return m(function*(){yield t.warning()})()}logStep(){var t=this;return m(function*(){yield t.warning()})()}step(t,r){var s=this;return m(function*(){return yield s.warning(),r()})()}stepDisplayName(){var t=this;return m(function*(){yield t.warning()})()}stepParameter(){var t=this;return m(function*(){yield t.warning()})()}testCaseId(){var t=this;return m(function*(){yield t.warning()})()}warning(){return m(function*(){console.log("no test runtime is found. Please check test framework configuration")})()}},v=new U;var pe="allureTestRuntime",G=e=>{globalThis[pe]=()=>e},j=()=>globalThis?.[pe],B=()=>{var e=j();if(e){var t;return(t=e())!==null&&t!==void 0?t:v}return v},V=()=>{var e=j();if(e){var t;return(t=e())!==null&&t!==void 0?t:v}if("_playwrightInstance"in globalThis)try{return(0,eval)("(() => import('allure-playwright/autoconfig'))()").then(()=>{var r,s;return(r=(s=j())===null||s===void 0?void 0:s())!==null&&r!==void 0?r:v})}catch(r){return console.log("can't execute allure-playwright/autoconfig",r),v}return v};var d=function(t){for(var r=arguments.length,s=new Array(r>1?r-1:0),n=1;n<r;n++)s[n-1]=arguments[n];var a=V();return E(a)?a.then(o=>o[t](...s)):a[t](...s)},y=(e,t)=>d("labels",{name:e,value:t}),ue=function(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];return d("labels",...r)},w=(e,t,r)=>d("links",{url:e,type:r,name:t}),le=function(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];return d("links",...r)},ce=(e,t,r)=>d("parameter",e,t,r),de=e=>d("description",e),me=e=>d("descriptionHtml",e),ye=e=>d("displayName",e),ge=e=>d("historyId",e),fe=e=>d("testCaseId",e),he=(e,t,r)=>{var s=typeof r=="string"?{contentType:r}:r;return d("attachment",e,t,s)},Se=(e,t,r)=>{var s=typeof r=="string"?{contentType:r}:r;return d("attachmentFromPath",e,t,s)},kt=()=>({displayName:e=>d("stepDisplayName",e),parameter:(e,t,r)=>d("stepParameter",e,t,r)}),Te=(e,t,r)=>d("logStep",e,t,r),ve=(e,t)=>d("step",e,()=>t(kt())),Ce=(e,t)=>w(e,t,x.ISSUE),xe=(e,t)=>w(e,t,x.TMS),Ee=e=>y(l.ALLURE_ID,e),_e=e=>y(l.EPIC,e),Ae=e=>y(l.FEATURE,e),Me=e=>y(l.STORY,e),be=e=>y(l.SUITE,e),Re=e=>y(l.PARENT_SUITE,e),Pe=e=>y(l.SUB_SUITE,e),ke=e=>y(l.OWNER,e),De=e=>y(l.SEVERITY,e),we=e=>y(l.LAYER,e),Ie=e=>y(l.TAG,e),Fe=function(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];return d("labels",...r.map(n=>({name:l.TAG,value:n})))};var Oe={stepsFromCommands:{maxArgumentLength:128,maxArgumentDepth:3}},He=e=>Array.isArray(e)||e.buffer?btoa(String.fromCharCode.apply(null,e)):e,Ne=e=>{let t=[];for(let r=e.parent;r;r=r.parent)t.push(r);return t.reverse(),t};var K=e=>wt(e.attributes.args)?.log===!1||e.attributes.name==="task"&&e.attributes.args[0]==="reportAllureRuntimeMessages"||e.attributes.name==="then"||e.attributes.name==="wrap"&&e.attributes.args[0]===A;var wt=e=>e[e.length-1],Le=(e,t)=>{let r=t.title,{cleanTitle:s,labels:n}=H(r),a=t.titlePath().slice(0,-1),o=`${e.relative}#${[...a,s].join(" ")}`;return{name:s,labels:n,fullName:o}},z=e=>({...Le(Cypress.spec,e),start:e.wallClockStartedAt?.getTime()||Date.now()}),Ue=e=>({duration:e.duration??0,retries:e._retries??0}),W=()=>({statusDetails:{message:"This is a pending test"}}),je=(e,t)=>{let r=ze();if(r)for(let s of Be(t)){let n=Ft(r,e,s.tests);Ot(s.tests,n)}};var Ge=Symbol("The test was reported to Allure"),$=e=>{e[Ge]=!0},M=e=>e[Ge]===!0,Be=function*(e){let t=[];for(let r=e;r;r=t.pop()){yield r;for(let s=r.suites.length-1;s>=0;s--)t.push(r.suites[s])}},Ve=function*(e){for(let t of Be(e))yield*t.tests},C=e=>e.title.includes(_),Ke=e=>e.parent.root&&e.hookName==="after all",It=(e,t,r)=>e.tests.some(s=>r&&s.id?.toString()===r||s.selector===t),Ft=(e,t,r)=>{let s=[];return r.forEach((n,a)=>{let{fullName:o,labels:i}=Le(t,n),p=i.find(({name:g})=>g===l.ALLURE_ID)?.value;It(e,o,p)||s.push(a)}),s},Ot=(e,t)=>{for(let r=t.length-1;r>=0;r--)e.splice(t[r],1)};var h=()=>{let e=Cypress.env("allure");return e||(e={config:Oe,initialized:!1,messages:[],testPlan:void 0,currentTest:void 0},Cypress.env("allure",e)),e},We=()=>h().initialized,$e=()=>{h().initialized=!0},b=()=>h().messages,Ye=e=>{h().messages=e},c=e=>{b().push(e)},ze=()=>h().testPlan,qe=()=>h().currentTest,Ze=e=>{h().currentTest=e},Je=()=>{h().currentTest=void 0},Xe=()=>h().config;var Y=class{constructor(){this.#t()}labels(...t){return this.#e({type:"metadata",data:{labels:t}})}links(...t){return this.#e({type:"metadata",data:{links:t}})}parameter(t,r,s){return this.#e({type:"metadata",data:{parameters:[{name:t,value:r,...s}]}})}description(t){return this.#e({type:"metadata",data:{description:t}})}descriptionHtml(t){return this.#e({type:"metadata",data:{descriptionHtml:t}})}displayName(t){return this.#e({type:"metadata",data:{displayName:t}})}historyId(t){return this.#e({type:"metadata",data:{historyId:t}})}testCaseId(t){return this.#e({type:"metadata",data:{testCaseId:t}})}attachment(t,r,s){let n=r?.type==="Buffer"?r.data:r,a=typeof n=="string"?"utf8":"base64",o=He(n);return this.#e({type:"attachment_content",data:{name:t,content:o,encoding:a,contentType:s.contentType,fileExtension:s.fileExtension}})}attachmentFromPath(t,r,s){return this.#e({type:"attachment_path",data:{name:t,path:r,contentType:s.contentType,fileExtension:s.fileExtension}})}logStep(t,r=u.PASSED,s){return cy.wrap(A,{log:!1}).then(()=>(this.#e({type:"step_start",data:{name:t,start:Date.now()}}),Cypress.Promise.resolve())).then(()=>this.#e({type:"step_stop",data:{status:r,stop:Date.now(),statusDetails:s?{...f(s)}:void 0}}))}step(t,r){return cy.wrap(A,{log:!1}).then(()=>(this.#e({type:"step_start",data:{name:t,start:Date.now()}}),Cypress.Promise.resolve(r()))).then(s=>this.#e({type:"step_stop",data:{status:u.PASSED,stop:Date.now()}}).then(()=>s))}stepDisplayName(t){return this.#e({type:"step_metadata",data:{name:t}})}stepParameter(t,r,s){return this.#e({type:"step_metadata",data:{parameters:[{name:t,value:r,mode:s}]}})}flushAllureMessagesToTask=t=>{let r=this.#r();r.length&&cy.task(t,{absolutePath:Cypress.spec.absolute,messages:r},{log:!1})};flushAllureMessagesToTaskAsync=t=>{let r=this.#r();if(r.length){let s={absolutePath:Cypress.spec.absolute,messages:r,isInteractive:Cypress.config("isInteractive")};return cy.task(t,s,{log:!1})}};#t=()=>Ye([]);#e=t=>(c(t),Cypress.Promise.resolve());#r=()=>{let t=b();return this.#t(),t}},tt=()=>G(new Y),rt=()=>B(),st=()=>{c({type:"cypress_run_start",data:{}})},nt=e=>{c({type:"cypress_suite_start",data:{id:e.id,name:e.title,root:e.root,start:Date.now()}})},at=e=>{c({type:"cypress_suite_end",data:{root:e.root,stop:Date.now()}})},q=(e,t)=>{c({type:"cypress_hook_start",data:{name:e.title,scopeType:e.hookName.includes("each")?"each":"all",position:e.hookName.includes("before")?"before":"after",start:t??Date.now()}})},I=e=>{c({type:"cypress_hook_end",data:{duration:e.duration??0}})},Z=e=>{Ze(e),c({type:"cypress_test_start",data:z(e)}),$(e)},J=(e,t)=>{let r=b();N(r).forEach(()=>{c({type:"step_stop",data:{stop:Date.now(),status:e,statusDetails:t}})})},ot=()=>{J(u.PASSED),c({type:"cypress_test_pass",data:{}})},it=e=>{M(e)?ct(u.SKIPPED,{message:"The test was skipped before the command was completed"}):Z(e),c({type:"cypress_test_skip",data:W()})},pt=e=>{let{stepsFromCommands:{maxArgumentDepth:t,maxArgumentLength:r}}=Xe();c({type:"cypress_command_start",data:{name:`Command "${e.attributes.name}"`,args:e.attributes.args.map(s=>L(s,{maxDepth:t,maxLength:r})),start:Date.now()}})},ut=()=>{c({type:"cypress_command_end",data:{status:u.PASSED,stop:Date.now()}})},lt=(e,t)=>{c({type:"attachment_path",data:{path:e,name:t||"Screenshot",contentType:P.PNG}})},ct=(e,t)=>{let r=b(),s=r.toReversed().findIndex(({type:i})=>i==="cypress_command_start"),n=r.toReversed().findIndex(({type:i})=>i==="cypress_command_end"),a=s>n,o={status:e,stop:Date.now()};t&&(o.statusDetails=t),a&&c({type:"cypress_command_end",data:o})},X=e=>{let t=T(e),r=f(e);ct(t,r),c({type:"cypress_fail",data:{status:t,statusDetails:r}})},Q=e=>{c({type:"cypress_test_end",data:{duration:e.duration??0,retries:e._retries??0}}),Je()},ee=(e,t)=>{let r=e.hookName.includes("each"),s=e.parent,n=Ut(e.title,r,t,s);I(e),Ht(),Nt(s,n)},dt=()=>{let[e,t,r]=Vt();Bt(t,r),Kt(e)},te=()=>rt().flushAllureMessagesToTask("reportAllureCypressSpecMessages"),mt=()=>rt().flushAllureMessagesToTaskAsync("reportFinalAllureCypressSpecMessages"),R=e=>{if(Yt(e)){let t=e.test;return C(t)||I(t),mt()}},yt=(e,t)=>{try{return X(t),ee(e.test,t),mt()}catch(r){$t(e,r)}},Ht=()=>{let e=qe();e&&Q(e)},Nt=(e,t)=>{for(let r of Ve(e))M(r)||Lt(r,r.pending?{...W(),status:u.SKIPPED}:t)},Lt=(e,t)=>{c({type:"cypress_skipped_test",data:{...z(e),...t,...Ue(e),suites:Ne(e).map(r=>r.id)}}),$(e)},Ut=(e,t,r,s)=>{let n=t?u.SKIPPED:T(r),{message:a,trace:o}=f(r);return{status:n,statusDetails:{message:t?jt(e,s):a,trace:o}}},jt=(e,t)=>{let r=t.title?`'${t.title}'`:"root";return`'${e}' defined in the ${r} suite has failed`},Gt=(e,...t)=>{let[r,s,n]=t;return typeof n>"u"&&typeof s>"u"?e(r):typeof s=="function"?e(r,s):e(r,s,n)},Bt=(e,t)=>{let r=a=>(o,i,p)=>{e();try{return Gt(a,o,i,p)}finally{t()}},s=globalThis.describe,n=r(s);n.only=r(s.only),n.skip=r(s.skip),globalThis.describe=n},Vt=()=>{let e=0;return[()=>e,()=>{e++},()=>{e--}]},Kt=e=>{let t=globalThis.after,r=(s,n)=>typeof s=="string"?t(s,Qe(e,n)):t(Qe(e,s));globalThis.after=r},Qe=(e,t)=>{if(e()===0&&t){let r=t.length?zt(t):Wt(t);return Object.defineProperty(r,"name",{value:t.name}),r}return t},zt=e=>function(t){let r=s=>{if(s){yt(this,s)?.then(()=>t(s))||t(s);return}try{if(R(this)?.then(()=>t()))return}catch(n){t(n);return}t()};return e.bind(this)(r)},Wt=e=>function(){let t,r;try{t=e.bind(this)()}catch(s){r=s}if(r)et(this,r);else return E(t)?t.then(()=>R(this),s=>et(this,s)):(R(this),t)},et=(e,t)=>{if(!yt(e,t)?.then(()=>{throw t}))throw t},$t=(e,t)=>{try{console.error(`Unexpected error when reporting the failure of ${e.test?.title??"'after all'"}`),console.error(t)}catch{}},Yt=e=>{let t=e.test;return e.test.parent.hooks.findLast(a=>a.hookName==="after all")?.hookId===t.hookId};var{EVENT_RUN_BEGIN:qt,EVENT_SUITE_BEGIN:Zt,EVENT_SUITE_END:Jt,EVENT_HOOK_BEGIN:Xt,EVENT_HOOK_END:Qt,EVENT_TEST_BEGIN:er,EVENT_TEST_PASS:tr,EVENT_TEST_FAIL:rr,EVENT_TEST_PENDING:sr,EVENT_TEST_END:nr}=Mocha.Runner.constants,ar=()=>{We()||($e(),Cypress.mocha.getRunner().on(qt,()=>{tt(),st()}).on(Zt,e=>{e.root&&je(Cypress.spec,e),nt(e)}).on(Jt,e=>{at(e)}).on(Xt,e=>{C(e)||q(e)}).on(Qt,e=>{C(e)||I(e)}).on(er,e=>{M(e)||Z(e)}).on(tr,()=>{ot()}).on(rr,(e,t)=>{let r="hookName"in e;if(r&&Ke(e))return;r&&C(e)&&q(e,Date.now()-(e.duration??0)),X(t),r&&ee(e,t)}).on(sr,e=>{it(e)}).on(nr,e=>{Q(e)}),Cypress.Screenshot.defaults({onAfterScreenshot:(e,{path:t,name:r})=>{lt(t,r)}}),Cypress.on("fail",e=>{let t=T(e),r=f(e);throw J(t,r),e}),Cypress.on("command:start",e=>{K(e)||pt(e)}),Cypress.on("command:end",e=>{K(e)||ut()}),afterEach(_,te),after(_,function(){te(),R(this)}),dt())};ar();
|
|
2
2
|
//# sourceMappingURL=index.js.map
|