qazen-cli 0.1.9 → 0.2.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/dist/commands/visionScout.js +2 -0
- package/dist/lib/api.js +4 -0
- package/dist/lib/visionNavigator.js +115 -25
- package/package.json +1 -1
|
@@ -114,8 +114,10 @@ export async function visionScoutCommand(options) {
|
|
|
114
114
|
await uploadVisionDiscovery(config.apiUrl, config.cliToken, project.id, result);
|
|
115
115
|
uploadSpinner.succeed(chalk.green("Discovery uploaded to QAZen"));
|
|
116
116
|
console.log("\n" + chalk.hex("#6366F1").bold(" Vision Scout complete\n"));
|
|
117
|
+
const totalScenarios = result.pages.reduce((sum, p) => sum + (p.testScenariosFound?.length ?? 0), 0);
|
|
117
118
|
console.log(chalk.gray(` Pages explored: ${chalk.white(result.pages.length)}`));
|
|
118
119
|
console.log(chalk.gray(` Elements found: ${chalk.white(result.totalElements)}`));
|
|
120
|
+
console.log(chalk.gray(` Test scenarios: ${chalk.white(totalScenarios)}`));
|
|
119
121
|
console.log(chalk.gray(` Actions taken: ${chalk.white(result.totalActions)}`));
|
|
120
122
|
console.log(chalk.gray(` Screenshots: ${chalk.white(result.screenshots.length)}`));
|
|
121
123
|
console.log(chalk.gray(`\n View in QAZen: ${config.apiUrl}/discovery\n`));
|
package/dist/lib/api.js
CHANGED
|
@@ -49,6 +49,7 @@ export async function fetchProjectAuthSession(apiUrl, cliToken, projectId) {
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
export async function uploadVisionDiscovery(apiUrl, cliToken, projectId, result) {
|
|
52
|
+
const totalTestScenarios = result.pages.reduce((sum, p) => sum + (p.testScenariosFound?.length ?? 0), 0);
|
|
52
53
|
const appMap = {
|
|
53
54
|
baseUrl: result.pages[0]?.url ?? "",
|
|
54
55
|
pages: result.pages.map((p) => ({
|
|
@@ -66,11 +67,14 @@ export async function uploadVisionDiscovery(apiUrl, cliToken, projectId, result)
|
|
|
66
67
|
.map((e) => e.action),
|
|
67
68
|
visualDescription: p.visualDescription,
|
|
68
69
|
workflow: p.workflow,
|
|
70
|
+
pageType: p.pageType,
|
|
69
71
|
actionsTaken: p.actions_taken,
|
|
72
|
+
testScenariosFound: p.testScenariosFound ?? [],
|
|
70
73
|
})),
|
|
71
74
|
api_endpoints: [],
|
|
72
75
|
total_pages: result.pages.length,
|
|
73
76
|
total_elements: result.totalElements,
|
|
77
|
+
totalTestScenarios,
|
|
74
78
|
discoveryMethod: "vision",
|
|
75
79
|
primaryWorkflows: result.primaryWorkflows,
|
|
76
80
|
screenshots: result.screenshots.slice(0, 5),
|
|
@@ -120,6 +120,7 @@ export class VisionNavigator {
|
|
|
120
120
|
const analysis = await this.analyzeScreenshot(screenshot, url, context, onEvent);
|
|
121
121
|
if (!analysis)
|
|
122
122
|
return;
|
|
123
|
+
const testScenariosFound = analysis.elements.flatMap((el) => el.testScenarios || []);
|
|
123
124
|
const pageMap = {
|
|
124
125
|
url: currentUrl,
|
|
125
126
|
title: await this.page.title(),
|
|
@@ -127,12 +128,30 @@ export class VisionNavigator {
|
|
|
127
128
|
elements: analysis.elements,
|
|
128
129
|
screenshot,
|
|
129
130
|
...(analysis.workflow ? { workflow: analysis.workflow } : {}),
|
|
131
|
+
...(analysis.pageType ? { pageType: analysis.pageType } : {}),
|
|
130
132
|
actions_taken: [],
|
|
133
|
+
testScenariosFound,
|
|
131
134
|
};
|
|
132
135
|
onEvent({
|
|
133
136
|
type: "page_mapped",
|
|
134
137
|
message: `${analysis.pageDescription} — ${analysis.elements.length} elements found`,
|
|
135
138
|
});
|
|
139
|
+
const scenarioCount = pageMap.testScenariosFound.length;
|
|
140
|
+
if (scenarioCount > 0) {
|
|
141
|
+
onEvent({
|
|
142
|
+
type: "vision_analysis",
|
|
143
|
+
message: `${scenarioCount} test scenarios identified across ${analysis.elements.length} interactive surfaces`,
|
|
144
|
+
});
|
|
145
|
+
const topSurfaces = analysis.elements
|
|
146
|
+
.filter((e) => (e.testScenarios?.length ?? 0) > 2)
|
|
147
|
+
.slice(0, 3);
|
|
148
|
+
for (const s of topSurfaces) {
|
|
149
|
+
onEvent({
|
|
150
|
+
type: "vision_analysis",
|
|
151
|
+
message: ` · ${s.interactionType}: ${s.testScenarios.length} scenarios (e.g. "${s.testScenarios[0]}")`,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}
|
|
136
155
|
const highPriority = analysis.elements
|
|
137
156
|
.filter((e) => {
|
|
138
157
|
if (e.priority !== "high")
|
|
@@ -213,39 +232,110 @@ export class VisionNavigator {
|
|
|
213
232
|
},
|
|
214
233
|
{
|
|
215
234
|
type: "text",
|
|
216
|
-
text: `You are a QA engineer
|
|
217
|
-
|
|
235
|
+
text: `You are a senior QA engineer with 15 years experience testing enterprise web applications.
|
|
236
|
+
|
|
218
237
|
Current URL: ${url}
|
|
238
|
+
Context: ${context}
|
|
239
|
+
Already visited (do not prioritise these):
|
|
240
|
+
${Array.from(this.visitedUrls).join("\n")}
|
|
241
|
+
|
|
242
|
+
Analyse this screenshot carefully. For EVERY interactive element visible on screen, identify:
|
|
243
|
+
1. What TYPE of interaction it represents
|
|
244
|
+
2. What TEST SCENARIOS it generates for QA
|
|
245
|
+
3. What INPUT DATA would properly exercise it
|
|
246
|
+
|
|
247
|
+
Interactive surface types to identify:
|
|
248
|
+
|
|
249
|
+
SEARCH — What can be searched? Generate scenarios:
|
|
250
|
+
empty search, partial match, exact match,
|
|
251
|
+
no results found, special characters,
|
|
252
|
+
maximum length input, leading/trailing spaces
|
|
253
|
+
|
|
254
|
+
DATE PICKER / DATE RANGE — Generate scenarios:
|
|
255
|
+
single day, multi-day range, maximum range,
|
|
256
|
+
minimum range (same day), future dates,
|
|
257
|
+
past dates, fiscal year boundaries,
|
|
258
|
+
invalid date format, date ordering (end before start)
|
|
259
|
+
|
|
260
|
+
DROPDOWN / SELECT — Generate scenarios:
|
|
261
|
+
each available option, default value,
|
|
262
|
+
does selecting one change another dropdown,
|
|
263
|
+
what happens with no selection
|
|
264
|
+
|
|
265
|
+
FILTER PANEL — Generate scenarios:
|
|
266
|
+
single filter applied, multiple filters combined,
|
|
267
|
+
clear all filters, filter with no results,
|
|
268
|
+
filter persists across page navigation
|
|
219
269
|
|
|
220
|
-
|
|
270
|
+
DATA TABLE — Generate scenarios:
|
|
271
|
+
sort each column ascending, sort descending,
|
|
272
|
+
default sort order, pagination if present,
|
|
273
|
+
rows per page selector, empty state,
|
|
274
|
+
export functionality
|
|
275
|
+
|
|
276
|
+
EXPORT BUTTON — Generate scenarios:
|
|
277
|
+
each available format (CSV/Excel/PDF),
|
|
278
|
+
export with filters applied,
|
|
279
|
+
export with date range applied,
|
|
280
|
+
large dataset export
|
|
281
|
+
|
|
282
|
+
CHART / GRAPH — Generate scenarios:
|
|
283
|
+
hover to see tooltip values,
|
|
284
|
+
click to drill down if interactive,
|
|
285
|
+
date range changes update chart,
|
|
286
|
+
empty data state, maximum data points
|
|
287
|
+
|
|
288
|
+
TOGGLE / SWITCH — Generate scenarios:
|
|
289
|
+
enable the toggle, disable the toggle,
|
|
290
|
+
does state persist on page refresh,
|
|
291
|
+
does it affect other elements
|
|
292
|
+
|
|
293
|
+
TAB BAR — Generate scenarios:
|
|
294
|
+
each tab loads correct content,
|
|
295
|
+
default active tab on page load,
|
|
296
|
+
tab state preserved on browser back navigation
|
|
297
|
+
|
|
298
|
+
FORM — Generate scenarios:
|
|
299
|
+
all required fields missing,
|
|
300
|
+
individual required fields missing,
|
|
301
|
+
invalid format (email, phone, date),
|
|
302
|
+
maximum field length exceeded,
|
|
303
|
+
successful submission,
|
|
304
|
+
error message display
|
|
305
|
+
|
|
306
|
+
MODAL / DIALOG — Generate scenarios:
|
|
307
|
+
open the modal, close with X button,
|
|
308
|
+
close with Escape key,
|
|
309
|
+
close by clicking outside (backdrop),
|
|
310
|
+
action confirmation inside modal
|
|
311
|
+
|
|
312
|
+
PAGINATION — Generate scenarios:
|
|
313
|
+
navigate to next page, previous page,
|
|
314
|
+
jump to last page, jump to first page,
|
|
315
|
+
rows per page selector
|
|
316
|
+
|
|
317
|
+
Return ONLY valid JSON — no markdown, no explanation:
|
|
221
318
|
{
|
|
222
|
-
"pageDescription": "
|
|
223
|
-
"workflow": "
|
|
319
|
+
"pageDescription": "one sentence description",
|
|
320
|
+
"workflow": "business workflow name",
|
|
321
|
+
"pageType": "report|form|dashboard|list|detail|other",
|
|
224
322
|
"elements": [
|
|
225
323
|
{
|
|
226
|
-
"description": "
|
|
227
|
-
"elementType": "
|
|
228
|
-
"
|
|
324
|
+
"description": "specific description of this element",
|
|
325
|
+
"elementType": "one of the types listed above",
|
|
326
|
+
"interactionType": "e.g. date range selector, market dropdown",
|
|
327
|
+
"testScenarios": [
|
|
328
|
+
"specific test scenario 1",
|
|
329
|
+
"specific test scenario 2"
|
|
330
|
+
],
|
|
331
|
+
"action": "what clicking/interacting does",
|
|
229
332
|
"priority": "high|medium|low",
|
|
230
|
-
"visualLocation": "
|
|
333
|
+
"visualLocation": "where on screen",
|
|
334
|
+
"requiresInput": true or false,
|
|
335
|
+
"inputExamples": ["example1", "example2"]
|
|
231
336
|
}
|
|
232
337
|
]
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
Already visited URLs — do NOT suggest clicking these as high priority:
|
|
236
|
-
${Array.from(this.visitedUrls).join("\n")}
|
|
237
|
-
|
|
238
|
-
If an element links to an already-visited URL, set its priority to 'low'.
|
|
239
|
-
|
|
240
|
-
Focus on:
|
|
241
|
-
- Navigation items and menu links (high priority)
|
|
242
|
-
- Primary action buttons (high priority)
|
|
243
|
-
- Tab bars and section switchers (high priority)
|
|
244
|
-
- Form inputs (medium priority)
|
|
245
|
-
- Secondary buttons (medium priority)
|
|
246
|
-
|
|
247
|
-
Ignore: decorative elements, footer links, external links.
|
|
248
|
-
Return ONLY the JSON object. No markdown, no explanation.`,
|
|
338
|
+
}`,
|
|
249
339
|
},
|
|
250
340
|
],
|
|
251
341
|
},
|