@digilogiclabs/platform-testing 1.0.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,2 @@
1
+
2
+ export { }
@@ -0,0 +1,2 @@
1
+
2
+ export { }
@@ -0,0 +1,19 @@
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 __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/feedback.tsx
17
+ var feedback_exports = {};
18
+ module.exports = __toCommonJS(feedback_exports);
19
+ //# sourceMappingURL=feedback.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/feedback.tsx"],"sourcesContent":["/**\n * Feedback widget and provider\n *\n * @example\n * ```tsx\n * import { FeedbackWidget } from '@digilogiclabs/platform-testing/feedback';\n *\n * <FeedbackWidget\n * appId=\"my-app\"\n * enabled={process.env.NODE_ENV !== 'production'}\n * onSubmit={async (feedback) => {\n * await fetch('/api/feedback', { method: 'POST', body: JSON.stringify(feedback) });\n * }}\n * />\n * ```\n */\n\nexport * from \"./feedback\";\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=feedback.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,2 @@
1
+
2
+ export { }
@@ -0,0 +1,2 @@
1
+
2
+ export { }
@@ -0,0 +1,19 @@
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 __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/fixtures.ts
17
+ var fixtures_exports = {};
18
+ module.exports = __toCommonJS(fixtures_exports);
19
+ //# sourceMappingURL=fixtures.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/fixtures.ts"],"sourcesContent":["/**\n * Test fixtures and data generators\n *\n * @example\n * ```typescript\n * import { createTestUser, STRIPE_TEST_CARDS } from '@digilogiclabs/platform-testing/fixtures';\n * ```\n */\n\nexport * from \"./fixtures\";\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=fixtures.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,322 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * IFeedback - Interface for in-app feedback collection
5
+ *
6
+ * Provides a vendor-agnostic interface for collecting user feedback
7
+ * during testing and development phases.
8
+ */
9
+
10
+ declare const FeedbackTypeSchema: z.ZodEnum<["bug", "feature", "usability", "performance", "other"]>;
11
+ declare const FeedbackPrioritySchema: z.ZodEnum<["low", "medium", "high", "critical"]>;
12
+ declare const FeedbackSchema: z.ZodObject<{
13
+ id: z.ZodString;
14
+ type: z.ZodEnum<["bug", "feature", "usability", "performance", "other"]>;
15
+ priority: z.ZodOptional<z.ZodEnum<["low", "medium", "high", "critical"]>>;
16
+ title: z.ZodString;
17
+ description: z.ZodString;
18
+ url: z.ZodString;
19
+ userAgent: z.ZodString;
20
+ screenSize: z.ZodObject<{
21
+ width: z.ZodNumber;
22
+ height: z.ZodNumber;
23
+ }, "strip", z.ZodTypeAny, {
24
+ width: number;
25
+ height: number;
26
+ }, {
27
+ width: number;
28
+ height: number;
29
+ }>;
30
+ screenshot: z.ZodOptional<z.ZodString>;
31
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
32
+ userId: z.ZodOptional<z.ZodString>;
33
+ userEmail: z.ZodOptional<z.ZodString>;
34
+ sessionId: z.ZodOptional<z.ZodString>;
35
+ createdAt: z.ZodDate;
36
+ appId: z.ZodString;
37
+ appVersion: z.ZodOptional<z.ZodString>;
38
+ environment: z.ZodEnum<["development", "staging", "production"]>;
39
+ }, "strip", z.ZodTypeAny, {
40
+ id: string;
41
+ type: "bug" | "feature" | "usability" | "performance" | "other";
42
+ title: string;
43
+ description: string;
44
+ url: string;
45
+ userAgent: string;
46
+ screenSize: {
47
+ width: number;
48
+ height: number;
49
+ };
50
+ createdAt: Date;
51
+ appId: string;
52
+ environment: "development" | "staging" | "production";
53
+ priority?: "low" | "medium" | "high" | "critical" | undefined;
54
+ screenshot?: string | undefined;
55
+ metadata?: Record<string, unknown> | undefined;
56
+ userId?: string | undefined;
57
+ userEmail?: string | undefined;
58
+ sessionId?: string | undefined;
59
+ appVersion?: string | undefined;
60
+ }, {
61
+ id: string;
62
+ type: "bug" | "feature" | "usability" | "performance" | "other";
63
+ title: string;
64
+ description: string;
65
+ url: string;
66
+ userAgent: string;
67
+ screenSize: {
68
+ width: number;
69
+ height: number;
70
+ };
71
+ createdAt: Date;
72
+ appId: string;
73
+ environment: "development" | "staging" | "production";
74
+ priority?: "low" | "medium" | "high" | "critical" | undefined;
75
+ screenshot?: string | undefined;
76
+ metadata?: Record<string, unknown> | undefined;
77
+ userId?: string | undefined;
78
+ userEmail?: string | undefined;
79
+ sessionId?: string | undefined;
80
+ appVersion?: string | undefined;
81
+ }>;
82
+ type FeedbackType = z.infer<typeof FeedbackTypeSchema>;
83
+ type FeedbackPriority = z.infer<typeof FeedbackPrioritySchema>;
84
+ type Feedback = z.infer<typeof FeedbackSchema>;
85
+ interface FeedbackConfig {
86
+ /** Unique identifier for the app */
87
+ appId: string;
88
+ /** App version (optional) */
89
+ appVersion?: string;
90
+ /** Environment */
91
+ environment: "development" | "staging" | "production";
92
+ /** Whether feedback widget is enabled */
93
+ enabled: boolean;
94
+ /** Position of the feedback button */
95
+ position?: "bottom-right" | "bottom-left" | "top-right" | "top-left";
96
+ /** Custom styling */
97
+ theme?: {
98
+ primaryColor?: string;
99
+ accentColor?: string;
100
+ darkMode?: boolean;
101
+ };
102
+ /** Collect screenshots automatically */
103
+ collectScreenshots?: boolean;
104
+ /** User info (if available) */
105
+ user?: {
106
+ id?: string;
107
+ email?: string;
108
+ };
109
+ /** Callback when feedback is submitted */
110
+ onSubmit?: (feedback: Feedback) => Promise<void>;
111
+ /** API endpoint for submitting feedback */
112
+ apiEndpoint?: string;
113
+ /** Custom headers for API requests */
114
+ apiHeaders?: Record<string, string>;
115
+ }
116
+ interface IFeedback {
117
+ /**
118
+ * Submit feedback
119
+ */
120
+ submit(feedback: Omit<Feedback, "id" | "createdAt">): Promise<{
121
+ id: string;
122
+ }>;
123
+ /**
124
+ * Get all feedback for the app
125
+ */
126
+ list(options?: {
127
+ type?: FeedbackType;
128
+ priority?: FeedbackPriority;
129
+ limit?: number;
130
+ offset?: number;
131
+ }): Promise<{
132
+ items: Feedback[];
133
+ total: number;
134
+ }>;
135
+ /**
136
+ * Get a single feedback item
137
+ */
138
+ get(id: string): Promise<Feedback | null>;
139
+ /**
140
+ * Update feedback status/metadata
141
+ */
142
+ update(id: string, updates: Partial<Pick<Feedback, "priority" | "metadata">>): Promise<Feedback>;
143
+ /**
144
+ * Delete feedback
145
+ */
146
+ delete(id: string): Promise<void>;
147
+ /**
148
+ * Export feedback to various formats
149
+ */
150
+ export(format: "json" | "csv"): Promise<string>;
151
+ /**
152
+ * Health check
153
+ */
154
+ healthCheck(): Promise<boolean>;
155
+ }
156
+ type FeedbackSubmitInput = {
157
+ type: FeedbackType;
158
+ title: string;
159
+ description: string;
160
+ priority?: FeedbackPriority;
161
+ screenshot?: string;
162
+ metadata?: Record<string, unknown>;
163
+ };
164
+
165
+ /**
166
+ * ITestRunner - Interface for E2E test execution
167
+ *
168
+ * Provides a vendor-agnostic interface for running E2E tests.
169
+ * Implementations can use Playwright, Cypress, or other runners.
170
+ */
171
+ type TestStatus = "passed" | "failed" | "skipped" | "pending";
172
+ interface TestResult {
173
+ name: string;
174
+ status: TestStatus;
175
+ duration: number;
176
+ error?: {
177
+ message: string;
178
+ stack?: string;
179
+ screenshot?: string;
180
+ };
181
+ retries: number;
182
+ }
183
+ interface TestSuiteResult {
184
+ name: string;
185
+ tests: TestResult[];
186
+ duration: number;
187
+ passed: number;
188
+ failed: number;
189
+ skipped: number;
190
+ }
191
+ interface TestRunResult {
192
+ suites: TestSuiteResult[];
193
+ totalDuration: number;
194
+ totalPassed: number;
195
+ totalFailed: number;
196
+ totalSkipped: number;
197
+ startedAt: Date;
198
+ finishedAt: Date;
199
+ environment: {
200
+ browser?: string;
201
+ os?: string;
202
+ nodeVersion?: string;
203
+ };
204
+ }
205
+ interface TestRunnerConfig {
206
+ /** Base URL for tests */
207
+ baseURL: string;
208
+ /** Test directory */
209
+ testDir: string;
210
+ /** Run tests in parallel */
211
+ parallel?: boolean;
212
+ /** Number of workers for parallel execution */
213
+ workers?: number;
214
+ /** Number of retries for failed tests */
215
+ retries?: number;
216
+ /** Timeout per test in milliseconds */
217
+ timeout?: number;
218
+ /** Whether to run headless */
219
+ headless?: boolean;
220
+ /** Browser to use */
221
+ browser?: "chromium" | "firefox" | "webkit";
222
+ /** Screenshots on failure */
223
+ screenshotOnFailure?: boolean;
224
+ /** Video recording */
225
+ video?: "off" | "on" | "retain-on-failure";
226
+ /** Trace collection */
227
+ trace?: "off" | "on" | "retain-on-failure";
228
+ /** Reporter configuration */
229
+ reporter?: "list" | "html" | "json" | "github";
230
+ /** Environment variables for tests */
231
+ env?: Record<string, string>;
232
+ }
233
+ interface ITestRunner {
234
+ /**
235
+ * Run all tests
236
+ */
237
+ run(options?: Partial<TestRunnerConfig>): Promise<TestRunResult>;
238
+ /**
239
+ * Run specific test file
240
+ */
241
+ runFile(filePath: string, options?: Partial<TestRunnerConfig>): Promise<TestRunResult>;
242
+ /**
243
+ * Run tests matching a grep pattern
244
+ */
245
+ runGrep(pattern: string, options?: Partial<TestRunnerConfig>): Promise<TestRunResult>;
246
+ /**
247
+ * Get list of available test files
248
+ */
249
+ listTests(): Promise<string[]>;
250
+ /**
251
+ * Generate test report
252
+ */
253
+ generateReport(result: TestRunResult, format: "html" | "json"): Promise<string>;
254
+ /**
255
+ * Health check
256
+ */
257
+ healthCheck(): Promise<boolean>;
258
+ }
259
+ interface TestHelpers {
260
+ /**
261
+ * Wait for network idle
262
+ */
263
+ waitForNetworkIdle(): Promise<void>;
264
+ /**
265
+ * Take screenshot
266
+ */
267
+ screenshot(name: string): Promise<string>;
268
+ /**
269
+ * Fill form fields
270
+ */
271
+ fillForm(fields: Record<string, string>): Promise<void>;
272
+ /**
273
+ * Click and wait for navigation
274
+ */
275
+ clickAndWait(selector: string): Promise<void>;
276
+ /**
277
+ * Assert text is visible
278
+ */
279
+ assertTextVisible(text: string): Promise<void>;
280
+ /**
281
+ * Assert element exists
282
+ */
283
+ assertElementExists(selector: string): Promise<void>;
284
+ /**
285
+ * Get element text
286
+ */
287
+ getElementText(selector: string): Promise<string>;
288
+ }
289
+
290
+ /**
291
+ * MemoryFeedback - In-memory implementation of IFeedback
292
+ *
293
+ * Useful for testing and local development without external dependencies.
294
+ */
295
+
296
+ declare class MemoryFeedback implements IFeedback {
297
+ private feedbackStore;
298
+ private idCounter;
299
+ private generateId;
300
+ submit(feedback: Omit<Feedback, "id" | "createdAt">): Promise<{
301
+ id: string;
302
+ }>;
303
+ list(options?: {
304
+ type?: FeedbackType;
305
+ priority?: FeedbackPriority;
306
+ limit?: number;
307
+ offset?: number;
308
+ }): Promise<{
309
+ items: Feedback[];
310
+ total: number;
311
+ }>;
312
+ get(id: string): Promise<Feedback | null>;
313
+ update(id: string, updates: Partial<Pick<Feedback, "priority" | "metadata">>): Promise<Feedback>;
314
+ delete(id: string): Promise<void>;
315
+ export(format: "json" | "csv"): Promise<string>;
316
+ healthCheck(): Promise<boolean>;
317
+ clear(): void;
318
+ getAll(): Feedback[];
319
+ size(): number;
320
+ }
321
+
322
+ export { type Feedback, type FeedbackConfig, type FeedbackPriority, FeedbackPrioritySchema, FeedbackSchema, type FeedbackSubmitInput, type FeedbackType, FeedbackTypeSchema, type IFeedback, type ITestRunner, MemoryFeedback, type TestHelpers, type TestResult, type TestRunResult, type TestRunnerConfig, type TestStatus, type TestSuiteResult };