@pygmalionjs/pygmalion 0.2.11 → 0.2.12
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/README.ko.md +36 -10
- package/README.md +36 -10
- package/dist-lib/{App-CyLtIqGh.js → App-B0w9z2Br.js} +7961 -6032
- package/dist-lib/pygmalion.js +2043 -361
- package/dist-lib/style.css +1 -1
- package/dist-lib/testing.js +1 -1
- package/node/dev-mirror.mjs +68 -1
- package/node/dev-view.vite.mjs +7 -0
- package/node/inspect-plugin.mjs +8 -1
- package/node/preview-artifact-plugin.mjs +296 -0
- package/node/qa-capture-plugin.mjs +1226 -0
- package/node/route-preview-artifact-v3.mjs +584 -0
- package/node/source-revision.mjs +83 -0
- package/node/storyboard-capture-runtime.mjs +1165 -0
- package/node/storyboard-capture-scheduler.mjs +226 -0
- package/node/storyboard.mjs +44 -0
- package/node/vite.mjs +116 -14
- package/package.json +16 -1
- package/qa.d.ts +201 -0
- package/storyboard.d.ts +298 -0
- package/types.d.ts +724 -40
- package/vite.d.ts +102 -20
package/storyboard.d.ts
ADDED
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
export type StoryboardCaptureStatus =
|
|
2
|
+
'ready' | 'rendered-with-qa-failure' | 'capture-error';
|
|
3
|
+
|
|
4
|
+
export interface StoryboardCaptureViewport {
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface StoryboardCaptureDiagnostic {
|
|
10
|
+
stage: string;
|
|
11
|
+
code: string;
|
|
12
|
+
selector?: string;
|
|
13
|
+
label?: string;
|
|
14
|
+
message?: string;
|
|
15
|
+
viewport: StoryboardCaptureViewport;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface StoryboardCaptureScreenshot {
|
|
19
|
+
mediaType: 'image/png';
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
bytes: Uint8Array;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface StoryboardCaptureResult {
|
|
26
|
+
id: string;
|
|
27
|
+
route: string | null;
|
|
28
|
+
status: StoryboardCaptureStatus;
|
|
29
|
+
viewport: StoryboardCaptureViewport;
|
|
30
|
+
snapshot?: string;
|
|
31
|
+
screenshot?: StoryboardCaptureScreenshot;
|
|
32
|
+
domTree?: unknown;
|
|
33
|
+
diagnostics: StoryboardCaptureDiagnostic[];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface StoryboardCaptureHookContext<
|
|
37
|
+
TScreenCase = Record<string, unknown>,
|
|
38
|
+
> {
|
|
39
|
+
context: unknown;
|
|
40
|
+
page: unknown;
|
|
41
|
+
screenCase: TScreenCase;
|
|
42
|
+
route: string;
|
|
43
|
+
signal?: AbortSignal;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface StoryboardCaptureOptions<
|
|
47
|
+
TScreenCase extends Record<string, unknown> = Record<string, unknown>,
|
|
48
|
+
> {
|
|
49
|
+
browser: {
|
|
50
|
+
newContext(options: Record<string, unknown>): Promise<unknown>;
|
|
51
|
+
};
|
|
52
|
+
baseUrl: string | URL;
|
|
53
|
+
screenCase: TScreenCase;
|
|
54
|
+
signal?: AbortSignal;
|
|
55
|
+
hooks?: {
|
|
56
|
+
beforePreset?(
|
|
57
|
+
context: StoryboardCaptureHookContext<TScreenCase>,
|
|
58
|
+
): void | Promise<void>;
|
|
59
|
+
afterPreset?(
|
|
60
|
+
context: StoryboardCaptureHookContext<TScreenCase>,
|
|
61
|
+
): void | Promise<void>;
|
|
62
|
+
};
|
|
63
|
+
includeDomTree?: boolean;
|
|
64
|
+
includePreviewSnapshot?: boolean;
|
|
65
|
+
previewBaseToken?: string;
|
|
66
|
+
contextOptions?: Record<string, unknown>;
|
|
67
|
+
navigationOptions?: Record<string, unknown>;
|
|
68
|
+
screenshotOptions?: Record<string, unknown>;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export declare const STORYBOARD_CAPTURE_STATUSES: Readonly<{
|
|
72
|
+
ready: 'ready';
|
|
73
|
+
qaFailure: 'rendered-with-qa-failure';
|
|
74
|
+
captureError: 'capture-error';
|
|
75
|
+
}>;
|
|
76
|
+
|
|
77
|
+
export declare class StoryboardCaptureStageError extends Error {
|
|
78
|
+
readonly stage: string;
|
|
79
|
+
readonly details: Record<string, unknown>;
|
|
80
|
+
constructor(stage: string, error: unknown, details?: Record<string, unknown>);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export declare function captureStoryboardCase<
|
|
84
|
+
TScreenCase extends Record<string, unknown>,
|
|
85
|
+
>(
|
|
86
|
+
options: StoryboardCaptureOptions<TScreenCase>,
|
|
87
|
+
): Promise<StoryboardCaptureResult>;
|
|
88
|
+
export declare function resolveStoryboardCaptureRoute(
|
|
89
|
+
screenCase: Record<string, unknown>,
|
|
90
|
+
): unknown;
|
|
91
|
+
export declare function resolveStoryboardCaptureUrl(
|
|
92
|
+
baseUrl: string | URL,
|
|
93
|
+
route: unknown,
|
|
94
|
+
environment?: Record<string, unknown>,
|
|
95
|
+
): string;
|
|
96
|
+
export declare function resolveStoryboardFixedTime(
|
|
97
|
+
preset: Record<string, unknown> | null | undefined,
|
|
98
|
+
): string | null;
|
|
99
|
+
export declare function hashStoryboardCapture(
|
|
100
|
+
value: string | Uint8Array,
|
|
101
|
+
): string;
|
|
102
|
+
export declare function normalizeStoryboardDomStructure(node: unknown): string;
|
|
103
|
+
export declare function createStoryboardArtifactRecord(input: {
|
|
104
|
+
screenCase: {
|
|
105
|
+
id: string;
|
|
106
|
+
scenarioIds?: readonly string[];
|
|
107
|
+
width?: number;
|
|
108
|
+
height?: number;
|
|
109
|
+
};
|
|
110
|
+
domTree: unknown;
|
|
111
|
+
screenshot: string | Uint8Array;
|
|
112
|
+
route: string | null;
|
|
113
|
+
}): {
|
|
114
|
+
id: string;
|
|
115
|
+
scenarioIds: string[];
|
|
116
|
+
route: string | null;
|
|
117
|
+
viewport: StoryboardCaptureViewport;
|
|
118
|
+
domStructureHash: string;
|
|
119
|
+
screenshotHash: string;
|
|
120
|
+
};
|
|
121
|
+
export declare function runStoryboardInteraction(
|
|
122
|
+
page: unknown,
|
|
123
|
+
interaction: Record<string, unknown>,
|
|
124
|
+
): Promise<void>;
|
|
125
|
+
export declare function runStoryboardAssertion(
|
|
126
|
+
page: unknown,
|
|
127
|
+
assertion: Record<string, unknown>,
|
|
128
|
+
): Promise<void>;
|
|
129
|
+
export declare function assertFinalStoryboardState(
|
|
130
|
+
page: unknown,
|
|
131
|
+
assertions: readonly Record<string, unknown>[],
|
|
132
|
+
): Promise<void>;
|
|
133
|
+
export declare function waitForStableStoryboardDocument(
|
|
134
|
+
page: unknown,
|
|
135
|
+
options?: {
|
|
136
|
+
attempts?: number;
|
|
137
|
+
requiredStableSamples?: number;
|
|
138
|
+
intervalMs?: number;
|
|
139
|
+
minimumWaitMs?: number;
|
|
140
|
+
},
|
|
141
|
+
): Promise<boolean>;
|
|
142
|
+
export declare function storyboardDocumentStabilitySignature(): string;
|
|
143
|
+
export declare function storyboardCaptureCandidateTexts(
|
|
144
|
+
element: Element,
|
|
145
|
+
): string[];
|
|
146
|
+
export declare function findUnassertedStoryboardModal(
|
|
147
|
+
assertions?: readonly Record<string, unknown>[],
|
|
148
|
+
): { role: string; label: string } | null;
|
|
149
|
+
export declare function collectStoryboardDomTree(): unknown;
|
|
150
|
+
export declare function serializeStoryboardPreviewDocument(
|
|
151
|
+
baseHref?: string,
|
|
152
|
+
): string | null;
|
|
153
|
+
|
|
154
|
+
export type StoryboardCaptureSchedulePhase =
|
|
155
|
+
'warm-up' | 'primary' | 'isolated-retry';
|
|
156
|
+
|
|
157
|
+
export interface StoryboardCaptureScheduleContext<TResult> {
|
|
158
|
+
phase: StoryboardCaptureSchedulePhase;
|
|
159
|
+
attempt: number;
|
|
160
|
+
index: number;
|
|
161
|
+
total: number;
|
|
162
|
+
isolated: boolean;
|
|
163
|
+
requiresFreshContext: true;
|
|
164
|
+
previousResult?: TResult;
|
|
165
|
+
signal?: AbortSignal;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export interface StoryboardScheduledCaptureResult {
|
|
169
|
+
status: StoryboardCaptureStatus;
|
|
170
|
+
snapshot?: unknown;
|
|
171
|
+
screenshot?: unknown;
|
|
172
|
+
domTree?: unknown;
|
|
173
|
+
diagnostics?: readonly unknown[];
|
|
174
|
+
[key: string]: unknown;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export interface StoryboardCaptureScheduleOptions {
|
|
178
|
+
concurrency?: number;
|
|
179
|
+
isolatedRetryAttempts?: number;
|
|
180
|
+
onRetryPass?(pass: {
|
|
181
|
+
attempt: number;
|
|
182
|
+
totalAttempts: number;
|
|
183
|
+
indexes: number[];
|
|
184
|
+
}): void;
|
|
185
|
+
signal?: AbortSignal;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export declare const STORYBOARD_CAPTURE_SCHEDULER_LIMITS: Readonly<{
|
|
189
|
+
defaultConcurrency: 8;
|
|
190
|
+
maximumConcurrency: 16;
|
|
191
|
+
}>;
|
|
192
|
+
|
|
193
|
+
export declare function scheduleStoryboardCaptures<
|
|
194
|
+
TItem,
|
|
195
|
+
TResult extends StoryboardScheduledCaptureResult,
|
|
196
|
+
>(
|
|
197
|
+
items: readonly TItem[],
|
|
198
|
+
capture: (
|
|
199
|
+
item: TItem,
|
|
200
|
+
context: StoryboardCaptureScheduleContext<TResult>,
|
|
201
|
+
) => TResult | Promise<TResult>,
|
|
202
|
+
options?: StoryboardCaptureScheduleOptions,
|
|
203
|
+
): Promise<TResult[]>;
|
|
204
|
+
|
|
205
|
+
export interface RoutePreviewArtifactV3Capture {
|
|
206
|
+
status: StoryboardCaptureStatus;
|
|
207
|
+
viewport: StoryboardCaptureViewport;
|
|
208
|
+
snapshot?: string;
|
|
209
|
+
screenshot?: {
|
|
210
|
+
mediaType: 'image/png' | 'image/webp';
|
|
211
|
+
width: number;
|
|
212
|
+
height: number;
|
|
213
|
+
bytes: Uint8Array;
|
|
214
|
+
};
|
|
215
|
+
diagnostics?: readonly StoryboardCaptureDiagnostic[];
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export interface RoutePreviewArtifactBundleV3 {
|
|
219
|
+
readonly version: 3;
|
|
220
|
+
readonly namespace: string;
|
|
221
|
+
readonly sourceRevision?: string;
|
|
222
|
+
readonly assets: {
|
|
223
|
+
readonly head: Readonly<Record<string, string>>;
|
|
224
|
+
readonly stylesheets: Readonly<Record<string, string>>;
|
|
225
|
+
readonly screenshots: Readonly<
|
|
226
|
+
Record<
|
|
227
|
+
string,
|
|
228
|
+
{
|
|
229
|
+
readonly mediaType: 'image/png' | 'image/webp';
|
|
230
|
+
readonly width: number;
|
|
231
|
+
readonly height: number;
|
|
232
|
+
readonly data: string;
|
|
233
|
+
readonly byteLength: number;
|
|
234
|
+
}
|
|
235
|
+
>
|
|
236
|
+
>;
|
|
237
|
+
};
|
|
238
|
+
readonly frames: Readonly<Record<string, unknown>>;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export declare const ROUTE_PREVIEW_ARTIFACT_V3_LIMITS: Readonly<
|
|
242
|
+
Record<string, number>
|
|
243
|
+
>;
|
|
244
|
+
export declare function createRoutePreviewArtifactV3(input: {
|
|
245
|
+
namespace: string;
|
|
246
|
+
sourceRevision?: string;
|
|
247
|
+
captures: Record<string, RoutePreviewArtifactV3Capture>;
|
|
248
|
+
}): RoutePreviewArtifactBundleV3;
|
|
249
|
+
export declare function validateRoutePreviewArtifactV3(bundle: unknown): {
|
|
250
|
+
valid: boolean;
|
|
251
|
+
errors: string[];
|
|
252
|
+
bytes: number;
|
|
253
|
+
};
|
|
254
|
+
export declare function validateRoutePreviewArtifactBundle(bundle: unknown): {
|
|
255
|
+
valid: boolean;
|
|
256
|
+
errors: string[];
|
|
257
|
+
bytes: number;
|
|
258
|
+
};
|
|
259
|
+
export declare function reconstructRoutePreviewArtifactSnapshotV3(
|
|
260
|
+
bundle: RoutePreviewArtifactBundleV3,
|
|
261
|
+
frameId: string,
|
|
262
|
+
): string | null;
|
|
263
|
+
export declare function reconstructRoutePreviewArtifactSnapshotsV3(
|
|
264
|
+
bundle: RoutePreviewArtifactBundleV3,
|
|
265
|
+
): Record<string, string>;
|
|
266
|
+
export declare function reconstructRoutePreviewArtifactScreenshotV3(
|
|
267
|
+
bundle: RoutePreviewArtifactBundleV3,
|
|
268
|
+
frameId: string,
|
|
269
|
+
): {
|
|
270
|
+
mediaType: 'image/png' | 'image/webp';
|
|
271
|
+
width: number;
|
|
272
|
+
height: number;
|
|
273
|
+
bytes: Uint8Array;
|
|
274
|
+
} | null;
|
|
275
|
+
|
|
276
|
+
export declare const PYGMALION_STORYBOARD_CANONICAL_CONTROL: string;
|
|
277
|
+
export declare function normalizeStoryboardSnapshot(
|
|
278
|
+
snapshot: string,
|
|
279
|
+
): string | null;
|
|
280
|
+
export declare function fingerprintStoryboardSnapshot(
|
|
281
|
+
snapshot: string,
|
|
282
|
+
): string | null;
|
|
283
|
+
export declare function recommendedStoryboardExecutionConcurrency(capabilities?: {
|
|
284
|
+
parallelism?: number;
|
|
285
|
+
totalMemoryBytes?: number;
|
|
286
|
+
}): number;
|
|
287
|
+
export declare function executeStoryboardCandidates(
|
|
288
|
+
candidates: readonly Record<string, unknown>[],
|
|
289
|
+
capture: (
|
|
290
|
+
candidate: Record<string, unknown>,
|
|
291
|
+
context: { signal: AbortSignal; index: number; total: number },
|
|
292
|
+
) => unknown | Promise<unknown>,
|
|
293
|
+
options?: { concurrency?: number; timeoutMs?: number },
|
|
294
|
+
): Promise<unknown[]>;
|
|
295
|
+
export declare function canonicalizeStoryboardExecutions(
|
|
296
|
+
candidates: readonly Record<string, unknown>[],
|
|
297
|
+
executions: readonly Record<string, unknown>[],
|
|
298
|
+
): unknown;
|