@sweny-ai/core 0.1.31 → 0.1.33
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/cli/e2e.d.ts +82 -0
- package/dist/cli/e2e.js +892 -0
- package/dist/cli/e2e.test.d.ts +1 -0
- package/dist/cli/e2e.test.js +638 -0
- package/dist/cli/main.js +19 -0
- package/package.json +1 -1
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* sweny e2e — Generate and run agent-driven end-to-end browser tests.
|
|
3
|
+
*
|
|
4
|
+
* Pure functions for workflow generation + thin @clack/prompts interactive layer.
|
|
5
|
+
* Tests cover the pure functions; the interactive wizard is thin glue.
|
|
6
|
+
*/
|
|
7
|
+
import type { Workflow, Node } from "../types.js";
|
|
8
|
+
export type FlowType = "registration" | "login" | "purchase" | "onboarding" | "upgrade" | "cancellation" | "custom";
|
|
9
|
+
export interface FlowConfig {
|
|
10
|
+
type: FlowType;
|
|
11
|
+
/** URL path for the flow (e.g. /signup, /login, /pricing) */
|
|
12
|
+
path: string;
|
|
13
|
+
/** Required form fields (registration only) */
|
|
14
|
+
fields?: string[];
|
|
15
|
+
/** Whether email verification is required (registration only) */
|
|
16
|
+
emailVerification?: boolean;
|
|
17
|
+
/** Success redirect path (registration only) */
|
|
18
|
+
successRedirect?: string;
|
|
19
|
+
/** Payment provider name (purchase only) */
|
|
20
|
+
paymentProvider?: string;
|
|
21
|
+
/** Free-text description (custom flow only) */
|
|
22
|
+
description?: string;
|
|
23
|
+
/** What constitutes success (most flow types) */
|
|
24
|
+
successCriteria?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface CleanupConfig {
|
|
27
|
+
enabled: boolean;
|
|
28
|
+
backend?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface E2eSelections {
|
|
31
|
+
flows: FlowConfig[];
|
|
32
|
+
baseUrl: string;
|
|
33
|
+
cleanup: CleanupConfig;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Replace {var_name} placeholders in text with values from the vars map.
|
|
37
|
+
* Unknown variables are left untouched.
|
|
38
|
+
*/
|
|
39
|
+
export declare function resolveTemplateVars(text: string, vars: Record<string, string>): string;
|
|
40
|
+
/**
|
|
41
|
+
* Build the template variable map from environment variables.
|
|
42
|
+
* Auto-generates run_id, test_email, test_password.
|
|
43
|
+
* Reads E2E_BASE_URL, E2E_EMAIL, E2E_PASSWORD, and any E2E_* custom vars.
|
|
44
|
+
*/
|
|
45
|
+
export declare function buildE2eVars(env: Record<string, string | undefined>): Record<string, string>;
|
|
46
|
+
export declare function buildSetupNode(): Node;
|
|
47
|
+
export declare function buildReportNode(testNodeIds: string[]): Node;
|
|
48
|
+
export declare function buildCleanupNode(backend?: string): Node;
|
|
49
|
+
interface FlowNodes {
|
|
50
|
+
nodes: Record<string, Node>;
|
|
51
|
+
testNodeIds: string[];
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Build the test nodes for a given flow type.
|
|
55
|
+
* Auth-dependent flows (purchase, onboarding, upgrade, cancellation)
|
|
56
|
+
* automatically include a login node.
|
|
57
|
+
*/
|
|
58
|
+
export declare function buildFlowNodes(config: FlowConfig): FlowNodes;
|
|
59
|
+
/**
|
|
60
|
+
* Build a complete Workflow object for a single e2e flow.
|
|
61
|
+
* Includes setup node, optional login, flow-specific test node,
|
|
62
|
+
* optional cleanup, and report node.
|
|
63
|
+
*/
|
|
64
|
+
export declare function buildFlowWorkflow(flow: FlowConfig, baseUrl: string, cleanup?: CleanupConfig): Workflow;
|
|
65
|
+
/**
|
|
66
|
+
* Build .env template content for e2e testing.
|
|
67
|
+
*/
|
|
68
|
+
export declare function buildE2eEnvTemplate(selections: E2eSelections): string;
|
|
69
|
+
/**
|
|
70
|
+
* Interactive E2E setup wizard — prompts through flow selection,
|
|
71
|
+
* then generates .sweny/e2e/*.yml and .env additions.
|
|
72
|
+
*/
|
|
73
|
+
export declare function runE2eInit(): Promise<void>;
|
|
74
|
+
export interface E2eRunOptions {
|
|
75
|
+
file?: string;
|
|
76
|
+
timeout?: number;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Load and execute e2e workflow files from .sweny/e2e/.
|
|
80
|
+
*/
|
|
81
|
+
export declare function runE2eRun(options: E2eRunOptions): Promise<void>;
|
|
82
|
+
export {};
|