@desplega.ai/qa-use 2.2.2 → 2.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/dist/lib/api/browser-types.d.ts +62 -3
  2. package/dist/lib/api/browser-types.d.ts.map +1 -1
  3. package/dist/lib/api/browser.d.ts +23 -2
  4. package/dist/lib/api/browser.d.ts.map +1 -1
  5. package/dist/lib/api/browser.js +68 -0
  6. package/dist/lib/api/browser.js.map +1 -1
  7. package/dist/lib/browser/index.d.ts +10 -0
  8. package/dist/lib/browser/index.d.ts.map +1 -1
  9. package/dist/lib/browser/index.js +29 -0
  10. package/dist/lib/browser/index.js.map +1 -1
  11. package/dist/package.json +1 -1
  12. package/dist/src/cli/commands/browser/create.d.ts.map +1 -1
  13. package/dist/src/cli/commands/browser/create.js +3 -0
  14. package/dist/src/cli/commands/browser/create.js.map +1 -1
  15. package/dist/src/cli/commands/browser/generate-test.d.ts +6 -0
  16. package/dist/src/cli/commands/browser/generate-test.d.ts.map +1 -0
  17. package/dist/src/cli/commands/browser/generate-test.js +46 -0
  18. package/dist/src/cli/commands/browser/generate-test.js.map +1 -0
  19. package/dist/src/cli/commands/browser/index.d.ts.map +1 -1
  20. package/dist/src/cli/commands/browser/index.js +4 -0
  21. package/dist/src/cli/commands/browser/index.js.map +1 -1
  22. package/dist/src/cli/commands/browser/logs.d.ts +6 -0
  23. package/dist/src/cli/commands/browser/logs.d.ts.map +1 -0
  24. package/dist/src/cli/commands/browser/logs.js +95 -0
  25. package/dist/src/cli/commands/browser/logs.js.map +1 -0
  26. package/dist/src/cli/commands/browser/run.d.ts.map +1 -1
  27. package/dist/src/cli/commands/browser/run.js +69 -1
  28. package/dist/src/cli/commands/browser/run.js.map +1 -1
  29. package/dist/src/cli/commands/browser/status.d.ts.map +1 -1
  30. package/dist/src/cli/commands/browser/status.js +23 -0
  31. package/dist/src/cli/commands/browser/status.js.map +1 -1
  32. package/dist/src/cli/commands/info.d.ts +1 -1
  33. package/dist/src/cli/commands/info.d.ts.map +1 -1
  34. package/dist/src/cli/commands/info.js +178 -15
  35. package/dist/src/cli/commands/info.js.map +1 -1
  36. package/dist/src/cli/commands/install-deps.d.ts +6 -0
  37. package/dist/src/cli/commands/install-deps.d.ts.map +1 -0
  38. package/dist/src/cli/commands/install-deps.js +52 -0
  39. package/dist/src/cli/commands/install-deps.js.map +1 -0
  40. package/dist/src/cli/commands/test/run.d.ts.map +1 -1
  41. package/dist/src/cli/commands/test/run.js +7 -13
  42. package/dist/src/cli/commands/test/run.js.map +1 -1
  43. package/dist/src/cli/index.js +2 -0
  44. package/dist/src/cli/index.js.map +1 -1
  45. package/dist/src/cli/lib/browser.d.ts +5 -0
  46. package/dist/src/cli/lib/browser.d.ts.map +1 -1
  47. package/dist/src/cli/lib/browser.js +19 -0
  48. package/dist/src/cli/lib/browser.js.map +1 -1
  49. package/dist/src/cli/lib/config.d.ts.map +1 -1
  50. package/dist/src/cli/lib/config.js +3 -0
  51. package/dist/src/cli/lib/config.js.map +1 -1
  52. package/lib/api/browser-types.ts +85 -0
  53. package/lib/api/browser.test.ts +163 -0
  54. package/lib/api/browser.ts +89 -0
  55. package/lib/browser/index.ts +37 -0
  56. package/package.json +1 -1
@@ -14,6 +14,12 @@ import type {
14
14
  BlocksResult,
15
15
  CreateBrowserSessionOptions,
16
16
  BrowserSessionStatus,
17
+ GenerateTestOptions,
18
+ GenerateTestResult,
19
+ ConsoleLogsOptions,
20
+ ConsoleLogsResult,
21
+ NetworkLogsOptions,
22
+ NetworkLogsResult,
17
23
  } from './browser-types.js';
18
24
  import type { ExtendedStep } from '../../src/types/test-definition.js';
19
25
 
@@ -67,6 +73,7 @@ export class BrowserApiClient {
67
73
  viewport: options.viewport ?? 'desktop',
68
74
  timeout: options.timeout ?? 300,
69
75
  ...(options.ws_url && { ws_url: options.ws_url }),
76
+ ...(options.record_blocks !== undefined && { record_blocks: options.record_blocks }),
70
77
  });
71
78
 
72
79
  return response.data as BrowserSession;
@@ -219,6 +226,80 @@ export class BrowserApiClient {
219
226
  }
220
227
  }
221
228
 
229
+ // ==========================================
230
+ // Test Generation
231
+ // ==========================================
232
+
233
+ /**
234
+ * Generate a test definition from recorded session blocks
235
+ * @param sessionId - The session ID
236
+ * @param options - Test generation options (name, app_config, variables)
237
+ * @returns Generated test YAML and metadata
238
+ */
239
+ async generateTest(sessionId: string, options: GenerateTestOptions): Promise<GenerateTestResult> {
240
+ try {
241
+ const response = await this.client.post(`/sessions/${sessionId}/generate-test`, options);
242
+ return response.data as GenerateTestResult;
243
+ } catch (error) {
244
+ throw this.handleError(error, 'generate test');
245
+ }
246
+ }
247
+
248
+ // ==========================================
249
+ // Logs
250
+ // ==========================================
251
+
252
+ /**
253
+ * Get console logs from a session
254
+ * @param sessionId - The session ID
255
+ * @param options - Filter options (level, limit)
256
+ * @returns Console log entries
257
+ */
258
+ async getConsoleLogs(
259
+ sessionId: string,
260
+ options: ConsoleLogsOptions = {}
261
+ ): Promise<ConsoleLogsResult> {
262
+ try {
263
+ const params = new URLSearchParams();
264
+ if (options.level) params.append('level', options.level);
265
+ if (options.limit !== undefined) params.append('limit', options.limit.toString());
266
+
267
+ const queryString = params.toString();
268
+ const url = `/sessions/${sessionId}/logs/console${queryString ? `?${queryString}` : ''}`;
269
+
270
+ const response = await this.client.get(url);
271
+ return response.data as ConsoleLogsResult;
272
+ } catch (error) {
273
+ throw this.handleError(error, 'get console logs');
274
+ }
275
+ }
276
+
277
+ /**
278
+ * Get network request logs from a session
279
+ * @param sessionId - The session ID
280
+ * @param options - Filter options (status, url_pattern, limit)
281
+ * @returns Network log entries
282
+ */
283
+ async getNetworkLogs(
284
+ sessionId: string,
285
+ options: NetworkLogsOptions = {}
286
+ ): Promise<NetworkLogsResult> {
287
+ try {
288
+ const params = new URLSearchParams();
289
+ if (options.status) params.append('status', options.status);
290
+ if (options.url_pattern) params.append('url_pattern', options.url_pattern);
291
+ if (options.limit !== undefined) params.append('limit', options.limit.toString());
292
+
293
+ const queryString = params.toString();
294
+ const url = `/sessions/${sessionId}/logs/network${queryString ? `?${queryString}` : ''}`;
295
+
296
+ const response = await this.client.get(url);
297
+ return response.data as NetworkLogsResult;
298
+ } catch (error) {
299
+ throw this.handleError(error, 'get network logs');
300
+ }
301
+ }
302
+
222
303
  // ==========================================
223
304
  // WebSocket Streaming
224
305
  // ==========================================
@@ -276,4 +357,12 @@ export type {
276
357
  UrlResult,
277
358
  CreateBrowserSessionOptions,
278
359
  BrowserSessionStatus,
360
+ GenerateTestOptions,
361
+ GenerateTestResult,
362
+ ConsoleLogsOptions,
363
+ ConsoleLogsResult,
364
+ ConsoleLogEntry,
365
+ NetworkLogsOptions,
366
+ NetworkLogsResult,
367
+ NetworkLogEntry,
279
368
  } from './browser-types.js';
@@ -2,9 +2,16 @@ import { chromium } from 'playwright';
2
2
  import type { BrowserServer, Browser } from 'playwright';
3
3
  import { fork } from 'child_process';
4
4
  import path from 'path';
5
+ import fs from 'fs';
5
6
  import { createRequire } from 'module';
6
7
  import { fileURLToPath } from 'url';
7
8
 
9
+ export interface BrowserInstallationStatus {
10
+ installed: boolean;
11
+ executablePath: string | null;
12
+ error?: string;
13
+ }
14
+
8
15
  export interface BrowserSession {
9
16
  browserServer: BrowserServer;
10
17
  wsEndpoint: string;
@@ -178,4 +185,34 @@ export class BrowserManager {
178
185
  }
179
186
  });
180
187
  }
188
+
189
+ /**
190
+ * Check if Playwright Chromium browser is installed without launching it.
191
+ * This is a fast, cheap check that verifies the executable file exists.
192
+ */
193
+ checkBrowsersInstalled(): BrowserInstallationStatus {
194
+ try {
195
+ const executablePath = chromium.executablePath();
196
+
197
+ // Check if the executable file actually exists
198
+ if (fs.existsSync(executablePath)) {
199
+ return {
200
+ installed: true,
201
+ executablePath,
202
+ };
203
+ }
204
+
205
+ return {
206
+ installed: false,
207
+ executablePath: null,
208
+ error: `Chromium executable not found at expected path: ${executablePath}`,
209
+ };
210
+ } catch (error: any) {
211
+ return {
212
+ installed: false,
213
+ executablePath: null,
214
+ error: error.message,
215
+ };
216
+ }
217
+ }
181
218
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@desplega.ai/qa-use",
3
- "version": "2.2.2",
3
+ "version": "2.2.4",
4
4
  "packageManager": "bun@^1.3.4",
5
5
  "description": "QA automation tool for browser testing with MCP server support",
6
6
  "type": "module",