allure-cypress 3.0.0-beta.1 → 3.0.0-beta.11
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 +140 -122
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +4 -4
- package/dist/cjs/model.js +7 -0
- package/dist/cjs/model.js.map +1 -1
- package/dist/cjs/reporter.js +558 -116
- package/dist/cjs/reporter.js.map +1 -1
- package/dist/cjs/runtime.js +640 -0
- package/dist/cjs/runtime.js.map +1 -0
- package/dist/cjs/state.js +49 -0
- package/dist/cjs/state.js.map +1 -0
- package/dist/cjs/utils.js +161 -19
- 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 +2 -1
- package/dist/esm/model.js.map +1 -1
- package/dist/esm/reporter.js +557 -117
- package/dist/esm/reporter.js.map +1 -1
- package/dist/esm/runtime.js +611 -0
- package/dist/esm/runtime.js.map +1 -0
- package/dist/esm/state.js +33 -0
- package/dist/esm/state.js.map +1 -0
- package/dist/esm/utils.js +143 -14
- package/dist/esm/utils.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/model.d.ts +150 -0
- package/dist/types/reporter.d.ts +87 -0
- package/dist/types/runtime.d.ts +50 -0
- package/dist/types/state.d.ts +11 -0
- package/dist/types/utils.d.ts +45 -0
- package/package.json +31 -23
- package/dist/index.d.ts +0 -23
- package/dist/model.d.ts +0 -29
- package/dist/reporter.d.ts +0 -18
- package/dist/utils.d.ts +0 -4
package/README.md
CHANGED
|
@@ -14,177 +14,195 @@
|
|
|
14
14
|
|
|
15
15
|
## Installation
|
|
16
16
|
|
|
17
|
-
Use your favorite
|
|
17
|
+
Use your favorite Node.js package manager to install the required packages:
|
|
18
18
|
|
|
19
19
|
```shell
|
|
20
20
|
npm add -D allure-cypress
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
Add the following lines to your `cypress.config.js` file
|
|
23
|
+
Add the following lines to your `cypress.config.js` file:
|
|
24
24
|
|
|
25
|
-
```
|
|
26
|
-
|
|
25
|
+
```javascript
|
|
26
|
+
import { defineConfig } from "cypress";
|
|
27
|
+
import { allureCypress } from "allure-cypress/reporter";
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
// ...
|
|
29
|
+
export default defineConfig({
|
|
30
30
|
e2e: {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
+ },
|
|
31
|
+
setupNodeEvents: (on, config) => {
|
|
32
|
+
allureCypress(on, config);
|
|
33
|
+
|
|
34
|
+
return config;
|
|
35
|
+
},
|
|
36
|
+
// ...
|
|
38
37
|
},
|
|
39
|
-
};
|
|
38
|
+
});
|
|
40
39
|
```
|
|
41
40
|
|
|
42
|
-
|
|
43
|
-
the installation:
|
|
41
|
+
Import `allure-cypress` in `cypress/support/e2e.js`:
|
|
44
42
|
|
|
45
|
-
```
|
|
46
|
-
|
|
43
|
+
```javascript
|
|
44
|
+
import "allure-cypress";
|
|
47
45
|
```
|
|
48
46
|
|
|
49
|
-
|
|
47
|
+
Allure Cypress is ready to run now. When the test run completes, the result files
|
|
48
|
+
will be collected in the `./allure-results` directory. If you want to use another
|
|
49
|
+
location, provide it via the `resultsDir` configuration option ([see below](#allure-cypress-options)).
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
### View the report
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
it("my test", () => {
|
|
57
|
-
attachment("Attachment name", "Hello world!", "text/plain");
|
|
58
|
-
epic("my_epic");
|
|
59
|
-
parameter("parameter_name", "parameter_value", {
|
|
60
|
-
mode: "hidden",
|
|
61
|
-
excluded: false,
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
```
|
|
53
|
+
> You need Allure Report to generate and open the report from result files. See the [installation instructions](https://allurereport.org/docs/install/) for more details.
|
|
54
|
+
|
|
55
|
+
Generate Allure Report:
|
|
65
56
|
|
|
66
|
-
|
|
57
|
+
```bash
|
|
58
|
+
allure generate ./allure-results -o ./allure-report
|
|
59
|
+
```
|
|
67
60
|
|
|
68
|
-
|
|
69
|
-
import { link, issue, tms } from "allure-js-commons";
|
|
61
|
+
Open Allure Report:
|
|
70
62
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
issue("Issue Name", "https://github.com/allure-framework/allure-js/issues/352");
|
|
74
|
-
tms("Task Name", "https://github.com/allure-framework/allure-js/tasks/352");
|
|
75
|
-
});
|
|
63
|
+
```bash
|
|
64
|
+
allure open ./allure-report
|
|
76
65
|
```
|
|
77
66
|
|
|
78
|
-
|
|
79
|
-
|
|
67
|
+
## The documentation
|
|
68
|
+
|
|
69
|
+
Learn more about Allure Cypress from the official documentation at
|
|
70
|
+
[https://allurereport.org/docs/cypress/](https://allurereport.org/docs/cypress/).
|
|
80
71
|
|
|
81
|
-
```diff
|
|
82
|
-
const { allureCypress } = require("allure-cypress/reporter");
|
|
83
72
|
|
|
84
|
-
|
|
85
|
-
|
|
73
|
+
## Allure Cypress options
|
|
74
|
+
| Option | Description | Default |
|
|
75
|
+
|-----------------|----------------------------------------------------------------------------------------------------------------------|--------------------|
|
|
76
|
+
| resultsDir | The path of the results folder. | `./allure-results` |
|
|
77
|
+
| videoOnFailOnly | When video capturing is enabled, set this option to `true` to attach the video to failed specs only. | `undefined` |
|
|
78
|
+
| links | Allure Runtime API link templates. | `undefined` |
|
|
79
|
+
| environmentInfo | A set of key-value pairs to display in the Environment section of the report | `undefined` |
|
|
80
|
+
| categories | An array of category definitions, each describing a [category of defects](https://allurereport.org/docs/categories/) | `undefined` |
|
|
81
|
+
|
|
82
|
+
Here is an example of the Allure Cypress configuration:
|
|
83
|
+
|
|
84
|
+
```javascript
|
|
85
|
+
import { defineConfig } from "cypress";
|
|
86
|
+
import { allureCypress } from "allure-cypress/reporter";
|
|
87
|
+
|
|
88
|
+
export default defineConfig({
|
|
86
89
|
e2e: {
|
|
87
90
|
setupNodeEvents: (on, config) => {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
91
|
+
allureCypress(on, config, {
|
|
92
|
+
resultsDir: "my-allure-results",
|
|
93
|
+
videoOnFailOnly: true,
|
|
94
|
+
links: {
|
|
95
|
+
link: {
|
|
96
|
+
urlTemplate: "https://github.com/allure-framework/allure-js/blob/main/%s",
|
|
97
|
+
},
|
|
98
|
+
issue: {
|
|
99
|
+
urlTemplate: "https://github.com/allure-framework/allure-js/issues/%s",
|
|
100
|
+
nameTemplate: "ISSUE-%s",
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
environmentInfo: {
|
|
104
|
+
OS: os.platform(),
|
|
105
|
+
Architecture: os.arch(),
|
|
106
|
+
NodeVersion: process.version,
|
|
107
|
+
},
|
|
108
|
+
categories: [
|
|
109
|
+
{
|
|
110
|
+
name: "Missing file errors",
|
|
111
|
+
messageRegex: /^ENOENT: no such file or directory/,
|
|
112
|
+
},
|
|
113
|
+
],
|
|
108
114
|
});
|
|
109
115
|
|
|
110
116
|
return config;
|
|
111
117
|
},
|
|
118
|
+
// other Cypress config properties ...
|
|
112
119
|
},
|
|
113
|
-
};
|
|
120
|
+
});
|
|
114
121
|
```
|
|
115
122
|
|
|
116
|
-
|
|
123
|
+
More details about Allure Cypress configuration are available at [https://allurereport.org/docs/cypress-configuration/](https://allurereport.org/docs/cypress-configuration/).
|
|
117
124
|
|
|
118
|
-
```js
|
|
119
|
-
import { link, issue, tms } from "allure-js-commons";
|
|
120
125
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
tms("352", "Task Name");
|
|
126
|
-
link("custom", "352");
|
|
127
|
-
link("custom", "352", "Link name");
|
|
128
|
-
});
|
|
129
|
-
```
|
|
126
|
+
## Combining Allure with other Cypress plugins
|
|
127
|
+
|
|
128
|
+
Use [cypress-on-fix](https://github.com/bahmutov/cypress-on-fix) to enable Allure
|
|
129
|
+
with other Cypress plugins. See more info [here](#setupnodeevents-limitations).
|
|
130
130
|
|
|
131
|
-
|
|
131
|
+
In the next example, Allure Cypress is enabled together with [@badeball/cypress-cucumber-preprocessor](https://github.com/badeball/cypress-cucumber-preprocessor):
|
|
132
132
|
|
|
133
|
-
|
|
133
|
+
```javascript
|
|
134
|
+
import { defineConfig } from "cypress";
|
|
135
|
+
import { allureCypress } from "allure-cypress/reporter";
|
|
136
|
+
import createBundler from "@bahmutov/cypress-esbuild-preprocessor";
|
|
137
|
+
import { addCucumberPreprocessorPlugin } from "@badeball/cypress-cucumber-preprocessor";
|
|
138
|
+
import { createEsbuildPlugin } from "@badeball/cypress-cucumber-preprocessor/esbuild";
|
|
139
|
+
import cypressOnFix from "cypress-on-fix";
|
|
140
|
+
|
|
141
|
+
export default defineConfig({
|
|
142
|
+
e2e: {
|
|
143
|
+
setupNodeEvents = async (on, config) => {
|
|
144
|
+
on = cypressOnFix(on);
|
|
145
|
+
await addCucumberPreprocessorPlugin(on, config);
|
|
134
146
|
|
|
135
|
-
|
|
136
|
-
|
|
147
|
+
on("file:preprocessor", createBundler({
|
|
148
|
+
plugins: [createEsbuildPlugin(config)],
|
|
149
|
+
}));
|
|
137
150
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
});
|
|
145
|
-
});
|
|
151
|
+
allureCypress(on, config);
|
|
152
|
+
|
|
153
|
+
return config;
|
|
154
|
+
},
|
|
155
|
+
// ...
|
|
156
|
+
},
|
|
146
157
|
});
|
|
147
158
|
```
|
|
148
159
|
|
|
149
|
-
##
|
|
160
|
+
## Known limitations
|
|
150
161
|
|
|
151
|
-
|
|
152
|
-
This is useful when you need to set allureId for the tests with failing before hooks. Just add `@allure.id={idValue}` for the allureId or `@allure.label.{labelName}={labelValue}` for other types of labels.
|
|
162
|
+
### `setupNodeEvents` limitations
|
|
153
163
|
|
|
154
|
-
|
|
155
|
-
it("test with allureId @allure.id=256", () => {});
|
|
156
|
-
it("tst with severity @allure.label.severity=critical", () => {});
|
|
157
|
-
it("test with epic @allure.label.epic=login", () => {});
|
|
158
|
-
it("test with strangeLabel @allure.label.strangeLabel=strangeValue", () => {});
|
|
159
|
-
```
|
|
164
|
+
Cypress can't compose multiple Node events, which are set in `setupNodeEvents`.
|
|
160
165
|
|
|
161
|
-
|
|
162
|
-
> Note that changing title can cause creating new testcases in history.
|
|
163
|
-
> To fix this please add `@allure.id={yourTestCaseId}` to the test name if you passing allure metadata from test title
|
|
166
|
+
Allure Cypress requires access to the following events:
|
|
164
167
|
|
|
165
|
-
|
|
168
|
+
- `after:spec`
|
|
169
|
+
- `after:run`
|
|
166
170
|
|
|
167
|
-
|
|
171
|
+
Otherwise, it may not work as expected.
|
|
168
172
|
|
|
169
|
-
|
|
170
|
-
|
|
173
|
+
If you need to define your own handlers of those events, make sure to call the
|
|
174
|
+
corresponding functions of the `allureCypress`s' return value:
|
|
171
175
|
|
|
172
|
-
|
|
173
|
-
|
|
176
|
+
```javascript
|
|
177
|
+
import { defineConfig } from "cypress";
|
|
178
|
+
import { allureCypress } from "allure-cypress/reporter";
|
|
179
|
+
|
|
180
|
+
export default defineConfig({
|
|
174
181
|
e2e: {
|
|
175
182
|
setupNodeEvents: (on, config) => {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
183
|
+
const allurePlugin = allureCypress(on, config);
|
|
184
|
+
|
|
185
|
+
on("after:spec", (spec, results) => {
|
|
186
|
+
allurePlugin.onAfterSpec(spec, results);
|
|
187
|
+
|
|
188
|
+
// your code ...
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
on("after:run", (results) => {
|
|
192
|
+
allurePlugin.onAfterRun(results);
|
|
193
|
+
|
|
194
|
+
// your code ...
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
return config;
|
|
198
|
+
},
|
|
199
|
+
// ...
|
|
188
200
|
},
|
|
189
|
-
};
|
|
201
|
+
});
|
|
190
202
|
```
|
|
203
|
+
|
|
204
|
+
If you want to combine Allure Cypress with other plugins, consider using
|
|
205
|
+
[cypress-on-fix](https://github.com/bahmutov/cypress-on-fix). See the example for
|
|
206
|
+
[the Cypress Cucumber preprocessor](#combining-allure-with-other-cypress-plugins) above.
|
|
207
|
+
|
|
208
|
+
You may read more details and workarounds in issues [cypress-io/cypress#5240](https://github.com/cypress-io/cypress/issues/5240) and [cypress-io/cypress#22428](https://github.com/cypress-io/cypress/issues/22428).
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var A=Object.defineProperty;var le=Object.getOwnPropertyDescriptor;var ce=Object.getOwnPropertyNames;var de=Object.prototype.hasOwnProperty;var ge=(e,t)=>{for(var r in t)A(e,r,{get:t[r],enumerable:!0})},me=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of ce(t))!de.call(e,a)&&a!==r&&A(e,a,{get:()=>t[a],enumerable:!(s=le(t,a))||s.enumerable});return e};var fe=e=>me(A({},"__esModule",{value:!0}),e);var Ie={};ge(Ie,{AllureCypressTestRuntime:()=>b,ContentType:()=>G,LabelName:()=>l,LinkType:()=>E,Severity:()=>C,Stage:()=>f,Status:()=>p,StatusByPriority:()=>O,allureId:()=>$,attachment:()=>V,description:()=>H,descriptionHtml:()=>k,displayName:()=>B,epic:()=>J,feature:()=>X,historyId:()=>K,issue:()=>Y,label:()=>g,labels:()=>L,layer:()=>ae,link:()=>R,links:()=>j,owner:()=>re,parameter:()=>U,parentSuite:()=>ee,severity:()=>se,step:()=>W,story:()=>q,subSuite:()=>te,suite:()=>Q,tag:()=>ne,tags:()=>ie,testCaseId:()=>z,tms:()=>Z});module.exports=fe(Ie);var p=function(e){return e.FAILED="failed",e.BROKEN="broken",e.PASSED="passed",e.SKIPPED="skipped",e}({}),O=[p.FAILED,p.BROKEN,p.PASSED,p.SKIPPED],f=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}({}),C=function(e){return e.BLOCKER="blocker",e.CRITICAL="critical",e.NORMAL="normal",e.MINOR="minor",e.TRIVIAL="trivial",e}({}),G=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}({}),E=function(e){return e.ISSUE="issue",e.TMS="tms",e}({});function N(e,t,r,s,a,n,i){try{var u=e[n](i),o=u.value}catch(m){return void r(m)}u.done?t(o):Promise.resolve(o).then(s,a)}function d(e){return function(){var t=this,r=arguments;return new Promise(function(s,a){var n=e.apply(t,r);function i(o){N(n,s,a,i,u,"next",o)}function u(o){N(n,s,a,i,u,"throw",o)}i(void 0)})}}var w=class{attachment(){var t=this;return d(function*(){yield t.warning()})()}description(){var t=this;return d(function*(){yield t.warning()})()}descriptionHtml(){var t=this;return d(function*(){yield t.warning()})()}displayName(){var t=this;return d(function*(){yield t.warning()})()}historyId(){var t=this;return d(function*(){yield t.warning()})()}labels(){var t=this;return d(function*(){yield t.warning()})()}links(){var t=this;return d(function*(){yield t.warning()})()}parameter(){var t=this;return d(function*(){yield t.warning()})()}step(t,r){var s=this;return d(function*(){return yield s.warning(),r()})()}stepDisplayName(){var t=this;return d(function*(){yield t.warning()})()}stepParameter(){var t=this;return d(function*(){yield t.warning()})()}testCaseId(){var t=this;return d(function*(){yield t.warning()})()}warning(){return d(function*(){console.log("no test runtime is found. Please check test framework configuration")})()}},h=new w;var F="allureTestRuntime",T=e=>{globalThis[F]=()=>e},I=()=>globalThis?.[F],v=()=>{var e=I();if(e){var t;return(t=e())!==null&&t!==void 0?t:h}return h},P=()=>{var e=I();if(e){var t;return(t=e())!==null&&t!==void 0?t:h}if("_playwrightInstance"in globalThis)try{return(0,eval)("(() => import('allure-playwright/autoconfig'))()").then(()=>{var r,s;return(r=(s=I())===null||s===void 0?void 0:s())!==null&&r!==void 0?r:h})}catch(r){return console.log("can't execute allure-playwright/autoconfig",r),h}return h};function S(){S=function(n,i){return new r(n,void 0,i)};var e=RegExp.prototype,t=new WeakMap;function r(a,n,i){var u=RegExp(a,n);return t.set(u,i||t.get(a)),x(u,r.prototype)}function s(a,n){var i=t.get(n);return Object.keys(i).reduce(function(u,o){var m=i[o];if(typeof m=="number")u[o]=a[m];else{for(var y=0;a[m[y]]===void 0&&y+1<m.length;)y++;u[o]=a[m[y]]}return u},Object.create(null))}return ye(r,RegExp),r.prototype.exec=function(a){var n=e.exec.call(this,a);if(n){n.groups=s(n,this);var i=n.indices;i&&(i.groups=s(i,this))}return n},r.prototype[Symbol.replace]=function(a,n){if(typeof n=="string"){var i=t.get(this);return e[Symbol.replace].call(this,a,n.replace(/\$<([^>]+)>/g,function(o,m){var y=i[m];return"$"+(Array.isArray(y)?y.join("$"):y)}))}if(typeof n=="function"){var u=this;return e[Symbol.replace].call(this,a,function(){var o=arguments;return typeof o[o.length-1]!="object"&&(o=[].slice.call(o)).push(s(o,u)),n.apply(this,o)})}return e[Symbol.replace].call(this,a,n)},S.apply(this,arguments)}function ye(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&&x(e,t)}function x(e,t){return x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},x(e,t)}var he=S(/@?allure.id[:=]([^\s]+)/,{id:1}),Ge=new RegExp(he,"g"),ve=S(/@?allure.label.([^\s]+?)[:=]([^\s]+)/,{name:1,value:2}),Ne=new RegExp(ve,"g");var _=e=>e.some(t=>t.type==="step_start"||t.type==="step_stop"),Ee=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(a=>a.length===1);return s===-1||t[s].push(r),t},[]),M=e=>{var t=Ee(e);return t.filter(r=>r.length===1)},D=e=>!!e&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function";var c=function(t){for(var r=arguments.length,s=new Array(r>1?r-1:0),a=1;a<r;a++)s[a-1]=arguments[a];var n=P();return D(n)?n.then(i=>i[t](...s)):n[t](...s)},g=(e,t)=>c("labels",{name:e,value:t}),L=function(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];return c("labels",...r)},R=(e,t,r)=>c("links",{url:e,type:t,name:r}),j=function(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];return c("links",...r)},U=(e,t,r)=>c("parameter",e,t,r),H=e=>c("description",e),k=e=>c("descriptionHtml",e),B=e=>c("displayName",e),K=e=>c("historyId",e),z=e=>c("testCaseId",e),V=(e,t,r)=>c("attachment",e,t,r),Se=()=>({displayName:e=>c("stepDisplayName",e),parameter:(e,t,r)=>c("stepParameter",e,t,r)}),W=(e,t)=>c("step",e,()=>t(Se())),Y=(e,t)=>R(e,E.ISSUE,t),Z=(e,t)=>R(e,E.TMS,t),$=e=>g(l.ALLURE_ID,e),J=e=>g(l.EPIC,e),X=e=>g(l.FEATURE,e),q=e=>g(l.STORY,e),Q=e=>g(l.SUITE,e),ee=e=>g(l.PARENT_SUITE,e),te=e=>g(l.SUB_SUITE,e),re=e=>g(l.OWNER,e),se=e=>g(l.SEVERITY,e),ae=e=>g(l.LAYER,e),ne=e=>g(l.TAG,e),ie=function(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];return c("labels",...r.map(a=>({name:l.TAG,value:a})))};var oe=e=>Array.isArray(e)||e.buffer?btoa(String.fromCharCode.apply(null,e)):e,ue=(e,t)=>Array.isArray(e)||e.buffer?"base64":t,pe=e=>{let t=[],r=e.parent;for(;r;)r.title&&t.unshift(r.title),r=r.parent;return t};var b=class{label(t,r){return this.sendMessageAsync({type:"metadata",data:{labels:[{name:t,value:r}]}})}labels(...t){return this.sendMessageAsync({type:"metadata",data:{labels:t}})}link(t,r,s){return this.sendMessageAsync({type:"metadata",data:{links:[{type:r,url:t,name:s}]}})}links(...t){return this.sendMessageAsync({type:"metadata",data:{links:t}})}parameter(t,r,s){return this.sendMessageAsync({type:"metadata",data:{parameters:[{name:t,value:r,...s}]}})}description(t){return this.sendMessageAsync({type:"metadata",data:{description:t}})}descriptionHtml(t){return this.sendMessageAsync({type:"metadata",data:{descriptionHtml:t}})}displayName(t){return this.sendMessageAsync({type:"metadata",data:{displayName:t}})}historyId(t){return this.sendMessageAsync({type:"metadata",data:{historyId:t}})}testCaseId(t){return this.sendMessageAsync({type:"metadata",data:{testCaseId:t}})}attachment(t,r,s){let a=r?.type==="Buffer"?r.data:r,n=r instanceof Buffer?"base64":"utf-8",i=ue(a,n),u=oe(a);return this.sendMessageAsync({type:"raw_attachment",data:{content:u,encoding:i,contentType:s,name:t}})}step(t,r){return cy.wrap(null,{log:!1}).then(()=>(this.sendMessage({type:"step_start",data:{name:t,start:Date.now()}}),Cypress.Promise.resolve(r()))).then(s=>this.sendMessageAsync({type:"step_stop",data:{status:p.PASSED,stage:f.FINISHED,stop:Date.now()}}).then(()=>s))}stepDisplayName(t){return this.sendMessageAsync({type:"step_metadata",data:{name:t}})}stepParameter(t,r,s){return this.sendMessageAsync({type:"step_metadata",data:{parameters:[{name:t,value:r,mode:s}]}})}sendMessage(t){let r=Cypress.env("allureRuntimeMessages")||[];Cypress.env("allureRuntimeMessages",r.concat(t))}sendMessageAsync(t){return this.sendMessage(t),Cypress.Promise.resolve()}},{EVENT_TEST_BEGIN:Re,EVENT_TEST_FAIL:be,EVENT_TEST_PASS:Ae}=Mocha.Runner.constants,we=()=>{Cypress.env("allureInitialized")||(Cypress.mocha.getRunner().on(Re,t=>{let r=new b;Cypress.env("allureRuntimeMessages",[]),r.sendMessage({type:"cypress_start",data:{isInteractive:Cypress.config("isInteractive"),absolutePath:Cypress.spec.absolute,specPath:pe(t).concat(t.title),filename:Cypress.spec.relative,start:Date.now()}}),T(r)}).on(Ae,()=>{let t=v(),r=Cypress.env("allureRuntimeMessages");M(r).forEach(()=>{t.sendMessage({type:"step_stop",data:{stage:f.FINISHED,status:p.PASSED,stop:Date.now()}})}),t.sendMessage({type:"cypress_end",data:{stage:f.FINISHED,status:p.PASSED,stop:Date.now()}})}).on(be,(t,r)=>{v().sendMessage({type:"cypress_end",data:{stage:f.FINISHED,status:r.constructor.name==="AssertionError"?p.FAILED:p.BROKEN,statusDetails:{message:r.message,trace:r.stack},stop:Date.now()}})}),Cypress.Screenshot.defaults({onAfterScreenshot:(t,r)=>{v().sendMessage({type:"cypress_screenshot",data:{path:r.path,name:r.name||"Screenshot"}})}}),Cypress.on("fail",t=>{let r=v(),s=Cypress.env("allureRuntimeMessages");if(!_(s))throw t;let n=M(s);if(n.length===0)throw t;let i=t.constructor.name==="AssertionError"?p.FAILED:p.BROKEN;throw n.forEach(()=>{r.sendMessage({type:"step_stop",data:{stage:f.FINISHED,status:i,stop:Date.now(),statusDetails:{message:t.message,trace:t.stack}}})}),t}),afterEach(()=>{let t=Cypress.env("allureRuntimeMessages");cy.task("allureReportTest",t,{log:!1})}),Cypress.env("allureInitialized",!0))};we();
|
|
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();
|
|
2
2
|
//# sourceMappingURL=index.js.map
|