allure-cypress 3.0.0-beta.8 → 3.0.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/README.md +181 -147
- 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 +557 -202
- package/dist/cjs/reporter.js.map +1 -1
- package/dist/cjs/runtime.js +649 -0
- package/dist/cjs/runtime.js.map +1 -0
- package/dist/cjs/state.js +56 -0
- package/dist/cjs/state.js.map +1 -0
- package/dist/cjs/utils.js +136 -37
- 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 +560 -205
- package/dist/esm/reporter.js.map +1 -1
- package/dist/esm/runtime.js +620 -0
- package/dist/esm/runtime.js.map +1 -0
- package/dist/esm/state.js +38 -0
- package/dist/esm/state.js.map +1 -0
- package/dist/esm/utils.js +126 -35
- package/dist/esm/utils.js.map +1 -1
- package/dist/types/index.d.ts +0 -22
- package/dist/types/model.d.ts +95 -45
- package/dist/types/reporter.d.ts +75 -9
- package/dist/types/runtime.d.ts +50 -0
- package/dist/types/state.d.ts +18 -0
- package/dist/types/utils.d.ts +48 -10
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -14,214 +14,248 @@
|
|
|
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/).
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
## Allure Cypress options
|
|
74
|
+
|
|
75
|
+
Customize Allure Cypress by providing a configuration object as the third argument
|
|
76
|
+
of `allureCypress`.
|
|
80
77
|
|
|
81
|
-
|
|
82
|
-
const { allureCypress } = require("allure-cypress/reporter");
|
|
78
|
+
The following options are supported:
|
|
83
79
|
|
|
84
|
-
|
|
85
|
-
|
|
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
|
|
98
|
+
|
|
99
|
+
Here is an example of the Allure Cypress configuration:
|
|
100
|
+
|
|
101
|
+
```javascript
|
|
102
|
+
import { defineConfig } from "cypress";
|
|
103
|
+
import { allureCypress } from "allure-cypress/reporter";
|
|
104
|
+
|
|
105
|
+
export default defineConfig({
|
|
86
106
|
e2e: {
|
|
87
107
|
setupNodeEvents: (on, config) => {
|
|
88
|
-
allureCypress(on, {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
108
|
+
allureCypress(on, config, {
|
|
109
|
+
resultsDir: "my-allure-results",
|
|
110
|
+
videoOnFailOnly: true,
|
|
111
|
+
links: {
|
|
112
|
+
link: {
|
|
113
|
+
urlTemplate: "https://github.com/allure-framework/allure-js/blob/main/%s",
|
|
114
|
+
},
|
|
115
|
+
issue: {
|
|
116
|
+
urlTemplate: "https://github.com/allure-framework/allure-js/issues/%s",
|
|
117
|
+
nameTemplate: "ISSUE-%s",
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
stepsFromCommands: {
|
|
121
|
+
maxArgumentLength: 64,
|
|
122
|
+
maxArgumentDepth: 5,
|
|
123
|
+
},
|
|
124
|
+
environmentInfo: {
|
|
125
|
+
OS: os.platform(),
|
|
126
|
+
Architecture: os.arch(),
|
|
127
|
+
NodeVersion: process.version,
|
|
128
|
+
},
|
|
129
|
+
categories: [
|
|
130
|
+
{
|
|
131
|
+
name: "Missing file errors",
|
|
132
|
+
messageRegex: /^ENOENT: no such file or directory/,
|
|
133
|
+
},
|
|
134
|
+
],
|
|
135
|
+
});
|
|
105
136
|
|
|
106
137
|
return config;
|
|
107
138
|
},
|
|
139
|
+
// other Cypress config properties ...
|
|
108
140
|
},
|
|
109
|
-
};
|
|
141
|
+
});
|
|
110
142
|
```
|
|
111
143
|
|
|
112
|
-
|
|
144
|
+
More details about Allure Cypress configuration are available at [https://allurereport.org/docs/cypress-configuration/](https://allurereport.org/docs/cypress-configuration/).
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
## Combining Allure with other Cypress plugins
|
|
113
148
|
|
|
114
|
-
|
|
115
|
-
|
|
149
|
+
Use [cypress-on-fix](https://github.com/bahmutov/cypress-on-fix) to enable Allure
|
|
150
|
+
with other Cypress plugins. See more info [here](#setupnodeevents-limitations).
|
|
151
|
+
|
|
152
|
+
In the next example, Allure Cypress is enabled together with [@badeball/cypress-cucumber-preprocessor](https://github.com/badeball/cypress-cucumber-preprocessor):
|
|
153
|
+
|
|
154
|
+
```javascript
|
|
155
|
+
import { defineConfig } from "cypress";
|
|
156
|
+
import { allureCypress } from "allure-cypress/reporter";
|
|
157
|
+
import createBundler from "@bahmutov/cypress-esbuild-preprocessor";
|
|
158
|
+
import { addCucumberPreprocessorPlugin } from "@badeball/cypress-cucumber-preprocessor";
|
|
159
|
+
import { createEsbuildPlugin } from "@badeball/cypress-cucumber-preprocessor/esbuild";
|
|
160
|
+
import cypressOnFix from "cypress-on-fix";
|
|
161
|
+
|
|
162
|
+
export default defineConfig({
|
|
163
|
+
e2e: {
|
|
164
|
+
setupNodeEvents = async (on, config) => {
|
|
165
|
+
on = cypressOnFix(on);
|
|
166
|
+
await addCucumberPreprocessorPlugin(on, config);
|
|
116
167
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
168
|
+
on("file:preprocessor", createBundler({
|
|
169
|
+
plugins: [createEsbuildPlugin(config)],
|
|
170
|
+
}));
|
|
171
|
+
|
|
172
|
+
allureCypress(on, config);
|
|
173
|
+
|
|
174
|
+
return config;
|
|
175
|
+
},
|
|
176
|
+
// ...
|
|
177
|
+
},
|
|
124
178
|
});
|
|
125
179
|
```
|
|
126
180
|
|
|
127
|
-
##
|
|
181
|
+
## Common issues
|
|
128
182
|
|
|
129
|
-
The
|
|
183
|
+
### The test plan feature doesn't work
|
|
130
184
|
|
|
131
|
-
|
|
132
|
-
import { step } from "allure-js-commons";
|
|
185
|
+
Make sure you pass the Cypress config as the second argument of `allureCypress`.
|
|
133
186
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
187
|
+
Correct:
|
|
188
|
+
|
|
189
|
+
```javascript
|
|
190
|
+
allureCypress(on, config);
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Also correct:
|
|
194
|
+
|
|
195
|
+
```javascript
|
|
196
|
+
allureCypress(on, config, {
|
|
197
|
+
resultsDir: "output",
|
|
142
198
|
});
|
|
143
199
|
```
|
|
144
200
|
|
|
145
|
-
|
|
201
|
+
Incorrect (the test plan won't work):
|
|
146
202
|
|
|
147
|
-
|
|
148
|
-
|
|
203
|
+
```javascript
|
|
204
|
+
allureCypress(on);
|
|
205
|
+
```
|
|
149
206
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
207
|
+
Also incorrect (the legacy style; the test plan won't work either):
|
|
208
|
+
|
|
209
|
+
```javascript
|
|
210
|
+
allureCypress(on, {
|
|
211
|
+
resultsDir: "output",
|
|
212
|
+
});
|
|
155
213
|
```
|
|
156
214
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
215
|
+
### `setupNodeEvents` limitations
|
|
216
|
+
|
|
217
|
+
Cypress can't compose multiple Node events, which are set in `setupNodeEvents`.
|
|
218
|
+
|
|
219
|
+
Allure Cypress requires access to the following events:
|
|
220
|
+
|
|
221
|
+
- `after:spec`
|
|
222
|
+
- `after:run`
|
|
160
223
|
|
|
161
|
-
|
|
224
|
+
Otherwise, it may not work as expected.
|
|
162
225
|
|
|
163
|
-
If you
|
|
226
|
+
If you need to define your own handlers of those events, make sure to call the
|
|
227
|
+
corresponding functions of the `allureCypress`s' return value:
|
|
164
228
|
|
|
165
|
-
```
|
|
166
|
-
|
|
229
|
+
```javascript
|
|
230
|
+
import { defineConfig } from "cypress";
|
|
231
|
+
import { allureCypress } from "allure-cypress/reporter";
|
|
167
232
|
|
|
168
|
-
|
|
169
|
-
// ...
|
|
233
|
+
export default defineConfig({
|
|
170
234
|
e2e: {
|
|
171
235
|
setupNodeEvents: (on, config) => {
|
|
172
|
-
|
|
173
|
-
+ resultsDir: "./allure-results",
|
|
174
|
-
+ });
|
|
175
|
-
+
|
|
176
|
-
+ allureCypress.attachToCypress(on, config);
|
|
177
|
-
+
|
|
178
|
-
+ on("after:run", (results) => {
|
|
179
|
-
+ allureCypress.endRun(results);
|
|
180
|
-
+ });
|
|
181
|
-
+
|
|
182
|
-
+ return config;
|
|
183
|
-
+ },
|
|
184
|
-
},
|
|
185
|
-
};
|
|
186
|
-
```
|
|
236
|
+
const allurePlugin = allureCypress(on, config);
|
|
187
237
|
|
|
188
|
-
|
|
238
|
+
on("after:spec", (spec, results) => {
|
|
239
|
+
allurePlugin.onAfterSpec(spec, results);
|
|
189
240
|
|
|
190
|
-
|
|
241
|
+
// your code ...
|
|
242
|
+
});
|
|
191
243
|
|
|
192
|
-
|
|
193
|
-
|
|
244
|
+
on("after:run", (results) => {
|
|
245
|
+
allurePlugin.onAfterRun(results);
|
|
194
246
|
|
|
195
|
-
|
|
196
|
-
// ...
|
|
197
|
-
e2e: {
|
|
198
|
-
+ video: true,
|
|
199
|
-
setupNodeEvents: (on, config) => {
|
|
200
|
-
allureCypress(on, {
|
|
201
|
-
+ videoOnFailOnly: true,
|
|
247
|
+
// your code ...
|
|
202
248
|
});
|
|
203
249
|
|
|
204
250
|
return config;
|
|
205
251
|
},
|
|
252
|
+
// ...
|
|
206
253
|
},
|
|
207
|
-
};
|
|
254
|
+
});
|
|
208
255
|
```
|
|
209
256
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
257
|
+
If you want to combine Allure Cypress with other plugins, consider using
|
|
258
|
+
[cypress-on-fix](https://github.com/bahmutov/cypress-on-fix). See the example for
|
|
259
|
+
[the Cypress Cucumber preprocessor](#combining-allure-with-other-cypress-plugins) above.
|
|
213
260
|
|
|
214
|
-
|
|
215
|
-
If you want to see the hooks in the report wrap your tests into `describe` block and move the hooks inside it:
|
|
216
|
-
|
|
217
|
-
```js
|
|
218
|
-
// this hook won't be reported
|
|
219
|
-
after(() => {})
|
|
220
|
-
|
|
221
|
-
describe("suite", () => {
|
|
222
|
-
// this hook will be reported
|
|
223
|
-
after(() => {})
|
|
224
|
-
|
|
225
|
-
it("test", () => {})
|
|
226
|
-
})
|
|
227
|
-
```
|
|
261
|
+
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 I=Object.defineProperty;var Ae=Object.getOwnPropertyDescriptor;var Ce=Object.getOwnPropertyNames;var be=Object.prototype.hasOwnProperty;var Pe=(t,e)=>{for(var s in e)I(t,s,{get:e[s],enumerable:!0})},we=(t,e,s,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Ce(e))!be.call(t,a)&&a!==s&&I(t,a,{get:()=>e[a],enumerable:!(r=Ae(e,a))||r.enumerable});return t};var Ie=t=>we(I({},"__esModule",{value:!0}),t);var Xe={};Pe(Xe,{AllureCypressTestRuntime:()=>M,ContentType:()=>T,LabelName:()=>l,LinkType:()=>S,Severity:()=>$,Stage:()=>K,Status:()=>u,StatusByPriority:()=>V,allureId:()=>le,attachment:()=>ae,attachmentPath:()=>ne,description:()=>Q,descriptionHtml:()=>ee,displayName:()=>te,epic:()=>de,feature:()=>ce,historyId:()=>se,issue:()=>pe,label:()=>g,labels:()=>J,layer:()=>_e,link:()=>b,links:()=>q,logStep:()=>ie,owner:()=>he,parameter:()=>X,parentSuite:()=>ge,severity:()=>ve,step:()=>oe,story:()=>me,subSuite:()=>fe,suite:()=>ye,tag:()=>Se,tags:()=>Ee,testCaseId:()=>re,tms:()=>ue});module.exports=Ie(Xe);var u=function(t){return t.FAILED="failed",t.BROKEN="broken",t.PASSED="passed",t.SKIPPED="skipped",t}({}),V=[u.FAILED,u.BROKEN,u.PASSED,u.SKIPPED],K=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}({}),$=function(t){return t.BLOCKER="blocker",t.CRITICAL="critical",t.NORMAL="normal",t.MINOR="minor",t.TRIVIAL="trivial",t}({}),T=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}({}),S=function(t){return t.DEFAULT="link",t.ISSUE="issue",t.TMS="tms",t}({});function z(t,e,s,r,a,n,i){try{var p=t[n](i),o=p.value}catch(m){return void s(m)}p.done?e(o):Promise.resolve(o).then(r,a)}function c(t){return function(){var e=this,s=arguments;return new Promise(function(r,a){var n=t.apply(e,s);function i(o){z(n,r,a,i,p,"next",o)}function p(o){z(n,r,a,i,p,"throw",o)}i(void 0)})}}var D=class{attachment(){var e=this;return c(function*(){yield e.warning()})()}attachmentFromPath(){var e=this;return c(function*(){yield e.warning()})()}description(){var e=this;return c(function*(){yield e.warning()})()}descriptionHtml(){var e=this;return c(function*(){yield e.warning()})()}displayName(){var e=this;return c(function*(){yield e.warning()})()}historyId(){var e=this;return c(function*(){yield e.warning()})()}labels(){var e=this;return c(function*(){yield e.warning()})()}links(){var e=this;return c(function*(){yield e.warning()})()}parameter(){var e=this;return c(function*(){yield e.warning()})()}logStep(){var e=this;return c(function*(){yield e.warning()})()}step(e,s){var r=this;return c(function*(){return yield r.warning(),s()})()}stepDisplayName(){var e=this;return c(function*(){yield e.warning()})()}stepParameter(){var e=this;return c(function*(){yield e.warning()})()}testCaseId(){var e=this;return c(function*(){yield e.warning()})()}warning(){return c(function*(){console.log("no test runtime is found. Please check test framework configuration")})()}},v=new D;var Y="allureTestRuntime",k=t=>{globalThis[Y]=()=>t},O=()=>globalThis?.[Y],y=()=>{var t=O();if(t){var e;return(e=t())!==null&&e!==void 0?e:v}return v},N=()=>{var t=O();if(t){var e;return(e=t())!==null&&e!==void 0?e:v}if("_playwrightInstance"in globalThis)try{return(0,eval)("(() => import('allure-playwright/autoconfig'))()").then(()=>{var s,r;return(s=(r=O())===null||r===void 0?void 0:r())!==null&&s!==void 0?s:v})}catch(s){return console.log("can't execute allure-playwright/autoconfig",s),v}return v};function x(){x=function(n,i){return new s(n,void 0,i)};var t=RegExp.prototype,e=new WeakMap;function s(a,n,i){var p=RegExp(a,n);return e.set(p,i||e.get(a)),R(p,s.prototype)}function r(a,n){var i=e.get(n);return Object.keys(i).reduce(function(p,o){var m=i[o];if(typeof m=="number")p[o]=a[m];else{for(var f=0;a[m[f]]===void 0&&f+1<m.length;)f++;p[o]=a[m[f]]}return p},Object.create(null))}return De(s,RegExp),s.prototype.exec=function(a){var n=t.exec.call(this,a);if(n){n.groups=r(n,this);var i=n.indices;i&&(i.groups=r(i,this))}return n},s.prototype[Symbol.replace]=function(a,n){if(typeof n=="string"){var i=e.get(this);return t[Symbol.replace].call(this,a,n.replace(/\$<([^>]+)>/g,function(o,m){var f=i[m];return"$"+(Array.isArray(f)?f.join("$"):f)}))}if(typeof n=="function"){var p=this;return t[Symbol.replace].call(this,a,function(){var o=arguments;return typeof o[o.length-1]!="object"&&(o=[].slice.call(o)).push(r(o,p)),n.apply(this,o)})}return t[Symbol.replace].call(this,a,n)},x.apply(this,arguments)}function De(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&&R(t,e)}function R(t,e){return R=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,r){return s.__proto__=r,s},R(t,e)}var Oe=function(){var{onlyFirst:e=!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,e?void 0:"g")},G=t=>{var e=Oe();return t.replace(e,"")},A=t=>{var{message:e,stack:s}=t;return{message:e?G(e):void 0,trace:s?G(s):void 0}},W=x(/(?:^|\s)@?allure\.id[:=]([^\s]+)/,{id:1}),ke=new RegExp(W,"g"),Z=x(/(?:^|\s)@?allure\.label\.([^:=\s]+)[:=]([^\s]+)/,{name:1,value:2}),Ne=new RegExp(Z,"g"),H=t=>{var e=[];t.split(" ").forEach(r=>{var a,n=(a=r.match(W))===null||a===void 0||(a=a.groups)===null||a===void 0?void 0:a.id;n&&e.push({name:l.ALLURE_ID,value:n});var i=r.match(Z),{name:p,value:o}=i?.groups||{};p&&o&&e?.push({name:p,value:o})});var s=t.replace(Ne,"").replace(ke,"").trim();return{labels:e,cleanTitle:s}};var L=t=>t.some(e=>e.type==="step_start"||e.type==="step_stop"),Ge=t=>t.reduce((e,s)=>{if(s.type!=="step_start"&&s.type!=="step_stop")return e;if(s.type==="step_start")return e.push([s]),e;var r=e.findLastIndex(a=>a.length===1);return r===-1||e[r].push(s),e},[]),C=t=>{var e=Ge(t);return e.filter(s=>s.length===1)},U=t=>!!t&&(typeof t=="object"||typeof t=="function")&&typeof t.then=="function";var d=function(e){for(var s=arguments.length,r=new Array(s>1?s-1:0),a=1;a<s;a++)r[a-1]=arguments[a];var n=N();return U(n)?n.then(i=>i[e](...r)):n[e](...r)},g=(t,e)=>d("labels",{name:t,value:e}),J=function(){for(var e=arguments.length,s=new Array(e),r=0;r<e;r++)s[r]=arguments[r];return d("labels",...s)},b=(t,e,s)=>d("links",{url:t,type:s,name:e}),q=function(){for(var e=arguments.length,s=new Array(e),r=0;r<e;r++)s[r]=arguments[r];return d("links",...s)},X=(t,e,s)=>d("parameter",t,e,s),Q=t=>d("description",t),ee=t=>d("descriptionHtml",t),te=t=>d("displayName",t),se=t=>d("historyId",t),re=t=>d("testCaseId",t),ae=(t,e,s)=>{var r=typeof s=="string"?{contentType:s}:s;return d("attachment",t,e,r)},ne=(t,e,s)=>{var r=typeof s=="string"?{contentType:s}:s;return d("attachmentFromPath",t,e,r)},He=()=>({displayName:t=>d("stepDisplayName",t),parameter:(t,e,s)=>d("stepParameter",t,e,s)}),ie=(t,e,s)=>d("logStep",t,e,s),oe=(t,e)=>d("step",t,()=>e(He())),pe=(t,e)=>b(t,e,S.ISSUE),ue=(t,e)=>b(t,e,S.TMS),le=t=>g(l.ALLURE_ID,t),de=t=>g(l.EPIC,t),ce=t=>g(l.FEATURE,t),me=t=>g(l.STORY,t),ye=t=>g(l.SUITE,t),ge=t=>g(l.PARENT_SUITE,t),fe=t=>g(l.SUB_SUITE,t),he=t=>g(l.OWNER,t),ve=t=>g(l.SEVERITY,t),_e=t=>g(l.LAYER,t),Se=t=>g(l.TAG,t),Ee=function(){for(var e=arguments.length,s=new Array(e),r=0;r<e;r++)s[r]=arguments[r];return d("labels",...s.map(a=>({name:l.TAG,value:a})))};var _="__allure_report_system_hook__",E="__allure_report_step_command__";var Me=t=>Array.isArray(t)||t.buffer?btoa(String.fromCharCode.apply(null,t)):t,P=t=>{let e=[],s=t.parent;for(;s;)s.title&&e.unshift(s.title),s=s.parent;return e},j=t=>je(t.attributes.args)?.log===!1||t.attributes.name==="task"&&t.attributes.args[0]==="allureReportTest"||t.attributes.name==="then"||t.attributes.name==="wrap"&&t.attributes.args[0]===E,F=t=>{let e=[];for(let s=t.length-1;s>=0;s--)e.push(t[s]);return e},w=t=>/(before|after) all/.test(t),Te=t=>t.includes("before")?"before":"after",je=t=>t[t.length-1],B=(t,e,s)=>{let r=`${e.relative}#${t.titlePath.join(" ")}`,{labels:a}=H(t.title),n=a.find(({name:i})=>i===l.ALLURE_ID);return s.tests.some(({id:i,selector:p=""})=>(i?String(i)===n?.value:!1)||p===r)};var M=class{labels(...e){return this.sendMessageAsync({type:"metadata",data:{labels:e}})}links(...e){return this.sendMessageAsync({type:"metadata",data:{links:e}})}parameter(e,s,r){return this.sendMessageAsync({type:"metadata",data:{parameters:[{name:e,value:s,...r}]}})}description(e){return this.sendMessageAsync({type:"metadata",data:{description:e}})}descriptionHtml(e){return this.sendMessageAsync({type:"metadata",data:{descriptionHtml:e}})}displayName(e){return this.sendMessageAsync({type:"metadata",data:{displayName:e}})}historyId(e){return this.sendMessageAsync({type:"metadata",data:{historyId:e}})}testCaseId(e){return this.sendMessageAsync({type:"metadata",data:{testCaseId:e}})}attachment(e,s,r){let a=s?.type==="Buffer"?s.data:s,n=typeof a=="string"?"utf8":"base64",i=Me(a);return this.sendMessageAsync({type:"attachment_content",data:{name:e,content:i,encoding:n,contentType:r.contentType,fileExtension:r.fileExtension}})}attachmentFromPath(e,s,r){return this.sendMessageAsync({type:"attachment_path",data:{name:e,path:s,contentType:r.contentType,fileExtension:r.fileExtension}})}logStep(e,s=u.PASSED,r){return cy.wrap(E,{log:!1}).then(()=>(this.sendMessage({type:"step_start",data:{name:e,start:Date.now()}}),Cypress.Promise.resolve())).then(()=>this.sendMessageAsync({type:"step_stop",data:{status:s,stop:Date.now(),statusDetails:r?{...A(r)}:void 0}}))}step(e,s){return cy.wrap(E,{log:!1}).then(()=>(this.sendMessage({type:"step_start",data:{name:e,start:Date.now()}}),Cypress.Promise.resolve(s()))).then(r=>this.sendMessageAsync({type:"step_stop",data:{status:u.PASSED,stop:Date.now()}}).then(()=>r))}stepDisplayName(e){return this.sendMessageAsync({type:"step_metadata",data:{name:e}})}stepParameter(e,s,r){return this.sendMessageAsync({type:"step_metadata",data:{parameters:[{name:e,value:s,mode:r}]}})}sendMessage(e){let s=Cypress.env("allureRuntimeMessages")||[];Cypress.env("allureRuntimeMessages",s.concat(e))}sendMessageAsync({type:e,data:s}){return this.sendMessage({type:e,data:{...s,cypressTestId:Cypress.state("test")?.id??""}}),Cypress.Promise.resolve()}},{EVENT_RUN_BEGIN:Fe,EVENT_RUN_END:Be,EVENT_TEST_BEGIN:Ve,EVENT_TEST_FAIL:Ke,EVENT_TEST_PASS:$e,EVENT_TEST_PENDING:ze,EVENT_SUITE_BEGIN:Ye,EVENT_SUITE_END:We,EVENT_HOOK_BEGIN:Ze,EVENT_HOOK_END:Je}=Mocha.Runner.constants,qe=()=>{Cypress.env("allureInitialized")||(Cypress.env("allureInitialized",!0),Cypress.mocha.getRunner().on(Fe,()=>{let e=new M;Cypress.env("allureRuntimeMessages",[]),k(e)}).on(Ze,e=>{if(e.title.includes(_))return;let s=y(),r=Cypress.state()?.test?.id;s.sendMessageAsync({type:"cypress_hook_start",data:{id:r?`${r}:${e.hookId}`:"",parentId:e.parent.id,name:e.title,type:Te(e.title),start:Date.now(),global:w(e.title)}})}).on(Je,e=>{if(e.title.includes(_))return;let s=y(),r=Cypress.env("allureRuntimeMessages"),a=F(r).find(({type:n})=>n==="cypress_hook_start");return a.data.id||(a.data.id=`${e.id}:${e.hookId}`),s.sendMessageAsync({type:"cypress_hook_end",data:{id:a.data.id,parentId:e.parent.id,status:u.PASSED,stop:a.data.start+(e.duration??0),global:w(e.title)}})}).on(Ye,e=>y().sendMessageAsync({type:"cypress_suite_start",data:{id:e.titlePath().join(" "),name:e.title}})).on(We,e=>y().sendMessageAsync({type:"cypress_suite_end",data:{id:e.titlePath().join(" ")}})).on(Ve,e=>{y().sendMessage({type:"cypress_test_start",data:{id:e.id,specPath:P(e).concat(e.title),filename:Cypress.spec.relative,start:e.wallClockStartedAt?.getTime()||Date.now()}})}).on($e,e=>{let s=y(),r=Cypress.env("allureRuntimeMessages"),a=C(r),n=e._retries??0;a.forEach(()=>{s.sendMessage({type:"step_stop",data:{status:u.PASSED,stop:Date.now()}})}),s.sendMessage({type:"cypress_test_end",data:{id:e.id,status:u.PASSED,stop:Date.now(),retries:n}})}).on(Ke,(e,s)=>{let r=y(),a=Cypress.env("allureRuntimeMessages"),n=a.toReversed().findIndex(({type:h})=>h==="cypress_command_start"),i=a.toReversed().findIndex(({type:h})=>h==="cypress_command_end"),p=n>i,o=s.constructor.name==="AssertionError"?u.FAILED:u.BROKEN,m={message:s.message,trace:s.stack},f=e._retries??0;if(p&&r.sendMessage({type:"cypress_command_end",data:{id:a[n].data.id,status:o,statusDetails:m}}),e.hookName){let h=a.toReversed().find(({type:Re})=>Re==="cypress_hook_start");return r.sendMessageAsync({type:"cypress_hook_end",data:{id:h.data.id,status:o,statusDetails:m,stop:h.data.start+(e.duration??0),parentId:h.data.parentId,global:w(e.hookName)}})}!e.hookName&&e.wallClockStartedAt===void 0&&r.sendMessage({type:"cypress_test_start",data:{id:e.id,specPath:P(e).concat(e.title),filename:Cypress.spec.relative,start:Date.now()}});let xe=F(a).find(({type:h})=>h==="cypress_test_start");r.sendMessage({type:"cypress_test_end",data:{id:e.id,status:o,statusDetails:m,stop:xe.data.start+(e.duration??0),retries:f}})}).on(ze,e=>{let s=new M,r=Cypress.env("allureTestPlan");if(r&&!B(Cypress.currentTest,Cypress.spec,r))return;let a=e._retries??0;return s.sendMessageAsync({type:"cypress_test_start",data:{id:e.id,specPath:P(e).concat(e.title),filename:Cypress.spec.relative,start:Date.now()}}),s.sendMessageAsync({type:"cypress_test_end",data:{id:e.id,status:u.SKIPPED,stop:Date.now(),retries:a}})}).on(Be,()=>{Cypress.config("isInteractive")&&cy.task("allureReportSpec",{absolute:Cypress.spec.absolute})}),Cypress.Screenshot.defaults({onAfterScreenshot:(e,s)=>y().sendMessageAsync({type:"attachment_path",data:{path:s.path,name:s.name||"Screenshot",contentType:T.PNG}})}),Cypress.on("fail",e=>{let s=y(),r=Cypress.env("allureRuntimeMessages");if(!L(r))throw e;let n=C(r);if(n.length===0)throw e;let i=e.constructor.name==="AssertionError"?u.FAILED:u.BROKEN;throw n.forEach(()=>{s.sendMessage({type:"step_stop",data:{status:i,stop:Date.now(),statusDetails:{message:e.message,trace:e.stack}}})}),e}),Cypress.on("command:start",e=>j(e)?void 0:y().sendMessageAsync({type:"cypress_command_start",data:{id:e.attributes.id,name:`Command "${e.attributes.name}"`,args:e.attributes.args.map(r=>typeof r=="string"?r:JSON.stringify(r,null,2))}})),Cypress.on("command:end",e=>j(e)?void 0:y().sendMessageAsync({type:"cypress_command_end",data:{id:e.attributes.id,status:u.PASSED}})),before(_,()=>{cy.task("readAllureTestPlan",{},{log:!1}).then(e=>{e&&Cypress.env("allureTestPlan",e)})}),beforeEach(_,function(){let e=Cypress.env("allureTestPlan");e&&(B(Cypress.currentTest,Cypress.spec,e)||this.skip())}),after(_,()=>{let e=Cypress.env("allureRuntimeMessages");cy.task("allureReportTest",{absolutePath:Cypress.spec.absolute,messages:e??[]},{log:!1})}))};qe();
|
|
1
|
+
"use strict";var F=Object.defineProperty;var ht=Object.getOwnPropertyDescriptor;var St=Object.getOwnPropertyNames;var vt=Object.prototype.hasOwnProperty;var Tt=(e,t)=>{for(var r in t)F(e,r,{get:t[r],enumerable:!0})},Ct=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of St(t))!vt.call(e,n)&&n!==r&&F(e,n,{get:()=>t[n],enumerable:!(s=ht(t,n))||s.enumerable});return e};var xt=e=>Ct(F({},"__esModule",{value:!0}),e);var ur={};Tt(ur,{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:()=>ve,owner:()=>De,parameter:()=>ce,parentSuite:()=>Re,severity:()=>ke,step:()=>Te,story:()=>be,subSuite:()=>Pe,suite:()=>Me,tag:()=>Ie,tags:()=>Fe,testCaseId:()=>fe,tms:()=>xe});module.exports=xt(ur);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 D(){D=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)),k(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 f=0;n[g[f]]===void 0&&f+1<g.length;)f++;i[p]=n[g[f]]}return i},Object.create(null))}return Et(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 f=o[g];return"$"+(Array.isArray(f)?f.join("$"):f)}))}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)},D.apply(this,arguments)}function Et(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&&k(e,t)}function k(e,t){return k=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},k(e,t)}var v=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}},_t=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=_t();return e.replace(t,"")},S=e=>{var{message:t,stack:r}=e;return{message:t?O(t):void 0,trace:r?O(r):void 0}},ae=D(/(?:^|\s)@?allure\.id[:=]([^\s]+)/,{id:1}),At=new RegExp(ae,"g"),oe=D(/(?:^|\s)@?allure\.label\.([^:=\s]+)[:=]([^\s]+)/,{name:1,value:2}),bt=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(bt,"").replace(At,"").trim();return{labels:t,cleanTitle:r}};var Mt=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=Mt(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 kt(typeof t=="object"?JSON.stringify(t,Rt(r)):String(t),s)},Rt=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?Pt(t,s):s instanceof Set?Dt(t,s):s}},Pt=(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]}),Dt=(e,t)=>Array.from(t).map(r=>e.includes(r)?void 0:r),kt=(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 j=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")})()}},T=new j;var pe="allureTestRuntime",G=e=>{globalThis[pe]=()=>e},U=()=>globalThis?.[pe],B=()=>{var e=U();if(e){var t;return(t=e())!==null&&t!==void 0?t:T}return T},V=()=>{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 r,s;return(r=(s=U())===null||s===void 0?void 0:s())!==null&&r!==void 0?r:T})}catch(r){return console.log("can't execute allure-playwright/autoconfig",r),T}return T};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)},wt=()=>({displayName:e=>d("stepDisplayName",e),parameter:(e,t,r)=>d("stepParameter",e,t,r)}),ve=(e,t,r)=>d("logStep",e,t,r),Te=(e,t)=>d("step",e,()=>t(wt())),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),be=e=>y(l.STORY,e),Me=e=>y(l.SUITE,e),Re=e=>y(l.PARENT_SUITE,e),Pe=e=>y(l.SUB_SUITE,e),De=e=>y(l.OWNER,e),ke=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=>Ft(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 Ft=e=>e[e.length-1],Ot=e=>{let t=$e(),r=t?e.absolute.substring(t.length+1):e.relative;return Cypress.platform==="win32"?r.replaceAll("\\","/"):r},Le=(e,t)=>{let r=t.title,{cleanTitle:s,labels:n}=H(r),o=`${[...t.titlePath().slice(0,-1),s].join(" ")}`;return{name:s,labels:n,fullNameSuffix:o}},z=e=>({...Le(Cypress.spec,e),start:e.wallClockStartedAt?.getTime()||Date.now()}),je=e=>({duration:e.duration??0,retries:e._retries??0}),$=()=>({statusDetails:{message:"This is a pending test"}}),Ue=(e,t)=>{let r=ze();if(r){let s=Ot(e);for(let n of Be(t)){let a=Nt(r,e,s,n.tests);Lt(n.tests,a)}}};var Ge=Symbol("The test was reported to Allure"),W=e=>{e[Ge]=!0},b=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",Ht=(e,t,r)=>e.tests.some(s=>r&&s.id?.toString()===r||s.selector===t),Nt=(e,t,r,s)=>{let n=[];return s.forEach((a,o)=>{let{fullNameSuffix:i,labels:p}=Le(t,a),g=`${r}#${i}`,f=p.find(({name:ft})=>ft===l.ALLURE_ID)?.value;Ht(e,g,f)||n.push(o)}),n},Lt=(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,projectDir:void 0},Cypress.env("allure",e)),e},We=()=>h().initialized,Ye=()=>{h().initialized=!0},M=()=>h().messages,qe=e=>{h().messages=e},c=e=>{M().push(e)},ze=()=>h().testPlan,$e=()=>h().projectDir,Ze=()=>h().currentTest,Je=e=>{h().currentTest=e},Xe=()=>{h().currentTest=void 0},Qe=()=>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?{...S(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=()=>qe([]);#e=t=>(c(t),Cypress.Promise.resolve());#r=()=>{let t=M();return this.#t(),t}},rt=()=>G(new Y),st=()=>B(),nt=()=>{c({type:"cypress_run_start",data:{}})},at=e=>{c({type:"cypress_suite_start",data:{id:e.id,name:e.title,root:e.root,start:Date.now()}})},ot=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=>{Je(e),c({type:"cypress_test_start",data:z(e)}),W(e)},J=(e,t)=>{let r=M();N(r).forEach(()=>{c({type:"step_stop",data:{stop:Date.now(),status:e,statusDetails:t}})})},it=()=>{J(u.PASSED),c({type:"cypress_test_pass",data:{}})},pt=e=>{b(e)?dt(u.SKIPPED,{message:"The test was skipped before the command was completed"}):Z(e),c({type:"cypress_test_skip",data:$()})},ut=e=>{let{stepsFromCommands:{maxArgumentDepth:t,maxArgumentLength:r}}=Qe();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()}})},lt=()=>{c({type:"cypress_command_end",data:{status:u.PASSED,stop:Date.now()}})},ct=(e,t)=>{c({type:"attachment_path",data:{path:e,name:t||"Screenshot",contentType:P.PNG}})},dt=(e,t)=>{let r=M(),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=v(e),r=S(e);dt(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}}),Xe()},ee=(e,t)=>{let r=e.hookName.includes("each"),s=e.parent,n=Bt(e.title,r,t,s);I(e),jt(),Ut(s,n)},mt=()=>{let[e,t,r]=$t();zt(t,r),Wt(e)},te=()=>st().flushAllureMessagesToTask("reportAllureCypressSpecMessages"),yt=()=>st().flushAllureMessagesToTaskAsync("reportFinalAllureCypressSpecMessages"),R=e=>{if(Jt(e)){let t=e.test;return C(t)||I(t),yt()}},gt=(e,t)=>{try{return X(t),ee(e.test,t),yt()}catch(r){Zt(e,r)}},jt=()=>{let e=Ze();e&&Q(e)},Ut=(e,t)=>{for(let r of Ve(e))b(r)||Gt(r,r.pending?{...$(),status:u.SKIPPED}:t)},Gt=(e,t)=>{c({type:"cypress_skipped_test",data:{...z(e),...t,...je(e),suites:Ne(e).map(r=>r.id)}}),W(e)},Bt=(e,t,r,s)=>{let n=t?u.SKIPPED:v(r),{message:a,trace:o}=S(r);return{status:n,statusDetails:{message:t?Vt(e,s):a,trace:o}}},Vt=(e,t)=>{let r=t.title?`'${t.title}'`:"root";return`'${e}' defined in the ${r} suite has failed`},Kt=(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)},zt=(e,t)=>{let r=a=>(o,i,p)=>{e();try{return Kt(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},$t=()=>{let e=0;return[()=>e,()=>{e++},()=>{e--}]},Wt=e=>{let t=globalThis.after,r=(s,n)=>typeof s=="string"?t(s,et(e,n)):t(et(e,s));globalThis.after=r},et=(e,t)=>{if(e()===0&&t){let r=t.length?Yt(t):qt(t);return Object.defineProperty(r,"name",{value:t.name}),r}return t},Yt=e=>function(t){let r=s=>{if(s){gt(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)},qt=e=>function(){let t,r;try{t=e.bind(this)()}catch(s){r=s}if(r)tt(this,r);else return E(t)?t.then(()=>R(this),s=>tt(this,s)):(R(this),t)},tt=(e,t)=>{if(!gt(e,t)?.then(()=>{throw t}))throw t},Zt=(e,t)=>{try{console.error(`Unexpected error when reporting the failure of ${e.test?.title??"'after all'"}`),console.error(t)}catch{}},Jt=e=>{let t=e.test;return e.test.parent.hooks.findLast(a=>a.hookName==="after all")?.hookId===t.hookId};var{EVENT_RUN_BEGIN:Xt,EVENT_SUITE_BEGIN:Qt,EVENT_SUITE_END:er,EVENT_HOOK_BEGIN:tr,EVENT_HOOK_END:rr,EVENT_TEST_BEGIN:sr,EVENT_TEST_PASS:nr,EVENT_TEST_FAIL:ar,EVENT_TEST_PENDING:or,EVENT_TEST_END:ir}=Mocha.Runner.constants,pr=()=>{We()||(Ye(),Cypress.mocha.getRunner().on(Xt,()=>{rt(),nt()}).on(Qt,e=>{e.root&&Ue(Cypress.spec,e),at(e)}).on(er,e=>{ot(e)}).on(tr,e=>{C(e)||q(e)}).on(rr,e=>{C(e)||I(e)}).on(sr,e=>{b(e)||Z(e)}).on(nr,()=>{it()}).on(ar,(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(or,e=>{pt(e)}).on(ir,e=>{Q(e)}),Cypress.Screenshot.defaults({onAfterScreenshot:(e,{path:t,name:r})=>{ct(t,r)}}),Cypress.on("fail",e=>{let t=v(e),r=S(e);throw J(t,r),e}),Cypress.on("command:start",e=>{K(e)||ut(e)}),Cypress.on("command:end",e=>{K(e)||lt()}),afterEach(_,te),after(_,function(){te(),R(this)}),mt())};pr();
|
|
2
2
|
//# sourceMappingURL=index.js.map
|