@flowspec-qa/runner-core 0.5.3 → 0.5.5
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/discovery.d.ts +47 -0
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +201 -24
- package/dist/discovery.js.map +1 -1
- package/dist/executor.d.ts.map +1 -1
- package/dist/executor.js +12 -2
- package/dist/executor.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/maestro-debug.d.ts +19 -0
- package/dist/maestro-debug.d.ts.map +1 -0
- package/dist/maestro-debug.js +59 -0
- package/dist/maestro-debug.js.map +1 -0
- package/dist/mobile-discovery-guards.d.ts +50 -0
- package/dist/mobile-discovery-guards.d.ts.map +1 -0
- package/dist/mobile-discovery-guards.js +145 -0
- package/dist/mobile-discovery-guards.js.map +1 -0
- package/dist/workspace.d.ts +22 -0
- package/dist/workspace.d.ts.map +1 -0
- package/dist/workspace.js +52 -0
- package/dist/workspace.js.map +1 -0
- package/package.json +1 -1
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,cAAc,EAAE,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAC1F,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,KAAK,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,YAAY,EAAE,KAAK,gBAAgB,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACpJ,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAo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eAAe,EAAE,KAAK,iBAAiB,EAAE,KAAK,cAAc,EAAE,KAAK,gBAAgB,EAAE,KAAK,uBAAuB,EAAE,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxN,OAAO,EAAE,uBAAuB,EAAE,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEpF,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,EAAE,mBAAmB,EAAE,UAAU,EAAE,UAAU,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,cAAc,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAClO,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,WAAW,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,UAAU,EAAE,eAAe,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,eAAe,EAAE,aAAa,EAAE,oBAAoB,EAAE,cAAc,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,aAAa,EAAE,aAAa,EAAE,0BAA0B,EAAE,KAAK,oBAAoB,EAAE,KAAK,mBAAmB,EAAE,KAAK,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC9gB,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,8BAA8B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -13,4 +13,6 @@ export { generateDiscoveryReport } from './discovery-report.js';
|
|
|
13
13
|
export { normalizeResultType } from './evidence-types.js';
|
|
14
14
|
export { createCorpus, addRecord, finalizeCorpus, buildRecord, legacyElementsToUIElements, elementsToUIElements, detectForm, looksLikeButton, getElementEvidence, getKnownElementIds, calculateGroundedScore, getMissingSelectors, serializeCorpus, corpusSummary, resetEvidenceCounter, classifyCorpus, screenFingerprint, computeEvidenceHash, deriveEvidenceQuality, migrateRecord, shouldCapture, findBaselineForFingerprint } from './evidence-corpus.js';
|
|
15
15
|
export * from './backup-manager.js';
|
|
16
|
+
export * from './workspace.js';
|
|
17
|
+
export * from './mobile-discovery-guards.js';
|
|
16
18
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,OAAO,EAAE,MAAM,EAAqB,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,cAAc,EAAmB,MAAM,WAAW,CAAC;AAC1F,OAAO,EAAE,SAAS,EAAE,aAAa,EAA2F,MAAM,iBAAiB,CAAC;AACpJ,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,UAAU,EAAmB,MAAM,oBAAoB,CAAC;AAClG,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,cAAc,EAAE,yBAAyB,EAAkE,MAAM,eAAe,CAAC;AAC7K,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,YAAY,EAAmB,MAAM,cAAc,CAAC;AACvH,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,aAAa,EAAsB,MAAM,eAAe,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAA2C,MAAM,iBAAiB,CAAC;AAC/G,OAAO,EAAE,eAAe,EAAyK,MAAM,gBAAgB,CAAC;AACxN,OAAO,EAAE,uBAAuB,EAAsB,MAAM,uBAAuB,CAAC;AAGpF,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,WAAW,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,UAAU,EAAE,eAAe,EAAE,kBAAkB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Ae,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,eAAe,EAAE,aAAa,EAAE,oBAAoB,EAAE,cAAc,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,aAAa,EAAE,aAAa,EAAE,0BAA0B,EAAiF,MAAM,sBAAsB,CAAC;AAC9gB,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { TestResultItem } from './api-client.js';
|
|
2
|
+
/** Folder (inside the suite dir) where Maestro writes its flattened debug output. */
|
|
3
|
+
export declare const MAESTRO_DEBUG_DIR = ".maestro-debug";
|
|
4
|
+
/**
|
|
5
|
+
* Maestro's JUnit report often says only "Unknown error". Its debug output
|
|
6
|
+
* (`commands-(<flow>).json`) keeps the real cause on the failed command.
|
|
7
|
+
* Returns that message, or null when there is none.
|
|
8
|
+
*/
|
|
9
|
+
export declare function failedCommandMessage(commands: unknown): string | null;
|
|
10
|
+
export declare function commandsFileFor(debugDir: string, flowName: string): string;
|
|
11
|
+
/** Masks every secret value (e.g. the .maestro.env values) that appears in the text. */
|
|
12
|
+
export declare function maskValues(text: string, secrets: string[]): string;
|
|
13
|
+
/**
|
|
14
|
+
* Replaces empty or "Unknown error" failure messages with Maestro's real cause.
|
|
15
|
+
* The cause can quote typed text, so `secrets` (the env values passed to the
|
|
16
|
+
* flows) are masked before the message leaves the machine.
|
|
17
|
+
*/
|
|
18
|
+
export declare function withMaestroFailureDetail(items: TestResultItem[], debugDir: string, secrets?: string[]): TestResultItem[];
|
|
19
|
+
//# sourceMappingURL=maestro-debug.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"maestro-debug.d.ts","sourceRoot":"","sources":["../src/maestro-debug.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD,qFAAqF;AACrF,eAAO,MAAM,iBAAiB,mBAAmB,CAAC;AAIlD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAYrE;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE1E;AAED,wFAAwF;AACxF,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,CAKlE;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,cAAc,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,MAAM,EAAO,GAAG,cAAc,EAAE,CAY5H"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { existsSync, readFileSync } from 'fs';
|
|
3
|
+
/** Folder (inside the suite dir) where Maestro writes its flattened debug output. */
|
|
4
|
+
export const MAESTRO_DEBUG_DIR = '.maestro-debug';
|
|
5
|
+
const GENERIC = /^\s*(unknown error)?\s*$/i;
|
|
6
|
+
/**
|
|
7
|
+
* Maestro's JUnit report often says only "Unknown error". Its debug output
|
|
8
|
+
* (`commands-(<flow>).json`) keeps the real cause on the failed command.
|
|
9
|
+
* Returns that message, or null when there is none.
|
|
10
|
+
*/
|
|
11
|
+
export function failedCommandMessage(commands) {
|
|
12
|
+
if (!Array.isArray(commands))
|
|
13
|
+
return null;
|
|
14
|
+
for (const entry of commands) {
|
|
15
|
+
const meta = entry?.metadata;
|
|
16
|
+
if (meta?.status !== 'FAILED')
|
|
17
|
+
continue;
|
|
18
|
+
const err = meta.error ?? {};
|
|
19
|
+
for (const key of ['message', 'localizedMessage', 'text']) {
|
|
20
|
+
const value = err[key];
|
|
21
|
+
if (typeof value === 'string' && value.trim())
|
|
22
|
+
return value.trim();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
export function commandsFileFor(debugDir, flowName) {
|
|
28
|
+
return path.join(debugDir, `commands-(${flowName}).json`);
|
|
29
|
+
}
|
|
30
|
+
/** Masks every secret value (e.g. the .maestro.env values) that appears in the text. */
|
|
31
|
+
export function maskValues(text, secrets) {
|
|
32
|
+
let out = text;
|
|
33
|
+
const values = [...new Set(secrets.filter((v) => v && v.length >= 3))].sort((a, b) => b.length - a.length);
|
|
34
|
+
for (const value of values)
|
|
35
|
+
out = out.split(value).join('***');
|
|
36
|
+
return out;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Replaces empty or "Unknown error" failure messages with Maestro's real cause.
|
|
40
|
+
* The cause can quote typed text, so `secrets` (the env values passed to the
|
|
41
|
+
* flows) are masked before the message leaves the machine.
|
|
42
|
+
*/
|
|
43
|
+
export function withMaestroFailureDetail(items, debugDir, secrets = []) {
|
|
44
|
+
return items.map((item) => {
|
|
45
|
+
if (item.status !== 'fail' || !GENERIC.test(item.error ?? ''))
|
|
46
|
+
return item;
|
|
47
|
+
const file = commandsFileFor(debugDir, item.name);
|
|
48
|
+
if (!existsSync(file))
|
|
49
|
+
return item;
|
|
50
|
+
try {
|
|
51
|
+
const detail = failedCommandMessage(JSON.parse(readFileSync(file, 'utf8')));
|
|
52
|
+
return detail ? { ...item, error: maskValues(detail, secrets) } : item;
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
return item;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=maestro-debug.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"maestro-debug.js","sourceRoot":"","sources":["../src/maestro-debug.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAG9C,qFAAqF;AACrF,MAAM,CAAC,M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AC,CAAC,MAAM,CAAC,CAAC;IAC3G,KAAK,MAAM,KAAK,IAAI,MAAM;QAAE,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/D,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CAAC,KAAuB,EAAE,QAAgB,EAAE,UAAoB,EAAE;IACxG,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACxB,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;YAAE,OAAO,IAAI,CAAC;QAC3E,MAAM,IAAI,GAAG,eAAe,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAClD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;YAAE,OAAO,IAAI,CAAC;QACnC,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;YAC5E,OAAO,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QACzE,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export interface InteractiveDecision {
|
|
2
|
+
enabled: boolean;
|
|
3
|
+
/** Message to show when the tester asked for it but it cannot run. */
|
|
4
|
+
warning?: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Prompts read the keyboard, so what matters is stdin being a terminal; stdout
|
|
8
|
+
* may be piped (e.g. `| tee discover.log`) and the prompts still show.
|
|
9
|
+
*/
|
|
10
|
+
export declare function interactiveDecision(opts: {
|
|
11
|
+
mobile: boolean;
|
|
12
|
+
interactive?: boolean;
|
|
13
|
+
stdinIsTTY: boolean;
|
|
14
|
+
}): InteractiveDecision;
|
|
15
|
+
export declare function isImeNode(node: any, appId?: string): boolean;
|
|
16
|
+
/** True when the hierarchy shows the on-screen keyboard. */
|
|
17
|
+
export declare function hasImeNodes(node: any, appId?: string): boolean;
|
|
18
|
+
/** Returns a copy of a Maestro hierarchy without the on-screen keyboard subtrees. */
|
|
19
|
+
export declare function stripImeNodes(node: any, appId?: string): any;
|
|
20
|
+
export interface LoginFormIds {
|
|
21
|
+
usernameId: string;
|
|
22
|
+
passwordId: string;
|
|
23
|
+
submitId: string;
|
|
24
|
+
}
|
|
25
|
+
/** Maestro steps that log in through the fields observed on the login screen. */
|
|
26
|
+
export declare function loginSteps(form: LoginFormIds, username: string, password: string, selector: (id: string) => string): string[];
|
|
27
|
+
/** Whether an element id observed earlier is on the current screen. */
|
|
28
|
+
export declare function elementPresent(currentIds: Iterable<string>, elementId: string): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Name for the state after a form submit. When the app shows the result on the
|
|
31
|
+
* same screen (inline message), it is that screen's result, not a new screen
|
|
32
|
+
* named after whatever text was typed.
|
|
33
|
+
*/
|
|
34
|
+
export declare function formResultName(screenName: string, sameScreen: boolean, inferred: string): string;
|
|
35
|
+
export type FormLocation = 'on_form' | 'on_login' | 'on_parent' | 'elsewhere';
|
|
36
|
+
/** Where the app is now, compared with the screens observed before the prompt. */
|
|
37
|
+
export declare function locateScreen(matches: {
|
|
38
|
+
form: boolean;
|
|
39
|
+
login: boolean;
|
|
40
|
+
parent: boolean;
|
|
41
|
+
}): FormLocation;
|
|
42
|
+
export declare const PARTIAL_FILE = "discovery_partial.json";
|
|
43
|
+
export declare function writePartialSnapshot(outputDir: string, data: unknown): string;
|
|
44
|
+
/**
|
|
45
|
+
* Installs SIGINT/SIGHUP handlers that save `snapshot()` before exiting.
|
|
46
|
+
* Inquirer re-raises SIGINT on Ctrl-C, which used to end the run silently.
|
|
47
|
+
* Returns the function that removes the handlers.
|
|
48
|
+
*/
|
|
49
|
+
export declare function guardInterruption(outputDir: string, snapshot: () => unknown, log?: (msg: string) => void, exit?: (code: number) => void): () => void;
|
|
50
|
+
//# sourceMappingURL=mobile-discovery-guards.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mobile-discovery-guards.d.ts","sourceRoot":"","sources":["../src/mobile-discovery-guards.ts"],"names":[],"mappings":"AAmBA,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,sEAAsE;IACtE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,EAAE,OAAO,CAAA;CAAE,GAAG,mBAAmB,CAU9H;AAYD,wBAAgB,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,SAAK,GAAG,OAAO,CAOxD;AAED,4DAA4D;AAC5D,wBAAgB,WAAW,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,SAAK,GAAG,OAAO,CAI1D;AAED,qFAAqF;AACrF,wBAAgB,aAAa,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,SAAK,GAAG,GAAG,CAOxD;AAID,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,iFAAiF;AACjF,wBAAgB,UAAU,CACxB,IAAI,EAAE,YAAY,EAClB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,MAAM,GAC/B,MAAM,EAAE,CAaV;AAED,uEAAuE;AACvE,wBAAgB,cAAc,CAAC,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAGvF;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEhG;AAED,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,UAAU,GAAG,WAAW,GAAG,WAAW,CAAC;AAE9E,kFAAkF;AAClF,wBAAgB,YAAY,CAC1B,OAAO,EAAE;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,GAC1D,YAAY,CAKd;AAID,eAAO,MAAM,YAAY,2BAA2B,CAAC;AAErD,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,MAAM,CAK7E;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,OAAO,EACvB,GAAG,GAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAA4B,EAClD,IAAI,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAA6B,GACpD,MAAM,IAAI,CAmBZ"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Guards for the mobile Discovery (discoverMobile, Maestro). Web Discovery
|
|
3
|
+
* does not use this module.
|
|
4
|
+
*
|
|
5
|
+
* TRUSTBANK-MOBILE-012 on a Samsung (2026-11-19) showed four failures, all
|
|
6
|
+
* generic to any app:
|
|
7
|
+
* 1. Interactive mode turned off silently when stdout was piped (tee).
|
|
8
|
+
* 2. While the tester answered a form prompt the app closed its session; the
|
|
9
|
+
* Runner then typed the data into whatever screen was showing.
|
|
10
|
+
* 3. The on-screen keyboard ("ES(US)", ".com", "Sig.") was recorded as the
|
|
11
|
+
* form's validation messages.
|
|
12
|
+
* 4. An interrupted prompt (Ctrl-C) ended the process and lost the evidence
|
|
13
|
+
* captured so far.
|
|
14
|
+
*/
|
|
15
|
+
import fs from 'fs';
|
|
16
|
+
import path from 'path';
|
|
17
|
+
/**
|
|
18
|
+
* Prompts read the keyboard, so what matters is stdin being a terminal; stdout
|
|
19
|
+
* may be piped (e.g. `| tee discover.log`) and the prompts still show.
|
|
20
|
+
*/
|
|
21
|
+
export function interactiveDecision(opts) {
|
|
22
|
+
if (!opts.mobile || opts.interactive === false)
|
|
23
|
+
return { enabled: false };
|
|
24
|
+
if (opts.stdinIsTTY)
|
|
25
|
+
return { enabled: true };
|
|
26
|
+
return {
|
|
27
|
+
enabled: false,
|
|
28
|
+
warning: 'Modo interactivo desactivado: esta terminal no permite responder preguntas. ' +
|
|
29
|
+
'Los formularios solo se probarán vacíos y no se pedirán datos de prueba. ' +
|
|
30
|
+
'Ejecuta discover en una terminal interactiva, o usa --no-interactive para ocultar este aviso.',
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
// ── 3. On-screen keyboard is not part of the app ─────────────────────────────
|
|
34
|
+
/** Packages of input methods (Samsung, Gboard, SwiftKey, AOSP, ...). */
|
|
35
|
+
const IME_PACKAGE = /(inputmethod|honeyboard|keyboard|swiftkey|\.ime\b|\.input\b)/i;
|
|
36
|
+
function packageOf(resourceId) {
|
|
37
|
+
const idx = resourceId.indexOf(':id/');
|
|
38
|
+
return idx > 0 ? resourceId.slice(0, idx) : '';
|
|
39
|
+
}
|
|
40
|
+
export function isImeNode(node, appId = '') {
|
|
41
|
+
const attrs = node?.attributes || {};
|
|
42
|
+
const pkg = attrs['package'] || packageOf(attrs['resource-id'] || '');
|
|
43
|
+
if (pkg && pkg === appId)
|
|
44
|
+
return false; // the app under test is never the keyboard
|
|
45
|
+
if (pkg && IME_PACKAGE.test(pkg))
|
|
46
|
+
return true;
|
|
47
|
+
const cls = attrs['class'] || '';
|
|
48
|
+
return /KeyboardView|InputMethod/i.test(cls);
|
|
49
|
+
}
|
|
50
|
+
/** True when the hierarchy shows the on-screen keyboard. */
|
|
51
|
+
export function hasImeNodes(node, appId = '') {
|
|
52
|
+
if (!node || typeof node !== 'object')
|
|
53
|
+
return false;
|
|
54
|
+
if (isImeNode(node, appId))
|
|
55
|
+
return true;
|
|
56
|
+
return Array.isArray(node.children) && node.children.some((c) => hasImeNodes(c, appId));
|
|
57
|
+
}
|
|
58
|
+
/** Returns a copy of a Maestro hierarchy without the on-screen keyboard subtrees. */
|
|
59
|
+
export function stripImeNodes(node, appId = '') {
|
|
60
|
+
if (!node || typeof node !== 'object')
|
|
61
|
+
return node;
|
|
62
|
+
if (isImeNode(node, appId))
|
|
63
|
+
return null;
|
|
64
|
+
const children = Array.isArray(node.children)
|
|
65
|
+
? node.children.map((c) => stripImeNodes(c, appId)).filter((c) => c !== null)
|
|
66
|
+
: node.children;
|
|
67
|
+
return { ...node, children };
|
|
68
|
+
}
|
|
69
|
+
/** Maestro steps that log in through the fields observed on the login screen. */
|
|
70
|
+
export function loginSteps(form, username, password, selector) {
|
|
71
|
+
return [
|
|
72
|
+
`- tapOn:\n ${selector(form.usernameId)}`,
|
|
73
|
+
`- eraseText: 50`,
|
|
74
|
+
`- inputText: "${username}"`,
|
|
75
|
+
`- hideKeyboard`,
|
|
76
|
+
`- tapOn:\n ${selector(form.passwordId)}`,
|
|
77
|
+
`- eraseText: 50`,
|
|
78
|
+
`- inputText: "${password}"`,
|
|
79
|
+
`- hideKeyboard`,
|
|
80
|
+
`- tapOn:\n ${selector(form.submitId)}`,
|
|
81
|
+
`- waitForAnimationToEnd:\n timeout: 5000`,
|
|
82
|
+
];
|
|
83
|
+
}
|
|
84
|
+
/** Whether an element id observed earlier is on the current screen. */
|
|
85
|
+
export function elementPresent(currentIds, elementId) {
|
|
86
|
+
for (const id of currentIds)
|
|
87
|
+
if (id === elementId)
|
|
88
|
+
return true;
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Name for the state after a form submit. When the app shows the result on the
|
|
93
|
+
* same screen (inline message), it is that screen's result, not a new screen
|
|
94
|
+
* named after whatever text was typed.
|
|
95
|
+
*/
|
|
96
|
+
export function formResultName(screenName, sameScreen, inferred) {
|
|
97
|
+
return sameScreen ? `${screenName} (Resultado)` : inferred;
|
|
98
|
+
}
|
|
99
|
+
/** Where the app is now, compared with the screens observed before the prompt. */
|
|
100
|
+
export function locateScreen(matches) {
|
|
101
|
+
if (matches.form)
|
|
102
|
+
return 'on_form';
|
|
103
|
+
if (matches.login)
|
|
104
|
+
return 'on_login';
|
|
105
|
+
if (matches.parent)
|
|
106
|
+
return 'on_parent';
|
|
107
|
+
return 'elsewhere';
|
|
108
|
+
}
|
|
109
|
+
// ── 4. Keep what was captured if the run is interrupted ──────────────────────
|
|
110
|
+
export const PARTIAL_FILE = 'discovery_partial.json';
|
|
111
|
+
export function writePartialSnapshot(outputDir, data) {
|
|
112
|
+
if (!fs.existsSync(outputDir))
|
|
113
|
+
fs.mkdirSync(outputDir, { recursive: true });
|
|
114
|
+
const file = path.join(outputDir, PARTIAL_FILE);
|
|
115
|
+
fs.writeFileSync(file, JSON.stringify(data));
|
|
116
|
+
return file;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Installs SIGINT/SIGHUP handlers that save `snapshot()` before exiting.
|
|
120
|
+
* Inquirer re-raises SIGINT on Ctrl-C, which used to end the run silently.
|
|
121
|
+
* Returns the function that removes the handlers.
|
|
122
|
+
*/
|
|
123
|
+
export function guardInterruption(outputDir, snapshot, log = (m) => console.log(m), exit = (c) => process.exit(c)) {
|
|
124
|
+
let done = false;
|
|
125
|
+
const handler = (signal) => {
|
|
126
|
+
if (done)
|
|
127
|
+
return;
|
|
128
|
+
done = true;
|
|
129
|
+
try {
|
|
130
|
+
const file = writePartialSnapshot(outputDir, snapshot());
|
|
131
|
+
log(`\n⚠️ Discovery interrumpido (${signal}). Evidencia capturada hasta ahora guardada en ${file}. No se sincronizó con FlowSpec QA.`);
|
|
132
|
+
}
|
|
133
|
+
catch (err) {
|
|
134
|
+
log(`\n⚠️ Discovery interrumpido (${signal}); no se pudo guardar la evidencia parcial: ${err?.message ?? err}`);
|
|
135
|
+
}
|
|
136
|
+
exit(130);
|
|
137
|
+
};
|
|
138
|
+
process.on('SIGINT', handler);
|
|
139
|
+
process.on('SIGHUP', handler);
|
|
140
|
+
return () => {
|
|
141
|
+
process.off('SIGINT', handler);
|
|
142
|
+
process.off('SIGHUP', handler);
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=mobile-discovery-guards.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mobile-discovery-guards.js","sourceRoot":"","sources":["../src/mobile-discovery-guards.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAUxB;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAqE;IACvG,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,WAAW,KAAK,KAAK;QAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC1E,IAAI,IAAI,CAAC,UAAU;QAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC9C,OAAO;QACL,OAAO,EAAE,KAAK;QACd,OAAO,EACL,8EAA8E;YAC9E,2EAA2E;YAC3E,+FAA+F;KAClG,CAAC;AACJ,CAAC;AAED,gFAAgF;AAEhF,wEAAwE;AACxE,MAAM,WAAW,GAAG,+DAA+D,CAAC;AAEpF,SAAS,SAAS,CAAC,UAAkB;IACnC,MAAM,GAAG,GAAG,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACvC,OAAO,GAAG,GAAG,CAAC,CAAC,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IAAI,qCAAqC,CAAC,CAAC;QAC1I,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,GAAG,CAAC,iCAAiC,MAAM,+CAA+C,GAAG,EAAE,OAAO,IAAI,GAAG,EAAE,CAAC,CAAC;QACnH,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,CAAC;IACZ,CAAC,CAAC;IACF,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC9B,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC9B,OAAO,GAAG,EAAE;QACV,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC/B,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACjC,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const REPORTS_SUBDIR = "reports";
|
|
2
|
+
export declare function workspaceRoot(env?: NodeJS.ProcessEnv, home?: string): string;
|
|
3
|
+
/** A folder-safe name: no path separators or characters macOS/Windows reject. */
|
|
4
|
+
export declare function safeSegment(value: string, fallback: string): string;
|
|
5
|
+
export declare function entityWorkspace(opts: {
|
|
6
|
+
projectName?: string;
|
|
7
|
+
entityId?: string;
|
|
8
|
+
target?: string;
|
|
9
|
+
}, root?: string): string;
|
|
10
|
+
/** --output wins; otherwise the entity's folder in the workspace. */
|
|
11
|
+
export declare function resolveOutputDir(output: string | undefined, opts: {
|
|
12
|
+
projectName?: string;
|
|
13
|
+
entityId?: string;
|
|
14
|
+
target?: string;
|
|
15
|
+
}, root?: string): string;
|
|
16
|
+
export declare function reportsDir(outputDir: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* Finds the folder holding discovery_data.json for an entity anywhere in the
|
|
19
|
+
* workspace (the project folder is not known by `flowspecqa report`).
|
|
20
|
+
*/
|
|
21
|
+
export declare function findEntityData(entityId: string, root?: string): string | null;
|
|
22
|
+
//# sourceMappingURL=workspace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../src/workspace.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,cAAc,YAAY,CAAC;AAExC,wBAAgB,aAAa,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,EAAE,IAAI,GAAE,MAAqB,GAAG,MAAM,CAEvG;AAED,iFAAiF;AACjF,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAGnE;AAED,wBAAgB,eAAe,CAC7B,IAAI,EAAE;IAAE,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,EAClE,IAAI,GAAE,MAAwB,GAC7B,MAAM,CAMR;AAED,qEAAqE;AACrE,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,IAAI,EAAE;IAAE,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,EAClE,IAAI,GAAE,MAAwB,GAC7B,MAAM,CAER;AAED,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,GAAE,MAAwB,GAAG,MAAM,GAAG,IAAI,CAQ9F"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Runner's fixed working folder, the same on any Mac:
|
|
3
|
+
*
|
|
4
|
+
* ~/FlowSpecQA/<project>/<ENTITY>/
|
|
5
|
+
* discovery_plan.md, discovery_data.json (latest run)
|
|
6
|
+
* reports/discovery_report_<app>_<date>.html (one per run, history kept)
|
|
7
|
+
* debug/ (diagnostics)
|
|
8
|
+
*
|
|
9
|
+
* FLOWSPECQA_HOME overrides the root; --output overrides the whole folder.
|
|
10
|
+
*/
|
|
11
|
+
import fs from 'fs';
|
|
12
|
+
import os from 'os';
|
|
13
|
+
import path from 'path';
|
|
14
|
+
export const REPORTS_SUBDIR = 'reports';
|
|
15
|
+
export function workspaceRoot(env = process.env, home = os.homedir()) {
|
|
16
|
+
return env.FLOWSPECQA_HOME ? path.resolve(env.FLOWSPECQA_HOME) : path.join(home, 'FlowSpecQA');
|
|
17
|
+
}
|
|
18
|
+
/** A folder-safe name: no path separators or characters macOS/Windows reject. */
|
|
19
|
+
export function safeSegment(value, fallback) {
|
|
20
|
+
const cleaned = (value || '').replace(/[\/\\:*?"<>|\x00-\x1f]+/g, '_').replace(/^\.+/, '').trim();
|
|
21
|
+
return cleaned || fallback;
|
|
22
|
+
}
|
|
23
|
+
export function entityWorkspace(opts, root = workspaceRoot()) {
|
|
24
|
+
const project = safeSegment(opts.projectName || '', 'sin-proyecto');
|
|
25
|
+
const entity = opts.entityId
|
|
26
|
+
? safeSegment(opts.entityId.trim().toUpperCase(), 'sin-entidad')
|
|
27
|
+
: safeSegment(`discovery-${opts.target || 'app'}`, 'sin-entidad');
|
|
28
|
+
return path.join(root, project, entity);
|
|
29
|
+
}
|
|
30
|
+
/** --output wins; otherwise the entity's folder in the workspace. */
|
|
31
|
+
export function resolveOutputDir(output, opts, root = workspaceRoot()) {
|
|
32
|
+
return output ? path.resolve(output) : entityWorkspace(opts, root);
|
|
33
|
+
}
|
|
34
|
+
export function reportsDir(outputDir) {
|
|
35
|
+
return path.join(outputDir, REPORTS_SUBDIR);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Finds the folder holding discovery_data.json for an entity anywhere in the
|
|
39
|
+
* workspace (the project folder is not known by `flowspecqa report`).
|
|
40
|
+
*/
|
|
41
|
+
export function findEntityData(entityId, root = workspaceRoot()) {
|
|
42
|
+
if (!fs.existsSync(root))
|
|
43
|
+
return null;
|
|
44
|
+
const entity = safeSegment(entityId.trim().toUpperCase(), 'sin-entidad');
|
|
45
|
+
for (const project of fs.readdirSync(root)) {
|
|
46
|
+
const dir = path.join(root, project, entity);
|
|
47
|
+
if (fs.existsSync(path.join(dir, 'discovery_data.json')))
|
|
48
|
+
return dir;
|
|
49
|
+
}
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=workspace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace.js","sourceRoot":"","sources":["../src/workspace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,MAAM,CAAC,MAAM,cAAc,GAAG,SAAS,CAAC;AAExC,MAAM,UAAU,aAAa,CAAC,MAAyB,OAAO,CAAC,GAAG,EAAE,OAAe,EAAE,CAAC,OAAO,EAAE;IAC7F,OAAO,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;AACjG,CAAC;AAED,iFAAiF;AACjF,MAAM,UAAU,WAAW,CAAC,KAAa,EAAE,QAAgB;IACzD,MAAM,OAAO,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,0BAA0B,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAClG,OAAO,OAAO,IAAI,QAAQ,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,eAAe,CAC7B,IAAkE,EAClE,OAAe,aAAa,EAAE;IAE9B,MAAM,OAAO,GAAG,WAAW,CAAC,IAAI,CAAC,WAAW,IA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