@qanalyzer/forge-wdio 1.1.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/LICENSE +202 -0
- package/README.md +136 -0
- package/dist/__fixtures__/saucedemo-13.json +183 -0
- package/dist/cucumber-tags.d.ts +15 -0
- package/dist/cucumber-tags.js +60 -0
- package/dist/enrich-screenshots.d.ts +2 -0
- package/dist/enrich-screenshots.js +51 -0
- package/dist/failure-screenshot-buffer.d.ts +20 -0
- package/dist/failure-screenshot-buffer.js +35 -0
- package/dist/helpers.d.ts +36 -0
- package/dist/helpers.js +101 -0
- package/dist/hooks.d.ts +23 -0
- package/dist/hooks.js +61 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +26 -0
- package/dist/metadata-manager.d.ts +13 -0
- package/dist/metadata-manager.js +19 -0
- package/dist/publish.d.ts +6 -0
- package/dist/publish.js +54 -0
- package/dist/report-builder.d.ts +25 -0
- package/dist/report-builder.js +83 -0
- package/dist/reporter.d.ts +44 -0
- package/dist/reporter.js +290 -0
- package/dist/results-buffer.d.ts +17 -0
- package/dist/results-buffer.js +44 -0
- package/dist/service.d.ts +48 -0
- package/dist/service.js +106 -0
- package/package.json +61 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright © 2026 JSoft
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# @qanalyzer/forge-wdio
|
|
2
|
+
|
|
3
|
+
WebdriverIO reporter + service for **QAnalyzer** (Jira Forge quality hub).
|
|
4
|
+
|
|
5
|
+
Supports **WebdriverIO 8+** with **Mocha** (`@wdio/mocha-framework`) or **Cucumber** (`@wdio/cucumber-framework`).
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Mocha (default)
|
|
11
|
+
npm install -D @qanalyzer/forge-wdio @qanalyzer/forge-commons @wdio/mocha-framework
|
|
12
|
+
|
|
13
|
+
# Cucumber
|
|
14
|
+
npm install -D @qanalyzer/forge-wdio @qanalyzer/forge-commons @wdio/cucumber-framework
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Configure — Mocha
|
|
18
|
+
|
|
19
|
+
```js
|
|
20
|
+
// wdio.conf.js
|
|
21
|
+
const QaWdioReporter = require('@qanalyzer/forge-wdio').default;
|
|
22
|
+
const { beforeRunHook, afterRunHook, QaWdioService } = require('@qanalyzer/forge-wdio');
|
|
23
|
+
|
|
24
|
+
exports.config = {
|
|
25
|
+
specs: ['./test/specs/**/*.spec.js'],
|
|
26
|
+
baseUrl: 'https://www.saucedemo.com',
|
|
27
|
+
framework: 'mocha',
|
|
28
|
+
reporters: [
|
|
29
|
+
[
|
|
30
|
+
QaWdioReporter,
|
|
31
|
+
{
|
|
32
|
+
// Defaults to mode=off (no credentials required)
|
|
33
|
+
// mode: 'ingest' | 'file' | 'off',
|
|
34
|
+
// projectKey: 'DEMO',
|
|
35
|
+
disableWebdriverStepsReporting: true, // default
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
],
|
|
39
|
+
services: [[QaWdioService, {}]],
|
|
40
|
+
capabilities: [
|
|
41
|
+
{
|
|
42
|
+
browserName: 'chrome',
|
|
43
|
+
'goog:chromeOptions': { args: ['--headless', '--disable-gpu'] },
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
onPrepare: async function () {
|
|
47
|
+
await beforeRunHook();
|
|
48
|
+
},
|
|
49
|
+
onComplete: async function () {
|
|
50
|
+
await afterRunHook();
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Configure — Cucumber
|
|
56
|
+
|
|
57
|
+
```js
|
|
58
|
+
// wdio.cucumber.conf.js
|
|
59
|
+
const QaWdioReporter = require('@qanalyzer/forge-wdio').default;
|
|
60
|
+
const { beforeRunHook, afterRunHook, QaWdioService } = require('@qanalyzer/forge-wdio');
|
|
61
|
+
|
|
62
|
+
exports.config = {
|
|
63
|
+
specs: ['./test/features/**/*.feature'],
|
|
64
|
+
framework: 'cucumber',
|
|
65
|
+
cucumberOpts: {
|
|
66
|
+
require: ['./test/step-definitions/**/*.js'],
|
|
67
|
+
},
|
|
68
|
+
reporters: [
|
|
69
|
+
[
|
|
70
|
+
QaWdioReporter,
|
|
71
|
+
{
|
|
72
|
+
useCucumber: true, // scenario → one result; Gherkin steps → meta.qa.steps
|
|
73
|
+
disableWebdriverStepsReporting: true,
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
],
|
|
77
|
+
services: [[QaWdioService, {}]],
|
|
78
|
+
onPrepare: async () => { await beforeRunHook(); },
|
|
79
|
+
onComplete: async () => { await afterRunHook(); },
|
|
80
|
+
};
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Tag conventions:
|
|
84
|
+
|
|
85
|
+
- Prefer **Jira keys in the scenario title** or bare tags: `@AUTH-101`
|
|
86
|
+
- Optional metadata: `@suite=Checkout`, `@title=…`, `@tags=smoke,e2e`
|
|
87
|
+
|
|
88
|
+
See `examples/single/wdio/wdio.cucumber.conf.js`.
|
|
89
|
+
|
|
90
|
+
**Required for ingest/file:** `onPrepare` → `beforeRunHook` and `onComplete` → `afterRunHook`.
|
|
91
|
+
|
|
92
|
+
### Modes
|
|
93
|
+
|
|
94
|
+
| Mode | Behavior |
|
|
95
|
+
| ---- | -------- |
|
|
96
|
+
| `off` (default) | No network / file write |
|
|
97
|
+
| `file` | Writes the ingest payload (default `./qanalyzer-results.json`) |
|
|
98
|
+
| `ingest` | POSTs the payload with `format: jest-json` |
|
|
99
|
+
|
|
100
|
+
Env: `QANALYZER_MODE`, `QANALYZER_PROJECT_KEY`, `QANALYZER_INGEST_URL`, `QANALYZER_INGEST_TOKEN`, `QANALYZER_LAUNCH_NAME`.
|
|
101
|
+
|
|
102
|
+
## Helpers (Mocha)
|
|
103
|
+
|
|
104
|
+
```js
|
|
105
|
+
const { qa } = require('@qanalyzer/forge-wdio');
|
|
106
|
+
const LoginPage = require('../pageobjects/LoginPage');
|
|
107
|
+
|
|
108
|
+
describe('Login', () => {
|
|
109
|
+
it('AUTH-101 User can login with valid credentials', async () => {
|
|
110
|
+
qa.fields({ severity: 'critical', layer: 'e2e' });
|
|
111
|
+
qa.suite('E-commerce\\tAuthentication\\tLogin');
|
|
112
|
+
|
|
113
|
+
await qa.step('Open login page', async () => {
|
|
114
|
+
await LoginPage.open();
|
|
115
|
+
await expect(LoginPage.usernameInput).toBeDisplayed();
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
await qa.step('Login', async (step) => {
|
|
119
|
+
await step.step('Fill credentials', async () => {
|
|
120
|
+
await LoginPage.login('standard_user', 'secret_sauce');
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Prefer **Jira issue keys in test titles**. Use **`await qa.step()`** for step timelines (including nested `step.step()`).
|
|
128
|
+
|
|
129
|
+
`qa.attach({ type: 'text/plain', ... })` uploads via Forge when content/path is set (still-image / small files). Use **`type`**, not `contentType`.
|
|
130
|
+
|
|
131
|
+
## Run
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
QANALYZER_MODE=off npx wdio run wdio.conf.js
|
|
135
|
+
QANALYZER_MODE=off npx wdio run wdio.cucumber.conf.js
|
|
136
|
+
```
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
{
|
|
2
|
+
"suite": "saucedemo-reference-wdio",
|
|
3
|
+
"source": "saucedemo e-commerce suite (login/inventory/cart/checkout) \u2014 titles use FR43 AUTH-* keys; steps via await qa.step()",
|
|
4
|
+
"specs": [
|
|
5
|
+
{
|
|
6
|
+
"name": "test/specs/login.spec.js",
|
|
7
|
+
"assertions": [
|
|
8
|
+
{
|
|
9
|
+
"ancestorTitles": [
|
|
10
|
+
"Login Scenarios"
|
|
11
|
+
],
|
|
12
|
+
"title": "AUTH-101 User can login with valid credentials",
|
|
13
|
+
"status": "passed",
|
|
14
|
+
"duration": 1200,
|
|
15
|
+
"steps": [
|
|
16
|
+
"Fill in username",
|
|
17
|
+
"Fill in password",
|
|
18
|
+
"Submit login form",
|
|
19
|
+
"Verify successful login"
|
|
20
|
+
]
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"ancestorTitles": [
|
|
24
|
+
"Login Scenarios"
|
|
25
|
+
],
|
|
26
|
+
"title": "AUTH-102 User cannot login with invalid password",
|
|
27
|
+
"status": "passed",
|
|
28
|
+
"duration": 800,
|
|
29
|
+
"steps": [
|
|
30
|
+
"Attempt login with invalid credentials",
|
|
31
|
+
"Verify error message is shown"
|
|
32
|
+
]
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"ancestorTitles": [
|
|
36
|
+
"Login Scenarios"
|
|
37
|
+
],
|
|
38
|
+
"title": "AUTH-103 Locked user cannot login",
|
|
39
|
+
"status": "passed",
|
|
40
|
+
"duration": 700,
|
|
41
|
+
"steps": [
|
|
42
|
+
"Attempt login with locked user",
|
|
43
|
+
"Verify locked out error"
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"name": "test/specs/inventory.spec.js",
|
|
50
|
+
"assertions": [
|
|
51
|
+
{
|
|
52
|
+
"ancestorTitles": [
|
|
53
|
+
"Product Inventory"
|
|
54
|
+
],
|
|
55
|
+
"title": "AUTH-104 User can browse all products",
|
|
56
|
+
"status": "passed",
|
|
57
|
+
"duration": 900,
|
|
58
|
+
"steps": [
|
|
59
|
+
"Verify Products page title",
|
|
60
|
+
"Count inventory items"
|
|
61
|
+
]
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"ancestorTitles": [
|
|
65
|
+
"Product Inventory"
|
|
66
|
+
],
|
|
67
|
+
"title": "AUTH-105 User can sort products by price",
|
|
68
|
+
"status": "passed",
|
|
69
|
+
"duration": 850,
|
|
70
|
+
"steps": [
|
|
71
|
+
"Select sort by price low to high",
|
|
72
|
+
"Verify prices ascending"
|
|
73
|
+
]
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"ancestorTitles": [
|
|
77
|
+
"Product Inventory"
|
|
78
|
+
],
|
|
79
|
+
"title": "AUTH-106 User can view product details",
|
|
80
|
+
"status": "passed",
|
|
81
|
+
"duration": 750,
|
|
82
|
+
"steps": [
|
|
83
|
+
"Click on first product name",
|
|
84
|
+
"Verify product detail page"
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"name": "test/specs/cart.spec.js",
|
|
91
|
+
"assertions": [
|
|
92
|
+
{
|
|
93
|
+
"ancestorTitles": [
|
|
94
|
+
"Cart Management"
|
|
95
|
+
],
|
|
96
|
+
"title": "AUTH-107 User can add product to cart",
|
|
97
|
+
"status": "passed",
|
|
98
|
+
"duration": 1000,
|
|
99
|
+
"steps": [
|
|
100
|
+
"Add to cart",
|
|
101
|
+
"Verify cart badge"
|
|
102
|
+
]
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"ancestorTitles": [
|
|
106
|
+
"Cart Management"
|
|
107
|
+
],
|
|
108
|
+
"title": "AUTH-108 User can remove product from cart",
|
|
109
|
+
"status": "passed",
|
|
110
|
+
"duration": 950,
|
|
111
|
+
"steps": [
|
|
112
|
+
"Remove from cart",
|
|
113
|
+
"Verify empty"
|
|
114
|
+
]
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"ancestorTitles": [
|
|
118
|
+
"Cart Management"
|
|
119
|
+
],
|
|
120
|
+
"title": "AUTH-109 User can add multiple products to cart",
|
|
121
|
+
"status": "passed",
|
|
122
|
+
"duration": 1100,
|
|
123
|
+
"steps": [
|
|
124
|
+
"Add products",
|
|
125
|
+
"Verify count"
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
]
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"name": "test/specs/checkout.spec.js",
|
|
132
|
+
"assertions": [
|
|
133
|
+
{
|
|
134
|
+
"ancestorTitles": [
|
|
135
|
+
"Checkout Flow"
|
|
136
|
+
],
|
|
137
|
+
"title": "AUTH-110 User can complete checkout with valid information",
|
|
138
|
+
"status": "passed",
|
|
139
|
+
"duration": 1500,
|
|
140
|
+
"steps": [
|
|
141
|
+
"Fill checkout",
|
|
142
|
+
"Finish",
|
|
143
|
+
"Verify confirmation"
|
|
144
|
+
]
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"ancestorTitles": [
|
|
148
|
+
"Checkout Flow"
|
|
149
|
+
],
|
|
150
|
+
"title": "AUTH-111 Checkout fails without required information",
|
|
151
|
+
"status": "passed",
|
|
152
|
+
"duration": 600,
|
|
153
|
+
"steps": [
|
|
154
|
+
"Submit empty",
|
|
155
|
+
"Verify validation"
|
|
156
|
+
]
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
"ancestorTitles": [
|
|
160
|
+
"Checkout Flow"
|
|
161
|
+
],
|
|
162
|
+
"title": "AUTH-112 User can cancel checkout",
|
|
163
|
+
"status": "passed",
|
|
164
|
+
"duration": 700,
|
|
165
|
+
"steps": [
|
|
166
|
+
"Cancel",
|
|
167
|
+
"Verify cart"
|
|
168
|
+
]
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"ancestorTitles": [
|
|
172
|
+
"Checkout Flow"
|
|
173
|
+
],
|
|
174
|
+
"title": "AUTH-113 Demo test that will be ignored in reporting",
|
|
175
|
+
"status": "pending",
|
|
176
|
+
"duration": 0,
|
|
177
|
+
"steps": [],
|
|
178
|
+
"ignore": true
|
|
179
|
+
}
|
|
180
|
+
]
|
|
181
|
+
}
|
|
182
|
+
]
|
|
183
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Map WDIO Cucumber tags → MetadataManager / issue-key sources (FR135 / FR43).
|
|
3
|
+
* Supports `@suite=…`, `@tags=…`, `@title=…` and bare `@PROJ-123` issue keys.
|
|
4
|
+
* Does not handle Qase `@QaseId`.
|
|
5
|
+
*/
|
|
6
|
+
export type TagLike = {
|
|
7
|
+
name: string;
|
|
8
|
+
};
|
|
9
|
+
export type CucumberTagApplyResult = {
|
|
10
|
+
issueKeys: string[];
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Apply Cucumber scenario tags onto MetadataManager; return bare issue keys.
|
|
14
|
+
*/
|
|
15
|
+
export declare function applyCucumberTags(tags: readonly TagLike[]): CucumberTagApplyResult;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Map WDIO Cucumber tags → MetadataManager / issue-key sources (FR135 / FR43).
|
|
4
|
+
* Supports `@suite=…`, `@tags=…`, `@title=…` and bare `@PROJ-123` issue keys.
|
|
5
|
+
* Does not handle Qase `@QaseId`.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.applyCucumberTags = applyCucumberTags;
|
|
9
|
+
const metadata_manager_1 = require("./metadata-manager");
|
|
10
|
+
const ISSUE_KEY_TAG_RE = /^@?([A-Z][A-Z0-9]+-\d+)$/;
|
|
11
|
+
function parseKeyValueTag(tag) {
|
|
12
|
+
const raw = tag.startsWith('@') ? tag : `@${tag}`;
|
|
13
|
+
const eq = raw.indexOf('=');
|
|
14
|
+
if (eq <= 0)
|
|
15
|
+
return null;
|
|
16
|
+
const key = raw.slice(0, eq);
|
|
17
|
+
const value = raw.slice(eq + 1).trim();
|
|
18
|
+
if (!key || !value)
|
|
19
|
+
return null;
|
|
20
|
+
return { key, value };
|
|
21
|
+
}
|
|
22
|
+
function extractBareIssueKey(tag) {
|
|
23
|
+
const m = tag.match(ISSUE_KEY_TAG_RE);
|
|
24
|
+
return m?.[1] ?? null;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Apply Cucumber scenario tags onto MetadataManager; return bare issue keys.
|
|
28
|
+
*/
|
|
29
|
+
function applyCucumberTags(tags) {
|
|
30
|
+
const issueKeys = [];
|
|
31
|
+
for (const tag of tags) {
|
|
32
|
+
const name = typeof tag?.name === 'string' ? tag.name.trim() : '';
|
|
33
|
+
if (!name)
|
|
34
|
+
continue;
|
|
35
|
+
const kv = parseKeyValueTag(name);
|
|
36
|
+
if (kv) {
|
|
37
|
+
switch (kv.key.toLowerCase()) {
|
|
38
|
+
case '@suite':
|
|
39
|
+
metadata_manager_1.MetadataManager.push('qa-suite', kv.value);
|
|
40
|
+
break;
|
|
41
|
+
case '@tags':
|
|
42
|
+
metadata_manager_1.MetadataManager.push('qa-fields', {
|
|
43
|
+
tags: kv.value,
|
|
44
|
+
});
|
|
45
|
+
break;
|
|
46
|
+
case '@title':
|
|
47
|
+
metadata_manager_1.MetadataManager.push('qa-title', kv.value);
|
|
48
|
+
break;
|
|
49
|
+
default:
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
const issueKey = extractBareIssueKey(name);
|
|
55
|
+
if (issueKey) {
|
|
56
|
+
issueKeys.push(issueKey);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return { issueKeys };
|
|
60
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.enrichSpecsWithFailureScreenshots = enrichSpecsWithFailureScreenshots;
|
|
4
|
+
const failure_screenshot_buffer_1 = require("./failure-screenshot-buffer");
|
|
5
|
+
function ensureQaMeta(assertion) {
|
|
6
|
+
if (!assertion.meta)
|
|
7
|
+
assertion.meta = {};
|
|
8
|
+
if (!assertion.meta.qa) {
|
|
9
|
+
assertion.meta.qa = {
|
|
10
|
+
framework: 'wdio',
|
|
11
|
+
host: { framework: 'wdio', reporter: '@qanalyzer/forge-wdio' },
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
return assertion.meta.qa;
|
|
15
|
+
}
|
|
16
|
+
function enrichSpecsWithFailureScreenshots(specs) {
|
|
17
|
+
for (const spec of specs) {
|
|
18
|
+
for (const assertion of spec.assertions) {
|
|
19
|
+
if (assertion.status !== 'failed')
|
|
20
|
+
continue;
|
|
21
|
+
const shots = failure_screenshot_buffer_1.FailureScreenshotBuffer.takeForTitle(assertion.title);
|
|
22
|
+
if (shots.length === 0)
|
|
23
|
+
continue;
|
|
24
|
+
const qa = ensureQaMeta(assertion);
|
|
25
|
+
if (!qa.attachments)
|
|
26
|
+
qa.attachments = [];
|
|
27
|
+
qa.attachments.push(...shots);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
// Ordered fallback for any remaining shots vs remaining failed assertions
|
|
31
|
+
const leftovers = failure_screenshot_buffer_1.FailureScreenshotBuffer.takeAll();
|
|
32
|
+
if (leftovers.length === 0)
|
|
33
|
+
return;
|
|
34
|
+
let li = 0;
|
|
35
|
+
for (const spec of specs) {
|
|
36
|
+
for (const assertion of spec.assertions) {
|
|
37
|
+
if (assertion.status !== 'failed' || li >= leftovers.length)
|
|
38
|
+
continue;
|
|
39
|
+
// Skip if already has a screenshot-like attach from takeForTitle
|
|
40
|
+
const qa = ensureQaMeta(assertion);
|
|
41
|
+
const hasShot = (qa.attachments ?? []).some((a) => a.mime_type?.startsWith('image/') ||
|
|
42
|
+
/\.(png|jpe?g|webp)$/i.test(a.file_name ?? ''));
|
|
43
|
+
if (hasShot)
|
|
44
|
+
continue;
|
|
45
|
+
if (!qa.attachments)
|
|
46
|
+
qa.attachments = [];
|
|
47
|
+
qa.attachments.push(leftovers[li].attachment);
|
|
48
|
+
li += 1;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Buffer for failure still-image wire metadata between service afterTest and publish (FR133).
|
|
3
|
+
*/
|
|
4
|
+
import type { QaMetaAttachmentWire } from '@qanalyzer/forge-commons';
|
|
5
|
+
type ShotEntry = {
|
|
6
|
+
title: string;
|
|
7
|
+
attachment: QaMetaAttachmentWire;
|
|
8
|
+
};
|
|
9
|
+
export declare const FailureScreenshotBuffer: {
|
|
10
|
+
clear(): void;
|
|
11
|
+
add(title: string, attachment: QaMetaAttachmentWire): void;
|
|
12
|
+
/**
|
|
13
|
+
* Take all shots matching a test title (exact or substring), removing them from the buffer.
|
|
14
|
+
*/
|
|
15
|
+
takeForTitle(title: string): QaMetaAttachmentWire[];
|
|
16
|
+
/** Drain remaining shots (ordered) for publish-time fallback. */
|
|
17
|
+
takeAll(): ShotEntry[];
|
|
18
|
+
size(): number;
|
|
19
|
+
};
|
|
20
|
+
export {};
|