allure-cypress 3.0.4 → 3.0.6

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.
Files changed (2) hide show
  1. package/README.md +52 -77
  2. package/package.json +12 -7
package/README.md CHANGED
@@ -12,15 +12,21 @@
12
12
 
13
13
  ---
14
14
 
15
+ ## The documentation
16
+
17
+ The docs for Allure Cypress are available at [https://allurereport.org/docs/cypress/](https://allurereport.org/docs/cypress/).
18
+
15
19
  ## Installation
16
20
 
17
- Use your favorite Node.js package manager to install the required packages:
21
+ Install `allure-cypress` using a package manager of your choice. For example:
18
22
 
19
23
  ```shell
20
- npm add -D allure-cypress
24
+ npm install -D allure-cypress
21
25
  ```
22
26
 
23
- Add the following lines to your `cypress.config.js` file:
27
+ ## Usage
28
+
29
+ Call `allureCypress` to initialize the plugin from the `setupNodeEvents` function in `cypress.config.js`:
24
30
 
25
31
  ```javascript
26
32
  import { defineConfig } from "cypress";
@@ -44,13 +50,13 @@ Import `allure-cypress` in `cypress/support/e2e.js`:
44
50
  import "allure-cypress";
45
51
  ```
46
52
 
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)).
53
+ When the test run completes, the result files will be generated in the `./allure-results` directory.
54
+
55
+ You may select another location, or further customize the plugin's behavior with [the configuration options](https://allurereport.org/docs/cypress-configuration/).
50
56
 
51
57
  ### View the report
52
58
 
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.
59
+ > You need Allure Report to be installed on your machine to generate and open the report from the result files. See the [installation instructions](https://allurereport.org/docs/install/) on how to get it.
54
60
 
55
61
  Generate Allure Report:
56
62
 
@@ -64,85 +70,56 @@ Open Allure Report:
64
70
  allure open ./allure-report
65
71
  ```
66
72
 
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`.
77
-
78
- The following options are supported:
73
+ ## Allure API
79
74
 
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` |
75
+ Enhance the report by utilizing the Allure API:
88
76
 
89
- ### stepsFromCommands
77
+ ```js
78
+ import * as allure from "allure-js-commons";
90
79
 
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 |
80
+ describe("signing in with a password", () => {
81
+ it("should sign in with a valid password", () => {
82
+ allure.description("The test checks if an active user with a valid password can sign in to the app.");
83
+ allure.epic("Signing in");
84
+ allure.feature("Sign in with a password");
85
+ allure.story("As an active user, I want to successfully sign in using a valid password");
86
+ allure.tags("signin", "ui", "positive");
87
+ allure.issue("https://github.com/allure-framework/allure-js/issues/900", "ISSUE-900");
88
+ allure.owner("eroshenkoam");
89
+ allure.parameter("browser", Cypress.browser.family);
95
90
 
91
+ allure.step("Prepare the user", () => {
92
+ return createAnActiveUserInDb();
93
+ }).then((user) => {
94
+ allure.step("Make a sign-in attempt", () => {
95
+ allure.step("Navigate to the sign-in page", () => {
96
+ // ...
97
+ });
96
98
 
97
- ### Example
99
+ allure.step("Fill the sign-in form", (stepContext) => {
100
+ stepContext.parameter("login", user.login);
101
+ stepContext.parameter("password", user.password, "masked");
98
102
 
99
- Here is an example of the Allure Cypress configuration:
103
+ // ...
104
+ });
100
105
 
101
- ```javascript
102
- import { defineConfig } from "cypress";
103
- import { allureCypress } from "allure-cypress/reporter";
106
+ allure.step("Submit the form", () => {
107
+ // ...
104
108
 
105
- export default defineConfig({
106
- e2e: {
107
- setupNodeEvents: (on, config) => {
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
- ],
109
+ allure.attachment("cookies", JSON.stringify(cy.getCookies()), { contentType: "application/json" });
110
+ });
135
111
  });
112
+
136
113
 
137
- return config;
138
- },
139
- // other Cypress config properties ...
140
- },
114
+ allure.step("Assert the signed-in state", () => {
115
+ // ...
116
+ });
117
+ });
118
+ });
141
119
  });
142
120
  ```
143
121
 
144
- More details about Allure Cypress configuration are available at [https://allurereport.org/docs/cypress-configuration/](https://allurereport.org/docs/cypress-configuration/).
145
-
122
+ More details about the API are available at [https://allurereport.org/docs/cypress-reference/](https://allurereport.org/docs/cypress-reference/).
146
123
 
147
124
  ## Combining Allure with other Cypress plugins
148
125
 
@@ -223,8 +200,7 @@ Allure Cypress requires access to the following events:
223
200
 
224
201
  Otherwise, it may not work as expected.
225
202
 
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:
203
+ If you need to define your own handlers of those events, make sure to call the corresponding functions of the `allureCypress`s' return value:
228
204
 
229
205
  ```javascript
230
206
  import { defineConfig } from "cypress";
@@ -255,7 +231,6 @@ export default defineConfig({
255
231
  ```
256
232
 
257
233
  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.
234
+ [cypress-on-fix](https://github.com/bahmutov/cypress-on-fix). See the example for [the Cypress Cucumber preprocessor](#combining-allure-with-other-cypress-plugins) above.
260
235
 
261
236
  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/package.json CHANGED
@@ -1,11 +1,16 @@
1
1
  {
2
2
  "name": "allure-cypress",
3
- "version": "3.0.4",
3
+ "version": "3.0.6",
4
4
  "description": "Allure Cypress integration",
5
5
  "keywords": [
6
+ "allure",
6
7
  "cypress",
7
- "typescript",
8
- "allure"
8
+ "html",
9
+ "test",
10
+ "report",
11
+ "reporter",
12
+ "testing",
13
+ "testops"
9
14
  ],
10
15
  "homepage": "https://github.com/allure-framework/allure-js#readme",
11
16
  "bugs": {
@@ -55,7 +60,7 @@
55
60
  "test": "vitest run"
56
61
  },
57
62
  "dependencies": {
58
- "allure-js-commons": "3.0.4"
63
+ "allure-js-commons": "3.0.6"
59
64
  },
60
65
  "devDependencies": {
61
66
  "@babel/cli": "^7.24.6",
@@ -71,19 +76,19 @@
71
76
  "@typescript-eslint/eslint-plugin": "^8.0.0",
72
77
  "@typescript-eslint/parser": "^8.0.0",
73
78
  "allure-commandline": "^2.29.0",
74
- "allure-vitest": "3.0.4",
79
+ "allure-vitest": "3.0.6",
75
80
  "babel-plugin-add-module-exports": "^1.0.4",
76
81
  "cypress": "^13.12.0",
77
82
  "esbuild": "^0.24.0",
78
83
  "eslint": "^8.57.0",
79
84
  "eslint-config-prettier": "^9.1.0",
80
- "eslint-plugin-cypress": "^3.4.0",
85
+ "eslint-plugin-cypress": "^4.0.0",
81
86
  "eslint-plugin-import": "^2.29.1",
82
87
  "eslint-plugin-jsdoc": "^50.0.0",
83
88
  "eslint-plugin-n": "^17.10.1",
84
89
  "eslint-plugin-no-null": "^1.0.2",
85
90
  "eslint-plugin-prefer-arrow": "^1.2.3",
86
- "npm-run-all2": "^6.1.2",
91
+ "npm-run-all2": "^7.0.0",
87
92
  "rimraf": "^6.0.0",
88
93
  "typescript": "^5.2.2",
89
94
  "vitest": "^1.6.0"