@browserflow-ai/core 0.0.6
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/config-schema.d.ts +354 -0
- package/dist/config-schema.d.ts.map +1 -0
- package/dist/config-schema.js +83 -0
- package/dist/config-schema.js.map +1 -0
- package/dist/config.d.ts +107 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +5 -0
- package/dist/config.js.map +1 -0
- package/dist/duration.d.ts +39 -0
- package/dist/duration.d.ts.map +1 -0
- package/dist/duration.js +111 -0
- package/dist/duration.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/locator-object.d.ts +556 -0
- package/dist/locator-object.d.ts.map +1 -0
- package/dist/locator-object.js +114 -0
- package/dist/locator-object.js.map +1 -0
- package/dist/lockfile.d.ts +1501 -0
- package/dist/lockfile.d.ts.map +1 -0
- package/dist/lockfile.js +86 -0
- package/dist/lockfile.js.map +1 -0
- package/dist/run-store.d.ts +81 -0
- package/dist/run-store.d.ts.map +1 -0
- package/dist/run-store.js +181 -0
- package/dist/run-store.js.map +1 -0
- package/dist/spec-loader.d.ts +17 -0
- package/dist/spec-loader.d.ts.map +1 -0
- package/dist/spec-loader.js +37 -0
- package/dist/spec-loader.js.map +1 -0
- package/dist/spec-schema.d.ts +1411 -0
- package/dist/spec-schema.d.ts.map +1 -0
- package/dist/spec-schema.js +239 -0
- package/dist/spec-schema.js.map +1 -0
- package/package.json +45 -0
- package/schemas/browserflow.schema.json +220 -0
- package/schemas/lockfile.schema.json +568 -0
- package/schemas/spec-v2.schema.json +413 -0
- package/src/config-schema.test.ts +190 -0
- package/src/config-schema.ts +111 -0
- package/src/config.ts +112 -0
- package/src/duration.test.ts +175 -0
- package/src/duration.ts +128 -0
- package/src/index.ts +136 -0
- package/src/json-schemas.test.ts +374 -0
- package/src/locator-object.test.ts +323 -0
- package/src/locator-object.ts +250 -0
- package/src/lockfile.test.ts +345 -0
- package/src/lockfile.ts +209 -0
- package/src/run-store.test.ts +232 -0
- package/src/run-store.ts +240 -0
- package/src/spec-loader.test.ts +181 -0
- package/src/spec-loader.ts +47 -0
- package/src/spec-schema.test.ts +360 -0
- package/src/spec-schema.ts +347 -0
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for browserflow.yaml config files
|
|
3
|
+
*
|
|
4
|
+
* @see bf-cv6 for implementation task
|
|
5
|
+
*/
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
export declare const browserTypeSchema: z.ZodEnum<["chromium", "firefox", "webkit"]>;
|
|
8
|
+
export declare const viewportSchema: z.ZodObject<{
|
|
9
|
+
width: z.ZodNumber;
|
|
10
|
+
height: z.ZodNumber;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
}, {
|
|
15
|
+
width: number;
|
|
16
|
+
height: number;
|
|
17
|
+
}>;
|
|
18
|
+
export declare const projectConfigSchema: z.ZodObject<{
|
|
19
|
+
name: z.ZodString;
|
|
20
|
+
base_url: z.ZodOptional<z.ZodString>;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
name: string;
|
|
23
|
+
base_url?: string | undefined;
|
|
24
|
+
}, {
|
|
25
|
+
name: string;
|
|
26
|
+
base_url?: string | undefined;
|
|
27
|
+
}>;
|
|
28
|
+
export declare const runtimeConfigSchema: z.ZodObject<{
|
|
29
|
+
browser: z.ZodDefault<z.ZodOptional<z.ZodEnum<["chromium", "firefox", "webkit"]>>>;
|
|
30
|
+
engine: z.ZodOptional<z.ZodEnum<["chromium", "firefox", "webkit"]>>;
|
|
31
|
+
headless: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
32
|
+
viewport: z.ZodOptional<z.ZodObject<{
|
|
33
|
+
width: z.ZodNumber;
|
|
34
|
+
height: z.ZodNumber;
|
|
35
|
+
}, "strip", z.ZodTypeAny, {
|
|
36
|
+
width: number;
|
|
37
|
+
height: number;
|
|
38
|
+
}, {
|
|
39
|
+
width: number;
|
|
40
|
+
height: number;
|
|
41
|
+
}>>;
|
|
42
|
+
timeout: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodNumber]>>;
|
|
43
|
+
}, "strip", z.ZodTypeAny, {
|
|
44
|
+
browser: "chromium" | "firefox" | "webkit";
|
|
45
|
+
headless: boolean;
|
|
46
|
+
timeout?: string | number | undefined;
|
|
47
|
+
viewport?: {
|
|
48
|
+
width: number;
|
|
49
|
+
height: number;
|
|
50
|
+
} | undefined;
|
|
51
|
+
engine?: "chromium" | "firefox" | "webkit" | undefined;
|
|
52
|
+
}, {
|
|
53
|
+
timeout?: string | number | undefined;
|
|
54
|
+
viewport?: {
|
|
55
|
+
width: number;
|
|
56
|
+
height: number;
|
|
57
|
+
} | undefined;
|
|
58
|
+
browser?: "chromium" | "firefox" | "webkit" | undefined;
|
|
59
|
+
engine?: "chromium" | "firefox" | "webkit" | undefined;
|
|
60
|
+
headless?: boolean | undefined;
|
|
61
|
+
}>;
|
|
62
|
+
export declare const locatorsConfigSchema: z.ZodObject<{
|
|
63
|
+
prefer_testid: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
64
|
+
testid_attributes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
65
|
+
}, "strip", z.ZodTypeAny, {
|
|
66
|
+
prefer_testid: boolean;
|
|
67
|
+
testid_attributes?: string[] | undefined;
|
|
68
|
+
}, {
|
|
69
|
+
prefer_testid?: boolean | undefined;
|
|
70
|
+
testid_attributes?: string[] | undefined;
|
|
71
|
+
}>;
|
|
72
|
+
export declare const explorationConfigSchema: z.ZodObject<{
|
|
73
|
+
adapter: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
74
|
+
max_retries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
75
|
+
}, "strip", z.ZodTypeAny, {
|
|
76
|
+
adapter: string;
|
|
77
|
+
max_retries: number;
|
|
78
|
+
}, {
|
|
79
|
+
adapter?: string | undefined;
|
|
80
|
+
max_retries?: number | undefined;
|
|
81
|
+
}>;
|
|
82
|
+
export declare const reviewConfigSchema: z.ZodObject<{
|
|
83
|
+
port: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
84
|
+
auto_open: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
85
|
+
}, "strip", z.ZodTypeAny, {
|
|
86
|
+
port: number;
|
|
87
|
+
auto_open: boolean;
|
|
88
|
+
}, {
|
|
89
|
+
port?: number | undefined;
|
|
90
|
+
auto_open?: boolean | undefined;
|
|
91
|
+
}>;
|
|
92
|
+
export declare const outputConfigSchema: z.ZodObject<{
|
|
93
|
+
tests_dir: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
94
|
+
baselines_dir: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
95
|
+
}, "strip", z.ZodTypeAny, {
|
|
96
|
+
tests_dir: string;
|
|
97
|
+
baselines_dir: string;
|
|
98
|
+
}, {
|
|
99
|
+
tests_dir?: string | undefined;
|
|
100
|
+
baselines_dir?: string | undefined;
|
|
101
|
+
}>;
|
|
102
|
+
export declare const ciConfigSchema: z.ZodObject<{
|
|
103
|
+
fail_on_baseline_diff: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
104
|
+
parallel: z.ZodOptional<z.ZodNumber>;
|
|
105
|
+
}, "strip", z.ZodTypeAny, {
|
|
106
|
+
fail_on_baseline_diff: boolean;
|
|
107
|
+
parallel?: number | undefined;
|
|
108
|
+
}, {
|
|
109
|
+
fail_on_baseline_diff?: boolean | undefined;
|
|
110
|
+
parallel?: number | undefined;
|
|
111
|
+
}>;
|
|
112
|
+
export declare const browserflowConfigSchema: z.ZodObject<{
|
|
113
|
+
project: z.ZodObject<{
|
|
114
|
+
name: z.ZodString;
|
|
115
|
+
base_url: z.ZodOptional<z.ZodString>;
|
|
116
|
+
}, "strip", z.ZodTypeAny, {
|
|
117
|
+
name: string;
|
|
118
|
+
base_url?: string | undefined;
|
|
119
|
+
}, {
|
|
120
|
+
name: string;
|
|
121
|
+
base_url?: string | undefined;
|
|
122
|
+
}>;
|
|
123
|
+
runtime: z.ZodOptional<z.ZodObject<{
|
|
124
|
+
browser: z.ZodDefault<z.ZodOptional<z.ZodEnum<["chromium", "firefox", "webkit"]>>>;
|
|
125
|
+
engine: z.ZodOptional<z.ZodEnum<["chromium", "firefox", "webkit"]>>;
|
|
126
|
+
headless: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
127
|
+
viewport: z.ZodOptional<z.ZodObject<{
|
|
128
|
+
width: z.ZodNumber;
|
|
129
|
+
height: z.ZodNumber;
|
|
130
|
+
}, "strip", z.ZodTypeAny, {
|
|
131
|
+
width: number;
|
|
132
|
+
height: number;
|
|
133
|
+
}, {
|
|
134
|
+
width: number;
|
|
135
|
+
height: number;
|
|
136
|
+
}>>;
|
|
137
|
+
timeout: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodNumber]>>;
|
|
138
|
+
}, "strip", z.ZodTypeAny, {
|
|
139
|
+
browser: "chromium" | "firefox" | "webkit";
|
|
140
|
+
headless: boolean;
|
|
141
|
+
timeout?: string | number | undefined;
|
|
142
|
+
viewport?: {
|
|
143
|
+
width: number;
|
|
144
|
+
height: number;
|
|
145
|
+
} | undefined;
|
|
146
|
+
engine?: "chromium" | "firefox" | "webkit" | undefined;
|
|
147
|
+
}, {
|
|
148
|
+
timeout?: string | number | undefined;
|
|
149
|
+
viewport?: {
|
|
150
|
+
width: number;
|
|
151
|
+
height: number;
|
|
152
|
+
} | undefined;
|
|
153
|
+
browser?: "chromium" | "firefox" | "webkit" | undefined;
|
|
154
|
+
engine?: "chromium" | "firefox" | "webkit" | undefined;
|
|
155
|
+
headless?: boolean | undefined;
|
|
156
|
+
}>>;
|
|
157
|
+
browser: z.ZodOptional<z.ZodObject<{
|
|
158
|
+
browser: z.ZodDefault<z.ZodOptional<z.ZodEnum<["chromium", "firefox", "webkit"]>>>;
|
|
159
|
+
engine: z.ZodOptional<z.ZodEnum<["chromium", "firefox", "webkit"]>>;
|
|
160
|
+
headless: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
161
|
+
viewport: z.ZodOptional<z.ZodObject<{
|
|
162
|
+
width: z.ZodNumber;
|
|
163
|
+
height: z.ZodNumber;
|
|
164
|
+
}, "strip", z.ZodTypeAny, {
|
|
165
|
+
width: number;
|
|
166
|
+
height: number;
|
|
167
|
+
}, {
|
|
168
|
+
width: number;
|
|
169
|
+
height: number;
|
|
170
|
+
}>>;
|
|
171
|
+
timeout: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodNumber]>>;
|
|
172
|
+
}, "strip", z.ZodTypeAny, {
|
|
173
|
+
browser: "chromium" | "firefox" | "webkit";
|
|
174
|
+
headless: boolean;
|
|
175
|
+
timeout?: string | number | undefined;
|
|
176
|
+
viewport?: {
|
|
177
|
+
width: number;
|
|
178
|
+
height: number;
|
|
179
|
+
} | undefined;
|
|
180
|
+
engine?: "chromium" | "firefox" | "webkit" | undefined;
|
|
181
|
+
}, {
|
|
182
|
+
timeout?: string | number | undefined;
|
|
183
|
+
viewport?: {
|
|
184
|
+
width: number;
|
|
185
|
+
height: number;
|
|
186
|
+
} | undefined;
|
|
187
|
+
browser?: "chromium" | "firefox" | "webkit" | undefined;
|
|
188
|
+
engine?: "chromium" | "firefox" | "webkit" | undefined;
|
|
189
|
+
headless?: boolean | undefined;
|
|
190
|
+
}>>;
|
|
191
|
+
locators: z.ZodOptional<z.ZodObject<{
|
|
192
|
+
prefer_testid: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
193
|
+
testid_attributes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
194
|
+
}, "strip", z.ZodTypeAny, {
|
|
195
|
+
prefer_testid: boolean;
|
|
196
|
+
testid_attributes?: string[] | undefined;
|
|
197
|
+
}, {
|
|
198
|
+
prefer_testid?: boolean | undefined;
|
|
199
|
+
testid_attributes?: string[] | undefined;
|
|
200
|
+
}>>;
|
|
201
|
+
exploration: z.ZodOptional<z.ZodObject<{
|
|
202
|
+
adapter: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
203
|
+
max_retries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
204
|
+
}, "strip", z.ZodTypeAny, {
|
|
205
|
+
adapter: string;
|
|
206
|
+
max_retries: number;
|
|
207
|
+
}, {
|
|
208
|
+
adapter?: string | undefined;
|
|
209
|
+
max_retries?: number | undefined;
|
|
210
|
+
}>>;
|
|
211
|
+
review: z.ZodOptional<z.ZodObject<{
|
|
212
|
+
port: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
213
|
+
auto_open: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
214
|
+
}, "strip", z.ZodTypeAny, {
|
|
215
|
+
port: number;
|
|
216
|
+
auto_open: boolean;
|
|
217
|
+
}, {
|
|
218
|
+
port?: number | undefined;
|
|
219
|
+
auto_open?: boolean | undefined;
|
|
220
|
+
}>>;
|
|
221
|
+
output: z.ZodOptional<z.ZodObject<{
|
|
222
|
+
tests_dir: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
223
|
+
baselines_dir: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
224
|
+
}, "strip", z.ZodTypeAny, {
|
|
225
|
+
tests_dir: string;
|
|
226
|
+
baselines_dir: string;
|
|
227
|
+
}, {
|
|
228
|
+
tests_dir?: string | undefined;
|
|
229
|
+
baselines_dir?: string | undefined;
|
|
230
|
+
}>>;
|
|
231
|
+
ci: z.ZodOptional<z.ZodObject<{
|
|
232
|
+
fail_on_baseline_diff: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
233
|
+
parallel: z.ZodOptional<z.ZodNumber>;
|
|
234
|
+
}, "strip", z.ZodTypeAny, {
|
|
235
|
+
fail_on_baseline_diff: boolean;
|
|
236
|
+
parallel?: number | undefined;
|
|
237
|
+
}, {
|
|
238
|
+
fail_on_baseline_diff?: boolean | undefined;
|
|
239
|
+
parallel?: number | undefined;
|
|
240
|
+
}>>;
|
|
241
|
+
}, "strip", z.ZodTypeAny, {
|
|
242
|
+
project: {
|
|
243
|
+
name: string;
|
|
244
|
+
base_url?: string | undefined;
|
|
245
|
+
};
|
|
246
|
+
browser?: {
|
|
247
|
+
browser: "chromium" | "firefox" | "webkit";
|
|
248
|
+
headless: boolean;
|
|
249
|
+
timeout?: string | number | undefined;
|
|
250
|
+
viewport?: {
|
|
251
|
+
width: number;
|
|
252
|
+
height: number;
|
|
253
|
+
} | undefined;
|
|
254
|
+
engine?: "chromium" | "firefox" | "webkit" | undefined;
|
|
255
|
+
} | undefined;
|
|
256
|
+
runtime?: {
|
|
257
|
+
browser: "chromium" | "firefox" | "webkit";
|
|
258
|
+
headless: boolean;
|
|
259
|
+
timeout?: string | number | undefined;
|
|
260
|
+
viewport?: {
|
|
261
|
+
width: number;
|
|
262
|
+
height: number;
|
|
263
|
+
} | undefined;
|
|
264
|
+
engine?: "chromium" | "firefox" | "webkit" | undefined;
|
|
265
|
+
} | undefined;
|
|
266
|
+
locators?: {
|
|
267
|
+
prefer_testid: boolean;
|
|
268
|
+
testid_attributes?: string[] | undefined;
|
|
269
|
+
} | undefined;
|
|
270
|
+
exploration?: {
|
|
271
|
+
adapter: string;
|
|
272
|
+
max_retries: number;
|
|
273
|
+
} | undefined;
|
|
274
|
+
review?: {
|
|
275
|
+
port: number;
|
|
276
|
+
auto_open: boolean;
|
|
277
|
+
} | undefined;
|
|
278
|
+
output?: {
|
|
279
|
+
tests_dir: string;
|
|
280
|
+
baselines_dir: string;
|
|
281
|
+
} | undefined;
|
|
282
|
+
ci?: {
|
|
283
|
+
fail_on_baseline_diff: boolean;
|
|
284
|
+
parallel?: number | undefined;
|
|
285
|
+
} | undefined;
|
|
286
|
+
}, {
|
|
287
|
+
project: {
|
|
288
|
+
name: string;
|
|
289
|
+
base_url?: string | undefined;
|
|
290
|
+
};
|
|
291
|
+
browser?: {
|
|
292
|
+
timeout?: string | number | undefined;
|
|
293
|
+
viewport?: {
|
|
294
|
+
width: number;
|
|
295
|
+
height: number;
|
|
296
|
+
} | undefined;
|
|
297
|
+
browser?: "chromium" | "firefox" | "webkit" | undefined;
|
|
298
|
+
engine?: "chromium" | "firefox" | "webkit" | undefined;
|
|
299
|
+
headless?: boolean | undefined;
|
|
300
|
+
} | undefined;
|
|
301
|
+
runtime?: {
|
|
302
|
+
timeout?: string | number | undefined;
|
|
303
|
+
viewport?: {
|
|
304
|
+
width: number;
|
|
305
|
+
height: number;
|
|
306
|
+
} | undefined;
|
|
307
|
+
browser?: "chromium" | "firefox" | "webkit" | undefined;
|
|
308
|
+
engine?: "chromium" | "firefox" | "webkit" | undefined;
|
|
309
|
+
headless?: boolean | undefined;
|
|
310
|
+
} | undefined;
|
|
311
|
+
locators?: {
|
|
312
|
+
prefer_testid?: boolean | undefined;
|
|
313
|
+
testid_attributes?: string[] | undefined;
|
|
314
|
+
} | undefined;
|
|
315
|
+
exploration?: {
|
|
316
|
+
adapter?: string | undefined;
|
|
317
|
+
max_retries?: number | undefined;
|
|
318
|
+
} | undefined;
|
|
319
|
+
review?: {
|
|
320
|
+
port?: number | undefined;
|
|
321
|
+
auto_open?: boolean | undefined;
|
|
322
|
+
} | undefined;
|
|
323
|
+
output?: {
|
|
324
|
+
tests_dir?: string | undefined;
|
|
325
|
+
baselines_dir?: string | undefined;
|
|
326
|
+
} | undefined;
|
|
327
|
+
ci?: {
|
|
328
|
+
fail_on_baseline_diff?: boolean | undefined;
|
|
329
|
+
parallel?: number | undefined;
|
|
330
|
+
} | undefined;
|
|
331
|
+
}>;
|
|
332
|
+
export type BrowserTypeConfig = z.infer<typeof browserTypeSchema>;
|
|
333
|
+
export type ViewportConfig = z.infer<typeof viewportSchema>;
|
|
334
|
+
export type ProjectConfig = z.infer<typeof projectConfigSchema>;
|
|
335
|
+
export type RuntimeConfig = z.infer<typeof runtimeConfigSchema>;
|
|
336
|
+
export type LocatorsConfig = z.infer<typeof locatorsConfigSchema>;
|
|
337
|
+
export type ExplorationConfig = z.infer<typeof explorationConfigSchema>;
|
|
338
|
+
export type ReviewConfig = z.infer<typeof reviewConfigSchema>;
|
|
339
|
+
export type OutputConfig = z.infer<typeof outputConfigSchema>;
|
|
340
|
+
export type CiConfig = z.infer<typeof ciConfigSchema>;
|
|
341
|
+
export type BrowserflowConfig = z.infer<typeof browserflowConfigSchema>;
|
|
342
|
+
/**
|
|
343
|
+
* Validates a browserflow config object
|
|
344
|
+
*/
|
|
345
|
+
export declare function validateBrowserflowConfig(config: unknown): config is BrowserflowConfig;
|
|
346
|
+
/**
|
|
347
|
+
* Parses and validates a browserflow config with error details
|
|
348
|
+
*/
|
|
349
|
+
export declare function parseBrowserflowConfig(config: unknown): {
|
|
350
|
+
success: boolean;
|
|
351
|
+
data?: BrowserflowConfig;
|
|
352
|
+
error?: string;
|
|
353
|
+
};
|
|
354
|
+
//# sourceMappingURL=config-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-schema.d.ts","sourceRoot":"","sources":["../src/config-schema.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,iBAAiB,8CAA4C,CAAC;AAG3E,eAAO,MAAM,cAAc;;;;;;;;;EAGzB,CAAC;AAGH,eAAO,MAAM,mBAAmB;;;;;;;;;EAG9B,CAAC;AAGH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAM9B,CAAC;AAGH,eAAO,MAAM,oBAAoB;;;;;;;;;EAG/B,CAAC;AAGH,eAAO,MAAM,uBAAuB;;;;;;;;;EAGlC,CAAC;AAGH,eA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BAAuB,CAAC,CAAC;AAExE;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,iBAAiB,CAEtF;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,OAAO,GAAG;IACvD,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,iBAAiB,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CASA"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for browserflow.yaml config files
|
|
3
|
+
*
|
|
4
|
+
* @see bf-cv6 for implementation task
|
|
5
|
+
*/
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
import { durationSchema } from './spec-schema.js';
|
|
8
|
+
// Browser types supported by Playwright
|
|
9
|
+
export const browserTypeSchema = z.enum(['chromium', 'firefox', 'webkit']);
|
|
10
|
+
// Viewport configuration
|
|
11
|
+
export const viewportSchema = z.object({
|
|
12
|
+
width: z.number().int().positive(),
|
|
13
|
+
height: z.number().int().positive(),
|
|
14
|
+
});
|
|
15
|
+
// Project section
|
|
16
|
+
export const projectConfigSchema = z.object({
|
|
17
|
+
name: z.string().min(1),
|
|
18
|
+
base_url: z.string().url().optional(),
|
|
19
|
+
});
|
|
20
|
+
// Runtime/browser section
|
|
21
|
+
export const runtimeConfigSchema = z.object({
|
|
22
|
+
browser: browserTypeSchema.optional().default('chromium'),
|
|
23
|
+
engine: browserTypeSchema.optional(), // Alias for browser
|
|
24
|
+
headless: z.boolean().optional().default(true),
|
|
25
|
+
viewport: viewportSchema.optional(),
|
|
26
|
+
timeout: z.union([durationSchema, z.number()]).optional(),
|
|
27
|
+
});
|
|
28
|
+
// Locator preferences
|
|
29
|
+
export const locatorsConfigSchema = z.object({
|
|
30
|
+
prefer_testid: z.boolean().optional().default(true),
|
|
31
|
+
testid_attributes: z.array(z.string()).optional(),
|
|
32
|
+
});
|
|
33
|
+
// Exploration settings
|
|
34
|
+
export const explorationConfigSchema = z.object({
|
|
35
|
+
adapter: z.string().optional().default('claude'),
|
|
36
|
+
max_retries: z.number().int().nonnegative().optional().default(3),
|
|
37
|
+
});
|
|
38
|
+
// Review UI settings
|
|
39
|
+
export const reviewConfigSchema = z.object({
|
|
40
|
+
port: z.number().int().min(1).max(65535).optional().default(8190),
|
|
41
|
+
auto_open: z.boolean().optional().default(true),
|
|
42
|
+
});
|
|
43
|
+
// Output paths
|
|
44
|
+
export const outputConfigSchema = z.object({
|
|
45
|
+
tests_dir: z.string().optional().default('e2e/tests'),
|
|
46
|
+
baselines_dir: z.string().optional().default('baselines'),
|
|
47
|
+
});
|
|
48
|
+
// CI settings
|
|
49
|
+
export const ciConfigSchema = z.object({
|
|
50
|
+
fail_on_baseline_diff: z.boolean().optional().default(false),
|
|
51
|
+
parallel: z.number().int().positive().optional(),
|
|
52
|
+
});
|
|
53
|
+
// Top-level browserflow.yaml config schema
|
|
54
|
+
export const browserflowConfigSchema = z.object({
|
|
55
|
+
project: projectConfigSchema,
|
|
56
|
+
runtime: runtimeConfigSchema.optional(),
|
|
57
|
+
browser: runtimeConfigSchema.optional(), // Alias for runtime
|
|
58
|
+
locators: locatorsConfigSchema.optional(),
|
|
59
|
+
exploration: explorationConfigSchema.optional(),
|
|
60
|
+
review: reviewConfigSchema.optional(),
|
|
61
|
+
output: outputConfigSchema.optional(),
|
|
62
|
+
ci: ciConfigSchema.optional(),
|
|
63
|
+
});
|
|
64
|
+
/**
|
|
65
|
+
* Validates a browserflow config object
|
|
66
|
+
*/
|
|
67
|
+
export function validateBrowserflowConfig(config) {
|
|
68
|
+
return browserflowConfigSchema.safeParse(config).success;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Parses and validates a browserflow config with error details
|
|
72
|
+
*/
|
|
73
|
+
export function parseBrowserflowConfig(config) {
|
|
74
|
+
const result = browserflowConfigSchema.safeParse(config);
|
|
75
|
+
if (result.success) {
|
|
76
|
+
return { success: true, data: result.data };
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
success: false,
|
|
80
|
+
error: result.error.errors.map((e) => `${e.path.join('.')}: ${e.message}`).join('; '),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=config-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-schema.js","sourceRoot":"","sources":["../src/config-schema.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,wCAAwC;AACxC,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;AAE3E,yBAAyB;AACzB,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IAClC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;CACpC,CAAC,CAAC;AAEH,kBAAkB;AAClB,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;CACtC,CAAC,CAAC;AAEH,0BAA0B;AAC1B,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,OAAO,EAAE,iBAAiB,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC;IACzD,MAAM,EAAE,iBAAiB,CAAC,QAAQ,EA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AAM,GAAG,uBAAuB,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACzD,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;IAC9C,CAAC;IACD,OAAO;QACL,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;KACtF,CAAC;AACJ,CAAC"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration types for BrowserFlow
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Generator output format options
|
|
6
|
+
*/
|
|
7
|
+
export type GeneratorOutputFormat = 'playwright-ts' | 'playwright-js' | 'bash';
|
|
8
|
+
/**
|
|
9
|
+
* Browser types supported by Playwright
|
|
10
|
+
*/
|
|
11
|
+
export type BrowserType = 'chromium' | 'firefox' | 'webkit';
|
|
12
|
+
/**
|
|
13
|
+
* Playwright project configuration
|
|
14
|
+
*/
|
|
15
|
+
export interface PlaywrightProject {
|
|
16
|
+
name: string;
|
|
17
|
+
use: {
|
|
18
|
+
browserName?: BrowserType;
|
|
19
|
+
viewport?: {
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
};
|
|
23
|
+
headless?: boolean;
|
|
24
|
+
[key: string]: unknown;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Playwright configuration options for generated tests
|
|
29
|
+
*/
|
|
30
|
+
export interface PlaywrightConfigOptions {
|
|
31
|
+
/** Test timeout in ms */
|
|
32
|
+
timeout?: number;
|
|
33
|
+
/** Number of retries */
|
|
34
|
+
retries?: number;
|
|
35
|
+
/** Number of workers */
|
|
36
|
+
workers?: number;
|
|
37
|
+
/** Reporter to use */
|
|
38
|
+
reporter?: 'html' | 'list' | 'dot' | 'json';
|
|
39
|
+
/** Projects configuration */
|
|
40
|
+
projects?: PlaywrightProject[];
|
|
41
|
+
/** Web server configuration */
|
|
42
|
+
webServer?: {
|
|
43
|
+
command: string;
|
|
44
|
+
url: string;
|
|
45
|
+
reuseExistingServer?: boolean;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Generator configuration
|
|
50
|
+
*/
|
|
51
|
+
export interface GeneratorConfig {
|
|
52
|
+
/** Output format for generated tests */
|
|
53
|
+
outputFormat: GeneratorOutputFormat;
|
|
54
|
+
/** Include baseline screenshot comparisons */
|
|
55
|
+
includeBaselineChecks: boolean;
|
|
56
|
+
/** Directory for baseline screenshots */
|
|
57
|
+
baselinesDir?: string;
|
|
58
|
+
/** Playwright config options */
|
|
59
|
+
playwrightConfig?: PlaywrightConfigOptions;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Review step data
|
|
63
|
+
*/
|
|
64
|
+
export interface ReviewStepData {
|
|
65
|
+
step_index: number;
|
|
66
|
+
status: 'approved' | 'rejected' | 'pending';
|
|
67
|
+
comment?: string;
|
|
68
|
+
tags?: string[];
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Review data for an exploration
|
|
72
|
+
*/
|
|
73
|
+
export interface ReviewData {
|
|
74
|
+
exploration_id: string;
|
|
75
|
+
reviewer?: string;
|
|
76
|
+
started_at: string;
|
|
77
|
+
updated_at: string;
|
|
78
|
+
steps: ReviewStepData[];
|
|
79
|
+
overall_notes?: string;
|
|
80
|
+
verdict: 'approved' | 'rejected' | 'pending';
|
|
81
|
+
submitted_at?: string;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Generated test output
|
|
85
|
+
*/
|
|
86
|
+
export interface GeneratedTest {
|
|
87
|
+
/** Test file path (relative) */
|
|
88
|
+
path: string;
|
|
89
|
+
/** Test file content */
|
|
90
|
+
content: string;
|
|
91
|
+
/** Spec name this was generated from */
|
|
92
|
+
specName: string;
|
|
93
|
+
/** Exploration ID used */
|
|
94
|
+
explorationId: string;
|
|
95
|
+
/** Generation timestamp */
|
|
96
|
+
generatedAt: string;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Generated config output
|
|
100
|
+
*/
|
|
101
|
+
export interface GeneratedConfig {
|
|
102
|
+
/** Config file path */
|
|
103
|
+
path: string;
|
|
104
|
+
/** Config file content */
|
|
105
|
+
content: string;
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,eAAe,GAAG,eAAe,GAAG,MAAM,CAAC;AAE/E;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE5D;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE;QACH,WAAW,CAAC,EAAE,WAAW,CAAC;QAC1B,QAAQ,CAAC,EAAE;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,CAAC;QAC7C,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACxB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,yBAAyB;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wBAAwB;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wBAAwB;IACxB,OAAO,CAA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C;IAChB,wCAAwC;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,0BAA0B;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,2BAA2B;IAC3B,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,uBAAuB;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,0BAA0B;IAC1B,OAAO,EAAE,MAAM,CAAC;CACjB"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Duration string parser
|
|
3
|
+
*
|
|
4
|
+
* Parses human-readable duration strings like "30s", "5m", "1h30m"
|
|
5
|
+
* into milliseconds.
|
|
6
|
+
*
|
|
7
|
+
* @see bf-x1q for implementation task
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Validates a duration string without parsing it.
|
|
11
|
+
*
|
|
12
|
+
* @param input - Duration string to validate
|
|
13
|
+
* @returns true if valid, false otherwise
|
|
14
|
+
*/
|
|
15
|
+
export declare function isValidDuration(input: string): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Parses a duration string into milliseconds.
|
|
18
|
+
*
|
|
19
|
+
* Supported formats:
|
|
20
|
+
* - "30s" -> 30000
|
|
21
|
+
* - "5m" -> 300000
|
|
22
|
+
* - "1h" -> 3600000
|
|
23
|
+
* - "1h30m" -> 5400000
|
|
24
|
+
* - "500ms" -> 500
|
|
25
|
+
* - "500" -> 500 (plain numbers treated as ms)
|
|
26
|
+
*
|
|
27
|
+
* @param input - Duration string to parse
|
|
28
|
+
* @returns Duration in milliseconds
|
|
29
|
+
* @throws Error if format is invalid
|
|
30
|
+
*/
|
|
31
|
+
export declare function parseDuration(input: string | number): number;
|
|
32
|
+
/**
|
|
33
|
+
* Formats milliseconds into a human-readable duration string.
|
|
34
|
+
*
|
|
35
|
+
* @param ms - Duration in milliseconds
|
|
36
|
+
* @returns Human-readable duration string
|
|
37
|
+
*/
|
|
38
|
+
export declare function formatDuration(ms: number): string;
|
|
39
|
+
//# sourceMappingURL=duration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"duration.d.ts","sourceRoot":"","sources":["../src/duration.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AASH;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CA+BtD;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAkC5D;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAejD"}
|