wdio-qase-reporter 1.1.2 → 1.1.4
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 +2 -0
- package/changelog.md +7 -0
- package/dist/reporter.js +10 -1
- package/docs/usage.md +247 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -20,6 +20,8 @@ from Qase.io before executing tests. It's a more reliable way to bind
|
|
|
20
20
|
autotests to test cases, that persists when you rename, move, or
|
|
21
21
|
parameterize your tests.
|
|
22
22
|
|
|
23
|
+
For more information, see the [Usage Guide](docs/usage.md).
|
|
24
|
+
|
|
23
25
|
For example:
|
|
24
26
|
|
|
25
27
|
### Mocha/Jasmine
|
package/changelog.md
CHANGED
package/dist/reporter.js
CHANGED
|
@@ -217,7 +217,16 @@ class WDIOQaseReporter extends reporter_1.default {
|
|
|
217
217
|
testResult.relations = relations;
|
|
218
218
|
}
|
|
219
219
|
testResult.execution.duration = testResult.execution.start_time ? Math.round(end_time - testResult.execution.start_time) : 0;
|
|
220
|
-
|
|
220
|
+
// Convert CompoundError to regular Error for status determination
|
|
221
|
+
let error = null;
|
|
222
|
+
if (err) {
|
|
223
|
+
error = new Error(err.message || 'Test failed');
|
|
224
|
+
if (err.stacktrace) {
|
|
225
|
+
error.stack = err.stacktrace;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
// Determine status based on error type
|
|
229
|
+
testResult.execution.status = (0, qase_javascript_commons_1.determineTestStatus)(error, status);
|
|
221
230
|
testResult.execution.stacktrace = err === null ?
|
|
222
231
|
null : err.stacktrace === undefined ?
|
|
223
232
|
null : err.stacktrace;
|
package/docs/usage.md
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
# Qase Integration in WebdriverIO
|
|
2
|
+
|
|
3
|
+
This guide demonstrates how to integrate Qase with WebdriverIO, 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 WebdriverIO, 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 'wdio-qase-reporter';
|
|
17
|
+
|
|
18
|
+
it(qase(1, 'test'), () => {
|
|
19
|
+
browser.url('https://example.com');
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it(qase([1, 2, 3], 'test'), () => {
|
|
23
|
+
browser.url('https://example.com');
|
|
24
|
+
});
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Adding a Title to a Test
|
|
30
|
+
|
|
31
|
+
You can provide a title for your test using the `qase.title` function. The function accepts a string, which will be
|
|
32
|
+
used as the test's title in Qase. If no title is provided, the test method name will be used by default.
|
|
33
|
+
|
|
34
|
+
### Example
|
|
35
|
+
|
|
36
|
+
```javascript
|
|
37
|
+
import { qase } from 'wdio-qase-reporter';
|
|
38
|
+
|
|
39
|
+
it('test', () => {
|
|
40
|
+
qase.title('Title');
|
|
41
|
+
browser.url('https://example.com');
|
|
42
|
+
});
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Adding Fields to a Test
|
|
48
|
+
|
|
49
|
+
The `qase.fields` function allows you to add additional metadata to a test case. You can specify multiple fields to
|
|
50
|
+
enhance test case information in Qase.
|
|
51
|
+
|
|
52
|
+
### System Fields
|
|
53
|
+
|
|
54
|
+
- `description` — Description of the test case.
|
|
55
|
+
- `preconditions` — Preconditions for the test case.
|
|
56
|
+
- `postconditions` — Postconditions for the test case.
|
|
57
|
+
- `severity` — Severity of the test case (e.g., `critical`, `major`).
|
|
58
|
+
- `priority` — Priority of the test case (e.g., `high`, `low`).
|
|
59
|
+
- `layer` — Test layer (e.g., `UI`, `API`).
|
|
60
|
+
|
|
61
|
+
### Example
|
|
62
|
+
|
|
63
|
+
```javascript
|
|
64
|
+
import { qase } from 'wdio-qase-reporter';
|
|
65
|
+
|
|
66
|
+
it('test', () => {
|
|
67
|
+
qase.fields({ description: "Description", preconditions: "Preconditions" });
|
|
68
|
+
browser.url('https://example.com');
|
|
69
|
+
});
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Adding a Suite to a Test
|
|
75
|
+
|
|
76
|
+
To assign a suite or sub-suite to a test, use the `qase.suite` function. It can receive a suite name, and optionally a
|
|
77
|
+
sub-suite, both as strings.
|
|
78
|
+
|
|
79
|
+
### Example
|
|
80
|
+
|
|
81
|
+
```javascript
|
|
82
|
+
import { qase } from 'wdio-qase-reporter';
|
|
83
|
+
|
|
84
|
+
it('test', () => {
|
|
85
|
+
qase.suite("Suite 01");
|
|
86
|
+
browser.url('https://example.com');
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it('test', () => {
|
|
90
|
+
qase.suite("Suite 01\tSuite 02");
|
|
91
|
+
browser.url('https://example.com');
|
|
92
|
+
});
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Ignoring a Test in Qase
|
|
98
|
+
|
|
99
|
+
To exclude a test from being reported to Qase (while still executing the test in WebdriverIO), use the `qase.ignore`
|
|
100
|
+
function. The test will run, but its result will not be sent to Qase.
|
|
101
|
+
|
|
102
|
+
### Example
|
|
103
|
+
|
|
104
|
+
```javascript
|
|
105
|
+
import { qase } from 'wdio-qase-reporter';
|
|
106
|
+
|
|
107
|
+
it('test', () => {
|
|
108
|
+
qase.ignore();
|
|
109
|
+
browser.url('https://example.com');
|
|
110
|
+
});
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## Adding a Comment to a Test
|
|
116
|
+
|
|
117
|
+
You can attach comments to the test results in Qase using the `qase.comment` function. The comment will be displayed
|
|
118
|
+
alongside the test execution details in Qase.
|
|
119
|
+
|
|
120
|
+
### Example
|
|
121
|
+
|
|
122
|
+
```javascript
|
|
123
|
+
import { qase } from 'wdio-qase-reporter';
|
|
124
|
+
|
|
125
|
+
it('test', () => {
|
|
126
|
+
qase.comment("Some comment");
|
|
127
|
+
browser.url('https://example.com');
|
|
128
|
+
});
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Attaching Files to a Test
|
|
134
|
+
|
|
135
|
+
To attach files to a test result, use the `qase.attach` function. This method supports attaching one or multiple files,
|
|
136
|
+
along with optional file names, comments, and file types.
|
|
137
|
+
|
|
138
|
+
### Example
|
|
139
|
+
|
|
140
|
+
```javascript
|
|
141
|
+
import { qase } from 'wdio-qase-reporter';
|
|
142
|
+
|
|
143
|
+
it('test', () => {
|
|
144
|
+
qase.attach({ name: 'attachment.txt', content: 'Hello, world!', type: 'text/plain' });
|
|
145
|
+
qase.attach({ paths: '/path/to/file' });
|
|
146
|
+
qase.attach({ paths: ['/path/to/file', '/path/to/another/file'] });
|
|
147
|
+
browser.url('https://example.com');
|
|
148
|
+
});
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Adding Parameters to a Test
|
|
152
|
+
|
|
153
|
+
You can add parameters to a test case using the `qase.parameters` function. This function accepts an object with
|
|
154
|
+
parameter names and values.
|
|
155
|
+
|
|
156
|
+
### Example
|
|
157
|
+
|
|
158
|
+
```javascript
|
|
159
|
+
import { qase } from 'wdio-qase-reporter';
|
|
160
|
+
|
|
161
|
+
it('test', () => {
|
|
162
|
+
qase.parameters({ param1: 'value1', param2: 'value2' });
|
|
163
|
+
browser.url('https://example.com');
|
|
164
|
+
});
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Adding Group Parameters to a Test
|
|
168
|
+
|
|
169
|
+
To add group parameters to a test case, use the `qase.groupParameters` function. This function accepts an object with
|
|
170
|
+
group parameter names and values.
|
|
171
|
+
|
|
172
|
+
### Example
|
|
173
|
+
|
|
174
|
+
```javascript
|
|
175
|
+
import { qase } from 'wdio-qase-reporter';
|
|
176
|
+
|
|
177
|
+
it('test', () => {
|
|
178
|
+
qase.parameters({ param1: 'value1', param2: 'value2' });
|
|
179
|
+
qase.groupParameters({ param3: 'value3', param4: 'value4' });
|
|
180
|
+
browser.url('https://example.com');
|
|
181
|
+
});
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## Adding Steps to a Test
|
|
185
|
+
|
|
186
|
+
You can add steps to a test case using the `qase.step` function. This function accepts a string and a callback function,
|
|
187
|
+
which will be used as the step description and actions in Qase.
|
|
188
|
+
|
|
189
|
+
### Example
|
|
190
|
+
|
|
191
|
+
```javascript
|
|
192
|
+
import { qase } from 'wdio-qase-reporter';
|
|
193
|
+
|
|
194
|
+
it('test', async () => {
|
|
195
|
+
await qase.step('Some step', async (step) => {
|
|
196
|
+
// some actions
|
|
197
|
+
step.attach({ name: 'screenshot.png', type: 'image/png', content: await browser.takeScreenshot() });
|
|
198
|
+
});
|
|
199
|
+
browser.url('https://example.com');
|
|
200
|
+
});
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
## Cucumber Integration
|
|
204
|
+
|
|
205
|
+
WebdriverIO Qase reporter supports Cucumber integration. When using Cucumber, you can annotate your scenarios with Qase IDs using tags.
|
|
206
|
+
|
|
207
|
+
### Feature file example
|
|
208
|
+
|
|
209
|
+
```gherkin
|
|
210
|
+
Feature: Test user role
|
|
211
|
+
|
|
212
|
+
@QaseId=3
|
|
213
|
+
Scenario: Login
|
|
214
|
+
Given I test login
|
|
215
|
+
When I enter credentials
|
|
216
|
+
Then I should be logged in
|
|
217
|
+
|
|
218
|
+
@QaseId=4,5
|
|
219
|
+
@Title=Custom Test Title
|
|
220
|
+
@Suite=Authentication
|
|
221
|
+
Scenario: Logout
|
|
222
|
+
Given I am logged in
|
|
223
|
+
When I click logout
|
|
224
|
+
Then I should be logged out
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### Supported Cucumber tags
|
|
228
|
+
|
|
229
|
+
- `@QaseId=<id>` - Set Qase test case ID(s). Multiple IDs can be separated by commas
|
|
230
|
+
- `@Title=<title>` - Set custom test title
|
|
231
|
+
- `@Suite=<suite>` - Set test suite name
|
|
232
|
+
|
|
233
|
+
### Configuration for Cucumber
|
|
234
|
+
|
|
235
|
+
```javascript
|
|
236
|
+
// wdio.conf.js
|
|
237
|
+
const WDIOQaseReporter = require('wdio-qase-reporter').default;
|
|
238
|
+
|
|
239
|
+
exports.config = {
|
|
240
|
+
reporters: [[WDIOQaseReporter, {
|
|
241
|
+
useCucumber: true, // Enable Cucumber support
|
|
242
|
+
disableWebdriverStepsReporting: true,
|
|
243
|
+
disableWebdriverScreenshotsReporting: false,
|
|
244
|
+
}]],
|
|
245
|
+
// ... other options
|
|
246
|
+
};
|
|
247
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wdio-qase-reporter",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"description": "Qase WebDriverIO Reporter",
|
|
5
5
|
"homepage": "https://github.com/qase-tms/qase-javascript",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"author": "Qase Team <support@qase.io>",
|
|
33
33
|
"license": "Apache-2.0",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"qase-javascript-commons": "~2.
|
|
35
|
+
"qase-javascript-commons": "~2.4.2",
|
|
36
36
|
"uuid": "^9.0.1",
|
|
37
37
|
"@types/node": "^20.1.0",
|
|
38
38
|
"@wdio/reporter": "^8.39.0",
|