cypress-qase-reporter 2.2.0-beta.3 → 2.2.1

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 CHANGED
@@ -4,21 +4,12 @@ Publish results simple and easy.
4
4
 
5
5
  ## Installation
6
6
 
7
- To install the latest release version (2.1.x), run:
7
+ To install the latest release version (2.2.x), run:
8
8
 
9
9
  ```sh
10
10
  npm install -D cypress-qase-reporter
11
11
  ```
12
12
 
13
- <!-- if there's no current beta, comment the next block
14
- -->
15
-
16
- To install the latest beta version (2.2.x), run:
17
-
18
- ```sh
19
- npm install -D cypress-qase-reporter@beta
20
- ```
21
-
22
13
  ## Updating from v1 to v2.1
23
14
 
24
15
  To update an existing test project using Qase reporter from version 1 to version 2.1,
package/changelog.md CHANGED
@@ -1,3 +1,23 @@
1
+ # cypress-qase-reporter@2.2.1
2
+
3
+ ## What's new
4
+
5
+ When specifying test names, QaseIDs are now excluded from the final test name.
6
+
7
+ ```js
8
+ // The test name will be 'Example', not 'Example (Qase ID: 1)'
9
+ qase(1,it('Example', () => {
10
+ expect(true).to.equal(true);
11
+ })
12
+ );
13
+ ```
14
+
15
+ # cypress-qase-reporter@2.2.0
16
+
17
+ ## What's new
18
+
19
+ Minor release of the Cypress reporter package
20
+
1
21
  # cypress-qase-reporter@2.2.0-beta.3
2
22
 
3
23
  ## What's new
@@ -70,6 +70,12 @@ export declare class CypressQaseReporter extends reporters.Base {
70
70
  * @private
71
71
  */
72
72
  private getFile;
73
+ /**
74
+ * @param {string} title
75
+ * @returns {string}
76
+ * @private
77
+ */
78
+ private removeQaseIdsFromTitle;
73
79
  private getSteps;
74
80
  }
75
81
  export {};
package/dist/reporter.js CHANGED
@@ -169,7 +169,7 @@ class CypressQaseReporter extends mocha_1.reporters.Base {
169
169
  thread: null,
170
170
  },
171
171
  testops_id: ids.length > 0 ? ids : null,
172
- title: metadata?.title ?? test.title,
172
+ title: metadata?.title ?? this.removeQaseIdsFromTitle(test.title),
173
173
  };
174
174
  void this.reporter.addTestResult(result);
175
175
  manager_1.MetadataManager.clear();
@@ -209,6 +209,18 @@ class CypressQaseReporter extends mocha_1.reporters.Base {
209
209
  }
210
210
  return undefined;
211
211
  }
212
+ /**
213
+ * @param {string} title
214
+ * @returns {string}
215
+ * @private
216
+ */
217
+ removeQaseIdsFromTitle(title) {
218
+ const matches = title.match(/\(Qase ID: ([0-9,]+)\)$/i);
219
+ if (matches) {
220
+ return title.replace(matches[0], '').trimEnd();
221
+ }
222
+ return title;
223
+ }
212
224
  getSteps(steps, attachments) {
213
225
  const result = [];
214
226
  const stepMap = new Map();
package/docs/usage.md ADDED
@@ -0,0 +1,196 @@
1
+ # Qase Integration in Cypress
2
+
3
+ This guide demonstrates how to integrate Qase with Cypress, providing instructions on how to add Qase IDs, titles,
4
+ fields, suites, comments, and file attachments to your test cases.
5
+
6
+ ---
7
+
8
+ ## Adding QaseID to a Test
9
+
10
+ To associate a QaseID with a test in Cypress, use the `qase` function. This function accepts a single integer
11
+ representing the test's ID in Qase.
12
+
13
+ ### Example:
14
+
15
+ ```javascript
16
+ import { qase } from 'cypress-qase-reporter/mocha';
17
+
18
+ qase(1, it('simple test', () => {
19
+ cy.visit('https://example.com');
20
+ }));
21
+ ```
22
+
23
+ ---
24
+
25
+ ## Adding a Title to a Test
26
+
27
+ You can provide a title for your test using the `qase.title` function. The function accepts a string, which will be
28
+ used as the test's title in Qase. If no title is provided, the test method name will be used by default.
29
+
30
+ ### Example:
31
+
32
+ ```javascript
33
+ import { qase } from 'cypress-qase-reporter/mocha';
34
+
35
+ it('test', () => {
36
+ qase.title('Title');
37
+ cy.visit('https://example.com');
38
+ });
39
+ ```
40
+
41
+ ---
42
+
43
+ ## Adding Fields to a Test
44
+
45
+ The `qase.fields` function allows you to add additional metadata to a test case. You can specify multiple fields to
46
+ enhance test case information in Qase.
47
+
48
+ ### System Fields:
49
+
50
+ - `description` — Description of the test case.
51
+ - `preconditions` — Preconditions for the test case.
52
+ - `postconditions` — Postconditions for the test case.
53
+ - `severity` — Severity of the test case (e.g., `critical`, `major`).
54
+ - `priority` — Priority of the test case (e.g., `high`, `low`).
55
+ - `layer` — Test layer (e.g., `UI`, `API`).
56
+
57
+ ### Example:
58
+
59
+ ```javascript
60
+ import { qase } from 'cypress-qase-reporter/mocha';
61
+
62
+ it('test', () => {
63
+ qase.fields({ description: "Description", preconditions: "Preconditions" });
64
+ cy.visit('https://example.com');
65
+ });
66
+ ```
67
+
68
+ ---
69
+
70
+ ## Adding a Suite to a Test
71
+
72
+ To assign a suite or sub-suite to a test, use the `qase.suite` function. It can receive a suite name, and optionally a
73
+ sub-suite, both as strings.
74
+
75
+ ### Example:
76
+
77
+ ```javascript
78
+ import { qase } from 'cypress-qase-reporter/mocha';
79
+
80
+ it('test', () => {
81
+ qase.suite("Suite 01");
82
+ cy.visit('https://example.com');
83
+ });
84
+
85
+ it('test', () => {
86
+ qase.suite("Suite 01\tSuite 02");
87
+ cy.visit('https://example.com');
88
+ });
89
+ ```
90
+
91
+ ---
92
+
93
+ ## Ignoring a Test in Qase
94
+
95
+ To exclude a test from being reported to Qase (while still executing the test in Cypress), use the `qase.ignore`
96
+ function. The test will run, but its result will not be sent to Qase.
97
+
98
+ ### Example:
99
+
100
+ ```javascript
101
+ import { qase } from 'cypress-qase-reporter/mocha';
102
+
103
+ it('test', () => {
104
+ qase.ignore();
105
+ cy.visit('https://example.com');
106
+ });
107
+ ```
108
+
109
+ ---
110
+
111
+ ## Adding a Comment to a Test
112
+
113
+ You can attach comments to the test results in Qase using the `qase.comment` function. The comment will be displayed
114
+ alongside the test execution details in Qase.
115
+
116
+ ### Example:
117
+
118
+ ```javascript
119
+ import { qase } from 'cypress-qase-reporter/mocha';
120
+
121
+ it('test', () => {
122
+ qase.comment("Some comment");
123
+ cy.visit('https://example.com');
124
+ });
125
+ ```
126
+
127
+ ---
128
+
129
+ ## Attaching Files to a Test
130
+
131
+ To attach files to a test result, use the `qase.attach` function. This method supports attaching one or multiple files,
132
+ along with optional file names, comments, and file types.
133
+
134
+ ### Example:
135
+
136
+ ```javascript
137
+ import { qase } from 'cypress-qase-reporter/mocha';
138
+
139
+ it('test', () => {
140
+ qase.attach({ name: 'attachment.txt', content: 'Hello, world!', contentType: 'text/plain' });
141
+ qase.attach({ paths: '/path/to/file' });
142
+ qase.attach({ paths: ['/path/to/file', '/path/to/another/file'] });
143
+ cy.visit('https://example.com');
144
+ });
145
+ ```
146
+
147
+ ## Adding Parameters to a Test
148
+
149
+ You can add parameters to a test case using the `qase.parameters` function. This function accepts an object with
150
+ parameter names and values.
151
+
152
+ ### Example:
153
+
154
+ ```javascript
155
+ import { qase } from 'cypress-qase-reporter/mocha';
156
+
157
+ it('test', () => {
158
+ qase.parameters({ param1: 'value1', param2: 'value2' });
159
+ cy.visit('https://example.com');
160
+ });
161
+ ```
162
+
163
+ ## Adding Group Parameters to a Test
164
+
165
+ To add group parameters to a test case, use the `qase.groupParameters` function. This function accepts an list with
166
+ group parameter names.
167
+
168
+ ### Example:
169
+
170
+ ```javascript
171
+ import { qase } from 'cypress-qase-reporter/mocha';
172
+
173
+ it('test', () => {
174
+ qase.parameters({ param1: 'value1', param2: 'value2' });
175
+ qase.groupParameters(['param1']);
176
+ cy.visit('https://example.com');
177
+ });
178
+ ```
179
+
180
+ ## Adding Steps to a Test
181
+
182
+ You can add steps to a test case using the `qase.step` function. This function accepts a string, which will be used as
183
+ the step description in Qase.
184
+
185
+ ### Example:
186
+
187
+ ```javascript
188
+ import { qase } from 'cypress-qase-reporter/mocha';
189
+
190
+ it('test', () => {
191
+ qase.step('Some step', () => {
192
+ // some actions
193
+ });
194
+ cy.visit('https://example.com');
195
+ });
196
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cypress-qase-reporter",
3
- "version": "2.2.0-beta.3",
3
+ "version": "2.2.1",
4
4
  "description": "Qase Cypress Reporter",
5
5
  "homepage": "https://github.com/qase-tms/qase-javascript",
6
6
  "sideEffects": false,
@@ -47,7 +47,7 @@
47
47
  "author": "Qase Team <support@qase.io>",
48
48
  "license": "Apache-2.0",
49
49
  "dependencies": {
50
- "qase-javascript-commons": "~2.2.0",
50
+ "qase-javascript-commons": "~2.2.3",
51
51
  "uuid": "^9.0.1"
52
52
  },
53
53
  "peerDependencies": {