effect-playwright 0.3.0 → 0.4.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/dist/experimental/index.d.mts +1 -1
- package/dist/experimental/index.mjs +3 -3
- package/dist/{index-CA1jsZ4o.d.mts → index-COItPgGw.d.mts} +645 -15
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{src-DxTog178.mjs → src-BdVoZgVR.mjs} +186 -69
- package/package.json +13 -13
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as PlaywrightError, D as PlaywrightFrameService, d as PlaywrightPageService, o as PlaywrightBrowser, s as PlaywrightBrowserService } from "../index-
|
|
1
|
+
import { A as PlaywrightError, D as PlaywrightFrameService, d as PlaywrightPageService, o as PlaywrightBrowser, s as PlaywrightBrowserService } from "../index-COItPgGw.mjs";
|
|
2
2
|
import { Context, Effect, Layer, Stream } from "effect";
|
|
3
3
|
import { BrowserType, LaunchOptions } from "playwright-core";
|
|
4
4
|
import { Scope as Scope$1 } from "effect/Scope";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "../chunk-CfYAbeIz.mjs";
|
|
2
|
-
import { n as PlaywrightBrowser, t as Playwright } from "../src-
|
|
2
|
+
import { n as PlaywrightBrowser, t as Playwright } from "../src-BdVoZgVR.mjs";
|
|
3
3
|
import { Array, Context, Effect, Layer, Stream, pipe } from "effect";
|
|
4
4
|
//#region src/experimental/browser-utils.ts
|
|
5
5
|
var browser_utils_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -11,7 +11,7 @@ var browser_utils_exports = /* @__PURE__ */ __exportAll({
|
|
|
11
11
|
* Returns all pages in the browser from all contexts.
|
|
12
12
|
* @category util
|
|
13
13
|
*/
|
|
14
|
-
const allPages = (browser) => Effect.
|
|
14
|
+
const allPages = (browser) => Effect.sync(() => Array.flatten(browser.contexts().map((context) => context.pages())));
|
|
15
15
|
/**
|
|
16
16
|
* Returns all frames in the browser from all pages in all contexts.
|
|
17
17
|
* @category util
|
|
@@ -24,7 +24,7 @@ const allFrames = (browser) => allPages(browser).pipe(Effect.flatMap((pages) =>
|
|
|
24
24
|
*/
|
|
25
25
|
const allFrameNavigatedEventStream = (browser) => Effect.gen(function* () {
|
|
26
26
|
const contexts = browser.contexts();
|
|
27
|
-
const currentPages =
|
|
27
|
+
const currentPages = Array.flatten(contexts.map((c) => c.pages())).map((page) => page.eventStream("framenavigated"));
|
|
28
28
|
const newPages = pipe(contexts.map((c) => c.eventStream("page")), Stream.mergeAll({ concurrency: "unbounded" }), Stream.flatMap((page) => page.eventStream("framenavigated"), { concurrency: "unbounded" }));
|
|
29
29
|
return Stream.mergeAll([newPages, ...currentPages], { concurrency: "unbounded" });
|
|
30
30
|
}).pipe(Stream.unwrap);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Context, Effect, Layer, Option, Scope, Stream } from "effect";
|
|
2
|
-
import { Browser, BrowserContext, BrowserType, Clock, ConnectOverCDPOptions, ConsoleMessage, Dialog, Download, ElementHandle, FileChooser, Frame, JSHandle, Keyboard, Locator, Mouse, Page, Request, Response, Touchscreen, WebError, WebSocket, Worker, chromium } from "playwright-core";
|
|
2
|
+
import { Browser, BrowserContext, BrowserType, Clock, ConnectOverCDPOptions, ConsoleMessage, Dialog, Download, ElementHandle, FileChooser, Frame, FrameLocator, JSHandle, Keyboard, Locator, Mouse, Page, Request, Response, Touchscreen, WebError, WebSocket, Worker, chromium } from "playwright-core";
|
|
3
3
|
import { Scope as Scope$1 } from "effect/Scope";
|
|
4
|
-
import * as effect_Types0 from "effect/Types";
|
|
5
|
-
import * as effect_Cause0 from "effect/Cause";
|
|
4
|
+
import * as _$effect_Types0 from "effect/Types";
|
|
5
|
+
import * as _$effect_Cause0 from "effect/Cause";
|
|
6
6
|
|
|
7
7
|
//#region src/errors.d.ts
|
|
8
8
|
/**
|
|
@@ -13,7 +13,7 @@ import * as effect_Cause0 from "effect/Cause";
|
|
|
13
13
|
* @since 0.1.0
|
|
14
14
|
*/
|
|
15
15
|
type PlaywrightErrorReason = "Timeout" | "Unknown";
|
|
16
|
-
declare const PlaywrightError_base: new <A extends Record<string, any> = {}>(args: effect_Types0.
|
|
16
|
+
declare const PlaywrightError_base: new <A extends Record<string, any> = {}>(args: _$effect_Types0.VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => _$effect_Cause0.YieldableError & {
|
|
17
17
|
readonly _tag: "PlaywrightError";
|
|
18
18
|
} & Readonly<A>;
|
|
19
19
|
/**
|
|
@@ -31,6 +31,111 @@ declare class PlaywrightError extends PlaywrightError_base<{
|
|
|
31
31
|
cause: unknown;
|
|
32
32
|
}> {}
|
|
33
33
|
//#endregion
|
|
34
|
+
//#region src/frame-locator.d.ts
|
|
35
|
+
/**
|
|
36
|
+
* Interface for a Playwright frame locator.
|
|
37
|
+
* @category model
|
|
38
|
+
*/
|
|
39
|
+
interface PlaywrightFrameLocatorService {
|
|
40
|
+
/**
|
|
41
|
+
* The underlying Playwright FrameLocator instance.
|
|
42
|
+
* @internal
|
|
43
|
+
*/
|
|
44
|
+
readonly _raw: FrameLocator;
|
|
45
|
+
/**
|
|
46
|
+
* Returns locator to the first matching frame.
|
|
47
|
+
*
|
|
48
|
+
* @see {@link FrameLocator.first}
|
|
49
|
+
* @since 0.1.0
|
|
50
|
+
*/
|
|
51
|
+
readonly first: () => PlaywrightFrameLocatorService;
|
|
52
|
+
/**
|
|
53
|
+
* When working with iframes, you can create a frame locator that will enter the iframe and allow selecting elements
|
|
54
|
+
* in that iframe.
|
|
55
|
+
*
|
|
56
|
+
* @see {@link FrameLocator.frameLocator}
|
|
57
|
+
* @since 0.1.0
|
|
58
|
+
*/
|
|
59
|
+
readonly frameLocator: (selector: string) => PlaywrightFrameLocatorService;
|
|
60
|
+
/**
|
|
61
|
+
* Returns locator to the last matching frame.
|
|
62
|
+
*
|
|
63
|
+
* @see {@link FrameLocator.last}
|
|
64
|
+
* @since 0.1.0
|
|
65
|
+
*/
|
|
66
|
+
readonly last: () => PlaywrightFrameLocatorService;
|
|
67
|
+
/**
|
|
68
|
+
* Returns locator to the n-th matching frame.
|
|
69
|
+
*
|
|
70
|
+
* @see {@link FrameLocator.nth}
|
|
71
|
+
* @since 0.1.0
|
|
72
|
+
*/
|
|
73
|
+
readonly nth: (index: number) => PlaywrightFrameLocatorService;
|
|
74
|
+
/**
|
|
75
|
+
* Returns a `Locator` object pointing to the same `iframe` as this frame locator.
|
|
76
|
+
*
|
|
77
|
+
* @see {@link FrameLocator.owner}
|
|
78
|
+
* @since 0.1.0
|
|
79
|
+
*/
|
|
80
|
+
readonly owner: () => PlaywrightLocatorService;
|
|
81
|
+
/**
|
|
82
|
+
* Finds an element matching the specified selector in the locator's subtree.
|
|
83
|
+
*
|
|
84
|
+
* @see {@link FrameLocator.locator}
|
|
85
|
+
* @since 0.1.0
|
|
86
|
+
*/
|
|
87
|
+
readonly locator: (selectorOrLocator: string | Locator | PlaywrightLocatorService, options?: Parameters<FrameLocator["locator"]>[1]) => PlaywrightLocatorService;
|
|
88
|
+
/**
|
|
89
|
+
* Allows locating elements by their ARIA role.
|
|
90
|
+
*
|
|
91
|
+
* @see {@link FrameLocator.getByRole}
|
|
92
|
+
* @since 0.1.0
|
|
93
|
+
*/
|
|
94
|
+
readonly getByRole: (role: Parameters<FrameLocator["getByRole"]>[0], options?: Parameters<FrameLocator["getByRole"]>[1]) => PlaywrightLocatorService;
|
|
95
|
+
/**
|
|
96
|
+
* Allows locating elements that contain given text.
|
|
97
|
+
*
|
|
98
|
+
* @see {@link FrameLocator.getByText}
|
|
99
|
+
* @since 0.1.0
|
|
100
|
+
*/
|
|
101
|
+
readonly getByText: (text: Parameters<FrameLocator["getByText"]>[0], options?: Parameters<FrameLocator["getByText"]>[1]) => PlaywrightLocatorService;
|
|
102
|
+
/**
|
|
103
|
+
* Allows locating elements by their label text.
|
|
104
|
+
*
|
|
105
|
+
* @see {@link FrameLocator.getByLabel}
|
|
106
|
+
* @since 0.1.0
|
|
107
|
+
*/
|
|
108
|
+
readonly getByLabel: (text: Parameters<FrameLocator["getByLabel"]>[0], options?: Parameters<FrameLocator["getByLabel"]>[1]) => PlaywrightLocatorService;
|
|
109
|
+
/**
|
|
110
|
+
* Allows locating elements by their placeholder text.
|
|
111
|
+
*
|
|
112
|
+
* @see {@link FrameLocator.getByPlaceholder}
|
|
113
|
+
* @since 0.1.0
|
|
114
|
+
*/
|
|
115
|
+
readonly getByPlaceholder: (text: Parameters<FrameLocator["getByPlaceholder"]>[0], options?: Parameters<FrameLocator["getByPlaceholder"]>[1]) => PlaywrightLocatorService;
|
|
116
|
+
/**
|
|
117
|
+
* Allows locating elements by their alt text.
|
|
118
|
+
*
|
|
119
|
+
* @see {@link FrameLocator.getByAltText}
|
|
120
|
+
* @since 0.1.0
|
|
121
|
+
*/
|
|
122
|
+
readonly getByAltText: (text: Parameters<FrameLocator["getByAltText"]>[0], options?: Parameters<FrameLocator["getByAltText"]>[1]) => PlaywrightLocatorService;
|
|
123
|
+
/**
|
|
124
|
+
* Allows locating elements by their title attribute.
|
|
125
|
+
*
|
|
126
|
+
* @see {@link FrameLocator.getByTitle}
|
|
127
|
+
* @since 0.1.0
|
|
128
|
+
*/
|
|
129
|
+
readonly getByTitle: (text: Parameters<FrameLocator["getByTitle"]>[0], options?: Parameters<FrameLocator["getByTitle"]>[1]) => PlaywrightLocatorService;
|
|
130
|
+
/**
|
|
131
|
+
* Allows locating elements by their test id.
|
|
132
|
+
*
|
|
133
|
+
* @see {@link FrameLocator.getByTestId}
|
|
134
|
+
* @since 0.1.0
|
|
135
|
+
*/
|
|
136
|
+
readonly getByTestId: (testId: Parameters<FrameLocator["getByTestId"]>[0]) => PlaywrightLocatorService;
|
|
137
|
+
}
|
|
138
|
+
//#endregion
|
|
34
139
|
//#region src/playwright-types.d.ts
|
|
35
140
|
/**
|
|
36
141
|
* Extracted from `playwright-core/types/structs.d.ts` because it is not exported over the package boundary.
|
|
@@ -60,6 +165,11 @@ type PatchedEvents<Original, Events> = Original & {
|
|
|
60
165
|
* @category model
|
|
61
166
|
*/
|
|
62
167
|
interface PlaywrightLocatorService {
|
|
168
|
+
/**
|
|
169
|
+
* The underlying Playwright Locator instance.
|
|
170
|
+
* @internal
|
|
171
|
+
*/
|
|
172
|
+
readonly _raw: Locator;
|
|
63
173
|
/**
|
|
64
174
|
* Clicks the element.
|
|
65
175
|
*
|
|
@@ -67,6 +177,13 @@ interface PlaywrightLocatorService {
|
|
|
67
177
|
* @since 0.1.0
|
|
68
178
|
*/
|
|
69
179
|
readonly click: (options?: Parameters<Locator["click"]>[0]) => Effect.Effect<void, PlaywrightError>;
|
|
180
|
+
/**
|
|
181
|
+
* Checks the element.
|
|
182
|
+
*
|
|
183
|
+
* @see {@link Locator.check}
|
|
184
|
+
* @since 0.1.0
|
|
185
|
+
*/
|
|
186
|
+
readonly check: (options?: Parameters<Locator["check"]>[0]) => Effect.Effect<void, PlaywrightError>;
|
|
70
187
|
/**
|
|
71
188
|
* Fills the input field.
|
|
72
189
|
*
|
|
@@ -109,6 +226,53 @@ interface PlaywrightLocatorService {
|
|
|
109
226
|
* @since 0.1.0
|
|
110
227
|
*/
|
|
111
228
|
readonly textContent: (options?: Parameters<Locator["textContent"]>[0]) => Effect.Effect<string | null, PlaywrightError>;
|
|
229
|
+
/**
|
|
230
|
+
* Gets all inner texts.
|
|
231
|
+
*
|
|
232
|
+
* @see {@link Locator.allInnerTexts}
|
|
233
|
+
* @since 0.1.0
|
|
234
|
+
*/
|
|
235
|
+
readonly allInnerTexts: () => Effect.Effect<ReadonlyArray<string>, PlaywrightError>;
|
|
236
|
+
/**
|
|
237
|
+
* Gets all text contents.
|
|
238
|
+
*
|
|
239
|
+
* @see {@link Locator.allTextContents}
|
|
240
|
+
* @since 0.1.0
|
|
241
|
+
*/
|
|
242
|
+
readonly allTextContents: () => Effect.Effect<ReadonlyArray<string>, PlaywrightError>;
|
|
243
|
+
/**
|
|
244
|
+
* Returns the accessibility tree snapshot.
|
|
245
|
+
*
|
|
246
|
+
* @see {@link Locator.ariaSnapshot}
|
|
247
|
+
* @since 0.1.0
|
|
248
|
+
*/
|
|
249
|
+
readonly ariaSnapshot: (options?: Parameters<Locator["ariaSnapshot"]>[0]) => Effect.Effect<string, PlaywrightError>;
|
|
250
|
+
/**
|
|
251
|
+
* Returns the bounding box of the element.
|
|
252
|
+
*
|
|
253
|
+
* @see {@link Locator.boundingBox}
|
|
254
|
+
* @since 0.1.0
|
|
255
|
+
*/
|
|
256
|
+
readonly boundingBox: (options?: Parameters<Locator["boundingBox"]>[0]) => Effect.Effect<Option.Option<{
|
|
257
|
+
x: number;
|
|
258
|
+
y: number;
|
|
259
|
+
width: number;
|
|
260
|
+
height: number;
|
|
261
|
+
}>, PlaywrightError>;
|
|
262
|
+
/**
|
|
263
|
+
* Describes the locator.
|
|
264
|
+
*
|
|
265
|
+
* @see {@link Locator.describe}
|
|
266
|
+
* @since 0.1.0
|
|
267
|
+
*/
|
|
268
|
+
readonly describe: (description: string) => PlaywrightLocatorService;
|
|
269
|
+
/**
|
|
270
|
+
* Returns the description of the locator.
|
|
271
|
+
*
|
|
272
|
+
* @see {@link Locator.description}
|
|
273
|
+
* @since 0.1.0
|
|
274
|
+
*/
|
|
275
|
+
readonly description: () => Option.Option<string>;
|
|
112
276
|
/**
|
|
113
277
|
* Counts the number of matched elements.
|
|
114
278
|
*
|
|
@@ -136,6 +300,111 @@ interface PlaywrightLocatorService {
|
|
|
136
300
|
* @since 0.1.0
|
|
137
301
|
*/
|
|
138
302
|
readonly nth: (index: number) => PlaywrightLocatorService;
|
|
303
|
+
/**
|
|
304
|
+
* Returns a locator that points to a matched element.
|
|
305
|
+
*
|
|
306
|
+
* @see {@link Locator.locator}
|
|
307
|
+
* @since 0.1.0
|
|
308
|
+
*/
|
|
309
|
+
readonly locator: (selectorOrLocator: string | Locator | PlaywrightLocatorService, options?: Parameters<Locator["locator"]>[1]) => PlaywrightLocatorService;
|
|
310
|
+
/**
|
|
311
|
+
* Allows locating elements by their ARIA role, ARIA attributes and accessible name.
|
|
312
|
+
*
|
|
313
|
+
* @see {@link Locator.getByRole}
|
|
314
|
+
* @since 0.1.0
|
|
315
|
+
*/
|
|
316
|
+
readonly getByRole: (role: Parameters<Locator["getByRole"]>[0], options?: Parameters<Locator["getByRole"]>[1]) => PlaywrightLocatorService;
|
|
317
|
+
/**
|
|
318
|
+
* Allows locating elements that contain given text.
|
|
319
|
+
*
|
|
320
|
+
* @see {@link Locator.getByText}
|
|
321
|
+
* @since 0.1.0
|
|
322
|
+
*/
|
|
323
|
+
readonly getByText: (text: Parameters<Locator["getByText"]>[0], options?: Parameters<Locator["getByText"]>[1]) => PlaywrightLocatorService;
|
|
324
|
+
/**
|
|
325
|
+
* Allows locating elements by their label text.
|
|
326
|
+
*
|
|
327
|
+
* @see {@link Locator.getByLabel}
|
|
328
|
+
* @since 0.1.0
|
|
329
|
+
*/
|
|
330
|
+
readonly getByLabel: (text: Parameters<Locator["getByLabel"]>[0], options?: Parameters<Locator["getByLabel"]>[1]) => PlaywrightLocatorService;
|
|
331
|
+
/**
|
|
332
|
+
* Allows locating elements by their placeholder text.
|
|
333
|
+
*
|
|
334
|
+
* @see {@link Locator.getByPlaceholder}
|
|
335
|
+
* @since 0.1.0
|
|
336
|
+
*/
|
|
337
|
+
readonly getByPlaceholder: (text: Parameters<Locator["getByPlaceholder"]>[0], options?: Parameters<Locator["getByPlaceholder"]>[1]) => PlaywrightLocatorService;
|
|
338
|
+
/**
|
|
339
|
+
* Allows locating elements by their alt text.
|
|
340
|
+
*
|
|
341
|
+
* @see {@link Locator.getByAltText}
|
|
342
|
+
* @since 0.1.0
|
|
343
|
+
*/
|
|
344
|
+
readonly getByAltText: (text: Parameters<Locator["getByAltText"]>[0], options?: Parameters<Locator["getByAltText"]>[1]) => PlaywrightLocatorService;
|
|
345
|
+
/**
|
|
346
|
+
* Allows locating elements by their title attribute.
|
|
347
|
+
*
|
|
348
|
+
* @see {@link Locator.getByTitle}
|
|
349
|
+
* @since 0.1.0
|
|
350
|
+
*/
|
|
351
|
+
readonly getByTitle: (text: Parameters<Locator["getByTitle"]>[0], options?: Parameters<Locator["getByTitle"]>[1]) => PlaywrightLocatorService;
|
|
352
|
+
/**
|
|
353
|
+
* Allows locating elements by their test id.
|
|
354
|
+
*
|
|
355
|
+
* @see {@link Locator.getByTestId}
|
|
356
|
+
* @since 0.1.0
|
|
357
|
+
*/
|
|
358
|
+
readonly getByTestId: (testId: Parameters<Locator["getByTestId"]>[0]) => PlaywrightLocatorService;
|
|
359
|
+
/**
|
|
360
|
+
* Returns whether the element is checked.
|
|
361
|
+
*
|
|
362
|
+
* @see {@link Locator.isChecked}
|
|
363
|
+
* @since 0.4.1
|
|
364
|
+
*/
|
|
365
|
+
readonly isChecked: (options?: Parameters<Locator["isChecked"]>[0]) => Effect.Effect<boolean, PlaywrightError>;
|
|
366
|
+
/**
|
|
367
|
+
* Returns whether the element is disabled.
|
|
368
|
+
*
|
|
369
|
+
* @see {@link Locator.isDisabled}
|
|
370
|
+
* @since 0.4.1
|
|
371
|
+
*/
|
|
372
|
+
readonly isDisabled: (options?: Parameters<Locator["isDisabled"]>[0]) => Effect.Effect<boolean, PlaywrightError>;
|
|
373
|
+
/**
|
|
374
|
+
* Returns whether the element is editable.
|
|
375
|
+
*
|
|
376
|
+
* @see {@link Locator.isEditable}
|
|
377
|
+
* @since 0.4.1
|
|
378
|
+
*/
|
|
379
|
+
readonly isEditable: (options?: Parameters<Locator["isEditable"]>[0]) => Effect.Effect<boolean, PlaywrightError>;
|
|
380
|
+
/**
|
|
381
|
+
* Returns whether the element is enabled.
|
|
382
|
+
*
|
|
383
|
+
* @see {@link Locator.isEnabled}
|
|
384
|
+
* @since 0.4.1
|
|
385
|
+
*/
|
|
386
|
+
readonly isEnabled: (options?: Parameters<Locator["isEnabled"]>[0]) => Effect.Effect<boolean, PlaywrightError>;
|
|
387
|
+
/**
|
|
388
|
+
* Returns whether the element is hidden.
|
|
389
|
+
*
|
|
390
|
+
* @see {@link Locator.isHidden}
|
|
391
|
+
* @since 0.4.1
|
|
392
|
+
*/
|
|
393
|
+
readonly isHidden: (options?: Parameters<Locator["isHidden"]>[0]) => Effect.Effect<boolean, PlaywrightError>;
|
|
394
|
+
/**
|
|
395
|
+
* Returns whether the element is visible.
|
|
396
|
+
*
|
|
397
|
+
* @see {@link Locator.isVisible}
|
|
398
|
+
* @since 0.4.1
|
|
399
|
+
*/
|
|
400
|
+
readonly isVisible: (options?: Parameters<Locator["isVisible"]>[0]) => Effect.Effect<boolean, PlaywrightError>;
|
|
401
|
+
/**
|
|
402
|
+
* Returns when element specified by locator satisfies the `state` option.
|
|
403
|
+
*
|
|
404
|
+
* @see {@link Locator.waitFor}
|
|
405
|
+
* @since 0.1.0
|
|
406
|
+
*/
|
|
407
|
+
readonly waitFor: (options?: Parameters<Locator["waitFor"]>[0]) => Effect.Effect<void, PlaywrightError>;
|
|
139
408
|
/**
|
|
140
409
|
* Evaluates a function on the matched element.
|
|
141
410
|
*
|
|
@@ -160,6 +429,216 @@ interface PlaywrightLocatorService {
|
|
|
160
429
|
readonly evaluate: <R, Arg = void, E extends SVGElement | HTMLElement = SVGElement | HTMLElement>(pageFunction: (element: E, arg: Unboxed<Arg>) => R | Promise<R>, arg?: Arg, options?: {
|
|
161
430
|
timeout?: number;
|
|
162
431
|
}) => Effect.Effect<R, PlaywrightError>;
|
|
432
|
+
/**
|
|
433
|
+
* Highlights the corresponding element(s) on the screen.
|
|
434
|
+
*
|
|
435
|
+
* @see {@link Locator.highlight}
|
|
436
|
+
* @since 0.4.1
|
|
437
|
+
*/
|
|
438
|
+
readonly highlight: () => Effect.Effect<void, PlaywrightError>;
|
|
439
|
+
/**
|
|
440
|
+
* Captures a screenshot of the element.
|
|
441
|
+
*
|
|
442
|
+
* @see {@link Locator.screenshot}
|
|
443
|
+
* @since 0.4.1
|
|
444
|
+
*/
|
|
445
|
+
readonly screenshot: (options?: Parameters<Locator["screenshot"]>[0]) => Effect.Effect<Buffer, PlaywrightError>;
|
|
446
|
+
/**
|
|
447
|
+
* Returns the string representation of the locator.
|
|
448
|
+
*
|
|
449
|
+
* @see {@link Locator.toString}
|
|
450
|
+
* @since 0.4.1
|
|
451
|
+
*/
|
|
452
|
+
readonly toString: () => string;
|
|
453
|
+
/**
|
|
454
|
+
* Evaluates a function on all matched elements.
|
|
455
|
+
*
|
|
456
|
+
* @see {@link Locator.evaluateAll}
|
|
457
|
+
* @since 0.3.0
|
|
458
|
+
*/
|
|
459
|
+
readonly evaluateAll: <R, Arg = void, E extends SVGElement | HTMLElement = SVGElement | HTMLElement>(pageFunction: (elements: E[], arg: Unboxed<Arg>) => R | Promise<R>, arg?: Arg) => Effect.Effect<R, PlaywrightError>;
|
|
460
|
+
/**
|
|
461
|
+
* Evaluates a function on the matched element and returns the result as a handle.
|
|
462
|
+
*
|
|
463
|
+
* @see {@link Locator.evaluateHandle}
|
|
464
|
+
* @since 0.3.0
|
|
465
|
+
*/
|
|
466
|
+
readonly evaluateHandle: <R, Arg = void, E extends SVGElement | HTMLElement = SVGElement | HTMLElement>(pageFunction: (element: E, arg: Unboxed<Arg>) => R | Promise<R>, arg?: Arg) => Effect.Effect<JSHandle<R>, PlaywrightError>;
|
|
467
|
+
/**
|
|
468
|
+
* Resolves given locator to the first matching DOM element.
|
|
469
|
+
*
|
|
470
|
+
* @see {@link Locator.elementHandle}
|
|
471
|
+
* @since 0.3.0
|
|
472
|
+
*/
|
|
473
|
+
readonly elementHandle: (options?: Parameters<Locator["elementHandle"]>[0]) => Effect.Effect<Option.Option<ElementHandle<SVGElement | HTMLElement>>, PlaywrightError>;
|
|
474
|
+
/**
|
|
475
|
+
* Resolves given locator to all matching DOM elements.
|
|
476
|
+
*
|
|
477
|
+
* @see {@link Locator.elementHandles}
|
|
478
|
+
* @since 0.3.0
|
|
479
|
+
*/
|
|
480
|
+
readonly elementHandles: () => Effect.Effect<ReadonlyArray<ElementHandle<SVGElement | HTMLElement>>, PlaywrightError>;
|
|
481
|
+
/**
|
|
482
|
+
* Returns an array of locators pointing to the matched elements.
|
|
483
|
+
*
|
|
484
|
+
* @see {@link Locator.all}
|
|
485
|
+
* @since 0.4.1
|
|
486
|
+
*/
|
|
487
|
+
readonly all: () => Effect.Effect<ReadonlyArray<PlaywrightLocatorService>, PlaywrightError>;
|
|
488
|
+
/**
|
|
489
|
+
* Creates a locator that matches both this locator and the argument locator.
|
|
490
|
+
*
|
|
491
|
+
* @see {@link Locator.and}
|
|
492
|
+
* @since 0.4.1
|
|
493
|
+
*/
|
|
494
|
+
readonly and: (locator: PlaywrightLocatorService | Locator) => PlaywrightLocatorService;
|
|
495
|
+
/**
|
|
496
|
+
* Returns a FrameLocator object pointing to the same iframe as this locator.
|
|
497
|
+
*
|
|
498
|
+
* @see {@link Locator.contentFrame}
|
|
499
|
+
* @since 0.4.1
|
|
500
|
+
*/
|
|
501
|
+
readonly contentFrame: () => PlaywrightFrameLocatorService;
|
|
502
|
+
/**
|
|
503
|
+
* Narrows existing locator according to the options.
|
|
504
|
+
*
|
|
505
|
+
* @see {@link Locator.filter}
|
|
506
|
+
* @since 0.4.1
|
|
507
|
+
*/
|
|
508
|
+
readonly filter: (options?: Parameters<Locator["filter"]>[0]) => PlaywrightLocatorService;
|
|
509
|
+
/**
|
|
510
|
+
* Creates a frame locator that will enter the iframe and allow selecting elements in that iframe.
|
|
511
|
+
*
|
|
512
|
+
* @see {@link Locator.frameLocator}
|
|
513
|
+
* @since 0.4.1
|
|
514
|
+
*/
|
|
515
|
+
readonly frameLocator: (selector: string) => PlaywrightFrameLocatorService;
|
|
516
|
+
/**
|
|
517
|
+
* Creates a locator that matches either this locator or the argument locator.
|
|
518
|
+
*
|
|
519
|
+
* @see {@link Locator.or}
|
|
520
|
+
* @since 0.4.1
|
|
521
|
+
*/
|
|
522
|
+
readonly or: (locator: PlaywrightLocatorService | Locator) => PlaywrightLocatorService;
|
|
523
|
+
/**
|
|
524
|
+
* A page this locator belongs to.
|
|
525
|
+
*
|
|
526
|
+
* @see {@link Locator.page}
|
|
527
|
+
* @since 0.4.1
|
|
528
|
+
*/
|
|
529
|
+
readonly page: () => typeof PlaywrightPage.Service;
|
|
530
|
+
/**
|
|
531
|
+
* Removes keyboard focus from the current element.
|
|
532
|
+
*
|
|
533
|
+
* @see {@link Locator.blur}
|
|
534
|
+
* @since 0.4.2
|
|
535
|
+
*/
|
|
536
|
+
readonly blur: (options?: Parameters<Locator["blur"]>[0]) => Effect.Effect<void, PlaywrightError>;
|
|
537
|
+
/**
|
|
538
|
+
* Clear the input field.
|
|
539
|
+
*
|
|
540
|
+
* @see {@link Locator.clear}
|
|
541
|
+
* @since 0.4.2
|
|
542
|
+
*/
|
|
543
|
+
readonly clear: (options?: Parameters<Locator["clear"]>[0]) => Effect.Effect<void, PlaywrightError>;
|
|
544
|
+
/**
|
|
545
|
+
* Double-clicks the element.
|
|
546
|
+
*
|
|
547
|
+
* @see {@link Locator.dblclick}
|
|
548
|
+
* @since 0.4.2
|
|
549
|
+
*/
|
|
550
|
+
readonly dblclick: (options?: Parameters<Locator["dblclick"]>[0]) => Effect.Effect<void, PlaywrightError>;
|
|
551
|
+
/**
|
|
552
|
+
* Dispatches an event.
|
|
553
|
+
*
|
|
554
|
+
* @see {@link Locator.dispatchEvent}
|
|
555
|
+
* @since 0.4.2
|
|
556
|
+
*/
|
|
557
|
+
readonly dispatchEvent: (type: Parameters<Locator["dispatchEvent"]>[0], eventInit?: Parameters<Locator["dispatchEvent"]>[1], options?: Parameters<Locator["dispatchEvent"]>[2]) => Effect.Effect<void, PlaywrightError>;
|
|
558
|
+
/**
|
|
559
|
+
* Drags the locator to another target locator.
|
|
560
|
+
*
|
|
561
|
+
* @see {@link Locator.dragTo}
|
|
562
|
+
* @since 0.4.2
|
|
563
|
+
*/
|
|
564
|
+
readonly dragTo: (target: PlaywrightLocatorService | Locator, options?: Parameters<Locator["dragTo"]>[1]) => Effect.Effect<void, PlaywrightError>;
|
|
565
|
+
/**
|
|
566
|
+
* Focuses the element.
|
|
567
|
+
*
|
|
568
|
+
* @see {@link Locator.focus}
|
|
569
|
+
* @since 0.4.2
|
|
570
|
+
*/
|
|
571
|
+
readonly focus: (options?: Parameters<Locator["focus"]>[0]) => Effect.Effect<void, PlaywrightError>;
|
|
572
|
+
/**
|
|
573
|
+
* Hovers over the element.
|
|
574
|
+
*
|
|
575
|
+
* @see {@link Locator.hover}
|
|
576
|
+
* @since 0.4.2
|
|
577
|
+
*/
|
|
578
|
+
readonly hover: (options?: Parameters<Locator["hover"]>[0]) => Effect.Effect<void, PlaywrightError>;
|
|
579
|
+
/**
|
|
580
|
+
* Focuses the element, and then uses `keyboard.down` and `keyboard.up`.
|
|
581
|
+
*
|
|
582
|
+
* @see {@link Locator.press}
|
|
583
|
+
* @since 0.4.2
|
|
584
|
+
*/
|
|
585
|
+
readonly press: (key: Parameters<Locator["press"]>[0], options?: Parameters<Locator["press"]>[1]) => Effect.Effect<void, PlaywrightError>;
|
|
586
|
+
/**
|
|
587
|
+
* Focuses the element, and then sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in the text.
|
|
588
|
+
*
|
|
589
|
+
* @see {@link Locator.pressSequentially}
|
|
590
|
+
* @since 0.4.2
|
|
591
|
+
*/
|
|
592
|
+
readonly pressSequentially: (text: Parameters<Locator["pressSequentially"]>[0], options?: Parameters<Locator["pressSequentially"]>[1]) => Effect.Effect<void, PlaywrightError>;
|
|
593
|
+
/**
|
|
594
|
+
* Scrolls the element into view if needed.
|
|
595
|
+
*
|
|
596
|
+
* @see {@link Locator.scrollIntoViewIfNeeded}
|
|
597
|
+
* @since 0.4.2
|
|
598
|
+
*/
|
|
599
|
+
readonly scrollIntoViewIfNeeded: (options?: Parameters<Locator["scrollIntoViewIfNeeded"]>[0]) => Effect.Effect<void, PlaywrightError>;
|
|
600
|
+
/**
|
|
601
|
+
* Selects an option in a `<select>` element.
|
|
602
|
+
*
|
|
603
|
+
* @see {@link Locator.selectOption}
|
|
604
|
+
* @since 0.4.2
|
|
605
|
+
*/
|
|
606
|
+
readonly selectOption: (values: Parameters<Locator["selectOption"]>[0], options?: Parameters<Locator["selectOption"]>[1]) => Effect.Effect<ReadonlyArray<string>, PlaywrightError>;
|
|
607
|
+
/**
|
|
608
|
+
* Selects text.
|
|
609
|
+
*
|
|
610
|
+
* @see {@link Locator.selectText}
|
|
611
|
+
* @since 0.4.2
|
|
612
|
+
*/
|
|
613
|
+
readonly selectText: (options?: Parameters<Locator["selectText"]>[0]) => Effect.Effect<void, PlaywrightError>;
|
|
614
|
+
/**
|
|
615
|
+
* Checks the element if not already checked.
|
|
616
|
+
*
|
|
617
|
+
* @see {@link Locator.setChecked}
|
|
618
|
+
* @since 0.4.2
|
|
619
|
+
*/
|
|
620
|
+
readonly setChecked: (checked: Parameters<Locator["setChecked"]>[0], options?: Parameters<Locator["setChecked"]>[1]) => Effect.Effect<void, PlaywrightError>;
|
|
621
|
+
/**
|
|
622
|
+
* Sets the value of the file input.
|
|
623
|
+
*
|
|
624
|
+
* @see {@link Locator.setInputFiles}
|
|
625
|
+
* @since 0.4.2
|
|
626
|
+
*/
|
|
627
|
+
readonly setInputFiles: (files: Parameters<Locator["setInputFiles"]>[0], options?: Parameters<Locator["setInputFiles"]>[1]) => Effect.Effect<void, PlaywrightError>;
|
|
628
|
+
/**
|
|
629
|
+
* Taps the element.
|
|
630
|
+
*
|
|
631
|
+
* @see {@link Locator.tap}
|
|
632
|
+
* @since 0.4.2
|
|
633
|
+
*/
|
|
634
|
+
readonly tap: (options?: Parameters<Locator["tap"]>[0]) => Effect.Effect<void, PlaywrightError>;
|
|
635
|
+
/**
|
|
636
|
+
* Unchecks the element.
|
|
637
|
+
*
|
|
638
|
+
* @see {@link Locator.uncheck}
|
|
639
|
+
* @since 0.4.2
|
|
640
|
+
*/
|
|
641
|
+
readonly uncheck: (options?: Parameters<Locator["uncheck"]>[0]) => Effect.Effect<void, PlaywrightError>;
|
|
163
642
|
/**
|
|
164
643
|
* A generic utility to execute any promise-based method on the underlying Playwright `Locator`.
|
|
165
644
|
* Can be used to access any Locator functionality not directly exposed by this service.
|
|
@@ -287,6 +766,69 @@ interface PlaywrightFrameService {
|
|
|
287
766
|
* @since 0.1.3
|
|
288
767
|
*/
|
|
289
768
|
readonly getByTestId: (testId: Parameters<Frame["getByTestId"]>[0]) => typeof PlaywrightLocator.Service;
|
|
769
|
+
/**
|
|
770
|
+
* Returns a locator that matches the given placeholder.
|
|
771
|
+
*
|
|
772
|
+
* @see {@link Frame.getByPlaceholder}
|
|
773
|
+
* @since 0.4.1
|
|
774
|
+
*/
|
|
775
|
+
readonly getByPlaceholder: (text: Parameters<Frame["getByPlaceholder"]>[0], options?: Parameters<Frame["getByPlaceholder"]>[1]) => typeof PlaywrightLocator.Service;
|
|
776
|
+
/**
|
|
777
|
+
* Returns a locator that matches the given alt text.
|
|
778
|
+
*
|
|
779
|
+
* @see {@link Frame.getByAltText}
|
|
780
|
+
* @since 0.4.1
|
|
781
|
+
*/
|
|
782
|
+
readonly getByAltText: (text: Parameters<Frame["getByAltText"]>[0], options?: Parameters<Frame["getByAltText"]>[1]) => typeof PlaywrightLocator.Service;
|
|
783
|
+
/**
|
|
784
|
+
* Returns a locator that matches the given title.
|
|
785
|
+
*
|
|
786
|
+
* @see {@link Frame.getByTitle}
|
|
787
|
+
* @since 0.4.1
|
|
788
|
+
*/
|
|
789
|
+
readonly getByTitle: (text: Parameters<Frame["getByTitle"]>[0], options?: Parameters<Frame["getByTitle"]>[1]) => typeof PlaywrightLocator.Service;
|
|
790
|
+
/**
|
|
791
|
+
* Returns the page that the frame belongs to.
|
|
792
|
+
*
|
|
793
|
+
* @see {@link Frame.page}
|
|
794
|
+
* @since 0.4.1
|
|
795
|
+
*/
|
|
796
|
+
readonly page: () => PlaywrightPageService;
|
|
797
|
+
/**
|
|
798
|
+
* Returns the parent frame, if any.
|
|
799
|
+
*
|
|
800
|
+
* @see {@link Frame.parentFrame}
|
|
801
|
+
* @since 0.4.1
|
|
802
|
+
*/
|
|
803
|
+
readonly parentFrame: () => Option.Option<PlaywrightFrameService>;
|
|
804
|
+
/**
|
|
805
|
+
* Returns an array of child frames.
|
|
806
|
+
*
|
|
807
|
+
* @see {@link Frame.childFrames}
|
|
808
|
+
* @since 0.4.1
|
|
809
|
+
*/
|
|
810
|
+
readonly childFrames: () => ReadonlyArray<PlaywrightFrameService>;
|
|
811
|
+
/**
|
|
812
|
+
* Returns whether the frame is detached.
|
|
813
|
+
*
|
|
814
|
+
* @see {@link Frame.isDetached}
|
|
815
|
+
* @since 0.4.1
|
|
816
|
+
*/
|
|
817
|
+
readonly isDetached: () => boolean;
|
|
818
|
+
/**
|
|
819
|
+
* Waits for the given timeout in milliseconds.
|
|
820
|
+
*
|
|
821
|
+
* @see {@link Frame.waitForTimeout}
|
|
822
|
+
* @since 0.4.1
|
|
823
|
+
*/
|
|
824
|
+
readonly waitForTimeout: (timeout: number) => Effect.Effect<void, PlaywrightError>;
|
|
825
|
+
/**
|
|
826
|
+
* Sets the HTML content of the frame.
|
|
827
|
+
*
|
|
828
|
+
* @see {@link Frame.setContent}
|
|
829
|
+
* @since 0.4.1
|
|
830
|
+
*/
|
|
831
|
+
readonly setContent: (html: string, options?: Parameters<Frame["setContent"]>[1]) => Effect.Effect<void, PlaywrightError>;
|
|
290
832
|
/**
|
|
291
833
|
* Returns the current URL of the frame.
|
|
292
834
|
*
|
|
@@ -421,7 +963,7 @@ declare class PlaywrightClock extends PlaywrightClock_base {
|
|
|
421
963
|
}
|
|
422
964
|
//#endregion
|
|
423
965
|
//#region src/common.d.ts
|
|
424
|
-
declare const PlaywrightRequest_base: new <A extends Record<string, any> = {}>(args: effect_Types0.
|
|
966
|
+
declare const PlaywrightRequest_base: new <A extends Record<string, any> = {}>(args: _$effect_Types0.VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => Readonly<A> & {
|
|
425
967
|
readonly _tag: "PlaywrightRequest";
|
|
426
968
|
};
|
|
427
969
|
/**
|
|
@@ -443,7 +985,7 @@ declare class PlaywrightRequest extends PlaywrightRequest_base<{
|
|
|
443
985
|
* Returns the Frame that initiated this request.
|
|
444
986
|
* @see {@link Request.frame}
|
|
445
987
|
*/
|
|
446
|
-
frame: Effect.Effect<PlaywrightFrameService>;
|
|
988
|
+
frame: Effect.Effect<PlaywrightFrameService, PlaywrightError>;
|
|
447
989
|
/**
|
|
448
990
|
* Returns the value of the header matching the name. The name is case insensitive.
|
|
449
991
|
* @see {@link Request.headerValue}
|
|
@@ -527,7 +1069,7 @@ declare class PlaywrightRequest extends PlaywrightRequest_base<{
|
|
|
527
1069
|
}> {
|
|
528
1070
|
static make(request: Request): PlaywrightRequest;
|
|
529
1071
|
}
|
|
530
|
-
declare const PlaywrightResponse_base: new <A extends Record<string, any> = {}>(args: effect_Types0.
|
|
1072
|
+
declare const PlaywrightResponse_base: new <A extends Record<string, any> = {}>(args: _$effect_Types0.VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => Readonly<A> & {
|
|
531
1073
|
readonly _tag: "PlaywrightResponse";
|
|
532
1074
|
};
|
|
533
1075
|
/**
|
|
@@ -538,7 +1080,7 @@ declare class PlaywrightResponse extends PlaywrightResponse_base<{
|
|
|
538
1080
|
allHeaders: Effect.Effect<Awaited<ReturnType<Response["allHeaders"]>>, PlaywrightError>;
|
|
539
1081
|
body: Effect.Effect<Awaited<ReturnType<Response["body"]>>, PlaywrightError>;
|
|
540
1082
|
finished: Effect.Effect<Awaited<ReturnType<Response["finished"]>>, PlaywrightError>;
|
|
541
|
-
frame: Effect.Effect<PlaywrightFrameService>;
|
|
1083
|
+
frame: Effect.Effect<PlaywrightFrameService, PlaywrightError>;
|
|
542
1084
|
fromServiceWorker: () => boolean;
|
|
543
1085
|
headers: () => ReturnType<Response["headers"]>;
|
|
544
1086
|
headersArray: Effect.Effect<Awaited<ReturnType<Response["headersArray"]>>, PlaywrightError>;
|
|
@@ -556,7 +1098,7 @@ declare class PlaywrightResponse extends PlaywrightResponse_base<{
|
|
|
556
1098
|
}> {
|
|
557
1099
|
static make(response: Response): PlaywrightResponse;
|
|
558
1100
|
}
|
|
559
|
-
declare const PlaywrightWorker_base: new <A extends Record<string, any> = {}>(args: effect_Types0.
|
|
1101
|
+
declare const PlaywrightWorker_base: new <A extends Record<string, any> = {}>(args: _$effect_Types0.VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => Readonly<A> & {
|
|
560
1102
|
readonly _tag: "PlaywrightWorker";
|
|
561
1103
|
};
|
|
562
1104
|
/**
|
|
@@ -569,7 +1111,7 @@ declare class PlaywrightWorker extends PlaywrightWorker_base<{
|
|
|
569
1111
|
}> {
|
|
570
1112
|
static make(worker: Worker): PlaywrightWorker;
|
|
571
1113
|
}
|
|
572
|
-
declare const PlaywrightDialog_base: new <A extends Record<string, any> = {}>(args: effect_Types0.
|
|
1114
|
+
declare const PlaywrightDialog_base: new <A extends Record<string, any> = {}>(args: _$effect_Types0.VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => Readonly<A> & {
|
|
573
1115
|
readonly _tag: "PlaywrightDialog";
|
|
574
1116
|
};
|
|
575
1117
|
/**
|
|
@@ -586,7 +1128,7 @@ declare class PlaywrightDialog extends PlaywrightDialog_base<{
|
|
|
586
1128
|
}> {
|
|
587
1129
|
static make(dialog: Dialog): PlaywrightDialog;
|
|
588
1130
|
}
|
|
589
|
-
declare const PlaywrightFileChooser_base: new <A extends Record<string, any> = {}>(args: effect_Types0.
|
|
1131
|
+
declare const PlaywrightFileChooser_base: new <A extends Record<string, any> = {}>(args: _$effect_Types0.VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => Readonly<A> & {
|
|
590
1132
|
readonly _tag: "PlaywrightFileChooser";
|
|
591
1133
|
};
|
|
592
1134
|
/**
|
|
@@ -601,7 +1143,7 @@ declare class PlaywrightFileChooser extends PlaywrightFileChooser_base<{
|
|
|
601
1143
|
}> {
|
|
602
1144
|
static make(fileChooser: FileChooser): PlaywrightFileChooser;
|
|
603
1145
|
}
|
|
604
|
-
declare const PlaywrightDownload_base: new <A extends Record<string, any> = {}>(args: effect_Types0.
|
|
1146
|
+
declare const PlaywrightDownload_base: new <A extends Record<string, any> = {}>(args: _$effect_Types0.VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => Readonly<A> & {
|
|
605
1147
|
readonly _tag: "PlaywrightDownload";
|
|
606
1148
|
};
|
|
607
1149
|
/**
|
|
@@ -870,6 +1412,13 @@ interface PlaywrightPageService {
|
|
|
870
1412
|
* @since 0.3.0
|
|
871
1413
|
*/
|
|
872
1414
|
readonly setContent: (html: string, options?: Parameters<Page["setContent"]>[1]) => Effect.Effect<void, PlaywrightError>;
|
|
1415
|
+
/**
|
|
1416
|
+
* Waits for the given timeout in milliseconds.
|
|
1417
|
+
*
|
|
1418
|
+
* @see {@link Page.waitForTimeout}
|
|
1419
|
+
* @since 0.4.0
|
|
1420
|
+
*/
|
|
1421
|
+
readonly waitForTimeout: (timeout: number) => Effect.Effect<void, PlaywrightError>;
|
|
873
1422
|
/**
|
|
874
1423
|
* This setting will change the default maximum navigation time for the following methods:
|
|
875
1424
|
* - {@link PlaywrightPageService.goBack}
|
|
@@ -882,14 +1431,14 @@ interface PlaywrightPageService {
|
|
|
882
1431
|
* @see {@link Page.setDefaultNavigationTimeout}
|
|
883
1432
|
* @since 0.3.0
|
|
884
1433
|
*/
|
|
885
|
-
readonly setDefaultNavigationTimeout: (timeout: Parameters<Page["setDefaultNavigationTimeout"]>[0]) =>
|
|
1434
|
+
readonly setDefaultNavigationTimeout: (timeout: Parameters<Page["setDefaultNavigationTimeout"]>[0]) => void;
|
|
886
1435
|
/**
|
|
887
1436
|
* This setting will change the default maximum time for all the methods accepting `timeout` option.
|
|
888
1437
|
*
|
|
889
1438
|
* @see {@link Page.setDefaultTimeout}
|
|
890
1439
|
* @since 0.3.0
|
|
891
1440
|
*/
|
|
892
|
-
readonly setDefaultTimeout: (timeout: Parameters<Page["setDefaultTimeout"]>[0]) =>
|
|
1441
|
+
readonly setDefaultTimeout: (timeout: Parameters<Page["setDefaultTimeout"]>[0]) => void;
|
|
893
1442
|
/**
|
|
894
1443
|
* The extra HTTP headers will be sent with every request the page initiates.
|
|
895
1444
|
*
|
|
@@ -1458,7 +2007,7 @@ interface PlaywrightBrowserContextService {
|
|
|
1458
2007
|
* @see {@link BrowserContext.pages}
|
|
1459
2008
|
* @since 0.1.0
|
|
1460
2009
|
*/
|
|
1461
|
-
readonly pages:
|
|
2010
|
+
readonly pages: () => Array<typeof PlaywrightPage.Service>;
|
|
1462
2011
|
/**
|
|
1463
2012
|
* Opens a new page in the browser context.
|
|
1464
2013
|
*
|
|
@@ -1487,6 +2036,87 @@ interface PlaywrightBrowserContextService {
|
|
|
1487
2036
|
* @since 0.2.0
|
|
1488
2037
|
*/
|
|
1489
2038
|
readonly addInitScript: (script: Parameters<BrowserContext["addInitScript"]>[0], arg?: Parameters<BrowserContext["addInitScript"]>[1]) => Effect.Effect<void, PlaywrightError>;
|
|
2039
|
+
/**
|
|
2040
|
+
* Returns the browser that the context belongs to.
|
|
2041
|
+
*
|
|
2042
|
+
* @see {@link BrowserContext.browser}
|
|
2043
|
+
* @since 0.4.0
|
|
2044
|
+
*/
|
|
2045
|
+
readonly browser: () => Option.Option<PlaywrightBrowserService>;
|
|
2046
|
+
/**
|
|
2047
|
+
* Clears the cookies from the browser context.
|
|
2048
|
+
*
|
|
2049
|
+
* @see {@link BrowserContext.clearCookies}
|
|
2050
|
+
* @since 0.4.0
|
|
2051
|
+
*/
|
|
2052
|
+
readonly clearCookies: (options?: {
|
|
2053
|
+
name?: string | RegExp;
|
|
2054
|
+
domain?: string | RegExp;
|
|
2055
|
+
path?: string | RegExp;
|
|
2056
|
+
}) => Effect.Effect<void, PlaywrightError>;
|
|
2057
|
+
/**
|
|
2058
|
+
* Clears the permissions from the browser context.
|
|
2059
|
+
*
|
|
2060
|
+
* @see {@link BrowserContext.clearPermissions}
|
|
2061
|
+
* @since 0.4.0
|
|
2062
|
+
*/
|
|
2063
|
+
readonly clearPermissions: Effect.Effect<void, PlaywrightError>;
|
|
2064
|
+
/**
|
|
2065
|
+
* Returns the cookies for the browser context.
|
|
2066
|
+
*
|
|
2067
|
+
* @see {@link BrowserContext.cookies}
|
|
2068
|
+
* @since 0.4.0
|
|
2069
|
+
*/
|
|
2070
|
+
readonly cookies: (urls?: string | string[]) => Effect.Effect<Awaited<ReturnType<BrowserContext["cookies"]>>, PlaywrightError>;
|
|
2071
|
+
/**
|
|
2072
|
+
* Sets the cookies for the browser context.
|
|
2073
|
+
*
|
|
2074
|
+
* @see {@link BrowserContext.addCookies}
|
|
2075
|
+
* @since 0.4.0
|
|
2076
|
+
*/
|
|
2077
|
+
readonly addCookies: (cookies: Parameters<BrowserContext["addCookies"]>[0]) => Effect.Effect<void, PlaywrightError>;
|
|
2078
|
+
/**
|
|
2079
|
+
* Grants permissions to the browser context.
|
|
2080
|
+
*
|
|
2081
|
+
* @see {@link BrowserContext.grantPermissions}
|
|
2082
|
+
* @since 0.4.0
|
|
2083
|
+
*/
|
|
2084
|
+
readonly grantPermissions: (permissions: Parameters<BrowserContext["grantPermissions"]>[0], options?: Parameters<BrowserContext["grantPermissions"]>[1]) => Effect.Effect<void, PlaywrightError>;
|
|
2085
|
+
/**
|
|
2086
|
+
* Sets the extra HTTP headers for the browser context.
|
|
2087
|
+
*
|
|
2088
|
+
* @see {@link BrowserContext.setExtraHTTPHeaders}
|
|
2089
|
+
* @since 0.4.0
|
|
2090
|
+
*/
|
|
2091
|
+
readonly setExtraHTTPHeaders: (headers: Parameters<BrowserContext["setExtraHTTPHeaders"]>[0]) => Effect.Effect<void, PlaywrightError>;
|
|
2092
|
+
/**
|
|
2093
|
+
* Sets the geolocation for the browser context.
|
|
2094
|
+
*
|
|
2095
|
+
* @see {@link BrowserContext.setGeolocation}
|
|
2096
|
+
* @since 0.4.0
|
|
2097
|
+
*/
|
|
2098
|
+
readonly setGeolocation: (geolocation: Parameters<BrowserContext["setGeolocation"]>[0]) => Effect.Effect<void, PlaywrightError>;
|
|
2099
|
+
/**
|
|
2100
|
+
* Sets the offline state for the browser context.
|
|
2101
|
+
*
|
|
2102
|
+
* @see {@link BrowserContext.setOffline}
|
|
2103
|
+
* @since 0.4.0
|
|
2104
|
+
*/
|
|
2105
|
+
readonly setOffline: (offline: boolean) => Effect.Effect<void, PlaywrightError>;
|
|
2106
|
+
/**
|
|
2107
|
+
* Sets the default navigation timeout for the browser context.
|
|
2108
|
+
*
|
|
2109
|
+
* @see {@link BrowserContext.setDefaultNavigationTimeout}
|
|
2110
|
+
* @since 0.4.0
|
|
2111
|
+
*/
|
|
2112
|
+
readonly setDefaultNavigationTimeout: (timeout: number) => void;
|
|
2113
|
+
/**
|
|
2114
|
+
* Sets the default timeout for the browser context.
|
|
2115
|
+
*
|
|
2116
|
+
* @see {@link BrowserContext.setDefaultTimeout}
|
|
2117
|
+
* @since 0.4.0
|
|
2118
|
+
*/
|
|
2119
|
+
readonly setDefaultTimeout: (timeout: number) => void;
|
|
1490
2120
|
/**
|
|
1491
2121
|
* Creates a stream of the given event from the browser context.
|
|
1492
2122
|
*
|
package/dist/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as PlaywrightError, C as PlaywrightWorker, D as PlaywrightFrameService, E as PlaywrightFrame, O as PlaywrightLocator, S as PlaywrightResponse, T as PlaywrightClockService, _ as PlaywrightKeyboardService, a as NewPageOptions, b as PlaywrightFileChooser, c as PlaywrightBrowserContext, d as PlaywrightPageService, f as PlaywrightTouchscreen, g as PlaywrightKeyboard, h as PlaywrightMouseService, i as NewContextOptions, j as PlaywrightErrorReason, k as PlaywrightLocatorService, l as PlaywrightBrowserContextService, m as PlaywrightMouse, n as PlaywrightService, o as PlaywrightBrowser, p as PlaywrightTouchscreenService, r as LaunchOptions, s as PlaywrightBrowserService, t as Playwright, u as PlaywrightPage, v as PlaywrightDialog, w as PlaywrightClock, x as PlaywrightRequest, y as PlaywrightDownload } from "./index-
|
|
1
|
+
import { A as PlaywrightError, C as PlaywrightWorker, D as PlaywrightFrameService, E as PlaywrightFrame, O as PlaywrightLocator, S as PlaywrightResponse, T as PlaywrightClockService, _ as PlaywrightKeyboardService, a as NewPageOptions, b as PlaywrightFileChooser, c as PlaywrightBrowserContext, d as PlaywrightPageService, f as PlaywrightTouchscreen, g as PlaywrightKeyboard, h as PlaywrightMouseService, i as NewContextOptions, j as PlaywrightErrorReason, k as PlaywrightLocatorService, l as PlaywrightBrowserContextService, m as PlaywrightMouse, n as PlaywrightService, o as PlaywrightBrowser, p as PlaywrightTouchscreenService, r as LaunchOptions, s as PlaywrightBrowserService, t as Playwright, u as PlaywrightPage, v as PlaywrightDialog, w as PlaywrightClock, x as PlaywrightRequest, y as PlaywrightDownload } from "./index-COItPgGw.mjs";
|
|
2
2
|
export { LaunchOptions, NewContextOptions, NewPageOptions, Playwright, PlaywrightBrowser, PlaywrightBrowserContext, PlaywrightBrowserContextService, PlaywrightBrowserService, PlaywrightClock, PlaywrightClockService, PlaywrightDialog, PlaywrightDownload, PlaywrightError, PlaywrightErrorReason, PlaywrightFileChooser, PlaywrightFrame, PlaywrightFrameService, PlaywrightKeyboard, PlaywrightKeyboardService, PlaywrightLocator, PlaywrightLocatorService, PlaywrightMouse, PlaywrightMouseService, PlaywrightPage, PlaywrightPageService, PlaywrightRequest, PlaywrightResponse, PlaywrightService, PlaywrightTouchscreen, PlaywrightTouchscreenService, PlaywrightWorker };
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as PlaywrightError, a as PlaywrightDownload, c as PlaywrightResponse, d as
|
|
1
|
+
import { _ as PlaywrightError, a as PlaywrightDownload, c as PlaywrightResponse, d as PlaywrightLocator, f as PlaywrightPage, g as PlaywrightClock, h as PlaywrightKeyboard, i as PlaywrightDialog, l as PlaywrightWorker, m as PlaywrightMouse, n as PlaywrightBrowser, o as PlaywrightFileChooser, p as PlaywrightTouchscreen, r as PlaywrightBrowserContext, s as PlaywrightRequest, t as Playwright, u as PlaywrightFrame } from "./src-BdVoZgVR.mjs";
|
|
2
2
|
export { Playwright, PlaywrightBrowser, PlaywrightBrowserContext, PlaywrightClock, PlaywrightDialog, PlaywrightDownload, PlaywrightError, PlaywrightFileChooser, PlaywrightFrame, PlaywrightKeyboard, PlaywrightLocator, PlaywrightMouse, PlaywrightPage, PlaywrightRequest, PlaywrightResponse, PlaywrightTouchscreen, PlaywrightWorker };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Context, Data, Effect, Layer, Option, Runtime, Stream, identity } from "effect";
|
|
1
|
+
import { Array, Context, Data, Effect, Layer, Match, Option, Predicate, Runtime, Stream, identity } from "effect";
|
|
2
2
|
import { chromium, errors } from "playwright-core";
|
|
3
3
|
import { Readable } from "node:stream";
|
|
4
4
|
//#region src/errors.ts
|
|
@@ -58,78 +58,38 @@ var PlaywrightClock = class PlaywrightClock extends Context.Tag("effect-playwrig
|
|
|
58
58
|
}
|
|
59
59
|
};
|
|
60
60
|
//#endregion
|
|
61
|
-
//#region src/locator.ts
|
|
61
|
+
//#region src/frame-locator.ts
|
|
62
62
|
/**
|
|
63
|
-
* A service that provides a `
|
|
63
|
+
* A service that provides a `PlaywrightFrameLocator` instance.
|
|
64
64
|
*
|
|
65
65
|
* @since 0.1.0
|
|
66
66
|
* @category tag
|
|
67
67
|
*/
|
|
68
|
-
var
|
|
68
|
+
var PlaywrightFrameLocator = class PlaywrightFrameLocator extends Context.Tag("effect-playwright/PlaywrightFrameLocator")() {
|
|
69
69
|
/**
|
|
70
|
-
* Creates a `
|
|
71
|
-
* But you could use this if you have used `use` or similar to wrap the locator.
|
|
72
|
-
*
|
|
73
|
-
* @example
|
|
74
|
-
* ```ts
|
|
75
|
-
* const playwrightNativeLocator = yield* page.use((p) => p.locator("button"));
|
|
76
|
-
* const locator = PlaywrightLocator.make(playwrightNativeLocator);
|
|
77
|
-
* ```
|
|
70
|
+
* Creates a `PlaywrightFrameLocator` from a Playwright `FrameLocator` instance.
|
|
78
71
|
*
|
|
79
|
-
* @param
|
|
72
|
+
* @param frameLocator - The Playwright `FrameLocator` instance to wrap.
|
|
80
73
|
* @since 0.1.0
|
|
81
74
|
* @category constructor
|
|
82
75
|
*/
|
|
83
|
-
static make(
|
|
84
|
-
const
|
|
85
|
-
return
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
//#endregion
|
|
103
|
-
//#region src/frame.ts
|
|
104
|
-
/**
|
|
105
|
-
* @category tag
|
|
106
|
-
* @since 0.1.2
|
|
107
|
-
*/
|
|
108
|
-
var PlaywrightFrame = class PlaywrightFrame extends Context.Tag("effect-playwright/PlaywrightFrame")() {
|
|
109
|
-
/**
|
|
110
|
-
* Creates a `PlaywrightFrame` from a Playwright `Frame` instance.
|
|
111
|
-
*
|
|
112
|
-
* @param frame - The Playwright `Frame` instance to wrap.
|
|
113
|
-
* @since 0.1.2
|
|
114
|
-
*/
|
|
115
|
-
static make(frame) {
|
|
116
|
-
const use = useHelper(frame);
|
|
117
|
-
return PlaywrightFrame.of({
|
|
118
|
-
goto: (url, options) => use((f) => f.goto(url, options)),
|
|
119
|
-
waitForURL: (url, options) => use((f) => f.waitForURL(url, options)),
|
|
120
|
-
waitForLoadState: (state, options) => use((f) => f.waitForLoadState(state, options)),
|
|
121
|
-
evaluate: (f, arg) => use((frame) => frame.evaluate(f, arg)),
|
|
122
|
-
title: use((f) => f.title()),
|
|
123
|
-
use,
|
|
124
|
-
locator: (selector, options) => PlaywrightLocator.make(frame.locator(selector, options)),
|
|
125
|
-
getByRole: (role, options) => PlaywrightLocator.make(frame.getByRole(role, options)),
|
|
126
|
-
getByText: (text, options) => PlaywrightLocator.make(frame.getByText(text, options)),
|
|
127
|
-
getByLabel: (label, options) => PlaywrightLocator.make(frame.getByLabel(label, options)),
|
|
128
|
-
getByTestId: (testId) => PlaywrightLocator.make(frame.getByTestId(testId)),
|
|
129
|
-
url: () => frame.url(),
|
|
130
|
-
content: use((f) => f.content()),
|
|
131
|
-
name: () => frame.name(),
|
|
132
|
-
click: (selector, options) => use((f) => f.click(selector, options))
|
|
76
|
+
static make(frameLocator) {
|
|
77
|
+
const unwrap = Match.type().pipe(Match.when(Predicate.hasProperty("_raw"), (l) => l._raw), Match.orElse((l) => l));
|
|
78
|
+
return PlaywrightFrameLocator.of({
|
|
79
|
+
_raw: frameLocator,
|
|
80
|
+
first: () => PlaywrightFrameLocator.make(frameLocator.first()),
|
|
81
|
+
frameLocator: (selector) => PlaywrightFrameLocator.make(frameLocator.frameLocator(selector)),
|
|
82
|
+
last: () => PlaywrightFrameLocator.make(frameLocator.last()),
|
|
83
|
+
nth: (index) => PlaywrightFrameLocator.make(frameLocator.nth(index)),
|
|
84
|
+
owner: () => PlaywrightLocator.make(frameLocator.owner()),
|
|
85
|
+
locator: (selectorOrLocator, options) => PlaywrightLocator.make(frameLocator.locator(unwrap(selectorOrLocator), options)),
|
|
86
|
+
getByRole: (role, options) => PlaywrightLocator.make(frameLocator.getByRole(role, options)),
|
|
87
|
+
getByText: (text, options) => PlaywrightLocator.make(frameLocator.getByText(text, options)),
|
|
88
|
+
getByLabel: (text, options) => PlaywrightLocator.make(frameLocator.getByLabel(text, options)),
|
|
89
|
+
getByPlaceholder: (text, options) => PlaywrightLocator.make(frameLocator.getByPlaceholder(text, options)),
|
|
90
|
+
getByAltText: (text, options) => PlaywrightLocator.make(frameLocator.getByAltText(text, options)),
|
|
91
|
+
getByTitle: (text, options) => PlaywrightLocator.make(frameLocator.getByTitle(text, options)),
|
|
92
|
+
getByTestId: (testId) => PlaywrightLocator.make(frameLocator.getByTestId(testId))
|
|
133
93
|
});
|
|
134
94
|
}
|
|
135
95
|
};
|
|
@@ -240,8 +200,9 @@ var PlaywrightPage = class PlaywrightPage extends Context.Tag("effect-playwright
|
|
|
240
200
|
touchscreen: PlaywrightTouchscreen.make(page.touchscreen),
|
|
241
201
|
goto: (url, options) => use((p) => p.goto(url, options)),
|
|
242
202
|
setContent: (html, options) => use((p) => p.setContent(html, options)),
|
|
243
|
-
|
|
244
|
-
|
|
203
|
+
waitForTimeout: (timeout) => use((p) => p.waitForTimeout(timeout)),
|
|
204
|
+
setDefaultNavigationTimeout: (timeout) => page.setDefaultNavigationTimeout(timeout),
|
|
205
|
+
setDefaultTimeout: (timeout) => page.setDefaultTimeout(timeout),
|
|
245
206
|
setExtraHTTPHeaders: (headers) => use((p) => p.setExtraHTTPHeaders(headers)),
|
|
246
207
|
setViewportSize: (viewportSize) => use((p) => p.setViewportSize(viewportSize)),
|
|
247
208
|
viewportSize: () => Option.fromNullable(page.viewportSize()),
|
|
@@ -300,6 +261,145 @@ var PlaywrightPage = class PlaywrightPage extends Context.Tag("effect-playwright
|
|
|
300
261
|
}
|
|
301
262
|
};
|
|
302
263
|
//#endregion
|
|
264
|
+
//#region src/locator.ts
|
|
265
|
+
/**
|
|
266
|
+
* A service that provides a `PlaywrightLocator` instance.
|
|
267
|
+
*
|
|
268
|
+
* @since 0.1.0
|
|
269
|
+
* @category tag
|
|
270
|
+
*/
|
|
271
|
+
var PlaywrightLocator = class PlaywrightLocator extends Context.Tag("effect-playwright/PlaywrightLocator")() {
|
|
272
|
+
/**
|
|
273
|
+
* Creates a `PlaywrightLocator` from a Playwright `Locator` instance. This is mostly for internal use.
|
|
274
|
+
* But you could use this if you have used `use` or similar to wrap the locator.
|
|
275
|
+
*
|
|
276
|
+
* @example
|
|
277
|
+
* ```ts
|
|
278
|
+
* const playwrightNativeLocator = yield* page.use((p) => p.locator("button"));
|
|
279
|
+
* const locator = PlaywrightLocator.make(playwrightNativeLocator);
|
|
280
|
+
* ```
|
|
281
|
+
*
|
|
282
|
+
* @param locator - The Playwright `Locator` instance to wrap.
|
|
283
|
+
* @since 0.1.0
|
|
284
|
+
* @category constructor
|
|
285
|
+
*/
|
|
286
|
+
static make(locator) {
|
|
287
|
+
const use = useHelper(locator);
|
|
288
|
+
const unwrap = Match.type().pipe(Match.when(Predicate.hasProperty("_raw"), (l) => l._raw), Match.orElse((l) => l));
|
|
289
|
+
return PlaywrightLocator.of({
|
|
290
|
+
_raw: locator,
|
|
291
|
+
click: (options) => use((l) => l.click(options)),
|
|
292
|
+
check: (options) => use((l) => l.check(options)),
|
|
293
|
+
fill: (value, options) => use((l) => l.fill(value, options)),
|
|
294
|
+
getAttribute: (name, options) => use((l) => l.getAttribute(name, options)),
|
|
295
|
+
innerText: (options) => use((l) => l.innerText(options)),
|
|
296
|
+
innerHTML: (options) => use((l) => l.innerHTML(options)),
|
|
297
|
+
inputValue: (options) => use((l) => l.inputValue(options)),
|
|
298
|
+
textContent: (options) => use((l) => l.textContent(options)),
|
|
299
|
+
allInnerTexts: () => use((l) => l.allInnerTexts()),
|
|
300
|
+
allTextContents: () => use((l) => l.allTextContents()),
|
|
301
|
+
ariaSnapshot: (options) => use((l) => l.ariaSnapshot(options)),
|
|
302
|
+
boundingBox: (options) => use((l) => l.boundingBox(options)).pipe(Effect.map(Option.fromNullable)),
|
|
303
|
+
describe: (description) => PlaywrightLocator.make(locator.describe(description)),
|
|
304
|
+
description: () => Option.fromNullable(locator.description()),
|
|
305
|
+
count: use((l) => l.count()),
|
|
306
|
+
first: () => PlaywrightLocator.make(locator.first()),
|
|
307
|
+
last: () => PlaywrightLocator.make(locator.last()),
|
|
308
|
+
nth: (index) => PlaywrightLocator.make(locator.nth(index)),
|
|
309
|
+
all: () => use((l) => l.all()).pipe(Effect.map(Array.map(PlaywrightLocator.make))),
|
|
310
|
+
and: (locatorOrService) => PlaywrightLocator.make(locator.and(unwrap(locatorOrService))),
|
|
311
|
+
contentFrame: () => PlaywrightFrameLocator.make(locator.contentFrame()),
|
|
312
|
+
filter: (options) => PlaywrightLocator.make(locator.filter(options)),
|
|
313
|
+
frameLocator: (selector) => PlaywrightFrameLocator.make(locator.frameLocator(selector)),
|
|
314
|
+
or: (locatorOrService) => PlaywrightLocator.make(locator.or(unwrap(locatorOrService))),
|
|
315
|
+
page: () => PlaywrightPage.make(locator.page()),
|
|
316
|
+
locator: (selectorOrLocator, options) => PlaywrightLocator.make(typeof selectorOrLocator === "string" ? locator.locator(selectorOrLocator, options) : locator.locator(unwrap(selectorOrLocator), options)),
|
|
317
|
+
getByRole: (role, options) => PlaywrightLocator.make(locator.getByRole(role, options)),
|
|
318
|
+
getByText: (text, options) => PlaywrightLocator.make(locator.getByText(text, options)),
|
|
319
|
+
getByLabel: (text, options) => PlaywrightLocator.make(locator.getByLabel(text, options)),
|
|
320
|
+
getByPlaceholder: (text, options) => PlaywrightLocator.make(locator.getByPlaceholder(text, options)),
|
|
321
|
+
getByAltText: (text, options) => PlaywrightLocator.make(locator.getByAltText(text, options)),
|
|
322
|
+
getByTitle: (text, options) => PlaywrightLocator.make(locator.getByTitle(text, options)),
|
|
323
|
+
getByTestId: (testId) => PlaywrightLocator.make(locator.getByTestId(testId)),
|
|
324
|
+
isChecked: (options) => use((l) => l.isChecked(options)),
|
|
325
|
+
isDisabled: (options) => use((l) => l.isDisabled(options)),
|
|
326
|
+
isEditable: (options) => use((l) => l.isEditable(options)),
|
|
327
|
+
isEnabled: (options) => use((l) => l.isEnabled(options)),
|
|
328
|
+
isHidden: (options) => use((l) => l.isHidden(options)),
|
|
329
|
+
isVisible: (options) => use((l) => l.isVisible(options)),
|
|
330
|
+
waitFor: (options) => use((l) => l.waitFor(options)),
|
|
331
|
+
evaluate: (pageFunction, arg, options) => use((l) => l.evaluate(pageFunction, arg, options)),
|
|
332
|
+
evaluateAll: (pageFunction, arg) => use((l) => l.evaluateAll(pageFunction, arg)),
|
|
333
|
+
evaluateHandle: (pageFunction, arg) => use((l) => l.evaluateHandle(pageFunction, arg)),
|
|
334
|
+
elementHandle: (options) => use((l) => l.elementHandle(options)).pipe(Effect.map(Option.fromNullable)),
|
|
335
|
+
elementHandles: () => use((l) => l.elementHandles()),
|
|
336
|
+
highlight: () => use((l) => l.highlight()),
|
|
337
|
+
screenshot: (options) => use((l) => l.screenshot(options)),
|
|
338
|
+
blur: (options) => use((l) => l.blur(options)),
|
|
339
|
+
clear: (options) => use((l) => l.clear(options)),
|
|
340
|
+
dblclick: (options) => use((l) => l.dblclick(options)),
|
|
341
|
+
dispatchEvent: (type, eventInit, options) => use((l) => l.dispatchEvent(type, eventInit, options)),
|
|
342
|
+
dragTo: (target, options) => use((l) => l.dragTo(unwrap(target), options)),
|
|
343
|
+
focus: (options) => use((l) => l.focus(options)),
|
|
344
|
+
hover: (options) => use((l) => l.hover(options)),
|
|
345
|
+
press: (key, options) => use((l) => l.press(key, options)),
|
|
346
|
+
pressSequentially: (text, options) => use((l) => l.pressSequentially(text, options)),
|
|
347
|
+
scrollIntoViewIfNeeded: (options) => use((l) => l.scrollIntoViewIfNeeded(options)),
|
|
348
|
+
selectOption: (values, options) => use((l) => l.selectOption(values, options)),
|
|
349
|
+
selectText: (options) => use((l) => l.selectText(options)),
|
|
350
|
+
setChecked: (checked, options) => use((l) => l.setChecked(checked, options)),
|
|
351
|
+
setInputFiles: (files, options) => use((l) => l.setInputFiles(files, options)),
|
|
352
|
+
tap: (options) => use((l) => l.tap(options)),
|
|
353
|
+
uncheck: (options) => use((l) => l.uncheck(options)),
|
|
354
|
+
toString: () => locator.toString(),
|
|
355
|
+
use
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
};
|
|
359
|
+
//#endregion
|
|
360
|
+
//#region src/frame.ts
|
|
361
|
+
/**
|
|
362
|
+
* @category tag
|
|
363
|
+
* @since 0.1.2
|
|
364
|
+
*/
|
|
365
|
+
var PlaywrightFrame = class PlaywrightFrame extends Context.Tag("effect-playwright/PlaywrightFrame")() {
|
|
366
|
+
/**
|
|
367
|
+
* Creates a `PlaywrightFrame` from a Playwright `Frame` instance.
|
|
368
|
+
*
|
|
369
|
+
* @param frame - The Playwright `Frame` instance to wrap.
|
|
370
|
+
* @since 0.1.2
|
|
371
|
+
*/
|
|
372
|
+
static make(frame) {
|
|
373
|
+
const use = useHelper(frame);
|
|
374
|
+
return PlaywrightFrame.of({
|
|
375
|
+
goto: (url, options) => use((f) => f.goto(url, options)),
|
|
376
|
+
waitForURL: (url, options) => use((f) => f.waitForURL(url, options)),
|
|
377
|
+
waitForLoadState: (state, options) => use((f) => f.waitForLoadState(state, options)),
|
|
378
|
+
evaluate: (f, arg) => use((frame) => frame.evaluate(f, arg)),
|
|
379
|
+
title: use((f) => f.title()),
|
|
380
|
+
use,
|
|
381
|
+
locator: (selector, options) => PlaywrightLocator.make(frame.locator(selector, options)),
|
|
382
|
+
getByRole: (role, options) => PlaywrightLocator.make(frame.getByRole(role, options)),
|
|
383
|
+
getByText: (text, options) => PlaywrightLocator.make(frame.getByText(text, options)),
|
|
384
|
+
getByLabel: (label, options) => PlaywrightLocator.make(frame.getByLabel(label, options)),
|
|
385
|
+
getByTestId: (testId) => PlaywrightLocator.make(frame.getByTestId(testId)),
|
|
386
|
+
getByPlaceholder: (text, options) => PlaywrightLocator.make(frame.getByPlaceholder(text, options)),
|
|
387
|
+
getByAltText: (text, options) => PlaywrightLocator.make(frame.getByAltText(text, options)),
|
|
388
|
+
getByTitle: (text, options) => PlaywrightLocator.make(frame.getByTitle(text, options)),
|
|
389
|
+
page: () => PlaywrightPage.make(frame.page()),
|
|
390
|
+
parentFrame: () => Option.fromNullable(frame.parentFrame()).pipe(Option.map(PlaywrightFrame.make)),
|
|
391
|
+
childFrames: () => Array.map(frame.childFrames(), (f) => PlaywrightFrame.make(f)),
|
|
392
|
+
isDetached: () => frame.isDetached(),
|
|
393
|
+
waitForTimeout: (timeout) => use((f) => f.waitForTimeout(timeout)),
|
|
394
|
+
setContent: (html, options) => use((f) => f.setContent(html, options)),
|
|
395
|
+
url: () => frame.url(),
|
|
396
|
+
content: use((f) => f.content()),
|
|
397
|
+
name: () => frame.name(),
|
|
398
|
+
click: (selector, options) => use((f) => f.click(selector, options))
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
};
|
|
402
|
+
//#endregion
|
|
303
403
|
//#region src/common.ts
|
|
304
404
|
/**
|
|
305
405
|
* @category model
|
|
@@ -311,7 +411,10 @@ var PlaywrightRequest = class PlaywrightRequest extends Data.TaggedClass("Playwr
|
|
|
311
411
|
return new PlaywrightRequest({
|
|
312
412
|
allHeaders: use(() => request.allHeaders()),
|
|
313
413
|
failure: Option.liftNullable(request.failure),
|
|
314
|
-
frame: Effect.
|
|
414
|
+
frame: Effect.try({
|
|
415
|
+
try: () => PlaywrightFrame.make(request.frame()),
|
|
416
|
+
catch: wrapError
|
|
417
|
+
}),
|
|
315
418
|
headerValue: (name) => use(() => request.headerValue(name)).pipe(Effect.map(Option.fromNullable)),
|
|
316
419
|
headers: () => request.headers(),
|
|
317
420
|
headersArray: use(() => request.headersArray()),
|
|
@@ -342,7 +445,10 @@ var PlaywrightResponse = class PlaywrightResponse extends Data.TaggedClass("Play
|
|
|
342
445
|
allHeaders: use(() => response.allHeaders()),
|
|
343
446
|
body: use(() => response.body()),
|
|
344
447
|
finished: use(() => response.finished()),
|
|
345
|
-
frame: Effect.
|
|
448
|
+
frame: Effect.try({
|
|
449
|
+
try: () => PlaywrightFrame.make(response.frame()),
|
|
450
|
+
catch: wrapError
|
|
451
|
+
}),
|
|
346
452
|
fromServiceWorker: () => response.fromServiceWorker(),
|
|
347
453
|
headers: () => response.headers(),
|
|
348
454
|
headersArray: use(() => response.headersArray()),
|
|
@@ -455,10 +561,21 @@ var PlaywrightBrowserContext = class PlaywrightBrowserContext extends Context.Ta
|
|
|
455
561
|
const use = useHelper(context);
|
|
456
562
|
return PlaywrightBrowserContext.of({
|
|
457
563
|
clock: PlaywrightClock.make(context.clock),
|
|
458
|
-
pages:
|
|
564
|
+
pages: () => context.pages().map(PlaywrightPage.make),
|
|
459
565
|
newPage: use((c) => c.newPage().then(PlaywrightPage.make)),
|
|
460
566
|
close: use((c) => c.close()),
|
|
461
567
|
addInitScript: (script, arg) => use((c) => c.addInitScript(script, arg)),
|
|
568
|
+
browser: () => Option.fromNullable(context.browser()).pipe(Option.map(PlaywrightBrowser.make)),
|
|
569
|
+
clearCookies: (options) => use((c) => c.clearCookies(options)),
|
|
570
|
+
clearPermissions: use((c) => c.clearPermissions()),
|
|
571
|
+
cookies: (urls) => use((c) => c.cookies(urls)),
|
|
572
|
+
addCookies: (cookies) => use((c) => c.addCookies(cookies)),
|
|
573
|
+
grantPermissions: (permissions, options) => use((c) => c.grantPermissions(permissions, options)),
|
|
574
|
+
setExtraHTTPHeaders: (headers) => use((c) => c.setExtraHTTPHeaders(headers)),
|
|
575
|
+
setGeolocation: (geolocation) => use((c) => c.setGeolocation(geolocation)),
|
|
576
|
+
setOffline: (offline) => use((c) => c.setOffline(offline)),
|
|
577
|
+
setDefaultNavigationTimeout: (timeout) => context.setDefaultNavigationTimeout(timeout),
|
|
578
|
+
setDefaultTimeout: (timeout) => context.setDefaultTimeout(timeout),
|
|
462
579
|
eventStream: (event) => Stream.asyncPush((emit) => Effect.acquireRelease(Effect.sync(() => {
|
|
463
580
|
context.on(event, emit.single);
|
|
464
581
|
context.once("close", emit.end);
|
|
@@ -547,4 +664,4 @@ var Playwright = class Playwright extends Context.Tag("effect-playwright/index/P
|
|
|
547
664
|
});
|
|
548
665
|
};
|
|
549
666
|
//#endregion
|
|
550
|
-
export { PlaywrightError as _, PlaywrightDownload as a, PlaywrightResponse as c,
|
|
667
|
+
export { PlaywrightError as _, PlaywrightDownload as a, PlaywrightResponse as c, PlaywrightLocator as d, PlaywrightPage as f, PlaywrightClock as g, PlaywrightKeyboard as h, PlaywrightDialog as i, PlaywrightWorker as l, PlaywrightMouse as m, PlaywrightBrowser as n, PlaywrightFileChooser as o, PlaywrightTouchscreen as p, PlaywrightBrowserContext as r, PlaywrightRequest as s, Playwright as t, PlaywrightFrame as u };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "effect-playwright",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.4.1",
|
|
5
5
|
"description": "An Effect-based Playwright library.",
|
|
6
6
|
"author": "Jobflow GmbH",
|
|
7
7
|
"license": "ISC",
|
|
@@ -36,21 +36,21 @@
|
|
|
36
36
|
"effect": "^3.19.6"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@biomejs/biome": "2.4.
|
|
40
|
-
"@effect/cli": "^0.
|
|
41
|
-
"@effect/language-service": "0.
|
|
42
|
-
"@effect/platform": "^0.
|
|
43
|
-
"@effect/platform-node": "^0.
|
|
44
|
-
"@effect/vitest": "^0.
|
|
45
|
-
"@types/node": "^25.
|
|
46
|
-
"effect": "^3.
|
|
39
|
+
"@biomejs/biome": "2.4.9",
|
|
40
|
+
"@effect/cli": "^0.75.0",
|
|
41
|
+
"@effect/language-service": "0.84.2",
|
|
42
|
+
"@effect/platform": "^0.96.0",
|
|
43
|
+
"@effect/platform-node": "^0.106.0",
|
|
44
|
+
"@effect/vitest": "^0.29.0",
|
|
45
|
+
"@types/node": "^25.5.0",
|
|
46
|
+
"effect": "^3.21.0",
|
|
47
47
|
"playwright": "^1.58.2",
|
|
48
48
|
"ts-morph": "^27.0.2",
|
|
49
|
-
"tsdown": "0.21.
|
|
49
|
+
"tsdown": "0.21.7",
|
|
50
50
|
"tsx": "^4.21.0",
|
|
51
|
-
"typedoc": "^0.28.
|
|
52
|
-
"typescript": "^
|
|
53
|
-
"vitest": "^4.
|
|
51
|
+
"typedoc": "^0.28.18",
|
|
52
|
+
"typescript": "^6.0.2",
|
|
53
|
+
"vitest": "^4.1.2"
|
|
54
54
|
},
|
|
55
55
|
"types": "./dist/index.d.mts",
|
|
56
56
|
"scripts": {
|