@qualflare/playwright 0.1.0

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 ADDED
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2026 Qualflare
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,139 @@
1
+ # @qualflare/playwright
2
+
3
+ [![npm version](https://img.shields.io/npm/v/%40qualflare%2Fplaywright.svg)](https://www.npmjs.com/package/@qualflare/playwright)
4
+ [![CI](https://github.com/Qualflare/qualflare-playwright/actions/workflows/ci.yml/badge.svg)](https://github.com/Qualflare/qualflare-playwright/actions/workflows/ci.yml)
5
+ [![License: Apache-2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](./LICENSE)
6
+
7
+ A native Playwright reporter for [Qualflare](https://qualflare.com) — captures test results directly
8
+ from your `playwright test` run: status, real retry counts and flakiness, nested `test.step()` trees,
9
+ screenshots, videos, and author-facing metadata (labels, links, tags, priority, custom attachments).
10
+
11
+ The reporter itself makes **no network calls**. It writes a report directory, and
12
+ [`qualflare-cli`](https://github.com/Qualflare/qualflare-cli) uploads it — which is what lets any
13
+ number of sharded CI jobs merge into a single Launch.
14
+
15
+ ## Install
16
+
17
+ ```sh
18
+ npm install --save-dev @qualflare/playwright
19
+ ```
20
+
21
+ Requires `@playwright/test` `>=1.40.0` (installed separately as a peer dependency) and Node `>=18`
22
+ (Playwright 1.62+ itself requires Node `>=20`). You also need
23
+ [`@qualflare/cli`](https://github.com/Qualflare/qualflare-cli) **v0.1.17 or newer** to upload what
24
+ this reporter writes.
25
+
26
+ The peer range is deliberately open-ended rather than capped at a known-good version, so a new
27
+ Playwright release never hard-blocks `npm install` for you. 1.40, 1.50 and 1.62 are exercised in CI
28
+ against a real `playwright test` run; newer versions are untested but not refused — please
29
+ [open an issue](https://github.com/Qualflare/qualflare-playwright/issues) if one misbehaves.
30
+
31
+ ## Quickstart
32
+
33
+ ```ts
34
+ // playwright.config.ts
35
+ import { defineConfig } from '@playwright/test';
36
+ import { qualflareReporter } from '@qualflare/playwright';
37
+
38
+ export default defineConfig({
39
+ reporter: [['list'], qualflareReporter({ environment: 'staging' })],
40
+ });
41
+ ```
42
+
43
+ `qualflareReporter()` is a typed helper. Playwright types reporter options as `any`, so the
44
+ hand-written tuple form silently accepts typos — but it works too, if you prefer it:
45
+
46
+ ```ts
47
+ reporter: [['list'], ['@qualflare/playwright/reporter', { environment: 'staging' }]],
48
+ ```
49
+
50
+ Then run your tests and upload the results — two steps, and no token needed for the first:
51
+
52
+ ```sh
53
+ # 1. Run. Writes ./qualflare-results (JSON + any videos). Zero network calls.
54
+ npx playwright test
55
+
56
+ # 2. Upload. `qf login <identifier> <token>` stores the credential once.
57
+ qf <your-project-identifier> collect ./qualflare-results
58
+ ```
59
+
60
+ ### Sharded CI
61
+
62
+ Point every shard at the **same** `outputDir` and collect once at the end. Each process writes its
63
+ own uniquely-named file, so shards never overwrite each other, and `qf collect` merges every file in
64
+ the directory into a single Launch:
65
+
66
+ ```sh
67
+ # in each parallel job — all writing to the same directory
68
+ npx playwright test --shard="$SHARD_INDEX/$SHARD_TOTAL"
69
+
70
+ # once, after all shards finish (e.g. with the directory restored from CI artifacts)
71
+ qf <your-project-identifier> collect ./qualflare-results
72
+ ```
73
+
74
+ Nothing needs configuring for this: Playwright hands reporters its own `--shard` value, so each
75
+ case is stamped with the shard that ran it automatically. (Playwright's shard index is 1-based and
76
+ Qualflare's is 0-based; the conversion is handled for you.)
77
+
78
+ ## Enriching your tests
79
+
80
+ ```ts
81
+ import { test, expect } from '@playwright/test';
82
+ import { qualflare } from '@qualflare/playwright';
83
+
84
+ test('a user can check out @smoke', async ({ page }) => {
85
+ qualflare.label('epic', 'Billing');
86
+ qualflare.link('https://tracker.example/QF-42', { type: 'issue', name: 'QF-42' });
87
+ qualflare.priority('high');
88
+
89
+ await qualflare.step('add an item to the cart', async () => {
90
+ qualflare.parameter('sku', 'BOOK-1');
91
+ await page.getByRole('button', { name: 'Add' }).click();
92
+ });
93
+
94
+ await expect(page.getByTestId('total')).toHaveText('10.00');
95
+ });
96
+ ```
97
+
98
+ `qualflare.step()` delegates to Playwright's own `test.step()`, so your steps appear in the
99
+ Playwright HTML report and trace viewer as well as in Qualflare. Full reference in
100
+ [`docs/METADATA-API.md`](./docs/METADATA-API.md).
101
+
102
+ ## Configuration
103
+
104
+ Every option has an environment-variable override, and everything has a sensible default — see
105
+ [`docs/CONFIGURATION.md`](./docs/CONFIGURATION.md). There is no `token` option: this reporter makes
106
+ no requests, so it has no credential.
107
+
108
+ ## Known limitations
109
+
110
+ - **Traces are not uploaded.** Playwright traces are `application/zip`, which Qualflare's attachment
111
+ upload endpoint rejects. They are deliberately not attached rather than attached as a link to
112
+ nothing.
113
+ - **`pw:api` and `fixture` steps are filtered out by default** (`includeApiSteps`) — a single
114
+ browser test emits hundreds, which buries the steps you actually wrote. A *failed* one is always
115
+ kept.
116
+ - **`outputDir` is merged blindly** — `qf collect` uploads every report file it finds, with no
117
+ run-identity check, so a directory left over from a previous run is silently merged into the
118
+ current one. Clear it at the start of each run.
119
+ - **`merge-reports` mode is not supported** in v0.1.0 — use the `outputDir` flow above rather than
120
+ Playwright's `blob` reporter.
121
+
122
+ Full details in [`docs/LIMITATIONS.md`](./docs/LIMITATIONS.md).
123
+
124
+ ## Development
125
+
126
+ ```sh
127
+ npm run typecheck # tsc --noEmit
128
+ npm run lint # eslint .
129
+ npm run build # tsup -> dist/ (ESM + CJS + d.ts)
130
+ npm test # unit tests
131
+ npm run test:integration # spawns a REAL `playwright test` against test/integration/fixtures/
132
+ ```
133
+
134
+ The integration suite loads the reporter from the built `dist/`, not `src/`, so it exercises the
135
+ real package `exports` map — run `npm run build` first.
136
+
137
+ ## License
138
+
139
+ Apache-2.0
package/dist/index.cjs ADDED
@@ -0,0 +1,139 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var src_exports = {};
22
+ __export(src_exports, {
23
+ qualflare: () => qualflare,
24
+ qualflareReporter: () => qualflareReporter
25
+ });
26
+ module.exports = __toCommonJS(src_exports);
27
+
28
+ // src/runtime/qualflare-api.ts
29
+ var import_test = require("@playwright/test");
30
+
31
+ // src/shared/constants.ts
32
+ var RESERVED_MESSAGE_MEDIA_TYPE = "application/vnd.qualflare.message+json";
33
+ var MAX_VIDEO_UPLOAD_BYTES = 50 * 1024 * 1024;
34
+
35
+ // src/shared/logger.ts
36
+ var PREFIX = "[qualflare-playwright]";
37
+ var logger = {
38
+ debug(...args) {
39
+ console.debug(PREFIX, ...args);
40
+ },
41
+ info(...args) {
42
+ console.log(PREFIX, ...args);
43
+ },
44
+ warn(...args) {
45
+ console.warn(PREFIX, ...args);
46
+ },
47
+ error(...args) {
48
+ console.error(PREFIX, ...args);
49
+ }
50
+ };
51
+
52
+ // src/runtime/qualflare-api.ts
53
+ function send(message) {
54
+ try {
55
+ void import_test.test.info().attach(`qualflare:${message.type}`, {
56
+ body: Buffer.from(JSON.stringify(message), "utf8"),
57
+ contentType: RESERVED_MESSAGE_MEDIA_TYPE
58
+ }).catch((err) => {
59
+ logger.warn(`qualflare.${message.type}() could not be recorded: ${err.message}`);
60
+ });
61
+ } catch {
62
+ logger.warn(`qualflare.${message.type}() was called outside a running test; the call was ignored.`);
63
+ }
64
+ }
65
+ var qualflare = {
66
+ /** Arbitrary name/value metadata (epic, feature, story, owner, severity). */
67
+ label(name, value) {
68
+ send({ type: "label", name, value });
69
+ },
70
+ /** A typed external reference. `type` defaults to `custom`. */
71
+ link(url, opts) {
72
+ send({ type: "link", url, linkType: opts?.type, name: opts?.name });
73
+ },
74
+ /** One or more free-text tags. */
75
+ tag(...tags) {
76
+ send({ type: "tag", tags });
77
+ },
78
+ /** Markdown description shown on the case. */
79
+ description(text) {
80
+ send({ type: "description", text });
81
+ },
82
+ /** Case priority (low | medium | high | critical). */
83
+ priority(value) {
84
+ send({ type: "priority", value });
85
+ },
86
+ /** A named input. Inside an open `step()` it attaches to that step;
87
+ * outside any step it lands in the case's properties. `masked` is a
88
+ * display hint for the UI only — the server does not redact the value. */
89
+ parameter(name, value, opts) {
90
+ send({ type: "parameter", name, value, masked: opts?.masked });
91
+ },
92
+ /** Attach in-memory content. */
93
+ attachment(name, content, opts) {
94
+ const contentBase64 = opts?.encoding === "base64" ? content : Buffer.from(content, "utf8").toString("base64");
95
+ send({ type: "attachment", name, contentBase64, mimeType: opts?.mimeType });
96
+ },
97
+ /** Attach a file from disk. */
98
+ attachmentFromFile(name, path, opts) {
99
+ send({ type: "attachment_from_file", name, path, mimeType: opts?.mimeType });
100
+ },
101
+ /**
102
+ * Records a named step around `fn`.
103
+ *
104
+ * Unlike the cucumber-js equivalent, this delegates to Playwright's own
105
+ * `test.step()` as well, so the step shows up in Playwright's HTML report
106
+ * and trace viewer in addition to Qualflare — there is no reason to make
107
+ * users choose, and a step that exists in only one of the two is a
108
+ * confusing thing to debug against.
109
+ */
110
+ async step(name, fn) {
111
+ return import_test.test.step(name, async () => {
112
+ send({ type: "step_start", name, timestamp: Date.now() });
113
+ try {
114
+ const result = await fn();
115
+ send({ type: "step_stop", status: "passed", timestamp: Date.now() });
116
+ return result;
117
+ } catch (err) {
118
+ send({
119
+ type: "step_stop",
120
+ status: "failed",
121
+ error: err instanceof Error ? err.message : String(err),
122
+ timestamp: Date.now()
123
+ });
124
+ throw err;
125
+ }
126
+ });
127
+ }
128
+ };
129
+
130
+ // src/index.ts
131
+ function qualflareReporter(options = {}) {
132
+ return ["@qualflare/playwright/reporter", options];
133
+ }
134
+ // Annotate the CommonJS export names for ESM import in node:
135
+ 0 && (module.exports = {
136
+ qualflare,
137
+ qualflareReporter
138
+ });
139
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/runtime/qualflare-api.ts","../src/shared/constants.ts","../src/shared/logger.ts"],"sourcesContent":["import type { ReporterDescription } from '@playwright/test';\n\nimport type { QualflarePlaywrightOptions } from './config/resolve-config.js';\n\nexport { qualflare } from './runtime/qualflare-api.js';\n\nexport type { QualflarePlaywrightOptions, ResolvedReporterConfig } from './config/resolve-config.js';\n\nexport type {\n Attachment,\n Case,\n CasePriority,\n CaseStatus,\n Collect,\n FrameworkCategory,\n Label,\n Link,\n LinkType,\n Metadata,\n NanosecondDuration,\n Parameter,\n Platform,\n Step,\n Suite,\n} from './shared/types.js';\n\n/**\n * Typed helper for registering the reporter.\n *\n * Playwright types a reporter's options as `any` (`ReporterDescription` ends\n * in `[string, any]`), so writing the tuple by hand gives no autocomplete and\n * silently accepts typos. This returns the same tuple with the options\n * checked:\n *\n * ```ts\n * import { defineConfig } from '@playwright/test';\n * import { qualflareReporter } from '@qualflare/playwright';\n *\n * export default defineConfig({\n * reporter: [['list'], qualflareReporter({ environment: 'staging' })],\n * });\n * ```\n */\nexport function qualflareReporter(options: QualflarePlaywrightOptions = {}): ReporterDescription {\n return ['@qualflare/playwright/reporter', options];\n}\n","import { test } from '@playwright/test';\n\nimport { RESERVED_MESSAGE_MEDIA_TYPE } from '../shared/constants.js';\nimport { logger } from '../shared/logger.js';\nimport type { CasePriority, LinkType } from '../shared/types.js';\nimport type { RuntimeMessage } from './message-types.js';\n\n/**\n * Ships one structured message from the test process to the reporter.\n *\n * Playwright runs tests in worker processes and reporters in the main\n * process, with no shared memory — the only user-reachable channel back is\n * `testInfo.attach()`. So every `qualflare.*()` call is serialized and\n * attached under a reserved content type; the reporter recognizes that exact\n * type in `onTestEnd`, replays it as a model mutation, and excludes it from\n * real attachment processing. Same trick `@qualflare/cucumberjs` plays with\n * `World.attach()`, for the same reason.\n *\n * `test.info()` throws when called outside a running test (module scope, a\n * `globalSetup`, a stray import). Warn and drop: a metadata call is never\n * worth failing somebody's suite over.\n */\nfunction send(message: RuntimeMessage): void {\n try {\n // The .catch() is not optional. `attach()` returns a promise, and an\n // unhandled rejection TERMINATES the process by default on Node >= 15 —\n // a metadata call would take the user's entire test run down with it.\n // The surrounding try/catch only covers a synchronous throw from\n // `test.info()` (called outside a running test), not this.\n void test\n .info()\n .attach(`qualflare:${message.type}`, {\n body: Buffer.from(JSON.stringify(message), 'utf8'),\n contentType: RESERVED_MESSAGE_MEDIA_TYPE,\n })\n .catch((err: unknown) => {\n logger.warn(`qualflare.${message.type}() could not be recorded: ${(err as Error).message}`);\n });\n } catch {\n logger.warn(`qualflare.${message.type}() was called outside a running test; the call was ignored.`);\n }\n}\n\n/**\n * Author-facing metadata API. Import it in a spec and annotate tests with\n * business context Playwright itself has no concept of:\n *\n * ```ts\n * import { qualflare } from '@qualflare/playwright';\n *\n * test('checks out', async ({ page }) => {\n * qualflare.label('epic', 'Billing');\n * qualflare.link('https://tracker/QF-1', { type: 'issue', name: 'QF-1' });\n * await qualflare.step('pay', async () => { ... });\n * });\n * ```\n */\nexport const qualflare = {\n /** Arbitrary name/value metadata (epic, feature, story, owner, severity). */\n label(name: string, value: string): void {\n send({ type: 'label', name, value });\n },\n\n /** A typed external reference. `type` defaults to `custom`. */\n link(url: string, opts?: { type?: LinkType; name?: string }): void {\n send({ type: 'link', url, linkType: opts?.type, name: opts?.name });\n },\n\n /** One or more free-text tags. */\n tag(...tags: string[]): void {\n send({ type: 'tag', tags });\n },\n\n /** Markdown description shown on the case. */\n description(text: string): void {\n send({ type: 'description', text });\n },\n\n /** Case priority (low | medium | high | critical). */\n priority(value: CasePriority): void {\n send({ type: 'priority', value });\n },\n\n /** A named input. Inside an open `step()` it attaches to that step;\n * outside any step it lands in the case's properties. `masked` is a\n * display hint for the UI only — the server does not redact the value. */\n parameter(name: string, value?: string, opts?: { masked?: boolean }): void {\n send({ type: 'parameter', name, value, masked: opts?.masked });\n },\n\n /** Attach in-memory content. */\n attachment(name: string, content: string, opts?: { encoding?: 'utf8' | 'base64'; mimeType?: string }): void {\n const contentBase64 = opts?.encoding === 'base64' ? content : Buffer.from(content, 'utf8').toString('base64');\n send({ type: 'attachment', name, contentBase64, mimeType: opts?.mimeType });\n },\n\n /** Attach a file from disk. */\n attachmentFromFile(name: string, path: string, opts?: { mimeType?: string }): void {\n send({ type: 'attachment_from_file', name, path, mimeType: opts?.mimeType });\n },\n\n /**\n * Records a named step around `fn`.\n *\n * Unlike the cucumber-js equivalent, this delegates to Playwright's own\n * `test.step()` as well, so the step shows up in Playwright's HTML report\n * and trace viewer in addition to Qualflare — there is no reason to make\n * users choose, and a step that exists in only one of the two is a\n * confusing thing to debug against.\n */\n async step<T>(name: string, fn: () => T | Promise<T>): Promise<T> {\n return test.step(name, async () => {\n send({ type: 'step_start', name, timestamp: Date.now() });\n try {\n const result = await fn();\n send({ type: 'step_stop', status: 'passed', timestamp: Date.now() });\n return result;\n } catch (err) {\n send({\n type: 'step_stop',\n status: 'failed',\n error: err instanceof Error ? err.message : String(err),\n timestamp: Date.now(),\n });\n throw err;\n }\n });\n },\n};\n","/**\n * Shared constants used across the reporter and the author-facing runtime\n * API.\n */\n\n/** Reserved `testInfo.attach()` content type used to smuggle structured\n * `qualflare.*()` calls (label/tag/step/etc.) from test and hook code back to\n * the reporter — the only channel Playwright gives user code back to a\n * running reporter. The reporter recognizes this exact content type and\n * replays the message as a model mutation instead of reporting it as a\n * literal attachment. */\nexport const RESERVED_MESSAGE_MEDIA_TYPE = 'application/vnd.qualflare.message+json';\n\n/** Server-side caps this client should respect defensively (see\n * `api-service/internal/core/domain/launch/launch.go`). */\nexport const MAX_SUITES_PER_LAUNCH = 2000;\nexport const MAX_CASES_PER_SUITE = 5000;\nexport const MAX_STEPS_PER_CASE = 1000;\nexport const MAX_PARAMETERS_PER_STEP = 50;\nexport const MAX_ATTACHMENTS_PER_CASE = 50;\nexport const MAX_LABELS_PER_CASE = 100;\nexport const MAX_LINKS_PER_CASE = 20;\nexport const MAX_TAGS_PER_CASE = 64;\nexport const MAX_TAG_LENGTH = 255;\n\n/** Mirrors `launch.MaxAttachmentUploadFileSize` — the server's hard cap on a\n * single `POST /api/v1/attachments/upload-url` request (video). */\nexport const MAX_VIDEO_UPLOAD_BYTES = 50 * 1024 * 1024;\n\n/** Client-side SOFT cap on steps recorded per scenario attempt — well under\n * the server's 1000-per-case hard cap (`MAX_STEPS_PER_CASE`). Once hit,\n * further steps within that attempt are dropped (with a one-time warning),\n * not queued and truncated later. */\nexport const MAX_STEPS_PER_TEST_ATTEMPT = 300;\n","/**\n * A minimal logger writing to stderr. Deliberately avoids stdout, since\n * that's typically Playwright's own reporter output stream and shouldn't be\n * polluted with reporter diagnostics.\n */\n\nconst PREFIX = '[qualflare-playwright]';\n\nexport const logger = {\n debug(...args: unknown[]): void {\n console.debug(PREFIX, ...args);\n },\n info(...args: unknown[]): void {\n console.log(PREFIX, ...args);\n },\n warn(...args: unknown[]): void {\n console.warn(PREFIX, ...args);\n },\n error(...args: unknown[]): void {\n console.error(PREFIX, ...args);\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,kBAAqB;;;ACWd,IAAM,8BAA8B;AAgBpC,IAAM,yBAAyB,KAAK,OAAO;;;ACrBlD,IAAM,SAAS;AAER,IAAM,SAAS;AAAA,EACpB,SAAS,MAAuB;AAC9B,YAAQ,MAAM,QAAQ,GAAG,IAAI;AAAA,EAC/B;AAAA,EACA,QAAQ,MAAuB;AAC7B,YAAQ,IAAI,QAAQ,GAAG,IAAI;AAAA,EAC7B;AAAA,EACA,QAAQ,MAAuB;AAC7B,YAAQ,KAAK,QAAQ,GAAG,IAAI;AAAA,EAC9B;AAAA,EACA,SAAS,MAAuB;AAC9B,YAAQ,MAAM,QAAQ,GAAG,IAAI;AAAA,EAC/B;AACF;;;AFCA,SAAS,KAAK,SAA+B;AAC3C,MAAI;AAMF,SAAK,iBACF,KAAK,EACL,OAAO,aAAa,QAAQ,IAAI,IAAI;AAAA,MACnC,MAAM,OAAO,KAAK,KAAK,UAAU,OAAO,GAAG,MAAM;AAAA,MACjD,aAAa;AAAA,IACf,CAAC,EACA,MAAM,CAAC,QAAiB;AACvB,aAAO,KAAK,aAAa,QAAQ,IAAI,6BAA8B,IAAc,OAAO,EAAE;AAAA,IAC5F,CAAC;AAAA,EACL,QAAQ;AACN,WAAO,KAAK,aAAa,QAAQ,IAAI,6DAA6D;AAAA,EACpG;AACF;AAgBO,IAAM,YAAY;AAAA;AAAA,EAEvB,MAAM,MAAc,OAAqB;AACvC,SAAK,EAAE,MAAM,SAAS,MAAM,MAAM,CAAC;AAAA,EACrC;AAAA;AAAA,EAGA,KAAK,KAAa,MAAiD;AACjE,SAAK,EAAE,MAAM,QAAQ,KAAK,UAAU,MAAM,MAAM,MAAM,MAAM,KAAK,CAAC;AAAA,EACpE;AAAA;AAAA,EAGA,OAAO,MAAsB;AAC3B,SAAK,EAAE,MAAM,OAAO,KAAK,CAAC;AAAA,EAC5B;AAAA;AAAA,EAGA,YAAY,MAAoB;AAC9B,SAAK,EAAE,MAAM,eAAe,KAAK,CAAC;AAAA,EACpC;AAAA;AAAA,EAGA,SAAS,OAA2B;AAClC,SAAK,EAAE,MAAM,YAAY,MAAM,CAAC;AAAA,EAClC;AAAA;AAAA;AAAA;AAAA,EAKA,UAAU,MAAc,OAAgB,MAAmC;AACzE,SAAK,EAAE,MAAM,aAAa,MAAM,OAAO,QAAQ,MAAM,OAAO,CAAC;AAAA,EAC/D;AAAA;AAAA,EAGA,WAAW,MAAc,SAAiB,MAAkE;AAC1G,UAAM,gBAAgB,MAAM,aAAa,WAAW,UAAU,OAAO,KAAK,SAAS,MAAM,EAAE,SAAS,QAAQ;AAC5G,SAAK,EAAE,MAAM,cAAc,MAAM,eAAe,UAAU,MAAM,SAAS,CAAC;AAAA,EAC5E;AAAA;AAAA,EAGA,mBAAmB,MAAc,MAAc,MAAoC;AACjF,SAAK,EAAE,MAAM,wBAAwB,MAAM,MAAM,UAAU,MAAM,SAAS,CAAC;AAAA,EAC7E;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAM,KAAQ,MAAc,IAAsC;AAChE,WAAO,iBAAK,KAAK,MAAM,YAAY;AACjC,WAAK,EAAE,MAAM,cAAc,MAAM,WAAW,KAAK,IAAI,EAAE,CAAC;AACxD,UAAI;AACF,cAAM,SAAS,MAAM,GAAG;AACxB,aAAK,EAAE,MAAM,aAAa,QAAQ,UAAU,WAAW,KAAK,IAAI,EAAE,CAAC;AACnE,eAAO;AAAA,MACT,SAAS,KAAK;AACZ,aAAK;AAAA,UACH,MAAM;AAAA,UACN,QAAQ;AAAA,UACR,OAAO,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG;AAAA,UACtD,WAAW,KAAK,IAAI;AAAA,QACtB,CAAC;AACD,cAAM;AAAA,MACR;AAAA,IACF,CAAC;AAAA,EACH;AACF;;;ADrFO,SAAS,kBAAkB,UAAsC,CAAC,GAAwB;AAC/F,SAAO,CAAC,kCAAkC,OAAO;AACnD;","names":[]}
@@ -0,0 +1,79 @@
1
+ import { ReporterDescription } from '@playwright/test';
2
+ import { L as LinkType, C as CasePriority, Q as QualflarePlaywrightOptions } from './resolve-config-CSjXFl7v.cjs';
3
+ export { A as Attachment, a as Case, b as CaseStatus, c as Collect, F as FrameworkCategory, d as Label, e as Link, M as Metadata, N as NanosecondDuration, P as Parameter, f as Platform, R as ResolvedReporterConfig, S as Step, g as Suite } from './resolve-config-CSjXFl7v.cjs';
4
+
5
+ /**
6
+ * Author-facing metadata API. Import it in a spec and annotate tests with
7
+ * business context Playwright itself has no concept of:
8
+ *
9
+ * ```ts
10
+ * import { qualflare } from '@qualflare/playwright';
11
+ *
12
+ * test('checks out', async ({ page }) => {
13
+ * qualflare.label('epic', 'Billing');
14
+ * qualflare.link('https://tracker/QF-1', { type: 'issue', name: 'QF-1' });
15
+ * await qualflare.step('pay', async () => { ... });
16
+ * });
17
+ * ```
18
+ */
19
+ declare const qualflare: {
20
+ /** Arbitrary name/value metadata (epic, feature, story, owner, severity). */
21
+ label(name: string, value: string): void;
22
+ /** A typed external reference. `type` defaults to `custom`. */
23
+ link(url: string, opts?: {
24
+ type?: LinkType;
25
+ name?: string;
26
+ }): void;
27
+ /** One or more free-text tags. */
28
+ tag(...tags: string[]): void;
29
+ /** Markdown description shown on the case. */
30
+ description(text: string): void;
31
+ /** Case priority (low | medium | high | critical). */
32
+ priority(value: CasePriority): void;
33
+ /** A named input. Inside an open `step()` it attaches to that step;
34
+ * outside any step it lands in the case's properties. `masked` is a
35
+ * display hint for the UI only — the server does not redact the value. */
36
+ parameter(name: string, value?: string, opts?: {
37
+ masked?: boolean;
38
+ }): void;
39
+ /** Attach in-memory content. */
40
+ attachment(name: string, content: string, opts?: {
41
+ encoding?: "utf8" | "base64";
42
+ mimeType?: string;
43
+ }): void;
44
+ /** Attach a file from disk. */
45
+ attachmentFromFile(name: string, path: string, opts?: {
46
+ mimeType?: string;
47
+ }): void;
48
+ /**
49
+ * Records a named step around `fn`.
50
+ *
51
+ * Unlike the cucumber-js equivalent, this delegates to Playwright's own
52
+ * `test.step()` as well, so the step shows up in Playwright's HTML report
53
+ * and trace viewer in addition to Qualflare — there is no reason to make
54
+ * users choose, and a step that exists in only one of the two is a
55
+ * confusing thing to debug against.
56
+ */
57
+ step<T>(name: string, fn: () => T | Promise<T>): Promise<T>;
58
+ };
59
+
60
+ /**
61
+ * Typed helper for registering the reporter.
62
+ *
63
+ * Playwright types a reporter's options as `any` (`ReporterDescription` ends
64
+ * in `[string, any]`), so writing the tuple by hand gives no autocomplete and
65
+ * silently accepts typos. This returns the same tuple with the options
66
+ * checked:
67
+ *
68
+ * ```ts
69
+ * import { defineConfig } from '@playwright/test';
70
+ * import { qualflareReporter } from '@qualflare/playwright';
71
+ *
72
+ * export default defineConfig({
73
+ * reporter: [['list'], qualflareReporter({ environment: 'staging' })],
74
+ * });
75
+ * ```
76
+ */
77
+ declare function qualflareReporter(options?: QualflarePlaywrightOptions): ReporterDescription;
78
+
79
+ export { CasePriority, LinkType, QualflarePlaywrightOptions, qualflare, qualflareReporter };
@@ -0,0 +1,79 @@
1
+ import { ReporterDescription } from '@playwright/test';
2
+ import { L as LinkType, C as CasePriority, Q as QualflarePlaywrightOptions } from './resolve-config-CSjXFl7v.js';
3
+ export { A as Attachment, a as Case, b as CaseStatus, c as Collect, F as FrameworkCategory, d as Label, e as Link, M as Metadata, N as NanosecondDuration, P as Parameter, f as Platform, R as ResolvedReporterConfig, S as Step, g as Suite } from './resolve-config-CSjXFl7v.js';
4
+
5
+ /**
6
+ * Author-facing metadata API. Import it in a spec and annotate tests with
7
+ * business context Playwright itself has no concept of:
8
+ *
9
+ * ```ts
10
+ * import { qualflare } from '@qualflare/playwright';
11
+ *
12
+ * test('checks out', async ({ page }) => {
13
+ * qualflare.label('epic', 'Billing');
14
+ * qualflare.link('https://tracker/QF-1', { type: 'issue', name: 'QF-1' });
15
+ * await qualflare.step('pay', async () => { ... });
16
+ * });
17
+ * ```
18
+ */
19
+ declare const qualflare: {
20
+ /** Arbitrary name/value metadata (epic, feature, story, owner, severity). */
21
+ label(name: string, value: string): void;
22
+ /** A typed external reference. `type` defaults to `custom`. */
23
+ link(url: string, opts?: {
24
+ type?: LinkType;
25
+ name?: string;
26
+ }): void;
27
+ /** One or more free-text tags. */
28
+ tag(...tags: string[]): void;
29
+ /** Markdown description shown on the case. */
30
+ description(text: string): void;
31
+ /** Case priority (low | medium | high | critical). */
32
+ priority(value: CasePriority): void;
33
+ /** A named input. Inside an open `step()` it attaches to that step;
34
+ * outside any step it lands in the case's properties. `masked` is a
35
+ * display hint for the UI only — the server does not redact the value. */
36
+ parameter(name: string, value?: string, opts?: {
37
+ masked?: boolean;
38
+ }): void;
39
+ /** Attach in-memory content. */
40
+ attachment(name: string, content: string, opts?: {
41
+ encoding?: "utf8" | "base64";
42
+ mimeType?: string;
43
+ }): void;
44
+ /** Attach a file from disk. */
45
+ attachmentFromFile(name: string, path: string, opts?: {
46
+ mimeType?: string;
47
+ }): void;
48
+ /**
49
+ * Records a named step around `fn`.
50
+ *
51
+ * Unlike the cucumber-js equivalent, this delegates to Playwright's own
52
+ * `test.step()` as well, so the step shows up in Playwright's HTML report
53
+ * and trace viewer in addition to Qualflare — there is no reason to make
54
+ * users choose, and a step that exists in only one of the two is a
55
+ * confusing thing to debug against.
56
+ */
57
+ step<T>(name: string, fn: () => T | Promise<T>): Promise<T>;
58
+ };
59
+
60
+ /**
61
+ * Typed helper for registering the reporter.
62
+ *
63
+ * Playwright types a reporter's options as `any` (`ReporterDescription` ends
64
+ * in `[string, any]`), so writing the tuple by hand gives no autocomplete and
65
+ * silently accepts typos. This returns the same tuple with the options
66
+ * checked:
67
+ *
68
+ * ```ts
69
+ * import { defineConfig } from '@playwright/test';
70
+ * import { qualflareReporter } from '@qualflare/playwright';
71
+ *
72
+ * export default defineConfig({
73
+ * reporter: [['list'], qualflareReporter({ environment: 'staging' })],
74
+ * });
75
+ * ```
76
+ */
77
+ declare function qualflareReporter(options?: QualflarePlaywrightOptions): ReporterDescription;
78
+
79
+ export { CasePriority, LinkType, QualflarePlaywrightOptions, qualflare, qualflareReporter };