@flowspec-qa/runner 0.3.0 → 0.4.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/capture.d.ts +22 -0
- package/dist/commands/capture.d.ts.map +1 -0
- package/dist/commands/capture.js +110 -0
- package/dist/commands/capture.js.map +1 -0
- package/dist/commands/discover.d.ts.map +1 -1
- package/dist/commands/discover.js +299 -32
- package/dist/commands/discover.js.map +1 -1
- package/dist/commands/generate.d.ts +3 -0
- package/dist/commands/generate.d.ts.map +1 -0
- package/dist/commands/generate.js +63 -0
- package/dist/commands/generate.js.map +1 -0
- package/dist/commands/ingest.d.ts.map +1 -1
- package/dist/commands/ingest.js +9 -1
- package/dist/commands/ingest.js.map +1 -1
- package/dist/commands/mcp-server.d.ts.map +1 -1
- package/dist/commands/mcp-server.js +2 -1
- package/dist/commands/mcp-server.js.map +1 -1
- package/dist/commands/projects.d.ts.map +1 -1
- package/dist/commands/projects.js +34 -0
- package/dist/commands/projects.js.map +1 -1
- package/dist/commands/record.d.ts +13 -0
- package/dist/commands/record.d.ts.map +1 -0
- package/dist/commands/record.js +90 -0
- package/dist/commands/record.js.map +1 -0
- package/dist/commands/report.d.ts +3 -0
- package/dist/commands/report.d.ts.map +1 -0
- package/dist/commands/report.js +40 -0
- package/dist/commands/report.js.map +1 -0
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +93 -29
- package/dist/commands/run.js.map +1 -1
- package/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/package.json +6 -5
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `flowspecqa capture` — Phase 13 (Manual Capture).
|
|
3
|
+
*
|
|
4
|
+
* Single-shot capture of the current device screen. Used to fill specific
|
|
5
|
+
* evidence gaps that the autonomous Discovery couldn't reach (e.g. a
|
|
6
|
+
* comprobante after PIN/2FA, an error state from a server-side condition).
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* flowspecqa capture --entity X --label "Comprobante transferencia exitosa"
|
|
10
|
+
*
|
|
11
|
+
* Flow:
|
|
12
|
+
* 1. Auto-pick or accept --device serial.
|
|
13
|
+
* 2. Wake screen + read current hierarchy + take screenshot.
|
|
14
|
+
* 3. Build a single EvidenceRecord with capture_mode='manual'.
|
|
15
|
+
* 4. Upload to backend as a standalone manual capture.
|
|
16
|
+
* 5. Print the next step (validate in UI to promote to baseline).
|
|
17
|
+
*
|
|
18
|
+
* Spec: DISCOVERY_SPEC.md § 13.
|
|
19
|
+
*/
|
|
20
|
+
import { Command } from 'commander';
|
|
21
|
+
export declare function captureCommand(): Command;
|
|
22
|
+
//# sourceMappingURL=capture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capture.d.ts","sourceRoot":"","sources":["../../src/commands/capture.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,cAAc,IAAI,OAAO,CA2FxC"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `flowspecqa capture` — Phase 13 (Manual Capture).
|
|
3
|
+
*
|
|
4
|
+
* Single-shot capture of the current device screen. Used to fill specific
|
|
5
|
+
* evidence gaps that the autonomous Discovery couldn't reach (e.g. a
|
|
6
|
+
* comprobante after PIN/2FA, an error state from a server-side condition).
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* flowspecqa capture --entity X --label "Comprobante transferencia exitosa"
|
|
10
|
+
*
|
|
11
|
+
* Flow:
|
|
12
|
+
* 1. Auto-pick or accept --device serial.
|
|
13
|
+
* 2. Wake screen + read current hierarchy + take screenshot.
|
|
14
|
+
* 3. Build a single EvidenceRecord with capture_mode='manual'.
|
|
15
|
+
* 4. Upload to backend as a standalone manual capture.
|
|
16
|
+
* 5. Print the next step (validate in UI to promote to baseline).
|
|
17
|
+
*
|
|
18
|
+
* Spec: DISCOVERY_SPEC.md § 13.
|
|
19
|
+
*/
|
|
20
|
+
import { Command } from 'commander';
|
|
21
|
+
import chalk from 'chalk';
|
|
22
|
+
import ora from 'ora';
|
|
23
|
+
import { discoveryEngine } from '@flowspec-qa/runner-core';
|
|
24
|
+
export function captureCommand() {
|
|
25
|
+
return new Command('capture')
|
|
26
|
+
.description('Captura manual de una pantalla — útil para llenar gaps que el Discovery autónomo no alcanzó (ej: comprobantes post-2FA)')
|
|
27
|
+
.requiredOption('--entity <id>', 'Entity ID donde guardar la captura')
|
|
28
|
+
.requiredOption('--label <label>', 'Nombre humano del flujo o pantalla (ej: "Comprobante transferencia exitosa")')
|
|
29
|
+
.option('--project <id>', 'Project ID (UUID o nombre like TRUSTBANK)')
|
|
30
|
+
.option('--device <serial>', 'Serial del dispositivo. Auto-detectado si hay uno solo.')
|
|
31
|
+
.option('--app-id <id>', 'App package ID (opcional, mejora trazabilidad)')
|
|
32
|
+
.action(async (options) => {
|
|
33
|
+
// ── Auto-pick device if not specified ─────────────────────────
|
|
34
|
+
let deviceId = options.device;
|
|
35
|
+
if (!deviceId) {
|
|
36
|
+
const { detectAllDevices } = await import('@flowspec-qa/runner-core');
|
|
37
|
+
const ready = detectAllDevices('android').filter((d) => d.status === 'ready');
|
|
38
|
+
if (ready.length === 0) {
|
|
39
|
+
console.error(chalk.red('\n❌ Sin dispositivos Android listos. Conecta uno y habilita USB Debugging.\n'));
|
|
40
|
+
console.log(chalk.dim(' Ejecuta: flowspecqa devices para verificar.'));
|
|
41
|
+
process.exit(1);
|
|
42
|
+
}
|
|
43
|
+
if (ready.length === 1) {
|
|
44
|
+
deviceId = ready[0].id;
|
|
45
|
+
console.log(chalk.dim(`📱 Dispositivo auto-seleccionado: ${chalk.bold(ready[0].name)} (${deviceId})`));
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
console.error(chalk.yellow('\n⚠️ Múltiples dispositivos conectados. Especifica uno con --device <serial>:\n'));
|
|
49
|
+
ready.forEach((d, i) => {
|
|
50
|
+
console.log(` ${i + 1}. ${chalk.bold(d.name.padEnd(28))} ${chalk.dim(d.id)}`);
|
|
51
|
+
});
|
|
52
|
+
process.exit(1);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
// Resolve Project ID
|
|
56
|
+
let projectId = options.project;
|
|
57
|
+
const { FlowSpecQAApi } = await import('@flowspec-qa/runner-core');
|
|
58
|
+
try {
|
|
59
|
+
const projects = await FlowSpecQAApi.listProjects();
|
|
60
|
+
if (projectId) {
|
|
61
|
+
const match = projects.find((p) => p.name === projectId || p.id === projectId);
|
|
62
|
+
if (match)
|
|
63
|
+
projectId = match.id;
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
const trustBank = projects.find((p) => p.name === 'TRUSTBANK');
|
|
67
|
+
projectId = trustBank ? trustBank.id : projects[0]?.id;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
catch (e) { }
|
|
71
|
+
console.log(chalk.cyan(`\n📸 Captura manual — ${chalk.bold(options.label)}`));
|
|
72
|
+
console.log(chalk.gray(` Entidad: ${options.entity}`));
|
|
73
|
+
console.log(chalk.gray(` Dispositivo: ${deviceId}\n`));
|
|
74
|
+
console.log(chalk.dim(' Asegúrate de que la app esté en la pantalla que quieres capturar.\n'));
|
|
75
|
+
const spinner = ora('Capturando estado del dispositivo...').start();
|
|
76
|
+
try {
|
|
77
|
+
const result = await discoveryEngine.captureSingleManualScreen({
|
|
78
|
+
entityId: options.entity,
|
|
79
|
+
projectId,
|
|
80
|
+
label: options.label,
|
|
81
|
+
appId: options.appId,
|
|
82
|
+
deviceId,
|
|
83
|
+
runnerVersion: '0.3.0',
|
|
84
|
+
onProgress: (step, detail) => {
|
|
85
|
+
spinner.text = detail || step;
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
spinner.succeed(chalk.green(`Captura registrada: ${chalk.bold(result.record_id.slice(0, 8))} · ` +
|
|
89
|
+
`calidad ${chalk.cyan(result.evidence_quality)} · ` +
|
|
90
|
+
`${result.elements_count} elementos · ` +
|
|
91
|
+
`${result.has_screenshot ? '📷 con screenshot' : '⚠️ sin screenshot'}`));
|
|
92
|
+
console.log('');
|
|
93
|
+
console.log(chalk.bold(' Próximos pasos'));
|
|
94
|
+
console.log(chalk.gray(' ──────────────────────────────────────────'));
|
|
95
|
+
console.log(` ${chalk.cyan('Validar ')} Abre la UI → Entidad ${options.entity} → tab "Baseline"`);
|
|
96
|
+
console.log(` ${chalk.cyan('Promover ')} Click "Validar evidencia" para que pase a baseline canónico`);
|
|
97
|
+
console.log(` ${chalk.cyan('Reusar ')} Próximo \`flowspecqa discover --mode incremental\` saltará esta pantalla`);
|
|
98
|
+
console.log('');
|
|
99
|
+
if (result.evidence_quality !== 'complete') {
|
|
100
|
+
console.log(chalk.yellow(` ⚠️ Calidad ${result.evidence_quality} — `
|
|
101
|
+
+ 'considera capturar de nuevo si el screenshot quedó parcial.\n'));
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
catch (err) {
|
|
105
|
+
spinner.fail(chalk.red(`Captura fallida: ${err?.message || err}`));
|
|
106
|
+
process.exit(1);
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=capture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capture.js","sourceRoot":"","sources":["../../src/commands/capture.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D,MAAM,UAAU,cAAc;IAC5B,OAAO,IAAI,OAAO,CAAC,SAAS,CAAC;SAC1B,WAAW,CAAC,yHAAyH,CAAC;SACtI,cAAc,CAA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C,EAAE,CAAC,CAAC;YAChB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC;YAC5C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,8CAA8C,CAAC,CAAC,CAAC;YACxE,OAAO,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,0BAA0B,OAAO,CAAC,MAAM,mBAAmB,CAAC,CAAC;YACvG,OAAO,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,+DAA+D,CAAC,CAAC;YAC3G,OAAO,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,4EAA4E,CAAC,CAAC;YACxH,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAEhB,IAAI,MAAM,CAAC,gBAAgB,KAAK,UAAU,EAAE,CAAC;gBAC3C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CACtB,iBAAiB,MAAM,CAAC,gBAAgB,KAAK;sBAC3C,+DAA+D,CAClE,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,oBAAoB,GAAG,EAAE,OAAO,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC;YACnE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discover.d.ts","sourceRoot":"","sources":["../../src/commands/discover.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"discover.d.ts","sourceRoot":"","sources":["../../src/commands/discover.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,wBAAgB,eAAe,IAAI,OAAO,CA6ezC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import chalk from 'chalk';
|
|
3
3
|
import inquirer from 'inquirer';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import { classifyCorpus } from '@flowspec-qa/runner-core';
|
|
4
6
|
export function discoverCommand() {
|
|
5
7
|
return new Command('discover')
|
|
6
8
|
.description('Descubre flujos de la aplicación y genera plan de pruebas con evidencias visuales')
|
|
@@ -12,6 +14,7 @@ export function discoverCommand() {
|
|
|
12
14
|
.option('--password <password>', 'Contraseña (o env FLOWSPECQA_APP_PASSWORD)')
|
|
13
15
|
.option('--device <serial>', 'Serial del dispositivo Android (de `flowspecqa devices`). Auto-seleccionado si hay uno solo.')
|
|
14
16
|
.option('--no-interactive', 'Desactiva el loop interactivo — ejecuta Discovery de una sola pasada')
|
|
17
|
+
.option('--mode <mode>', 'Modo de Discovery: full (default), incremental, recapture, resume', 'full')
|
|
15
18
|
.action(async (url, options) => {
|
|
16
19
|
// ── Auto-selección de dispositivo ────────────────────────────────
|
|
17
20
|
let deviceId = options.device;
|
|
@@ -54,8 +57,35 @@ export function discoverCommand() {
|
|
|
54
57
|
const detailStr = detail ? chalk.gray(` — ${detail}`) : '';
|
|
55
58
|
process.stdout.write(`\r${chalk.cyan(' →')} ${label}${detailStr}${' '.repeat(10)}\n`);
|
|
56
59
|
};
|
|
60
|
+
// ── Validate --mode flag (Phase 8 atomization + Phase 11 incremental) ──
|
|
61
|
+
const mode = String(options.mode || 'full').toLowerCase();
|
|
62
|
+
const VALID_MODES = ['full', 'incremental', 'recapture', 'resume'];
|
|
63
|
+
if (!VALID_MODES.includes(mode)) {
|
|
64
|
+
console.error(chalk.red(`\n❌ --mode inválido: "${mode}". Valores aceptados: ${VALID_MODES.join(', ')}`));
|
|
65
|
+
process.exit(1);
|
|
66
|
+
}
|
|
67
|
+
// Sprint 6 implements incremental. Recapture and resume still pending.
|
|
68
|
+
if (mode === 'recapture') {
|
|
69
|
+
console.log(chalk.yellow(`⚠️ --mode recapture todavía es parcial — usa la misma lógica que incremental por ahora.\n` +
|
|
70
|
+
` Sprint 6+ entregará el filtro estricto a pantallas marcadas needs_recapture.\n`));
|
|
71
|
+
}
|
|
72
|
+
if (mode === 'resume') {
|
|
73
|
+
if (!options.mobile) {
|
|
74
|
+
console.error(chalk.red(`\n❌ --mode resume solo está disponible para mobile (--mobile).\n`));
|
|
75
|
+
process.exit(1);
|
|
76
|
+
}
|
|
77
|
+
console.log(chalk.cyan(`🤝 Modo resume activado.\n` +
|
|
78
|
+
` Asegúrate de tener la app abierta en el dispositivo y haber pasado\n` +
|
|
79
|
+
` manualmente cualquier paso bloqueante (PIN/2FA/OTP/SSO/biometría).\n` +
|
|
80
|
+
` Discovery NO va a reiniciar la app — captura desde el estado actual.\n`));
|
|
81
|
+
}
|
|
82
|
+
if (mode === 'incremental' && !options.entity) {
|
|
83
|
+
console.error(chalk.red(`\n❌ --mode incremental requiere --entity para consultar el baseline.\n`));
|
|
84
|
+
process.exit(1);
|
|
85
|
+
}
|
|
57
86
|
console.log(chalk.blue(`\n🔍 FlowSpec QA Discovery — ${chalk.bold(url)}`));
|
|
58
|
-
console.log(chalk.gray(` Framework: ${options.mobile ? 'Maestro (mobile)' : 'Playwright (web)'}
|
|
87
|
+
console.log(chalk.gray(` Framework: ${options.mobile ? 'Maestro (mobile)' : 'Playwright (web)'}`));
|
|
88
|
+
console.log(chalk.gray(` Modo: ${mode}\n`));
|
|
59
89
|
try {
|
|
60
90
|
const { discoveryEngine } = await import('@flowspec-qa/runner-core');
|
|
61
91
|
// ── Interactive loop callback (mobile only, unless --no-interactive or non-TTY) ──
|
|
@@ -64,11 +94,155 @@ export function discoverCommand() {
|
|
|
64
94
|
const interactiveEnabled = options.mobile &&
|
|
65
95
|
options.interactive !== false &&
|
|
66
96
|
process.stdout.isTTY === true;
|
|
97
|
+
// Track the corpus across the run + interactive loop so exploreElement
|
|
98
|
+
// can register EvidenceRecords into the same corpus.
|
|
99
|
+
let discoveryCorpus;
|
|
100
|
+
// ── Step 0: Ensure project_id is available ──────────────────
|
|
101
|
+
let projectId = options.project;
|
|
102
|
+
const { FlowSpecQAApi } = await import('@flowspec-qa/runner-core');
|
|
103
|
+
const projects = await FlowSpecQAApi.listProjects();
|
|
104
|
+
if (projectId) {
|
|
105
|
+
// If user provided a name (e.g. TRUSTBANK), resolve to UUID
|
|
106
|
+
const match = projects.find(p => p.name === projectId || p.id === projectId);
|
|
107
|
+
if (match)
|
|
108
|
+
projectId = match.id;
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
if (projects.length === 0) {
|
|
112
|
+
console.error(chalk.red('\n❌ No tienes proyectos en FlowSpecQA.\n'));
|
|
113
|
+
process.exit(1);
|
|
114
|
+
}
|
|
115
|
+
if (projects.length === 1) {
|
|
116
|
+
projectId = projects[0].id;
|
|
117
|
+
console.log(chalk.dim(`\n📁 Auto-asociando al único proyecto: ${chalk.bold(projects[0].name)}`));
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
const trustBank = projects.find((p) => p.name === 'TRUSTBANK');
|
|
121
|
+
if (trustBank && interactiveEnabled) {
|
|
122
|
+
const { useTrustBank } = await inquirer.prompt([{
|
|
123
|
+
type: 'confirm',
|
|
124
|
+
name: 'useTrustBank',
|
|
125
|
+
message: `He encontrado el proyecto ${chalk.bold('TRUSTBANK')}. ¿Quieres usarlo?`,
|
|
126
|
+
default: true
|
|
127
|
+
}]);
|
|
128
|
+
if (useTrustBank)
|
|
129
|
+
projectId = trustBank.id;
|
|
130
|
+
}
|
|
131
|
+
if (!projectId && interactiveEnabled) {
|
|
132
|
+
const { selectedProject } = await inquirer.prompt([{
|
|
133
|
+
type: 'list',
|
|
134
|
+
name: 'selectedProject',
|
|
135
|
+
message: 'Por favor, selecciona un proyecto:',
|
|
136
|
+
choices: projects.map(p => ({ name: p.name, value: p.id }))
|
|
137
|
+
}]);
|
|
138
|
+
projectId = selectedProject;
|
|
139
|
+
}
|
|
140
|
+
else if (!projectId) {
|
|
141
|
+
projectId = trustBank ? trustBank.id : projects[0].id;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
// ── Hybrid Discovery Decision Point ──────────────────────────
|
|
146
|
+
if (interactiveEnabled && mode === 'resume') {
|
|
147
|
+
console.log('\n' + chalk.cyan('─'.repeat(60)));
|
|
148
|
+
console.log(chalk.bold('🤖 Discovery Híbrido Activado'));
|
|
149
|
+
console.log(chalk.gray(' He detectado el dispositivo. ¿Cómo quieres explorar Consorcio?'));
|
|
150
|
+
console.log(chalk.cyan('─'.repeat(60)));
|
|
151
|
+
const { hybridChoice } = await inquirer.prompt([{
|
|
152
|
+
type: 'list',
|
|
153
|
+
name: 'hybridChoice',
|
|
154
|
+
message: 'Selecciona una estrategia:',
|
|
155
|
+
choices: [
|
|
156
|
+
{ name: '🤖 Modo Automático (IA explora sola)', value: 'auto' },
|
|
157
|
+
{ name: '🤝 Modo Asistido (Tú eliges los pasos, la IA los ejecuta)', value: 'assisted' },
|
|
158
|
+
{ name: '🎬 Modo Manual (Tú grabas el flujo - Estilo JMeter)', value: 'manual' },
|
|
159
|
+
],
|
|
160
|
+
}]);
|
|
161
|
+
if (hybridChoice === 'manual') {
|
|
162
|
+
console.log(chalk.yellow('\n🎬 Iniciando Modo Recorder guiado...'));
|
|
163
|
+
const { runRecordSession } = await import('./record.js');
|
|
164
|
+
await runRecordSession({
|
|
165
|
+
entity: options.entity || 'Consorcio-Discovery',
|
|
166
|
+
projectId: projectId,
|
|
167
|
+
deviceId: deviceId,
|
|
168
|
+
appId: url
|
|
169
|
+
});
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
if (hybridChoice === 'assisted') {
|
|
173
|
+
console.log(chalk.cyan('\n🤝 Iniciando Discovery Asistido (Paso a Paso)...'));
|
|
174
|
+
// Set a flag to tell the loop to be more guided/step-by-step
|
|
175
|
+
options.assisted = true;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
// ── onFormDetected — prompt tester for field values ─────────────────
|
|
179
|
+
const onFormDetected = interactiveEnabled
|
|
180
|
+
? async (form) => {
|
|
181
|
+
console.log('\n' + chalk.cyan('─'.repeat(60)));
|
|
182
|
+
console.log(chalk.bold('📋 Discovery encontró un formulario\n'));
|
|
183
|
+
console.log(` ${chalk.bold('Pantalla:')} ${form.screenName}`);
|
|
184
|
+
console.log(` ${chalk.bold('Campos detectados:')}`);
|
|
185
|
+
form.fields.forEach((f) => {
|
|
186
|
+
console.log(` ${chalk.cyan('•')} ${chalk.bold(f.id)}${f.label ? ` — ${f.label}` : ''}`);
|
|
187
|
+
});
|
|
188
|
+
console.log(chalk.cyan('─'.repeat(60)));
|
|
189
|
+
const { explore } = await inquirer.prompt([{
|
|
190
|
+
type: 'confirm',
|
|
191
|
+
name: 'explore',
|
|
192
|
+
message: '¿Deseas explorar este flujo?',
|
|
193
|
+
default: true,
|
|
194
|
+
}]);
|
|
195
|
+
if (!explore)
|
|
196
|
+
return null;
|
|
197
|
+
console.log(chalk.bold('\n Ingresa los datos de prueba:'));
|
|
198
|
+
const answers = await inquirer.prompt(form.fields.map((f) => ({
|
|
199
|
+
type: 'input',
|
|
200
|
+
name: f.id,
|
|
201
|
+
message: ` › ${f.label || f.id}:`,
|
|
202
|
+
default: '',
|
|
203
|
+
})));
|
|
204
|
+
const testerLabel = (await inquirer.prompt([{
|
|
205
|
+
type: 'input',
|
|
206
|
+
name: 'label',
|
|
207
|
+
message: ' ¿Cómo quieres llamar a este flujo?',
|
|
208
|
+
default: `${form.screenName} — flujo principal`,
|
|
209
|
+
}])).label;
|
|
210
|
+
console.log(chalk.green(`\n ✅ Datos capturados para "${testerLabel}"`));
|
|
211
|
+
return answers;
|
|
212
|
+
}
|
|
213
|
+
: undefined;
|
|
214
|
+
// ── onRetryFailed — app no cargó tras reintentos automáticos ────────
|
|
215
|
+
const onRetryFailed = interactiveEnabled
|
|
216
|
+
? async (message) => {
|
|
217
|
+
console.log('\n' + chalk.red('─'.repeat(60)));
|
|
218
|
+
console.log(chalk.bold.red('🚨 La app no pudo ser confirmada en primer plano\n'));
|
|
219
|
+
console.log(chalk.yellow(` ${message}`));
|
|
220
|
+
console.log(chalk.red('─'.repeat(60)));
|
|
221
|
+
const { proceed } = await inquirer.prompt([{
|
|
222
|
+
type: 'confirm',
|
|
223
|
+
name: 'proceed',
|
|
224
|
+
message: '¿Continuar de todas formas? (la evidencia capturada puede ser incorrecta)',
|
|
225
|
+
default: false,
|
|
226
|
+
}]);
|
|
227
|
+
if (!proceed) {
|
|
228
|
+
console.log(chalk.red('\n❌ Discovery abortado por el usuario.'));
|
|
229
|
+
process.exit(1);
|
|
230
|
+
}
|
|
231
|
+
return true;
|
|
232
|
+
}
|
|
233
|
+
: undefined;
|
|
67
234
|
const onInteractiveLoop = interactiveEnabled
|
|
68
235
|
? async (evidence) => {
|
|
69
236
|
const unexplored = discoveryEngine.detectUnexplored(evidence);
|
|
70
|
-
|
|
71
|
-
|
|
237
|
+
const currentScreen = evidence.screens[evidence.screens.length - 1]?.name;
|
|
238
|
+
// In assisted mode, we prioritize elements from the current screen
|
|
239
|
+
const displayList = options.assisted
|
|
240
|
+
? unexplored.filter((u) => u.sourceScreen === currentScreen)
|
|
241
|
+
: unexplored;
|
|
242
|
+
// If current screen is fully explored in assisted mode, show ALL unexplored or finish
|
|
243
|
+
const effectiveList = (options.assisted && displayList.length === 0) ? unexplored : displayList;
|
|
244
|
+
if (effectiveList.length === 0) {
|
|
245
|
+
console.log(chalk.green('\n✅ Discovery completado — no quedan elementos sin explorar.'));
|
|
72
246
|
return false;
|
|
73
247
|
}
|
|
74
248
|
// ── Summary banner ──────────────────────────────────────
|
|
@@ -82,42 +256,51 @@ export function discoverCommand() {
|
|
|
82
256
|
` ${chalk.red(errorStates + ' error states')}` +
|
|
83
257
|
` ${chalk.blue('Confianza: ~' + confScore + '%')}`);
|
|
84
258
|
console.log(chalk.cyan('─'.repeat(60)));
|
|
85
|
-
|
|
86
|
-
|
|
259
|
+
if (options.assisted) {
|
|
260
|
+
console.log(chalk.bold.cyan(`\n📍 Pantalla actual: ${chalk.white(currentScreen)}`));
|
|
261
|
+
console.log(chalk.dim(` Elige qué acción quieres que la IA ejecute ahora:\n`));
|
|
262
|
+
}
|
|
263
|
+
else {
|
|
264
|
+
console.log(chalk.bold.yellow('\n🔍 Elementos sin explorar:\n'));
|
|
265
|
+
}
|
|
266
|
+
effectiveList.forEach((u, i) => {
|
|
87
267
|
const text = u.elementText ? chalk.white(`"${u.elementText.substring(0, 25)}"`) : '';
|
|
88
268
|
console.log(` ${chalk.dim(String(i + 1).padStart(2, ' '))}. ` +
|
|
89
269
|
`${chalk.cyan(u.elementId.padEnd(26))} ${text.padEnd(30)} ` +
|
|
90
|
-
chalk.gray(`en: ${u.sourceScreen}`));
|
|
270
|
+
(options.assisted ? '' : chalk.gray(`en: ${u.sourceScreen}`)));
|
|
91
271
|
});
|
|
92
272
|
// ── Inquirer checkbox ───────────────────────────────────
|
|
93
273
|
const { selected } = await inquirer.prompt([{
|
|
94
|
-
type: 'checkbox',
|
|
274
|
+
type: options.assisted ? 'list' : 'checkbox', // List for step-by-step, checkbox for batch
|
|
95
275
|
name: 'selected',
|
|
96
|
-
message:
|
|
97
|
-
pageSize: Math.min(15,
|
|
276
|
+
message: options.assisted ? 'Selecciona el siguiente paso:' : '¿Qué quieres explorar?',
|
|
277
|
+
pageSize: Math.min(15, effectiveList.length + 3),
|
|
278
|
+
instructions: false,
|
|
98
279
|
choices: [
|
|
99
|
-
...
|
|
280
|
+
...effectiveList.map((u) => {
|
|
100
281
|
const label = chalk.cyan(u.elementId.padEnd(26)) +
|
|
101
282
|
(u.elementText ? chalk.white(`"${u.elementText.substring(0, 22)}"`) : chalk.dim('(sin texto)')) +
|
|
102
|
-
chalk.gray(` ← ${u.sourceScreen}`);
|
|
283
|
+
(options.assisted ? '' : chalk.gray(` ← ${u.sourceScreen}`));
|
|
103
284
|
return { name: label, value: u };
|
|
104
285
|
}),
|
|
105
286
|
new inquirer.Separator(' ────────────────────────────────────────'),
|
|
106
287
|
{
|
|
107
|
-
name: chalk.green('✅
|
|
288
|
+
name: chalk.green('✅ Finalizar — generar suite con lo explorado'),
|
|
108
289
|
value: '__DONE__',
|
|
109
290
|
},
|
|
110
291
|
],
|
|
111
292
|
}]);
|
|
112
293
|
// User chose "Done" or nothing
|
|
113
|
-
if (!selected || selected.length === 0 || selected.includes('__DONE__')) {
|
|
294
|
+
if (!selected || (Array.isArray(selected) && selected.length === 0) || selected === '__DONE__' || (Array.isArray(selected) && selected.includes('__DONE__'))) {
|
|
114
295
|
console.log(chalk.green('\n✅ Generando suite con evidencias actuales...'));
|
|
115
296
|
return false;
|
|
116
297
|
}
|
|
117
|
-
//
|
|
118
|
-
const toExplore =
|
|
298
|
+
// Normalize to array
|
|
299
|
+
const toExplore = Array.isArray(selected) ? selected : [selected];
|
|
119
300
|
// ── Explore each selected element ───────────────────────
|
|
120
|
-
|
|
301
|
+
if (!options.assisted) {
|
|
302
|
+
console.log(chalk.blue(`\n🔭 Explorando ${toExplore.length} elemento(s)...\n`));
|
|
303
|
+
}
|
|
121
304
|
for (const element of toExplore) {
|
|
122
305
|
const label = element.elementText
|
|
123
306
|
? `${element.elementId} ("${element.elementText.substring(0, 20)}")`
|
|
@@ -126,11 +309,15 @@ export function discoverCommand() {
|
|
|
126
309
|
const newScreens = await discoveryEngine.exploreElement(element, {
|
|
127
310
|
url,
|
|
128
311
|
framework: 'maestro',
|
|
312
|
+
projectId,
|
|
313
|
+
entityId: options.entity,
|
|
129
314
|
username: options.username || process.env.FLOWSPECQA_APP_USERNAME,
|
|
130
315
|
password: options.password || process.env.FLOWSPECQA_APP_PASSWORD,
|
|
131
316
|
deviceId,
|
|
132
317
|
onProgress,
|
|
133
|
-
|
|
318
|
+
onFormDetected,
|
|
319
|
+
onRetryFailed,
|
|
320
|
+
}, evidence, discoveryCorpus);
|
|
134
321
|
if (newScreens.length > 0) {
|
|
135
322
|
console.log(chalk.green(` ✅ +${newScreens.length} pantalla(s) nueva(s): ` +
|
|
136
323
|
newScreens.map((s) => chalk.bold(s.name)).join(', ')));
|
|
@@ -139,30 +326,110 @@ export function discoverCommand() {
|
|
|
139
326
|
return true; // continue loop — show updated unexplored list
|
|
140
327
|
}
|
|
141
328
|
: undefined;
|
|
142
|
-
await discoveryEngine.run({
|
|
329
|
+
const runResult = await discoveryEngine.run({
|
|
143
330
|
url,
|
|
144
331
|
framework: options.mobile ? 'maestro' : 'playwright',
|
|
145
|
-
projectId:
|
|
332
|
+
projectId: projectId,
|
|
146
333
|
entityId: options.entity,
|
|
147
334
|
username: options.username || process.env.FLOWSPECQA_APP_USERNAME,
|
|
148
335
|
password: options.password || process.env.FLOWSPECQA_APP_PASSWORD,
|
|
149
336
|
deviceId,
|
|
337
|
+
// Phase 11 — pass the validated mode to the engine.
|
|
338
|
+
// The engine consults the entity's baseline when mode='incremental'
|
|
339
|
+
// and skips screens whose fingerprint matches a verified baseline.
|
|
340
|
+
mode: mode,
|
|
150
341
|
onProgress,
|
|
151
342
|
onInteractiveLoop,
|
|
343
|
+
onFormDetected,
|
|
344
|
+
onRetryFailed,
|
|
152
345
|
});
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
console.log(
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
346
|
+
// Store corpus reference so the interactive loop can extend it
|
|
347
|
+
discoveryCorpus = runResult.corpus;
|
|
348
|
+
// Compute absolute output path for display
|
|
349
|
+
const outputDir = path.resolve(options.output || 'specs');
|
|
350
|
+
console.log(chalk.green('\n✅ Discovery completado — generando artefactos desde evidencia disponible.\n'));
|
|
351
|
+
// ── Clasificación de evidencia (Spec § 5.3) ────────────────────
|
|
352
|
+
if (discoveryCorpus) {
|
|
353
|
+
const cls = classifyCorpus(discoveryCorpus);
|
|
354
|
+
const W = (n, color) => chalk[color](String(n).padStart(3, ' '));
|
|
355
|
+
console.log(chalk.bold(' Evidencia clasificada:'));
|
|
356
|
+
console.log(` ${W(cls.strict_count, 'green')} ${chalk.green('STRICT')} casos respaldados por evidencia suficiente`);
|
|
357
|
+
console.log(` ${W(cls.partial_count, 'yellow')} ${chalk.yellow('PARTIAL')} flujos incompletos que requieren revisión`);
|
|
358
|
+
console.log(` ${W(cls.reco_count, 'cyan')} ${chalk.cyan('RECO')} recomendaciones derivadas del corpus descubierto`);
|
|
359
|
+
console.log(` ${W(cls.gaps_count, 'red')} ${chalk.red('GAPS')} cobertura pendiente por explorar`);
|
|
360
|
+
// Show 1-2 PARTIAL items with recommendation
|
|
361
|
+
if (cls.details.partial.length > 0) {
|
|
362
|
+
console.log(chalk.dim('\n PARTIAL destacados:'));
|
|
363
|
+
cls.details.partial.slice(0, 2).forEach(p => {
|
|
364
|
+
const desc = p.description.length > 100 ? p.description.slice(0, 97) + '...' : p.description;
|
|
365
|
+
console.log(chalk.dim(` ⚠ ${p.evidenceId}: ${desc}`));
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
// Show top GAPS by priority (alta first)
|
|
369
|
+
if (cls.details.gaps.length > 0) {
|
|
370
|
+
const sortedGaps = [...cls.details.gaps].sort((a, b) => {
|
|
371
|
+
const order = { alta: 0, media: 1, baja: 2 };
|
|
372
|
+
return order[a.priority] - order[b.priority];
|
|
373
|
+
});
|
|
374
|
+
console.log(chalk.dim('\n GAPS destacados:'));
|
|
375
|
+
sortedGaps.slice(0, 3).forEach(g => {
|
|
376
|
+
const prio = g.priority === 'alta' ? chalk.red('●') : g.priority === 'media' ? chalk.yellow('●') : chalk.gray('●');
|
|
377
|
+
const action = g.action.length > 78 ? g.action.slice(0, 75) + '...' : g.action;
|
|
378
|
+
console.log(chalk.dim(` ${prio} ${action}`));
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
// Show top RECO by priority
|
|
382
|
+
if (cls.details.reco.length > 0) {
|
|
383
|
+
const sortedRecos = [...cls.details.reco].sort((a, b) => {
|
|
384
|
+
const order = { alta: 0, media: 1, baja: 2 };
|
|
385
|
+
return order[a.priority] - order[b.priority];
|
|
386
|
+
});
|
|
387
|
+
console.log(chalk.dim('\n RECO destacados:'));
|
|
388
|
+
sortedRecos.slice(0, 3).forEach(r => {
|
|
389
|
+
const prio = r.priority === 'alta' ? chalk.red('●') : r.priority === 'media' ? chalk.yellow('●') : chalk.gray('●');
|
|
390
|
+
const title = r.title.length > 78 ? r.title.slice(0, 75) + '...' : r.title;
|
|
391
|
+
console.log(chalk.dim(` ${prio} [${r.category}] ${title}`));
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
console.log('');
|
|
395
|
+
}
|
|
396
|
+
const reportFile = runResult.reportPath
|
|
397
|
+
? path.resolve(runResult.reportPath)
|
|
398
|
+
: path.join(outputDir, 'discovery_report.html');
|
|
399
|
+
const stripAnsi = (str) => {
|
|
400
|
+
// eslint-disable-next-line no-control-regex
|
|
401
|
+
return str.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{1,4})*)?[0-9A-ORZcf-nqry=><]/g, '');
|
|
402
|
+
};
|
|
403
|
+
// Renders a single box line, padding to fill the border width
|
|
404
|
+
const formatBoxLine = (content, totalWidth = 84) => {
|
|
405
|
+
const contentWidth = totalWidth - 6; // ║ (1) + 2 spaces + 2 spaces + ║ (1)
|
|
406
|
+
const visible = stripAnsi(content);
|
|
407
|
+
const padding = Math.max(0, contentWidth - visible.length);
|
|
408
|
+
return `${chalk.cyan('║')} ${content}${' '.repeat(padding)} ${chalk.cyan('║')}`;
|
|
409
|
+
};
|
|
410
|
+
// Renders a plain string that may be longer than contentWidth, wrapping across multiple lines
|
|
411
|
+
const formatBoxPath = (filePath, totalWidth = 84) => {
|
|
412
|
+
const contentWidth = totalWidth - 6;
|
|
413
|
+
const lines = [];
|
|
414
|
+
let remaining = filePath;
|
|
415
|
+
while (remaining.length > 0) {
|
|
416
|
+
lines.push(remaining.slice(0, contentWidth));
|
|
417
|
+
remaining = remaining.slice(contentWidth);
|
|
418
|
+
}
|
|
419
|
+
return lines.map(l => {
|
|
420
|
+
const padding = Math.max(0, contentWidth - l.length);
|
|
421
|
+
return `${chalk.cyan('║')} ${chalk.green(l)}${' '.repeat(padding)} ${chalk.cyan('║')}`;
|
|
422
|
+
}).join('\n');
|
|
423
|
+
};
|
|
424
|
+
console.log(`${chalk.cyan('╔══════════════════════════════════════════════════════════════════════════════════╗')}`);
|
|
425
|
+
console.log(formatBoxLine(chalk.bold('PRÓXIMOS PASOS')));
|
|
426
|
+
console.log(`${chalk.cyan('╠══════════════════════════════════════════════════════════════════════════════════╣')}`);
|
|
427
|
+
console.log(formatBoxLine(chalk.bold('📋 Reporte de evidencias (HTML):')));
|
|
428
|
+
console.log(formatBoxPath(reportFile));
|
|
429
|
+
console.log(formatBoxLine(''));
|
|
430
|
+
console.log(formatBoxLine(chalk.bold('Portal SaaS:')));
|
|
431
|
+
console.log(formatBoxLine('El plan ya está sincronizado. Ve a FlowSpecQA y genera tests.'));
|
|
432
|
+
console.log(`${chalk.cyan('╚══════════════════════════════════════════════════════════════════════════════════╝')}\n`);
|
|
166
433
|
}
|
|
167
434
|
catch (err) {
|
|
168
435
|
console.error(chalk.red(`\n❌ Discovery fallido: ${err.message}`));
|