cucumberjs-qase-reporter 2.1.3 → 2.1.5

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
@@ -27,6 +27,8 @@ from Qase.io before executing tests. It's a more reliable way to bind
27
27
  autotests to test cases, that persists when you rename, move, or
28
28
  parameterize your tests.
29
29
 
30
+ For more information, see the [Usage Guide](docs/usage.md).
31
+
30
32
  For example:
31
33
 
32
34
  ```gherkin
package/changelog.md CHANGED
@@ -1,3 +1,10 @@
1
+ # qase-cucumberjs@2.1.5
2
+
3
+ ## What's new
4
+
5
+ - Added support for status filter in the test run.
6
+ - Improved error handling.
7
+
1
8
  # qase-cucumberjs@2.1.3
2
9
 
3
10
  ## What's new
package/dist/storage.js CHANGED
@@ -4,11 +4,11 @@ exports.Storage = void 0;
4
4
  const qase_javascript_commons_1 = require("qase-javascript-commons");
5
5
  const cucumber_1 = require("@cucumber/cucumber");
6
6
  const uuid_1 = require("uuid");
7
- const qaseIdRegExp = /^@[Qq]-?(\d+)$/g;
8
- const newQaseIdRegExp = /^@[Qq]ase[Ii][Dd]=(\d+(?:,\s*\d+)*)$/g;
9
- const qaseTitleRegExp = /^@[Qq]ase[Tt]itle=(.+)$/g;
10
- const qaseFieldsRegExp = /^@[Qq]ase[Ff]ields=(.+)$/g;
11
- const qaseIgnoreRegExp = /^@[Qq]ase[Ii][Gg][Nn][Oo][Rr][Ee]$/g;
7
+ const qaseIdRegExp = /^@[Qq]-?(\d+)$/;
8
+ const newQaseIdRegExp = /^@[Qq]ase[Ii][Dd]=(\d+(?:,\s*\d+)*)$/;
9
+ const qaseTitleRegExp = /^@[Qq]ase[Tt]itle=(.+)$/;
10
+ const qaseFieldsRegExp = /^@[Qq]ase[Ff]ields=(.+)$/;
11
+ const qaseIgnoreRegExp = /^@[Qq]ase[Ii][Gg][Nn][Oo][Rr][Ee]$/;
12
12
  class Storage {
13
13
  /**
14
14
  * @type {Record<string, Pickle>}
@@ -145,7 +145,13 @@ class Storage {
145
145
  */
146
146
  addTestCaseStep(testCaseStep) {
147
147
  const oldStatus = this.testCaseStartedResult[testCaseStep.testCaseStartedId];
148
- const newStatus = Storage.statusMap[testCaseStep.testStepResult.status];
148
+ // Create error object for status determination
149
+ let error = null;
150
+ if (testCaseStep.testStepResult.message) {
151
+ error = new Error(testCaseStep.testStepResult.message);
152
+ }
153
+ // Determine status based on error type
154
+ const newStatus = (0, qase_javascript_commons_1.determineTestStatus)(error, testCaseStep.testStepResult.status);
149
155
  this.testCaseSteps[testCaseStep.testStepId] = testCaseStep;
150
156
  if (newStatus !== qase_javascript_commons_1.TestStatusEnum.passed) {
151
157
  if (testCaseStep.testStepResult.message) {
package/docs/usage.md ADDED
@@ -0,0 +1,248 @@
1
+ # Qase Integration in Cucumber.js
2
+
3
+ This guide demonstrates how to integrate Qase with Cucumber.js, 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 Cucumber.js, use the `@QaseId` tag in your Gherkin feature files. This tag accepts
11
+ a single integer or multiple integers separated by commas representing the test's ID(s) in Qase.
12
+
13
+ ### Example
14
+
15
+ ```gherkin
16
+ Feature: User Authentication
17
+
18
+ @QaseId=1
19
+ Scenario: Successful login
20
+ Given I am on the login page
21
+ When I enter valid credentials
22
+ Then I should be logged in
23
+
24
+ @QaseId=2,3,4
25
+ Scenario: Multiple test cases
26
+ Given I am on the login page
27
+ When I enter invalid credentials
28
+ Then I should see an error message
29
+ ```
30
+
31
+ ---
32
+
33
+ ## Adding a Title to a Test
34
+
35
+ You can provide a custom title for your test using the `@Title` tag. The tag accepts a string, which will be used as
36
+ the test's title in Qase. If no title is provided, the scenario name will be used by default.
37
+
38
+ ### Example
39
+
40
+ ```gherkin
41
+ Feature: User Authentication
42
+
43
+ @QaseId=1
44
+ @Title=Custom Test Title
45
+ Scenario: Successful login
46
+ Given I am on the login page
47
+ When I enter valid credentials
48
+ Then I should be logged in
49
+ ```
50
+
51
+ ---
52
+
53
+ ## Adding Fields to a Test
54
+
55
+ The `@QaseFields` tag allows you to add additional metadata to a test case. You can specify multiple fields to
56
+ enhance test case information in Qase.
57
+
58
+ ### System Fields
59
+
60
+ - `description` — Description of the test case.
61
+ - `preconditions` — Preconditions for the test case.
62
+ - `postconditions` — Postconditions for the test case.
63
+ - `severity` — Severity of the test case (e.g., `critical`, `major`).
64
+ - `priority` — Priority of the test case (e.g., `high`, `low`).
65
+ - `layer` — Test layer (e.g., `UI`, `API`).
66
+
67
+ ### Example
68
+
69
+ ```gherkin
70
+ Feature: User Authentication
71
+
72
+ @QaseId=1
73
+ @QaseFields={'severity':'high','priority':'medium','description':'Login functionality test'}
74
+ Scenario: Successful login
75
+ Given I am on the login page
76
+ When I enter valid credentials
77
+ Then I should be logged in
78
+ ```
79
+
80
+ ---
81
+
82
+ ## Adding a Suite to a Test
83
+
84
+ To assign a suite or sub-suite to a test, use the `@QaseSuite` tag. It can receive a suite name, and optionally a
85
+ sub-suite, both as strings.
86
+
87
+ ### Example
88
+
89
+ ```gherkin
90
+ Feature: User Authentication
91
+
92
+ @QaseId=1
93
+ @QaseSuite=Authentication
94
+ Scenario: Successful login
95
+ Given I am on the login page
96
+ When I enter valid credentials
97
+ Then I should be logged in
98
+
99
+ @QaseId=2
100
+ @QaseSuite=Authentication\tLogin\tEdge Cases
101
+ Scenario: Login with special characters
102
+ Given I am on the login page
103
+ When I enter credentials with special characters
104
+ Then I should be logged in
105
+ ```
106
+
107
+ ---
108
+
109
+ ## Ignoring a Test in Qase
110
+
111
+ To exclude a test from being reported to Qase (while still executing the test in Cucumber.js), use the `@QaseIgnore`
112
+ tag. The test will run, but its result will not be sent to Qase.
113
+
114
+ ### Example
115
+
116
+ ```gherkin
117
+ Feature: User Authentication
118
+
119
+ @QaseIgnore
120
+ Scenario: This test will not be reported to Qase
121
+ Given I am on the login page
122
+ When I enter valid credentials
123
+ Then I should be logged in
124
+ ```
125
+
126
+ ---
127
+
128
+ ## Adding Parameters to a Test
129
+
130
+ You can add parameters to a test case using the `@QaseParameters` tag. This tag accepts a JSON object with
131
+ parameter names and values.
132
+
133
+ ### Example
134
+
135
+ ```gherkin
136
+ Feature: User Authentication
137
+
138
+ @QaseId=1
139
+ @QaseParameters={'browser':'chrome','environment':'staging'}
140
+ Scenario: Successful login
141
+ Given I am on the login page
142
+ When I enter valid credentials
143
+ Then I should be logged in
144
+ ```
145
+
146
+ ---
147
+
148
+ ## Adding Group Parameters to a Test
149
+
150
+ To add group parameters to a test case, use the `@QaseGroupParameters` tag. This tag accepts a JSON object with
151
+ group parameter names and values.
152
+
153
+ ### Example
154
+
155
+ ```gherkin
156
+ Feature: User Authentication
157
+
158
+ @QaseId=1
159
+ @QaseParameters={'browser':'chrome','environment':'staging'}
160
+ @QaseGroupParameters={'test_group':'authentication','test_type':'smoke'}
161
+ Scenario: Successful login
162
+ Given I am on the login page
163
+ When I enter valid credentials
164
+ Then I should be logged in
165
+ ```
166
+
167
+ ---
168
+
169
+ ## Adding Steps to a Test
170
+
171
+ Cucumber.js automatically creates steps from your Gherkin scenarios. Each `Given`, `When`, and `Then` statement
172
+ becomes a step in Qase. You can also add custom step information in your step definitions.
173
+
174
+ ### Example
175
+
176
+ ```gherkin
177
+ Feature: User Authentication
178
+
179
+ @QaseId=1
180
+ Scenario: Successful login
181
+ Given I am on the login page
182
+ When I enter valid credentials
183
+ Then I should be logged in
184
+ ```
185
+
186
+ ```javascript
187
+ // step_definitions/login_steps.js
188
+ const { Given, When, Then } = require('@cucumber/cucumber');
189
+
190
+ Given('I am on the login page', async function() {
191
+ // Step implementation
192
+ await this.page.goto('https://example.com/login');
193
+ });
194
+
195
+ When('I enter valid credentials', async function() {
196
+ // Step implementation
197
+ await this.page.fill('#username', 'testuser');
198
+ await this.page.fill('#password', 'password');
199
+ await this.page.click('#login-button');
200
+ });
201
+
202
+ Then('I should be logged in', async function() {
203
+ // Step implementation
204
+ await this.page.waitForSelector('.dashboard');
205
+ });
206
+ ```
207
+
208
+ ---
209
+
210
+ ## Attaching Files to a Test
211
+
212
+ You can attach files to test results using the `this.attach()` method in your step definitions. This method supports
213
+ attaching files with content, paths, or media types.
214
+
215
+ ### Example
216
+
217
+ ```javascript
218
+ // step_definitions/login_steps.js
219
+ const { Given, When, Then } = require('@cucumber/cucumber');
220
+
221
+ Given('I am on the login page', async function() {
222
+ await this.page.goto('https://example.com/login');
223
+
224
+ // Attach screenshot
225
+ const screenshot = await this.page.screenshot();
226
+ await this.attach(screenshot, 'image/png');
227
+ });
228
+
229
+ When('I enter valid credentials', async function() {
230
+ await this.page.fill('#username', 'testuser');
231
+ await this.page.fill('#password', 'password');
232
+
233
+ // Attach text content
234
+ await this.attach('Credentials entered successfully', 'text/plain');
235
+
236
+ await this.page.click('#login-button');
237
+ });
238
+
239
+ Then('I should be logged in', async function() {
240
+ await this.page.waitForSelector('.dashboard');
241
+
242
+ // Attach JSON data
243
+ const userData = { username: 'testuser', status: 'logged_in' };
244
+ await this.attach(JSON.stringify(userData, null, 2), 'application/json');
245
+ });
246
+ ```
247
+
248
+ ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cucumberjs-qase-reporter",
3
- "version": "2.1.3",
3
+ "version": "2.1.5",
4
4
  "description": "Qase TMS CucumberJS Reporter",
5
5
  "homepage": "https://github.com/qase-tms/qase-javascript",
6
6
  "main": "./dist/index.js",
@@ -40,7 +40,7 @@
40
40
  "license": "Apache-2.0",
41
41
  "dependencies": {
42
42
  "@cucumber/messages": "^22.0.0",
43
- "qase-javascript-commons": "~2.3.5"
43
+ "qase-javascript-commons": "~2.4.2"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "@cucumber/cucumber": ">=7.0.0"