qagentic-reporter 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.
@@ -0,0 +1,304 @@
1
+ /**
2
+ * Test severity levels - compatible with Allure.
3
+ */
4
+ declare enum Severity {
5
+ BLOCKER = "blocker",
6
+ CRITICAL = "critical",
7
+ NORMAL = "normal",
8
+ MINOR = "minor",
9
+ TRIVIAL = "trivial"
10
+ }
11
+
12
+ /**
13
+ * Test execution status.
14
+ */
15
+ declare enum Status {
16
+ PASSED = "passed",
17
+ FAILED = "failed",
18
+ BROKEN = "broken",
19
+ SKIPPED = "skipped",
20
+ PENDING = "pending",
21
+ RUNNING = "running",
22
+ UNKNOWN = "unknown"
23
+ }
24
+
25
+ /**
26
+ * Core type definitions for QAagentic SDK.
27
+ */
28
+
29
+ /**
30
+ * Test step result.
31
+ */
32
+ interface StepResult {
33
+ id: string;
34
+ name: string;
35
+ status: Status;
36
+ startTime?: Date;
37
+ endTime?: Date;
38
+ durationMs: number;
39
+ error?: string;
40
+ errorTrace?: string;
41
+ attachments: Attachment[];
42
+ children: StepResult[];
43
+ parameters: Record<string, unknown>;
44
+ }
45
+ /**
46
+ * Attachment data.
47
+ */
48
+ interface Attachment {
49
+ id: string;
50
+ name: string;
51
+ type: string;
52
+ extension?: string;
53
+ content: string;
54
+ size: number;
55
+ timestamp: string;
56
+ }
57
+ /**
58
+ * Test labels and metadata.
59
+ */
60
+ interface TestLabels {
61
+ feature?: string;
62
+ story?: string;
63
+ epic?: string;
64
+ severity?: Severity;
65
+ tags?: string[];
66
+ owner?: string;
67
+ layer?: string;
68
+ suite?: string;
69
+ subSuite?: string;
70
+ parentSuite?: string;
71
+ [key: string]: unknown;
72
+ }
73
+ /**
74
+ * Link to external resource.
75
+ */
76
+ interface TestLink {
77
+ url: string;
78
+ name: string;
79
+ type: 'link' | 'issue' | 'tms';
80
+ }
81
+ /**
82
+ * Complete test result.
83
+ */
84
+ interface TestResult {
85
+ id: string;
86
+ name: string;
87
+ fullName: string;
88
+ description?: string;
89
+ status: Status;
90
+ startTime?: Date;
91
+ endTime?: Date;
92
+ durationMs: number;
93
+ errorMessage?: string;
94
+ errorType?: string;
95
+ stackTrace?: string;
96
+ labels: TestLabels;
97
+ links: TestLink[];
98
+ parameters: Record<string, unknown>;
99
+ steps: StepResult[];
100
+ attachments: Attachment[];
101
+ filePath?: string;
102
+ lineNumber?: number;
103
+ retryCount: number;
104
+ isRetry: boolean;
105
+ isFlaky: boolean;
106
+ flakyReason?: string;
107
+ }
108
+ /**
109
+ * Test run result containing multiple tests.
110
+ */
111
+ interface TestRunResult {
112
+ id: string;
113
+ name: string;
114
+ projectName: string;
115
+ environment: string;
116
+ startTime?: Date;
117
+ endTime?: Date;
118
+ durationMs: number;
119
+ tests: TestResult[];
120
+ total: number;
121
+ passed: number;
122
+ failed: number;
123
+ broken: number;
124
+ skipped: number;
125
+ passRate: number;
126
+ labels: Record<string, unknown>;
127
+ parameters: Record<string, unknown>;
128
+ ciBuildId?: string;
129
+ ciBuildUrl?: string;
130
+ branch?: string;
131
+ commitHash?: string;
132
+ }
133
+
134
+ /**
135
+ * Step context manager for defining test steps.
136
+ */
137
+
138
+ /**
139
+ * Represents a test step with timing and status tracking.
140
+ */
141
+ declare class Step {
142
+ readonly id: string;
143
+ readonly name: string;
144
+ readonly description?: string;
145
+ status: Status;
146
+ startTime?: Date;
147
+ endTime?: Date;
148
+ durationMs: number;
149
+ error?: string;
150
+ errorTrace?: string;
151
+ attachments: Attachment[];
152
+ children: Step[];
153
+ parameters: Record<string, unknown>;
154
+ constructor(name: string, description?: string, parameters?: Record<string, unknown>);
155
+ /**
156
+ * Start the step.
157
+ */
158
+ start(): this;
159
+ /**
160
+ * End the step.
161
+ */
162
+ end(error?: Error): this;
163
+ /**
164
+ * Attach data to this step.
165
+ */
166
+ attach(data: string | Buffer, name: string, type?: string): this;
167
+ /**
168
+ * Attach a screenshot.
169
+ */
170
+ attachScreenshot(path: string, name?: string): this;
171
+ /**
172
+ * Attach JSON data.
173
+ */
174
+ attachJson(data: unknown, name?: string): this;
175
+ /**
176
+ * Set a step parameter.
177
+ */
178
+ setParameter(name: string, value: unknown): this;
179
+ /**
180
+ * Convert to result object.
181
+ */
182
+ toResult(): StepResult;
183
+ }
184
+ /**
185
+ * Execute a function within a step context.
186
+ *
187
+ * @example
188
+ * ```typescript
189
+ * step('Login to application', () => {
190
+ * // test code
191
+ * });
192
+ *
193
+ * await step('Async operation', async () => {
194
+ * await someAsyncOperation();
195
+ * });
196
+ * ```
197
+ */
198
+ declare function step<T>(name: string, fn: () => T): T;
199
+ declare function step<T>(name: string, description: string, fn: () => T): T;
200
+
201
+ /**
202
+ * Decorators for annotating tests with metadata.
203
+ * Compatible with Allure-style annotations.
204
+ */
205
+
206
+ /**
207
+ * Mark test with a feature label.
208
+ */
209
+ declare function feature(name: string): <T extends object>(target: T) => T;
210
+ /**
211
+ * Mark test with a user story label.
212
+ */
213
+ declare function story(name: string): <T extends object>(target: T) => T;
214
+ /**
215
+ * Mark test with an epic label.
216
+ */
217
+ declare function epic(name: string): <T extends object>(target: T) => T;
218
+ /**
219
+ * Mark test with a severity level.
220
+ */
221
+ declare function severity(level: Severity | string): <T extends object>(target: T) => T;
222
+ /**
223
+ * Add tags to a test.
224
+ */
225
+ declare function tag(...tags: string[]): <T extends object>(target: T) => T;
226
+ /**
227
+ * Add a custom label to a test.
228
+ */
229
+ declare function label(name: string, value: string): <T extends object>(target: T) => T;
230
+ /**
231
+ * Add a link to a test.
232
+ */
233
+ declare function link(url: string, name?: string, type?: string): <T extends object>(target: T) => T;
234
+ /**
235
+ * Link test to an issue tracker.
236
+ */
237
+ declare function issue(url: string, name?: string): <T extends object>(target: T) => T;
238
+ /**
239
+ * Link test to a test management system.
240
+ */
241
+ declare function testcase(url: string, name?: string): <T extends object>(target: T) => T;
242
+ /**
243
+ * Add a description to a test.
244
+ */
245
+ declare function description(text: string): <T extends object>(target: T) => T;
246
+ /**
247
+ * Set a custom title for the test.
248
+ */
249
+ declare function title(name: string): <T extends object>(target: T) => T;
250
+ /**
251
+ * Set the test owner.
252
+ */
253
+ declare function owner(name: string): <T extends object>(target: T) => T;
254
+ /**
255
+ * Set the test layer.
256
+ */
257
+ declare function layer(name: string): <T extends object>(target: T) => T;
258
+ /**
259
+ * Set the suite name.
260
+ */
261
+ declare function suite(name: string): <T extends object>(target: T) => T;
262
+ /**
263
+ * Set the sub-suite name.
264
+ */
265
+ declare function subSuite(name: string): <T extends object>(target: T) => T;
266
+ /**
267
+ * Set the parent suite name.
268
+ */
269
+ declare function parentSuite(name: string): <T extends object>(target: T) => T;
270
+
271
+ /**
272
+ * Attachment utilities for adding files, screenshots, and data to test reports.
273
+ */
274
+
275
+ /**
276
+ * Attach data to the current test or step.
277
+ */
278
+ declare function attach(data: string | Buffer, name: string, type?: string, extension?: string): string;
279
+ /**
280
+ * Attach a file to the current test.
281
+ */
282
+ declare function attachFile(filePath: string, name?: string): string;
283
+ /**
284
+ * Attach a screenshot to the current test.
285
+ */
286
+ declare function attachScreenshot(data: string | Buffer, name?: string): string;
287
+ /**
288
+ * Attach JSON data to the current test.
289
+ */
290
+ declare function attachJson(data: unknown, name?: string): string;
291
+ /**
292
+ * Attach plain text to the current test.
293
+ */
294
+ declare function attachText(text: string, name?: string): string;
295
+ /**
296
+ * Attach HTML content to the current test.
297
+ */
298
+ declare function attachHtml(html: string, name?: string): string;
299
+ /**
300
+ * Attach a video to the current test.
301
+ */
302
+ declare function attachVideo(filePath: string, name?: string): string;
303
+
304
+ export { attachVideo as A, type StepResult as B, Severity as S, type TestRunResult as T, type TestResult as a, Status as b, Step as c, story as d, epic as e, feature as f, severity as g, link as h, issue as i, testcase as j, description as k, label as l, title as m, layer as n, owner as o, suite as p, subSuite as q, parentSuite as r, step as s, tag as t, attach as u, attachFile as v, attachScreenshot as w, attachJson as x, attachText as y, attachHtml as z };
@@ -0,0 +1,95 @@
1
+ export { S as Severity, b as Status, c as Step, u as attach, x as attachJson, w as attachScreenshot, y as attachText, e as epic, f as feature, l as label, g as severity, s as step, d as story, t as tag } from '../attachments-B2zaEsD5.mjs';
2
+
3
+ /**
4
+ * QAagentic Cypress Plugin
5
+ *
6
+ * Automatically captures test results from Cypress and reports to QAagentic.
7
+ *
8
+ * @example
9
+ * ```javascript
10
+ * // cypress.config.js
11
+ * const { qagentic } = require('@qagentic/reporter/cypress');
12
+ *
13
+ * module.exports = defineConfig({
14
+ * e2e: {
15
+ * setupNodeEvents(on, config) {
16
+ * qagentic(on, config);
17
+ * return config;
18
+ * },
19
+ * },
20
+ * });
21
+ * ```
22
+ */
23
+
24
+ /**
25
+ * Cypress plugin events interface.
26
+ */
27
+ interface CypressPluginEvents {
28
+ (action: 'before:run', fn: (details: BeforeRunDetails) => void | Promise<void>): void;
29
+ (action: 'after:spec', fn: (spec: unknown, results: CypressSpecResult) => void | Promise<void>): void;
30
+ (action: 'after:run', fn: () => void | Promise<void>): void;
31
+ }
32
+ /**
33
+ * Cypress plugin config interface.
34
+ */
35
+ interface CypressPluginConfig {
36
+ projectId?: string;
37
+ env?: Record<string, string>;
38
+ }
39
+ /**
40
+ * Before run details.
41
+ */
42
+ interface BeforeRunDetails {
43
+ config?: CypressPluginConfig;
44
+ }
45
+ /**
46
+ * Cypress plugin options.
47
+ */
48
+ interface CypressPluginOptions {
49
+ projectName?: string;
50
+ environment?: string;
51
+ apiUrl?: string;
52
+ apiKey?: string;
53
+ outputDir?: string;
54
+ screenshotsOnFailure?: boolean;
55
+ videosOnFailure?: boolean;
56
+ }
57
+ /**
58
+ * Cypress test result from after:spec event.
59
+ */
60
+ interface CypressTestResult {
61
+ title: string[];
62
+ state: string;
63
+ duration: number;
64
+ err?: {
65
+ message: string;
66
+ stack?: string;
67
+ };
68
+ }
69
+ interface CypressSpecResult {
70
+ stats: {
71
+ tests: number;
72
+ passes: number;
73
+ failures: number;
74
+ pending: number;
75
+ skipped: number;
76
+ duration: number;
77
+ };
78
+ tests: CypressTestResult[];
79
+ spec: {
80
+ name: string;
81
+ relative: string;
82
+ absolute: string;
83
+ };
84
+ }
85
+ /**
86
+ * Main Cypress plugin setup function.
87
+ */
88
+ declare function qagentic(on: CypressPluginEvents, config: CypressPluginConfig, options?: CypressPluginOptions): void;
89
+ /**
90
+ * Cypress command to add a step.
91
+ * Call this in your support file to register custom commands.
92
+ */
93
+ declare function registerCommands(): void;
94
+
95
+ export { type CypressPluginOptions, qagentic as default, qagentic, registerCommands };
@@ -0,0 +1,95 @@
1
+ export { S as Severity, b as Status, c as Step, u as attach, x as attachJson, w as attachScreenshot, y as attachText, e as epic, f as feature, l as label, g as severity, s as step, d as story, t as tag } from '../attachments-B2zaEsD5.js';
2
+
3
+ /**
4
+ * QAagentic Cypress Plugin
5
+ *
6
+ * Automatically captures test results from Cypress and reports to QAagentic.
7
+ *
8
+ * @example
9
+ * ```javascript
10
+ * // cypress.config.js
11
+ * const { qagentic } = require('@qagentic/reporter/cypress');
12
+ *
13
+ * module.exports = defineConfig({
14
+ * e2e: {
15
+ * setupNodeEvents(on, config) {
16
+ * qagentic(on, config);
17
+ * return config;
18
+ * },
19
+ * },
20
+ * });
21
+ * ```
22
+ */
23
+
24
+ /**
25
+ * Cypress plugin events interface.
26
+ */
27
+ interface CypressPluginEvents {
28
+ (action: 'before:run', fn: (details: BeforeRunDetails) => void | Promise<void>): void;
29
+ (action: 'after:spec', fn: (spec: unknown, results: CypressSpecResult) => void | Promise<void>): void;
30
+ (action: 'after:run', fn: () => void | Promise<void>): void;
31
+ }
32
+ /**
33
+ * Cypress plugin config interface.
34
+ */
35
+ interface CypressPluginConfig {
36
+ projectId?: string;
37
+ env?: Record<string, string>;
38
+ }
39
+ /**
40
+ * Before run details.
41
+ */
42
+ interface BeforeRunDetails {
43
+ config?: CypressPluginConfig;
44
+ }
45
+ /**
46
+ * Cypress plugin options.
47
+ */
48
+ interface CypressPluginOptions {
49
+ projectName?: string;
50
+ environment?: string;
51
+ apiUrl?: string;
52
+ apiKey?: string;
53
+ outputDir?: string;
54
+ screenshotsOnFailure?: boolean;
55
+ videosOnFailure?: boolean;
56
+ }
57
+ /**
58
+ * Cypress test result from after:spec event.
59
+ */
60
+ interface CypressTestResult {
61
+ title: string[];
62
+ state: string;
63
+ duration: number;
64
+ err?: {
65
+ message: string;
66
+ stack?: string;
67
+ };
68
+ }
69
+ interface CypressSpecResult {
70
+ stats: {
71
+ tests: number;
72
+ passes: number;
73
+ failures: number;
74
+ pending: number;
75
+ skipped: number;
76
+ duration: number;
77
+ };
78
+ tests: CypressTestResult[];
79
+ spec: {
80
+ name: string;
81
+ relative: string;
82
+ absolute: string;
83
+ };
84
+ }
85
+ /**
86
+ * Main Cypress plugin setup function.
87
+ */
88
+ declare function qagentic(on: CypressPluginEvents, config: CypressPluginConfig, options?: CypressPluginOptions): void;
89
+ /**
90
+ * Cypress command to add a step.
91
+ * Call this in your support file to register custom commands.
92
+ */
93
+ declare function registerCommands(): void;
94
+
95
+ export { type CypressPluginOptions, qagentic as default, qagentic, registerCommands };