walkwright 0.0.1
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/LICENSE +21 -0
- package/README.md +276 -0
- package/bin/walkwright.js +3 -0
- package/build/aria.d.ts +92 -0
- package/build/aria.js +215 -0
- package/build/aria.js.map +1 -0
- package/build/browser.d.ts +3 -0
- package/build/browser.js +18 -0
- package/build/browser.js.map +1 -0
- package/build/chunk-5CHKYNP7.js +507 -0
- package/build/chunk-5CHKYNP7.js.map +1 -0
- package/build/chunk-6YRKPGUO.js +1197 -0
- package/build/chunk-6YRKPGUO.js.map +1 -0
- package/build/chunk-A452S7R3.js +35 -0
- package/build/chunk-A452S7R3.js.map +1 -0
- package/build/chunk-BODO6HIH.js +60 -0
- package/build/chunk-BODO6HIH.js.map +1 -0
- package/build/chunk-FJI2CMCE.js +439 -0
- package/build/chunk-FJI2CMCE.js.map +1 -0
- package/build/chunk-JYHZVRB2.js +80 -0
- package/build/chunk-JYHZVRB2.js.map +1 -0
- package/build/chunk-KQN5IYN6.js +97 -0
- package/build/chunk-KQN5IYN6.js.map +1 -0
- package/build/chunk-KTXNERHT.js +72 -0
- package/build/chunk-KTXNERHT.js.map +1 -0
- package/build/chunk-MFTC7XL2.js +141 -0
- package/build/chunk-MFTC7XL2.js.map +1 -0
- package/build/chunk-N4SSLHMP.js +108 -0
- package/build/chunk-N4SSLHMP.js.map +1 -0
- package/build/chunk-RNNW7OW2.js +270 -0
- package/build/chunk-RNNW7OW2.js.map +1 -0
- package/build/chunk-UAWBPTDW.js +51 -0
- package/build/chunk-UAWBPTDW.js.map +1 -0
- package/build/chunk-Z7CW5CAY.js +64 -0
- package/build/chunk-Z7CW5CAY.js.map +1 -0
- package/build/cli.d.ts +1 -0
- package/build/cli.js +253 -0
- package/build/cli.js.map +1 -0
- package/build/config.d.ts +13 -0
- package/build/config.js +15 -0
- package/build/config.js.map +1 -0
- package/build/descriptor.d.ts +96 -0
- package/build/descriptor.js +27 -0
- package/build/descriptor.js.map +1 -0
- package/build/device-auth.d.ts +6 -0
- package/build/device-auth.js +11 -0
- package/build/device-auth.js.map +1 -0
- package/build/locator.d.ts +140 -0
- package/build/locator.js +92 -0
- package/build/locator.js.map +1 -0
- package/build/paths.d.ts +11 -0
- package/build/paths.js +22 -0
- package/build/paths.js.map +1 -0
- package/build/pom-kcSMxwX2.d.ts +349 -0
- package/build/pom.d.ts +6 -0
- package/build/pom.js +37 -0
- package/build/pom.js.map +1 -0
- package/build/project.d.ts +13 -0
- package/build/project.js +19 -0
- package/build/project.js.map +1 -0
- package/build/provisioner.d.ts +34 -0
- package/build/provisioner.js +14 -0
- package/build/provisioner.js.map +1 -0
- package/build/recorder.d.ts +6 -0
- package/build/recorder.js +15 -0
- package/build/recorder.js.map +1 -0
- package/build/reporter.d.ts +16 -0
- package/build/reporter.js +426 -0
- package/build/reporter.js.map +1 -0
- package/build/schema.d.ts +49 -0
- package/build/schema.js +16 -0
- package/build/schema.js.map +1 -0
- package/build/storage-state.d.ts +22 -0
- package/build/storage-state.js +42 -0
- package/build/storage-state.js.map +1 -0
- package/build/store.d.ts +17 -0
- package/build/store.js +9 -0
- package/build/store.js.map +1 -0
- package/build/ui.d.ts +49 -0
- package/build/ui.js +56 -0
- package/build/ui.js.map +1 -0
- package/build/upload.d.ts +10 -0
- package/build/upload.js +8 -0
- package/build/upload.js.map +1 -0
- package/build/wait.d.ts +14 -0
- package/build/wait.js +50 -0
- package/build/wait.js.map +1 -0
- package/package.json +52 -0
- package/src/aria.ts +326 -0
- package/src/browser.ts +15 -0
- package/src/cli.ts +295 -0
- package/src/config.ts +16 -0
- package/src/descriptor.ts +179 -0
- package/src/device-auth.ts +188 -0
- package/src/locator.ts +683 -0
- package/src/paths.ts +70 -0
- package/src/pom.ts +2363 -0
- package/src/project.ts +77 -0
- package/src/provisioner.ts +183 -0
- package/src/recorder.ts +877 -0
- package/src/reporter.ts +561 -0
- package/src/schema.ts +37 -0
- package/src/storage-state.ts +71 -0
- package/src/store.ts +96 -0
- package/src/ui.ts +333 -0
- package/src/upload.ts +116 -0
- package/src/wait.ts +63 -0
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
import { Page, Fixtures, PlaywrightTestArgs, Locator, TestType, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions } from '@playwright/test';
|
|
2
|
+
import { OverlayDescriptor, AppDescriptor, NestedSurfaceDescriptor, PageDescriptor } from './descriptor.js';
|
|
3
|
+
import { LocatorDescriptor, LazyLocator, Mount } from './locator.js';
|
|
4
|
+
import { AnyProvision, ProvisionMap } from './provisioner.js';
|
|
5
|
+
|
|
6
|
+
interface ShotRecord {
|
|
7
|
+
file: string;
|
|
8
|
+
state: string;
|
|
9
|
+
page: string;
|
|
10
|
+
path?: string;
|
|
11
|
+
group?: string[];
|
|
12
|
+
}
|
|
13
|
+
interface Recorder {
|
|
14
|
+
record: {
|
|
15
|
+
<Target extends VisitablePage<never>>(target: PageOrFactory<Target>, state?: string, options?: ShotOptions): Promise<Target>;
|
|
16
|
+
<Params, Target extends VisitablePage<Params>>(target: PageOrFactory<Target>, params: Params, state?: string, options?: ShotOptions): Promise<Target>;
|
|
17
|
+
(dialog: OverlayDialog, options?: ShotOptions): Promise<void>;
|
|
18
|
+
(state: string, dialog: OverlayDialog, options?: ShotOptions): Promise<void>;
|
|
19
|
+
(state?: string, options?: ShotOptions): Promise<void>;
|
|
20
|
+
};
|
|
21
|
+
shots: () => ShotRecord[];
|
|
22
|
+
}
|
|
23
|
+
interface ShotOptions {
|
|
24
|
+
viewport?: {
|
|
25
|
+
width?: number;
|
|
26
|
+
height?: number;
|
|
27
|
+
};
|
|
28
|
+
page?: string;
|
|
29
|
+
group?: string[];
|
|
30
|
+
state?: string;
|
|
31
|
+
}
|
|
32
|
+
type PageFactory$1<Target> = (page: Page) => Target;
|
|
33
|
+
type PageOrFactory<Target> = Target | PageFactory$1<Target>;
|
|
34
|
+
interface VisitablePage<Params> {
|
|
35
|
+
path: string;
|
|
36
|
+
name: string;
|
|
37
|
+
url: (params: Params) => string;
|
|
38
|
+
goto: (params: Params) => Promise<void>;
|
|
39
|
+
}
|
|
40
|
+
interface OverlayDialog {
|
|
41
|
+
label?: string;
|
|
42
|
+
waitFor: (state?: "visible" | "hidden") => Promise<unknown>;
|
|
43
|
+
close: () => Promise<unknown>;
|
|
44
|
+
descriptor?: OverlayDescriptor;
|
|
45
|
+
self?: {
|
|
46
|
+
chain: LocatorDescriptor;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
declare const runDirVariable = "WALKWRIGHT_RUN_DIR";
|
|
50
|
+
declare const shotsAttachment = "walkwright-shots";
|
|
51
|
+
interface RecordedShots {
|
|
52
|
+
pages: PageMeta[];
|
|
53
|
+
shots: ShotRecord[];
|
|
54
|
+
}
|
|
55
|
+
interface RecorderFixtures {
|
|
56
|
+
recording: boolean;
|
|
57
|
+
runDir: string;
|
|
58
|
+
record: Recorder["record"];
|
|
59
|
+
}
|
|
60
|
+
interface RecordedApp {
|
|
61
|
+
descriptor: AppDescriptor;
|
|
62
|
+
}
|
|
63
|
+
declare function createRecorderFixtures(app: RecordedApp): Fixtures<RecorderFixtures, object, PlaywrightTestArgs>;
|
|
64
|
+
declare global {
|
|
65
|
+
interface Window {
|
|
66
|
+
__walkwrightRestore?: (() => void)[];
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
declare function describeError(error: unknown): string;
|
|
70
|
+
|
|
71
|
+
type CaptureRule = {
|
|
72
|
+
element: string;
|
|
73
|
+
text: string;
|
|
74
|
+
match?: RegExp;
|
|
75
|
+
} | {
|
|
76
|
+
match: RegExp;
|
|
77
|
+
text: string;
|
|
78
|
+
};
|
|
79
|
+
interface CaptureRules {
|
|
80
|
+
rules: CaptureRule[];
|
|
81
|
+
}
|
|
82
|
+
type ElementPath<E> = Extract<keyof E, string> | `${Extract<keyof E, string>}.${string}`;
|
|
83
|
+
type TypedCaptureRule<E> = {
|
|
84
|
+
element: ElementPath<E>;
|
|
85
|
+
text: string;
|
|
86
|
+
match?: RegExp;
|
|
87
|
+
} | {
|
|
88
|
+
match: RegExp;
|
|
89
|
+
text: string;
|
|
90
|
+
};
|
|
91
|
+
interface TypedCaptureRules<E> {
|
|
92
|
+
rules: TypedCaptureRule<E>[];
|
|
93
|
+
}
|
|
94
|
+
type Factory<T> = (page: Page) => T;
|
|
95
|
+
interface Rooted {
|
|
96
|
+
self: LazyLocator;
|
|
97
|
+
root: Locator;
|
|
98
|
+
}
|
|
99
|
+
interface SurfaceInstance {
|
|
100
|
+
page: Page;
|
|
101
|
+
elements: object;
|
|
102
|
+
}
|
|
103
|
+
interface Surface<I extends SurfaceInstance = SurfaceInstance> {
|
|
104
|
+
(scope: LazyLocator): Surface<I & Rooted>;
|
|
105
|
+
(scope: Page): I;
|
|
106
|
+
readonly descriptor: NestedSurfaceDescriptor;
|
|
107
|
+
}
|
|
108
|
+
type AnySurface = Surface;
|
|
109
|
+
interface OverlayEmbed {
|
|
110
|
+
overlay: OverlayFactory;
|
|
111
|
+
open?: () => Promise<void>;
|
|
112
|
+
}
|
|
113
|
+
type ElementMap = Record<string, LazyLocator | ((...params: never[]) => LazyLocator) | AnySurface | ((...params: never[]) => AnySurface) | OverlayEmbed | ((scope: Mount) => unknown) | ((...params: never[]) => (scope: Mount) => unknown)>;
|
|
114
|
+
type ThisElements<Self> = Record<string, ElementMap[string] | (OverlayEmbed & ThisType<Self>)>;
|
|
115
|
+
type Instantiated<M extends ElementMap> = {
|
|
116
|
+
[Key in keyof M]: M[Key] extends {
|
|
117
|
+
overlay: infer O extends AnySurface;
|
|
118
|
+
} ? SurfaceInstanceOf<O> : M[Key] extends LazyLocator ? Locator : M[Key] extends (...args: infer A) => LazyLocator ? (...args: A) => Locator : M[Key] extends {
|
|
119
|
+
(...params: infer Params): infer S;
|
|
120
|
+
parameterized: true;
|
|
121
|
+
} ? S extends AnySurface ? (...params: Params) => SurfaceInstanceOf<S> : never : M[Key] extends AnySurface ? SurfaceInstanceOf<M[Key]> : M[Key] extends (...args: infer A) => infer S ? S extends AnySurface ? (...args: A) => SurfaceInstanceOf<S> : S extends (scope: never) => infer R ? (...args: A) => R : S : never;
|
|
122
|
+
};
|
|
123
|
+
type ActionMap = Record<string, (...params: never[]) => unknown>;
|
|
124
|
+
type Parameterized<Params extends unknown[], F> = ((...params: Params) => F) & {
|
|
125
|
+
parameterized: true;
|
|
126
|
+
};
|
|
127
|
+
type Component<E extends object, A extends object = Record<never, never>> = {
|
|
128
|
+
page: Page;
|
|
129
|
+
elements: E;
|
|
130
|
+
self?: LazyLocator;
|
|
131
|
+
root?: Locator;
|
|
132
|
+
} & A;
|
|
133
|
+
type RootedComponent<E extends object, A extends object = Record<never, never>> = Component<E, A> & Rooted;
|
|
134
|
+
type SurfaceInstanceOf<S> = S extends (scope: Page) => infer I ? I : never;
|
|
135
|
+
type ActionsOf<I> = Omit<I, keyof SurfaceInstance | keyof Rooted>;
|
|
136
|
+
type IncludeShape<Inc extends readonly AnySurface[]> = Inc extends readonly [
|
|
137
|
+
infer First,
|
|
138
|
+
...infer Rest
|
|
139
|
+
] ? Rest extends readonly AnySurface[] ? SurfaceInstanceOf<First> extends infer I extends SurfaceInstance ? {
|
|
140
|
+
elements: I["elements"] & IncludeShape<Rest>["elements"];
|
|
141
|
+
actions: ActionsOf<I> & IncludeShape<Rest>["actions"];
|
|
142
|
+
} : never : never : {
|
|
143
|
+
elements: unknown;
|
|
144
|
+
actions: unknown;
|
|
145
|
+
};
|
|
146
|
+
type IncludeElements<Inc extends readonly AnySurface[]> = IncludeShape<Inc>["elements"];
|
|
147
|
+
type IncludeActions<Inc extends readonly AnySurface[]> = IncludeShape<Inc>["actions"];
|
|
148
|
+
declare function rootOf(instance: {
|
|
149
|
+
root?: Locator;
|
|
150
|
+
}): Locator;
|
|
151
|
+
interface SurfaceDefinition {
|
|
152
|
+
elements?: ElementMap;
|
|
153
|
+
actions?: ActionMap;
|
|
154
|
+
include?: readonly AnySurface[];
|
|
155
|
+
capture?: CaptureRules;
|
|
156
|
+
}
|
|
157
|
+
interface ComponentDefinition<Inc extends readonly AnySurface[], M extends ElementMap, A extends ActionMap, Self> {
|
|
158
|
+
include?: readonly [...Inc];
|
|
159
|
+
elements?: M & ThisElements<Self> & ThisType<Self>;
|
|
160
|
+
actions?: A & ActionMap & ThisType<Self>;
|
|
161
|
+
capture?: TypedCaptureRules<IncludeElements<Inc> & Instantiated<M>>;
|
|
162
|
+
}
|
|
163
|
+
interface DefinitionShape {
|
|
164
|
+
root?: LazyLocator;
|
|
165
|
+
}
|
|
166
|
+
type ComponentInstanceOf<Def extends DefinitionShape, Inc extends readonly AnySurface[], M extends ElementMap, A extends ActionMap> = Def extends {
|
|
167
|
+
root: LazyLocator;
|
|
168
|
+
} ? RootedComponent<IncludeElements<Inc> & Instantiated<M>, IncludeActions<Inc> & A> : Component<IncludeElements<Inc> & Instantiated<M>, IncludeActions<Inc> & A>;
|
|
169
|
+
declare function defineComponent<Params extends unknown[], Def extends DefinitionShape, Inc extends readonly AnySurface[] = [], M extends ElementMap = Record<never, never>, A extends ActionMap = Record<never, never>>(build: (...params: Params) => Def & ComponentDefinition<Inc, M, A, ComponentInstanceOf<Def, Inc, M, A>>): Parameterized<Params, Surface<ComponentInstanceOf<Def, Inc, M, A>>>;
|
|
170
|
+
declare function defineComponent<Def extends DefinitionShape, Inc extends readonly AnySurface[] = [], M extends ElementMap = Record<never, never>, A extends ActionMap = Record<never, never>>(definition: Def & ComponentDefinition<Inc, M, A, ComponentInstanceOf<Def, Inc, M, A>>): Surface<ComponentInstanceOf<Def, Inc, M, A>>;
|
|
171
|
+
interface OverlayClose {
|
|
172
|
+
esc?: boolean;
|
|
173
|
+
button?: LazyLocator;
|
|
174
|
+
}
|
|
175
|
+
interface OverlayRecorder {
|
|
176
|
+
label: string;
|
|
177
|
+
}
|
|
178
|
+
interface OverlayHandle {
|
|
179
|
+
waitFor: (state?: "visible" | "hidden") => Promise<void>;
|
|
180
|
+
open: () => Promise<void>;
|
|
181
|
+
close: () => Promise<void>;
|
|
182
|
+
}
|
|
183
|
+
type Overlay<E extends object> = {
|
|
184
|
+
page: Page;
|
|
185
|
+
elements: E;
|
|
186
|
+
label: string;
|
|
187
|
+
} & Rooted & OverlayHandle;
|
|
188
|
+
type Dialog<E extends object> = Overlay<E> & {
|
|
189
|
+
name: string | RegExp;
|
|
190
|
+
};
|
|
191
|
+
type AnyOverlayInstance = SurfaceInstance & Rooted & OverlayHandle & {
|
|
192
|
+
label: string;
|
|
193
|
+
};
|
|
194
|
+
interface OverlayFactory<I extends AnyOverlayInstance = AnyOverlayInstance> extends Surface<I> {
|
|
195
|
+
overlay: true;
|
|
196
|
+
descriptor: OverlayDescriptor;
|
|
197
|
+
}
|
|
198
|
+
type OverlayInstanceOf<Inc extends readonly AnySurface[], M extends ElementMap, A extends ActionMap> = Overlay<IncludeElements<Inc> & Instantiated<M>> & IncludeActions<Inc> & A;
|
|
199
|
+
type DialogInstanceOf<Inc extends readonly AnySurface[], M extends ElementMap, A extends ActionMap> = Dialog<IncludeElements<Inc> & Instantiated<M>> & IncludeActions<Inc> & A;
|
|
200
|
+
interface OverlayDefinition<Inc extends readonly AnySurface[] = [], M extends ElementMap = Record<never, never>, A extends ActionMap = Record<never, never>> extends ComponentDefinition<Inc, M, A, OverlayInstanceOf<Inc, M, A>> {
|
|
201
|
+
root: LazyLocator;
|
|
202
|
+
recorder: OverlayRecorder;
|
|
203
|
+
close?: OverlayClose;
|
|
204
|
+
}
|
|
205
|
+
interface DialogDefinition<Inc extends readonly AnySurface[] = [], M extends ElementMap = Record<never, never>, A extends ActionMap = Record<never, never>> extends ComponentDefinition<Inc, M, A, DialogInstanceOf<Inc, M, A>> {
|
|
206
|
+
name: string | RegExp;
|
|
207
|
+
role?: "dialog" | "alertdialog";
|
|
208
|
+
recorder?: OverlayRecorder;
|
|
209
|
+
close?: OverlayClose;
|
|
210
|
+
}
|
|
211
|
+
declare function defineOverlay<Params extends unknown[], Inc extends readonly AnySurface[] = [], M extends ElementMap = Record<never, never>, A extends ActionMap = Record<never, never>>(build: (...params: Params) => OverlayDefinition<Inc, M, A>): Parameterized<Params, OverlayFactory<OverlayInstanceOf<Inc, M, A>>>;
|
|
212
|
+
declare function defineOverlay<Inc extends readonly AnySurface[] = [], M extends ElementMap = Record<never, never>, A extends ActionMap = Record<never, never>>(definition: OverlayDefinition<Inc, M, A>): OverlayFactory<OverlayInstanceOf<Inc, M, A>>;
|
|
213
|
+
declare function defineDialog<Params extends unknown[], Inc extends readonly AnySurface[] = [], M extends ElementMap = Record<never, never>, A extends ActionMap = Record<never, never>>(build: (...params: Params) => DialogDefinition<Inc, M, A>): Parameterized<Params, OverlayFactory<DialogInstanceOf<Inc, M, A>>>;
|
|
214
|
+
declare function defineDialog<Inc extends readonly AnySurface[] = [], M extends ElementMap = Record<never, never>, A extends ActionMap = Record<never, never>>(definition: DialogDefinition<Inc, M, A>): OverlayFactory<DialogInstanceOf<Inc, M, A>>;
|
|
215
|
+
type PathParams<Path extends string> = Path extends `${string}:${infer Param}/${infer Rest}` ? Record<Param, string> & PathParams<Rest> : Path extends `${string}:${infer Param}` ? Record<Param, string> : unknown;
|
|
216
|
+
interface PageMeta {
|
|
217
|
+
name: string;
|
|
218
|
+
path: string;
|
|
219
|
+
group?: string[];
|
|
220
|
+
}
|
|
221
|
+
interface PageRecorder {
|
|
222
|
+
group?: string[];
|
|
223
|
+
label?: string;
|
|
224
|
+
}
|
|
225
|
+
interface Register {
|
|
226
|
+
}
|
|
227
|
+
type RegisteredPages = Register extends {
|
|
228
|
+
app: {
|
|
229
|
+
pages: infer P extends AnyPages;
|
|
230
|
+
};
|
|
231
|
+
} ? BoundPages<P> : Record<string, never>;
|
|
232
|
+
interface PageObject<Path extends string, E> {
|
|
233
|
+
page: Page;
|
|
234
|
+
path: Path;
|
|
235
|
+
name: string;
|
|
236
|
+
goto: (params: PathParams<Path>) => Promise<void>;
|
|
237
|
+
url: (params: PathParams<Path>) => string;
|
|
238
|
+
params: () => PathParams<Path>;
|
|
239
|
+
waitFor: () => Promise<void>;
|
|
240
|
+
elements: E;
|
|
241
|
+
pages: RegisteredPages;
|
|
242
|
+
}
|
|
243
|
+
interface PageFactory<Path extends string, E, A> {
|
|
244
|
+
(page: Page): PageObject<Path, E> & A;
|
|
245
|
+
descriptor: PageDescriptor;
|
|
246
|
+
}
|
|
247
|
+
type InstanceOf<T> = T extends (...args: never[]) => infer R ? R extends (...args: never[]) => infer R2 ? R2 : R : never;
|
|
248
|
+
type HeaderElement<H extends string | undefined> = H extends string ? {
|
|
249
|
+
header: Locator;
|
|
250
|
+
} : unknown;
|
|
251
|
+
interface PageContext<E> {
|
|
252
|
+
page: Page;
|
|
253
|
+
elements: E;
|
|
254
|
+
pages: RegisteredPages;
|
|
255
|
+
}
|
|
256
|
+
type PageThis<Inc extends readonly AnySurface[], M extends ElementMap, H extends string | undefined, A extends ActionMap> = PageContext<IncludeElements<Inc> & Instantiated<M> & HeaderElement<H>> & IncludeActions<Inc> & A;
|
|
257
|
+
interface PageDefinition<Path extends string, Inc extends readonly AnySurface[] = [], M extends ElementMap = Record<never, never>, H extends string | undefined = undefined, A extends ActionMap = Record<never, never>, Ambient extends readonly AnySurface[] = []> {
|
|
258
|
+
path: Path;
|
|
259
|
+
name: string;
|
|
260
|
+
recorder?: PageRecorder;
|
|
261
|
+
ready?: AppReady;
|
|
262
|
+
header?: H;
|
|
263
|
+
include?: readonly [...Inc];
|
|
264
|
+
elements?: M & ThisElements<PageThis<[...Ambient, ...Inc], M, H, A>> & ThisType<PageThis<[...Ambient, ...Inc], M, H, A>>;
|
|
265
|
+
anchor?: string | LazyLocator;
|
|
266
|
+
actions?: A & ActionMap & ThisType<PageThis<[...Ambient, ...Inc], M, H, A>>;
|
|
267
|
+
capture?: TypedCaptureRules<IncludeElements<Inc> & Instantiated<M> & HeaderElement<H>>;
|
|
268
|
+
}
|
|
269
|
+
interface PagePresetDefinition<Prefix extends string, Inc extends readonly AnySurface[] = []> {
|
|
270
|
+
path: Prefix;
|
|
271
|
+
include?: readonly [...Inc];
|
|
272
|
+
recorder?: {
|
|
273
|
+
group?: string[];
|
|
274
|
+
};
|
|
275
|
+
ready?: AppReady;
|
|
276
|
+
capture?: TypedCaptureRules<IncludeElements<Inc>>;
|
|
277
|
+
}
|
|
278
|
+
interface PagePreset<Prefix extends string, Inc extends readonly AnySurface[]> {
|
|
279
|
+
readonly path: Prefix;
|
|
280
|
+
readonly include: Inc;
|
|
281
|
+
<Params extends unknown[], Sub extends string, Own extends readonly AnySurface[] = [], M extends ElementMap = Record<never, never>, H extends string | undefined = undefined, A extends ActionMap = Record<never, never>>(build: (...params: Params) => PageDefinition<Sub, Own, M, H, A, Inc>): Parameterized<Params, PageFactory<`${Prefix}${Sub}`, IncludeElements<[...Inc, ...Own]> & Instantiated<M> & HeaderElement<H>, IncludeActions<[...Inc, ...Own]> & A>>;
|
|
282
|
+
<Sub extends string, Own extends readonly AnySurface[] = [], M extends ElementMap = Record<never, never>, H extends string | undefined = undefined, A extends ActionMap = Record<never, never>>(def: PageDefinition<Sub, Own, M, H, A, Inc>): PageFactory<`${Prefix}${Sub}`, IncludeElements<[...Inc, ...Own]> & Instantiated<M> & HeaderElement<H>, IncludeActions<[...Inc, ...Own]> & A>;
|
|
283
|
+
preset<SubPrefix extends string, SubInc extends readonly AnySurface[] = []>(base: PagePresetDefinition<SubPrefix, SubInc>): PagePreset<`${Prefix}${SubPrefix}`, [...Inc, ...SubInc]>;
|
|
284
|
+
}
|
|
285
|
+
type PresetPage<P extends PagePreset<string, readonly AnySurface[]>, Sub extends string, M extends ElementMap = Record<never, never>, H extends string | undefined = undefined, A extends ActionMap = Record<never, never>, Own extends readonly AnySurface[] = []> = PageFactory<`${P["path"]}${Sub}`, IncludeElements<[...P["include"], ...Own]> & Instantiated<M> & HeaderElement<H>, IncludeActions<[...P["include"], ...Own]> & A>;
|
|
286
|
+
interface DefinePage {
|
|
287
|
+
<Params extends unknown[], Path extends string, Inc extends readonly AnySurface[] = [], M extends ElementMap = Record<never, never>, H extends string | undefined = undefined, A extends ActionMap = Record<never, never>>(build: (...params: Params) => PageDefinition<Path, Inc, M, H, A>): Parameterized<Params, PageFactory<Path, IncludeElements<Inc> & Instantiated<M> & HeaderElement<H>, IncludeActions<Inc> & A>>;
|
|
288
|
+
<Path extends string, Inc extends readonly AnySurface[] = [], M extends ElementMap = Record<never, never>, H extends string | undefined = undefined, A extends ActionMap = Record<never, never>>(def: PageDefinition<Path, Inc, M, H, A>): PageFactory<Path, IncludeElements<Inc> & Instantiated<M> & HeaderElement<H>, IncludeActions<Inc> & A>;
|
|
289
|
+
preset<Prefix extends string, Inc extends readonly AnySurface[] = []>(base: PagePresetDefinition<Prefix, Inc>): PagePreset<Prefix, Inc>;
|
|
290
|
+
}
|
|
291
|
+
type AppReady = {
|
|
292
|
+
selector: string;
|
|
293
|
+
} | ((page: Page) => Promise<void>);
|
|
294
|
+
interface AnyPageFactory {
|
|
295
|
+
(page: Page): unknown;
|
|
296
|
+
descriptor: PageDescriptor;
|
|
297
|
+
}
|
|
298
|
+
declare const definePage: DefinePage;
|
|
299
|
+
type AnyPages = Record<string, AnyPageFactory>;
|
|
300
|
+
interface AppDefinition<P extends AnyPages> {
|
|
301
|
+
pages: P;
|
|
302
|
+
ready?: AppReady;
|
|
303
|
+
capture?: {
|
|
304
|
+
rules: {
|
|
305
|
+
match: RegExp;
|
|
306
|
+
text: string;
|
|
307
|
+
}[];
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
type BoundPages<P extends AnyPages> = {
|
|
311
|
+
[K in keyof P]: P[K] extends (page: Page) => infer Instance ? Instance : never;
|
|
312
|
+
};
|
|
313
|
+
interface AppFixtures<P extends AnyPages> extends RecorderFixtures {
|
|
314
|
+
pages: BoundPages<P>;
|
|
315
|
+
}
|
|
316
|
+
type DefaultTestArgs<P extends AnyPages> = PlaywrightTestArgs & PlaywrightTestOptions & AppFixtures<P>;
|
|
317
|
+
type DefaultWorkerArgs = PlaywrightWorkerArgs & PlaywrightWorkerOptions;
|
|
318
|
+
interface AppFixtureOptions {
|
|
319
|
+
base?: TestType<PlaywrightTestArgs, NonNullable<unknown>>;
|
|
320
|
+
}
|
|
321
|
+
interface AppFixture<P extends AnyPages> {
|
|
322
|
+
<Defs extends readonly AnyProvision[], T extends PlaywrightTestArgs, W extends NonNullable<unknown>>(provisions: Defs, options: AppFixtureOptions & {
|
|
323
|
+
base: TestType<T, W>;
|
|
324
|
+
}): TestType<T & AppFixtures<P> & {
|
|
325
|
+
provision: ProvisionMap<Defs>;
|
|
326
|
+
}, W>;
|
|
327
|
+
<Defs extends readonly AnyProvision[]>(provisions: Defs, options?: AppFixtureOptions): TestType<DefaultTestArgs<P> & {
|
|
328
|
+
provision: ProvisionMap<Defs>;
|
|
329
|
+
}, DefaultWorkerArgs>;
|
|
330
|
+
<T extends PlaywrightTestArgs, W extends NonNullable<unknown>>(provisions: undefined, options: AppFixtureOptions & {
|
|
331
|
+
base: TestType<T, W>;
|
|
332
|
+
}): TestType<T & AppFixtures<P>, W>;
|
|
333
|
+
(provisions?: undefined, options?: AppFixtureOptions): TestType<DefaultTestArgs<P>, DefaultWorkerArgs>;
|
|
334
|
+
}
|
|
335
|
+
interface App<P extends AnyPages = AnyPages> {
|
|
336
|
+
pages: P;
|
|
337
|
+
fixture: AppFixture<P>;
|
|
338
|
+
descriptor: AppDescriptor;
|
|
339
|
+
}
|
|
340
|
+
declare function defineApp<P extends AnyPages>(def: AppDefinition<P>): App<P>;
|
|
341
|
+
declare function loadPage(descriptor: PageDescriptor): PageFactory<string, Record<string, unknown>, Record<never, never>>;
|
|
342
|
+
declare function loadApp(raw: unknown): App;
|
|
343
|
+
declare function arriveAt<T extends {
|
|
344
|
+
waitFor: () => Promise<void>;
|
|
345
|
+
}>(destination: Factory<T>, page: Page): Promise<T>;
|
|
346
|
+
declare function waitForHydration(page: Page, timeoutMs?: number): Promise<void>;
|
|
347
|
+
declare function pathParams<Path extends string>(path: Path, url: string): PathParams<Path>;
|
|
348
|
+
|
|
349
|
+
export { type PageFactory as $, type ActionMap as A, type BoundPages as B, type Component as C, type CaptureRule as D, type CaptureRules as E, type ComponentDefinition as F, type DefinePage as G, type Dialog as H, type Instantiated as I, type DialogDefinition as J, type ElementMap as K, type Factory as L, type HeaderElement as M, type IncludeActions as N, type Overlay as O, type Parameterized as P, type IncludeElements as Q, type Rooted as R, type Surface as S, type InstanceOf as T, type OverlayClose as U, type VisitablePage as V, type OverlayDefinition as W, type OverlayEmbed as X, type OverlayRecorder as Y, type PageContext as Z, type PageDefinition as _, type SurfaceInstance as a, type PageMeta as a0, type PageObject as a1, type PagePreset as a2, type PagePresetDefinition as a3, type PageRecorder as a4, type PathParams as a5, type PresetPage as a6, type Register as a7, type RegisteredPages as a8, type SurfaceDefinition as a9, arriveAt as aa, defineApp as ab, defineComponent as ac, defineDialog as ad, defineOverlay as ae, definePage as af, loadApp as ag, loadPage as ah, pathParams as ai, rootOf as aj, waitForHydration as ak, type OverlayFactory as b, type RootedComponent as c, type OverlayHandle as d, type OverlayDialog as e, type PageFactory$1 as f, type PageOrFactory as g, type RecordedApp as h, type RecordedShots as i, type Recorder as j, type RecorderFixtures as k, type ShotOptions as l, type ShotRecord as m, createRecorderFixtures as n, describeError as o, type AnyPageFactory as p, type AnyPages as q, runDirVariable as r, shotsAttachment as s, type AnySurface as t, type App as u, type AppDefinition as v, type AppFixture as w, type AppFixtureOptions as x, type AppFixtures as y, type AppReady as z };
|
package/build/pom.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import '@playwright/test';
|
|
2
|
+
import './descriptor.js';
|
|
3
|
+
export { Mount, Scope, pageOf } from './locator.js';
|
|
4
|
+
import './provisioner.js';
|
|
5
|
+
export { A as ActionMap, p as AnyPageFactory, q as AnyPages, t as AnySurface, u as App, v as AppDefinition, w as AppFixture, x as AppFixtureOptions, y as AppFixtures, z as AppReady, B as BoundPages, D as CaptureRule, E as CaptureRules, C as Component, F as ComponentDefinition, G as DefinePage, H as Dialog, J as DialogDefinition, K as ElementMap, L as Factory, M as HeaderElement, N as IncludeActions, Q as IncludeElements, T as InstanceOf, I as Instantiated, O as Overlay, U as OverlayClose, W as OverlayDefinition, X as OverlayEmbed, b as OverlayFactory, d as OverlayHandle, Y as OverlayRecorder, Z as PageContext, _ as PageDefinition, $ as PageFactory, a0 as PageMeta, a1 as PageObject, a2 as PagePreset, a3 as PagePresetDefinition, a4 as PageRecorder, P as Parameterized, a5 as PathParams, a6 as PresetPage, a7 as Register, a8 as RegisteredPages, R as Rooted, c as RootedComponent, S as Surface, a9 as SurfaceDefinition, a as SurfaceInstance, aa as arriveAt, ab as defineApp, ac as defineComponent, ad as defineDialog, ae as defineOverlay, af as definePage, ag as loadApp, ah as loadPage, ai as pathParams, aj as rootOf, ak as waitForHydration } from './pom-kcSMxwX2.js';
|
|
6
|
+
import 'zod';
|
package/build/pom.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {
|
|
2
|
+
arriveAt,
|
|
3
|
+
defineApp,
|
|
4
|
+
defineComponent,
|
|
5
|
+
defineDialog,
|
|
6
|
+
defineOverlay,
|
|
7
|
+
definePage,
|
|
8
|
+
loadApp,
|
|
9
|
+
loadPage,
|
|
10
|
+
pathParams,
|
|
11
|
+
rootOf,
|
|
12
|
+
waitForHydration
|
|
13
|
+
} from "./chunk-6YRKPGUO.js";
|
|
14
|
+
import "./chunk-KQN5IYN6.js";
|
|
15
|
+
import "./chunk-5CHKYNP7.js";
|
|
16
|
+
import "./chunk-KTXNERHT.js";
|
|
17
|
+
import "./chunk-N4SSLHMP.js";
|
|
18
|
+
import {
|
|
19
|
+
pageOf
|
|
20
|
+
} from "./chunk-FJI2CMCE.js";
|
|
21
|
+
import "./chunk-BODO6HIH.js";
|
|
22
|
+
import "./chunk-UAWBPTDW.js";
|
|
23
|
+
export {
|
|
24
|
+
arriveAt,
|
|
25
|
+
defineApp,
|
|
26
|
+
defineComponent,
|
|
27
|
+
defineDialog,
|
|
28
|
+
defineOverlay,
|
|
29
|
+
definePage,
|
|
30
|
+
loadApp,
|
|
31
|
+
loadPage,
|
|
32
|
+
pageOf,
|
|
33
|
+
pathParams,
|
|
34
|
+
rootOf,
|
|
35
|
+
waitForHydration
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=pom.js.map
|
package/build/pom.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare const defaultReportsUrl = "https://app.walkwright.dev";
|
|
2
|
+
interface WalkwrightConfig {
|
|
3
|
+
url: string;
|
|
4
|
+
project: string;
|
|
5
|
+
token: string;
|
|
6
|
+
}
|
|
7
|
+
declare function describeConfigPath(cwd?: string): string;
|
|
8
|
+
declare function readWalkwrightConfig(cwd?: string): WalkwrightConfig | undefined;
|
|
9
|
+
declare function writeWalkwrightConfig(config: WalkwrightConfig, cwd?: string): string;
|
|
10
|
+
declare function currentBranch(cwd?: string): string;
|
|
11
|
+
declare function repoName(cwd?: string): string;
|
|
12
|
+
|
|
13
|
+
export { type WalkwrightConfig, currentBranch, defaultReportsUrl, describeConfigPath, readWalkwrightConfig, repoName, writeWalkwrightConfig };
|
package/build/project.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
currentBranch,
|
|
3
|
+
defaultReportsUrl,
|
|
4
|
+
describeConfigPath,
|
|
5
|
+
readWalkwrightConfig,
|
|
6
|
+
repoName,
|
|
7
|
+
writeWalkwrightConfig
|
|
8
|
+
} from "./chunk-Z7CW5CAY.js";
|
|
9
|
+
import "./chunk-BODO6HIH.js";
|
|
10
|
+
import "./chunk-UAWBPTDW.js";
|
|
11
|
+
export {
|
|
12
|
+
currentBranch,
|
|
13
|
+
defaultReportsUrl,
|
|
14
|
+
describeConfigPath,
|
|
15
|
+
readWalkwrightConfig,
|
|
16
|
+
repoName,
|
|
17
|
+
writeWalkwrightConfig
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=project.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Page } from '@playwright/test';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
type Use = <D extends AnyProvision>(provision: D, ...input: ProvisionArgs<InputOf<D>>) => Promise<ResultOf<D>>;
|
|
5
|
+
interface Provision<Name extends string, Input, Result> {
|
|
6
|
+
name: Name;
|
|
7
|
+
create: (page: Page, input: Input, use: Use) => Promise<Result>;
|
|
8
|
+
dispose?: (page: Page, result: Result) => Promise<void>;
|
|
9
|
+
schema?: z.ZodType<Result>;
|
|
10
|
+
}
|
|
11
|
+
interface AnyProvision {
|
|
12
|
+
name: string;
|
|
13
|
+
create: (page: Page, input: never, use: Use) => Promise<unknown>;
|
|
14
|
+
dispose?: (page: Page, result: never) => Promise<void>;
|
|
15
|
+
schema?: z.ZodType;
|
|
16
|
+
}
|
|
17
|
+
type InputOf<D extends AnyProvision> = D extends {
|
|
18
|
+
create: (page: Page, input: infer Input, use: Use) => Promise<unknown>;
|
|
19
|
+
} ? Input : never;
|
|
20
|
+
type ResultOf<D extends AnyProvision> = D extends {
|
|
21
|
+
create: (page: Page, input: never, use: Use) => Promise<infer Result>;
|
|
22
|
+
} ? Result : never;
|
|
23
|
+
declare function createProvision<Name extends string, Input, Result>(name: Name, create: (page: Page, input: Input, use: Use) => Promise<Result>, dispose?: (page: Page, result: Result) => Promise<void>): Provision<Name, Input, Result>;
|
|
24
|
+
declare function createPersistentProvision<Name extends string, Input, Result>(name: Name, schema: z.ZodType<Result>, create: (page: Page, input: Input, use: Use) => Promise<Result>, dispose?: (page: Page, result: Result) => Promise<void>): Provision<Name, Input, Result>;
|
|
25
|
+
type ProvisionMap<Defs extends readonly AnyProvision[]> = {
|
|
26
|
+
[D in Defs[number] as D["name"]]: (...input: ProvisionArgs<InputOf<D>>) => Promise<ResultOf<D>>;
|
|
27
|
+
};
|
|
28
|
+
interface Provisioner<Defs extends readonly AnyProvision[]> extends AsyncDisposable {
|
|
29
|
+
provision: ProvisionMap<Defs>;
|
|
30
|
+
}
|
|
31
|
+
declare function createProvisioner<Defs extends readonly AnyProvision[]>(page: Page, provisions: Defs): Provisioner<Defs>;
|
|
32
|
+
type ProvisionArgs<Input> = undefined extends Input ? [input?: Input] : [input: Input];
|
|
33
|
+
|
|
34
|
+
export { type AnyProvision, type InputOf, type Provision, type ProvisionMap, type Provisioner, type ResultOf, type Use, createPersistentProvision, createProvision, createProvisioner };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createPersistentProvision,
|
|
3
|
+
createProvision,
|
|
4
|
+
createProvisioner
|
|
5
|
+
} from "./chunk-KQN5IYN6.js";
|
|
6
|
+
import "./chunk-KTXNERHT.js";
|
|
7
|
+
import "./chunk-BODO6HIH.js";
|
|
8
|
+
import "./chunk-UAWBPTDW.js";
|
|
9
|
+
export {
|
|
10
|
+
createPersistentProvision,
|
|
11
|
+
createProvision,
|
|
12
|
+
createProvisioner
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=provisioner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import '@playwright/test';
|
|
2
|
+
import './descriptor.js';
|
|
3
|
+
import './locator.js';
|
|
4
|
+
export { e as OverlayDialog, f as PageFactory, g as PageOrFactory, h as RecordedApp, i as RecordedShots, j as Recorder, k as RecorderFixtures, l as ShotOptions, m as ShotRecord, V as VisitablePage, n as createRecorderFixtures, o as describeError, r as runDirVariable, s as shotsAttachment } from './pom-kcSMxwX2.js';
|
|
5
|
+
import 'zod';
|
|
6
|
+
import './provisioner.js';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createRecorderFixtures,
|
|
3
|
+
describeError,
|
|
4
|
+
runDirVariable,
|
|
5
|
+
shotsAttachment
|
|
6
|
+
} from "./chunk-5CHKYNP7.js";
|
|
7
|
+
import "./chunk-FJI2CMCE.js";
|
|
8
|
+
import "./chunk-UAWBPTDW.js";
|
|
9
|
+
export {
|
|
10
|
+
createRecorderFixtures,
|
|
11
|
+
describeError,
|
|
12
|
+
runDirVariable,
|
|
13
|
+
shotsAttachment
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=recorder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Reporter, TestCase, TestResult, FullResult } from '@playwright/test/reporter';
|
|
2
|
+
|
|
3
|
+
interface ReporterOptions {
|
|
4
|
+
appUrl: string;
|
|
5
|
+
reportsDir?: string;
|
|
6
|
+
}
|
|
7
|
+
declare class WalkwrightReporter implements Reporter {
|
|
8
|
+
#private;
|
|
9
|
+
constructor(options: ReporterOptions);
|
|
10
|
+
onTestEnd(test: TestCase, result: TestResult): void;
|
|
11
|
+
onEnd(result: FullResult): Promise<{
|
|
12
|
+
status: FullResult["status"];
|
|
13
|
+
} | undefined>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { type ReporterOptions, WalkwrightReporter as default };
|