effect-playwright 0.4.1 → 0.5.0
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 +18 -4
- package/README.md +23 -15
- package/bin/cli.mjs +10 -0
- package/dist/experimental/index.d.mts +9 -8
- package/dist/experimental/index.mjs +11 -13
- package/dist/{index-COItPgGw.d.mts → index-Byy8-OGM.d.mts} +257 -22
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/{src-BdVoZgVR.mjs → src-D4xmzWgO.mjs} +74 -6
- package/package.json +23 -17
package/LICENSE
CHANGED
|
@@ -1,7 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright
|
|
3
|
+
Copyright (c) 2026 Jobflow GmbH
|
|
4
4
|
|
|
5
|
-
Permission
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
6
11
|
|
|
7
|
-
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -13,23 +13,17 @@ A Playwright wrapper for the Effect ecosystem. This library provides a set of se
|
|
|
13
13
|
## Installation
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
pnpm add effect-playwright
|
|
16
|
+
pnpm add effect-playwright
|
|
17
|
+
pnpm effect-playwright install chromium
|
|
17
18
|
```
|
|
18
19
|
|
|
19
|
-
or
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
npm install effect-playwright playwright-core
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
You can also install `playwright` instead of `playwright-core` if you want the post-build auto install of the browsers.
|
|
20
|
+
Browser installation is not required if connecting to an existing browser via CDP or using a local browser.
|
|
26
21
|
|
|
27
22
|
## Quick Start
|
|
28
23
|
|
|
29
24
|
```ts
|
|
30
|
-
import { Playwright } from "effect-playwright";
|
|
25
|
+
import { Playwright, chromium } from "effect-playwright";
|
|
31
26
|
import { Effect } from "effect";
|
|
32
|
-
import { chromium } from "playwright-core";
|
|
33
27
|
|
|
34
28
|
const program = Effect.gen(function* () {
|
|
35
29
|
const playwright = yield* Playwright;
|
|
@@ -37,7 +31,8 @@ const program = Effect.gen(function* () {
|
|
|
37
31
|
const page = yield* browser.newPage();
|
|
38
32
|
|
|
39
33
|
yield* page.goto("https://example.com");
|
|
40
|
-
|
|
34
|
+
const title = yield* page.title;
|
|
35
|
+
yield* Effect.log(`Page title: ${title}`);
|
|
41
36
|
}).pipe(Effect.scoped, Effect.provide(Playwright.layer));
|
|
42
37
|
|
|
43
38
|
await Effect.runPromise(program);
|
|
@@ -92,10 +87,9 @@ The `PlaywrightEnvironment` simplifies setup by allowing you to configure the br
|
|
|
92
87
|
### Usage
|
|
93
88
|
|
|
94
89
|
```ts
|
|
95
|
-
import { PlaywrightBrowser } from "effect-playwright";
|
|
90
|
+
import { PlaywrightBrowser, chromium } from "effect-playwright";
|
|
96
91
|
import { PlaywrightEnvironment } from "effect-playwright/experimental";
|
|
97
92
|
import { Effect } from "effect";
|
|
98
|
-
import { chromium } from "playwright-core";
|
|
99
93
|
|
|
100
94
|
const liveLayer = PlaywrightEnvironment.layer(chromium, {
|
|
101
95
|
headless: false /** any other launch options */,
|
|
@@ -164,9 +158,8 @@ const program = Effect.gen(function* () {
|
|
|
164
158
|
If you need to access functionality from the underlying Playwright objects that isn't directly exposed, you can use the `use` method available on most services/objects (browsers, pages, locators).
|
|
165
159
|
|
|
166
160
|
```ts
|
|
167
|
-
import { Playwright } from "effect-playwright";
|
|
161
|
+
import { Playwright, chromium } from "effect-playwright";
|
|
168
162
|
import { Effect } from "effect";
|
|
169
|
-
import { chromium } from "playwright-core";
|
|
170
163
|
|
|
171
164
|
const program = Effect.gen(function* () {
|
|
172
165
|
const playwright = yield* Playwright;
|
|
@@ -183,3 +176,18 @@ const program = Effect.gen(function* () {
|
|
|
183
176
|
All methods return effects that can fail with a `PlaywrightError`. This error wraps the original error from Playwright.
|
|
184
177
|
Note that Playwright does not support interruption, so `Effect.timeout` or similar code does not behave like you
|
|
185
178
|
might expect. Playwright provides its own `timeout` option for almost every method.
|
|
179
|
+
|
|
180
|
+
## CLI Wrapper
|
|
181
|
+
|
|
182
|
+
`effect-playwright` includes a lightweight command-line wrapper that forwards all commands directly to the underlying `playwright-core` CLI. You can use it to install browsers, generate code, or inspect traces:
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
# Install browsers
|
|
186
|
+
pnpm effect-playwright install chromium
|
|
187
|
+
|
|
188
|
+
# Code generation
|
|
189
|
+
pnpm effect-playwright codegen https://example.com
|
|
190
|
+
|
|
191
|
+
# Open inspector / trace viewer
|
|
192
|
+
pnpm effect-playwright show-trace trace.zip
|
|
193
|
+
```
|
package/bin/cli.mjs
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
|
|
5
|
+
const require = createRequire(import.meta.url);
|
|
6
|
+
const cliPath = path.join(
|
|
7
|
+
path.dirname(require.resolve("playwright-core/package.json")),
|
|
8
|
+
"cli.js",
|
|
9
|
+
);
|
|
10
|
+
require(cliPath);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { Context, Effect, Layer, Stream } from "effect";
|
|
1
|
+
import { A as PlaywrightFrameService, N as PlaywrightError, l as PlaywrightBrowser, m as PlaywrightPageService, u as PlaywrightBrowserService } from "../index-Byy8-OGM.mjs";
|
|
3
2
|
import { BrowserType, LaunchOptions } from "playwright-core";
|
|
3
|
+
import { Context, Effect, Layer, Stream } from "effect";
|
|
4
4
|
import { Scope as Scope$1 } from "effect/Scope";
|
|
5
5
|
|
|
6
6
|
//#region src/experimental/browser-utils.d.ts
|
|
@@ -11,7 +11,7 @@ declare namespace browser_utils_d_exports {
|
|
|
11
11
|
* Returns all pages in the browser from all contexts.
|
|
12
12
|
* @category util
|
|
13
13
|
*/
|
|
14
|
-
declare const allPages: (browser: PlaywrightBrowserService) =>
|
|
14
|
+
declare const allPages: (browser: PlaywrightBrowserService) => PlaywrightPageService[];
|
|
15
15
|
/**
|
|
16
16
|
* Returns all frames in the browser from all pages in all contexts.
|
|
17
17
|
* @category util
|
|
@@ -34,8 +34,7 @@ declare const PlaywrightEnvironment_base: Context.TagClass<PlaywrightEnvironment
|
|
|
34
34
|
* `PlaywrightEnvironment` is a service that allows you to configure how browsers are launched once. You can then
|
|
35
35
|
* use `PlaywrightEnvironment.browser` to start browsers scoped to the current lifetime. They will be closed when the scope is closed.
|
|
36
36
|
*
|
|
37
|
-
* You can use {@link withBrowser} to provide the `PlaywrightBrowser` service to the wrapped effect.
|
|
38
|
-
* also allows you to re-use the same browser as many times as you want.
|
|
37
|
+
* This service will not start a browser on its own. You can use {@link withBrowser} to provide the `PlaywrightBrowser` service to the wrapped effect.
|
|
39
38
|
*
|
|
40
39
|
* @since 0.1.0
|
|
41
40
|
* @category tag
|
|
@@ -47,8 +46,8 @@ declare class PlaywrightEnvironment extends PlaywrightEnvironment_base {}
|
|
|
47
46
|
* @example
|
|
48
47
|
*
|
|
49
48
|
* ```ts
|
|
49
|
+
* import { chromium } from "effect-playwright";
|
|
50
50
|
* import { PlaywrightEnvironment } from "effect-playwright/experimental";
|
|
51
|
-
* import { chromium } from "playwright-core";
|
|
52
51
|
*
|
|
53
52
|
* const playwrightEnv = PlaywrightEnvironment.layer(chromium);
|
|
54
53
|
*
|
|
@@ -73,11 +72,13 @@ declare const layer: (browser: BrowserType, launchOptions?: LaunchOptions) => La
|
|
|
73
72
|
*
|
|
74
73
|
* You will need to provide the `PlaywrightEnvironment` layer first.
|
|
75
74
|
*
|
|
75
|
+
* This will start a browser and close it when the scope is closed.
|
|
76
|
+
*
|
|
76
77
|
* @example
|
|
77
78
|
*
|
|
78
79
|
* ```ts
|
|
80
|
+
* import { chromium } from "effect-playwright";
|
|
79
81
|
* import { PlaywrightEnvironment } from "effect-playwright/experimental";
|
|
80
|
-
* import { chromium } from "playwright-core";
|
|
81
82
|
*
|
|
82
83
|
* const env = PlaywrightEnvironment.layer(chromium);
|
|
83
84
|
*
|
|
@@ -91,6 +92,6 @@ declare const layer: (browser: BrowserType, launchOptions?: LaunchOptions) => La
|
|
|
91
92
|
* @since 0.1.0
|
|
92
93
|
* @category util
|
|
93
94
|
*/
|
|
94
|
-
declare const withBrowser: <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, PlaywrightError | E, PlaywrightEnvironment | Exclude<R, PlaywrightBrowser>>;
|
|
95
|
+
declare const withBrowser: <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, PlaywrightError | E, PlaywrightEnvironment | Exclude<Exclude<R, PlaywrightBrowser>, Scope$1>>;
|
|
95
96
|
//#endregion
|
|
96
97
|
export { browser_utils_d_exports as BrowserUtils, environment_d_exports as PlaywrightEnvironment };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "../chunk-CfYAbeIz.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { a as PlaywrightBrowser, i as Playwright } from "../src-D4xmzWgO.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,12 +11,12 @@ 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) =>
|
|
14
|
+
const allPages = (browser) => 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
|
|
18
18
|
*/
|
|
19
|
-
const allFrames = (browser) =>
|
|
19
|
+
const allFrames = (browser) => Effect.all(allPages(browser).map((page) => page.frames)).pipe(Effect.map(Array.flatten));
|
|
20
20
|
/**
|
|
21
21
|
* Returns a stream of all framenavigated events for all current and future pages in the browser.
|
|
22
22
|
* In all current contexts (but not future contexts).
|
|
@@ -40,8 +40,7 @@ var environment_exports = /* @__PURE__ */ __exportAll({
|
|
|
40
40
|
* `PlaywrightEnvironment` is a service that allows you to configure how browsers are launched once. You can then
|
|
41
41
|
* use `PlaywrightEnvironment.browser` to start browsers scoped to the current lifetime. They will be closed when the scope is closed.
|
|
42
42
|
*
|
|
43
|
-
* You can use {@link withBrowser} to provide the `PlaywrightBrowser` service to the wrapped effect.
|
|
44
|
-
* also allows you to re-use the same browser as many times as you want.
|
|
43
|
+
* This service will not start a browser on its own. You can use {@link withBrowser} to provide the `PlaywrightBrowser` service to the wrapped effect.
|
|
45
44
|
*
|
|
46
45
|
* @since 0.1.0
|
|
47
46
|
* @category tag
|
|
@@ -53,8 +52,8 @@ var PlaywrightEnvironment = class extends Context.Tag("effect-playwright/experim
|
|
|
53
52
|
* @example
|
|
54
53
|
*
|
|
55
54
|
* ```ts
|
|
55
|
+
* import { chromium } from "effect-playwright";
|
|
56
56
|
* import { PlaywrightEnvironment } from "effect-playwright/experimental";
|
|
57
|
-
* import { chromium } from "playwright-core";
|
|
58
57
|
*
|
|
59
58
|
* const playwrightEnv = PlaywrightEnvironment.layer(chromium);
|
|
60
59
|
*
|
|
@@ -73,21 +72,20 @@ var PlaywrightEnvironment = class extends Context.Tag("effect-playwright/experim
|
|
|
73
72
|
* @since 0.1.0
|
|
74
73
|
* @category layer
|
|
75
74
|
*/
|
|
76
|
-
const layer = (browser, launchOptions) => {
|
|
77
|
-
|
|
78
|
-
return PlaywrightEnvironment.of({ browser: playwright.launchScoped(browser, launchOptions) });
|
|
79
|
-
}), Effect.provide(Playwright.layer)));
|
|
80
|
-
};
|
|
75
|
+
const layer = (browser, launchOptions) => Playwright.pipe(Effect.map((playwright) => PlaywrightEnvironment.of({ browser: playwright.launchScoped(browser, launchOptions) })), Layer.effect(PlaywrightEnvironment), Layer.provide(Playwright.layer));
|
|
76
|
+
const withBrowserUnscoped = Effect.provideServiceEffect(PlaywrightBrowser, PlaywrightEnvironment.pipe(Effect.flatMap((e) => e.browser)));
|
|
81
77
|
/**
|
|
82
78
|
* Provides a scoped `PlaywrightBrowser` service, allowing you to access the browser from the context (e.g. by yielding `PlaywrightBrowser`).
|
|
83
79
|
*
|
|
84
80
|
* You will need to provide the `PlaywrightEnvironment` layer first.
|
|
85
81
|
*
|
|
82
|
+
* This will start a browser and close it when the scope is closed.
|
|
83
|
+
*
|
|
86
84
|
* @example
|
|
87
85
|
*
|
|
88
86
|
* ```ts
|
|
87
|
+
* import { chromium } from "effect-playwright";
|
|
89
88
|
* import { PlaywrightEnvironment } from "effect-playwright/experimental";
|
|
90
|
-
* import { chromium } from "playwright-core";
|
|
91
89
|
*
|
|
92
90
|
* const env = PlaywrightEnvironment.layer(chromium);
|
|
93
91
|
*
|
|
@@ -101,6 +99,6 @@ const layer = (browser, launchOptions) => {
|
|
|
101
99
|
* @since 0.1.0
|
|
102
100
|
* @category util
|
|
103
101
|
*/
|
|
104
|
-
const withBrowser =
|
|
102
|
+
const withBrowser = (self) => Effect.scoped(withBrowserUnscoped(self));
|
|
105
103
|
//#endregion
|
|
106
104
|
export { browser_utils_exports as BrowserUtils, environment_exports as PlaywrightEnvironment };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { Browser, BrowserContext, BrowserType, Clock, ConnectOverCDPOptions, ConsoleMessage, Dialog, Download, ElementHandle, FileChooser, Frame, FrameLocator, JSHandle, Keyboard, Locator, Mouse, Page, Request, Response, Screencast, Touchscreen, Tracing, WebError, WebSocket, Worker, chromium, chromium as chromium$1, firefox, webkit } from "playwright-core";
|
|
1
2
|
import { Context, Effect, Layer, Option, Scope, Stream } from "effect";
|
|
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
|
-
import { Scope as Scope$1 } from "effect/Scope";
|
|
4
3
|
import * as _$effect_Types0 from "effect/Types";
|
|
5
4
|
import * as _$effect_Cause0 from "effect/Cause";
|
|
5
|
+
import { Scope as Scope$1 } from "effect/Scope";
|
|
6
6
|
|
|
7
7
|
//#region src/errors.d.ts
|
|
8
8
|
/**
|
|
@@ -435,7 +435,28 @@ interface PlaywrightLocatorService {
|
|
|
435
435
|
* @see {@link Locator.highlight}
|
|
436
436
|
* @since 0.4.1
|
|
437
437
|
*/
|
|
438
|
-
readonly highlight: () => Effect.Effect<void, PlaywrightError>;
|
|
438
|
+
readonly highlight: (options?: Parameters<Locator["highlight"]>[0]) => Effect.Effect<void, PlaywrightError>;
|
|
439
|
+
/**
|
|
440
|
+
* Hides the element highlight previously added by highlight.
|
|
441
|
+
*
|
|
442
|
+
* @see {@link Locator.hideHighlight}
|
|
443
|
+
* @since 0.5.0
|
|
444
|
+
*/
|
|
445
|
+
readonly hideHighlight: Effect.Effect<void, PlaywrightError>;
|
|
446
|
+
/**
|
|
447
|
+
* Drops the locator.
|
|
448
|
+
*
|
|
449
|
+
* @see {@link Locator.drop}
|
|
450
|
+
* @since 0.5.0
|
|
451
|
+
*/
|
|
452
|
+
readonly drop: (data: Parameters<Locator["drop"]>[0], options?: Parameters<Locator["drop"]>[1]) => Effect.Effect<void, PlaywrightError>;
|
|
453
|
+
/**
|
|
454
|
+
* Normalizes the locator.
|
|
455
|
+
*
|
|
456
|
+
* @see {@link Locator.normalize}
|
|
457
|
+
* @since 0.5.0
|
|
458
|
+
*/
|
|
459
|
+
readonly normalize: () => Effect.Effect<PlaywrightLocatorService, PlaywrightError>;
|
|
439
460
|
/**
|
|
440
461
|
* Captures a screenshot of the element.
|
|
441
462
|
*
|
|
@@ -1289,6 +1310,70 @@ declare class PlaywrightMouse extends PlaywrightMouse_base {
|
|
|
1289
1310
|
static make(mouse: Mouse): PlaywrightMouseService;
|
|
1290
1311
|
}
|
|
1291
1312
|
//#endregion
|
|
1313
|
+
//#region src/screencast.d.ts
|
|
1314
|
+
/**
|
|
1315
|
+
* @category model
|
|
1316
|
+
* @since 0.5.0
|
|
1317
|
+
*/
|
|
1318
|
+
interface PlaywrightScreencastService {
|
|
1319
|
+
/**
|
|
1320
|
+
* Starts recording the screencast.
|
|
1321
|
+
*
|
|
1322
|
+
* @see {@link Screencast.start}
|
|
1323
|
+
* @since 0.5.0
|
|
1324
|
+
*/
|
|
1325
|
+
readonly start: (options?: Parameters<Screencast["start"]>[0]) => Effect.Effect<void, PlaywrightError>;
|
|
1326
|
+
/**
|
|
1327
|
+
* Stops recording the screencast.
|
|
1328
|
+
*
|
|
1329
|
+
* @see {@link Screencast.stop}
|
|
1330
|
+
* @since 0.5.0
|
|
1331
|
+
*/
|
|
1332
|
+
readonly stop: Effect.Effect<void, PlaywrightError>;
|
|
1333
|
+
/**
|
|
1334
|
+
* Shows action annotations.
|
|
1335
|
+
*
|
|
1336
|
+
* @see {@link Screencast.showActions}
|
|
1337
|
+
* @since 0.5.0
|
|
1338
|
+
*/
|
|
1339
|
+
readonly showActions: (options?: Parameters<Screencast["showActions"]>[0]) => Effect.Effect<void, PlaywrightError>;
|
|
1340
|
+
/**
|
|
1341
|
+
* Hides action annotations.
|
|
1342
|
+
*
|
|
1343
|
+
* @see {@link Screencast.hideActions}
|
|
1344
|
+
* @since 0.5.0
|
|
1345
|
+
*/
|
|
1346
|
+
readonly hideActions: Effect.Effect<void, PlaywrightError>;
|
|
1347
|
+
/**
|
|
1348
|
+
* Shows a chapter title.
|
|
1349
|
+
*
|
|
1350
|
+
* @see {@link Screencast.showChapter}
|
|
1351
|
+
* @since 0.5.0
|
|
1352
|
+
*/
|
|
1353
|
+
readonly showChapter: (title: string, options?: Parameters<Screencast["showChapter"]>[1]) => Effect.Effect<void, PlaywrightError>;
|
|
1354
|
+
/**
|
|
1355
|
+
* Shows a custom HTML overlay.
|
|
1356
|
+
*
|
|
1357
|
+
* @see {@link Screencast.showOverlay}
|
|
1358
|
+
* @since 0.5.0
|
|
1359
|
+
*/
|
|
1360
|
+
readonly showOverlay: (html: string, options?: Parameters<Screencast["showOverlay"]>[1]) => Effect.Effect<void, PlaywrightError>;
|
|
1361
|
+
/**
|
|
1362
|
+
* Shows all overlays.
|
|
1363
|
+
*
|
|
1364
|
+
* @see {@link Screencast.showOverlays}
|
|
1365
|
+
* @since 0.5.0
|
|
1366
|
+
*/
|
|
1367
|
+
readonly showOverlays: Effect.Effect<void, PlaywrightError>;
|
|
1368
|
+
/**
|
|
1369
|
+
* Hides all overlays.
|
|
1370
|
+
*
|
|
1371
|
+
* @see {@link Screencast.hideOverlays}
|
|
1372
|
+
* @since 0.5.0
|
|
1373
|
+
*/
|
|
1374
|
+
readonly hideOverlays: Effect.Effect<void, PlaywrightError>;
|
|
1375
|
+
}
|
|
1376
|
+
//#endregion
|
|
1292
1377
|
//#region src/touchscreen.d.ts
|
|
1293
1378
|
/**
|
|
1294
1379
|
* @category model
|
|
@@ -1392,6 +1477,12 @@ interface PlaywrightPageService {
|
|
|
1392
1477
|
* @since 0.3.0
|
|
1393
1478
|
*/
|
|
1394
1479
|
readonly touchscreen: PlaywrightTouchscreenService;
|
|
1480
|
+
/**
|
|
1481
|
+
* Access the screencast.
|
|
1482
|
+
*
|
|
1483
|
+
* @since 0.5.0
|
|
1484
|
+
*/
|
|
1485
|
+
readonly screencast: PlaywrightScreencastService;
|
|
1395
1486
|
/**
|
|
1396
1487
|
* Navigates the page to the given URL.
|
|
1397
1488
|
*
|
|
@@ -1863,30 +1954,79 @@ interface PlaywrightPageService {
|
|
|
1863
1954
|
* @since 0.1.0
|
|
1864
1955
|
*/
|
|
1865
1956
|
readonly url: () => string;
|
|
1957
|
+
/**
|
|
1958
|
+
* Clears all highlights.
|
|
1959
|
+
*
|
|
1960
|
+
* @see {@link Page.hideHighlight}
|
|
1961
|
+
* @since 0.5.0
|
|
1962
|
+
*/
|
|
1963
|
+
readonly hideHighlight: Effect.Effect<void, PlaywrightError>;
|
|
1964
|
+
/**
|
|
1965
|
+
* Clears stored console messages.
|
|
1966
|
+
*
|
|
1967
|
+
* @see {@link Page.clearConsoleMessages}
|
|
1968
|
+
* @since 0.5.0
|
|
1969
|
+
*/
|
|
1970
|
+
readonly clearConsoleMessages: Effect.Effect<void, PlaywrightError>;
|
|
1971
|
+
/**
|
|
1972
|
+
* Clears stored page errors.
|
|
1973
|
+
*
|
|
1974
|
+
* @see {@link Page.clearPageErrors}
|
|
1975
|
+
* @since 0.5.0
|
|
1976
|
+
*/
|
|
1977
|
+
readonly clearPageErrors: Effect.Effect<void, PlaywrightError>;
|
|
1866
1978
|
/**
|
|
1867
1979
|
* Returns all messages that have been logged to the console.
|
|
1868
1980
|
*
|
|
1869
1981
|
* @example
|
|
1870
1982
|
* ```ts
|
|
1871
|
-
* const consoleMessages = yield* page.consoleMessages;
|
|
1983
|
+
* const consoleMessages = yield* page.consoleMessages();
|
|
1872
1984
|
* ```
|
|
1873
1985
|
*
|
|
1874
1986
|
* @see {@link Page.consoleMessages}
|
|
1875
1987
|
* @since 0.3.0
|
|
1876
1988
|
*/
|
|
1877
|
-
readonly consoleMessages: Effect.Effect<ReadonlyArray<ConsoleMessage>, PlaywrightError>;
|
|
1989
|
+
readonly consoleMessages: (options?: Parameters<Page["consoleMessages"]>[0]) => Effect.Effect<ReadonlyArray<ConsoleMessage>, PlaywrightError>;
|
|
1878
1990
|
/**
|
|
1879
1991
|
* Returns all errors that have been thrown in the page.
|
|
1880
1992
|
*
|
|
1881
1993
|
* @example
|
|
1882
1994
|
* ```ts
|
|
1883
|
-
* const pageErrors = yield* page.pageErrors;
|
|
1995
|
+
* const pageErrors = yield* page.pageErrors();
|
|
1884
1996
|
* ```
|
|
1885
1997
|
*
|
|
1886
1998
|
* @see {@link Page.pageErrors}
|
|
1887
1999
|
* @since 0.3.0
|
|
1888
2000
|
*/
|
|
1889
|
-
readonly pageErrors: Effect.Effect<ReadonlyArray<Error>, PlaywrightError>;
|
|
2001
|
+
readonly pageErrors: (options?: Parameters<Page["pageErrors"]>[0]) => Effect.Effect<ReadonlyArray<Error>, PlaywrightError>;
|
|
2002
|
+
/**
|
|
2003
|
+
* Returns the most recent network requests from the page.
|
|
2004
|
+
*
|
|
2005
|
+
* @see {@link Page.requests}
|
|
2006
|
+
* @since 0.5.0
|
|
2007
|
+
*/
|
|
2008
|
+
readonly requests: Effect.Effect<ReadonlyArray<PlaywrightRequest>, PlaywrightError>;
|
|
2009
|
+
/**
|
|
2010
|
+
* Enters an interactive mode where hovering over elements highlights them and shows the corresponding locator.
|
|
2011
|
+
*
|
|
2012
|
+
* @see {@link Page.pickLocator}
|
|
2013
|
+
* @since 0.5.0
|
|
2014
|
+
*/
|
|
2015
|
+
readonly pickLocator: Effect.Effect<typeof PlaywrightLocator.Service, PlaywrightError>;
|
|
2016
|
+
/**
|
|
2017
|
+
* Cancels the locator picking mode.
|
|
2018
|
+
*
|
|
2019
|
+
* @see {@link Page.cancelPickLocator}
|
|
2020
|
+
* @since 0.5.0
|
|
2021
|
+
*/
|
|
2022
|
+
readonly cancelPickLocator: Effect.Effect<void, PlaywrightError>;
|
|
2023
|
+
/**
|
|
2024
|
+
* Captures the aria snapshot of the page.
|
|
2025
|
+
*
|
|
2026
|
+
* @see {@link Page.ariaSnapshot}
|
|
2027
|
+
* @since 0.5.0
|
|
2028
|
+
*/
|
|
2029
|
+
readonly ariaSnapshot: (options?: Parameters<Page["ariaSnapshot"]>[0]) => Effect.Effect<string, PlaywrightError>;
|
|
1890
2030
|
/**
|
|
1891
2031
|
* Returns all workers.
|
|
1892
2032
|
*
|
|
@@ -1964,13 +2104,70 @@ declare class PlaywrightPage extends PlaywrightPage_base {
|
|
|
1964
2104
|
static make(page: PageWithPatchedEvents): PlaywrightPageService;
|
|
1965
2105
|
}
|
|
1966
2106
|
//#endregion
|
|
2107
|
+
//#region src/tracing.d.ts
|
|
2108
|
+
/**
|
|
2109
|
+
* @category model
|
|
2110
|
+
* @since 0.5.0
|
|
2111
|
+
*/
|
|
2112
|
+
interface PlaywrightTracingService {
|
|
2113
|
+
/**
|
|
2114
|
+
* Starts tracing.
|
|
2115
|
+
*
|
|
2116
|
+
* @see {@link Tracing.start}
|
|
2117
|
+
* @since 0.5.0
|
|
2118
|
+
*/
|
|
2119
|
+
readonly start: (options?: Parameters<Tracing["start"]>[0]) => Effect.Effect<void, PlaywrightError>;
|
|
2120
|
+
/**
|
|
2121
|
+
* Starts a new tracing chunk.
|
|
2122
|
+
*
|
|
2123
|
+
* @see {@link Tracing.startChunk}
|
|
2124
|
+
* @since 0.5.0
|
|
2125
|
+
*/
|
|
2126
|
+
readonly startChunk: (options?: Parameters<Tracing["startChunk"]>[0]) => Effect.Effect<void, PlaywrightError>;
|
|
2127
|
+
/**
|
|
2128
|
+
* Stops a tracing chunk.
|
|
2129
|
+
*
|
|
2130
|
+
* @see {@link Tracing.stopChunk}
|
|
2131
|
+
* @since 0.5.0
|
|
2132
|
+
*/
|
|
2133
|
+
readonly stopChunk: (options?: Parameters<Tracing["stopChunk"]>[0]) => Effect.Effect<void, PlaywrightError>;
|
|
2134
|
+
/**
|
|
2135
|
+
* Stops tracing.
|
|
2136
|
+
*
|
|
2137
|
+
* @see {@link Tracing.stop}
|
|
2138
|
+
* @since 0.5.0
|
|
2139
|
+
*/
|
|
2140
|
+
readonly stop: (options?: Parameters<Tracing["stop"]>[0]) => Effect.Effect<void, PlaywrightError>;
|
|
2141
|
+
/**
|
|
2142
|
+
* Starts HAR recording.
|
|
2143
|
+
*
|
|
2144
|
+
* @see {@link Tracing.startHar}
|
|
2145
|
+
* @since 0.5.0
|
|
2146
|
+
*/
|
|
2147
|
+
readonly startHar: (options: Parameters<Tracing["startHar"]>[0]) => Effect.Effect<void, PlaywrightError>;
|
|
2148
|
+
/**
|
|
2149
|
+
* Stops HAR recording.
|
|
2150
|
+
*
|
|
2151
|
+
* @see {@link Tracing.stopHar}
|
|
2152
|
+
* @since 0.5.0
|
|
2153
|
+
*/
|
|
2154
|
+
readonly stopHar: Effect.Effect<void, PlaywrightError>;
|
|
2155
|
+
}
|
|
2156
|
+
//#endregion
|
|
1967
2157
|
//#region src/browser-context.d.ts
|
|
1968
2158
|
interface BrowserContextEvents {
|
|
2159
|
+
/** @deprecated Since Playwright 1.56.0. This event is no longer emitted. */
|
|
1969
2160
|
backgroundpage: Page;
|
|
1970
2161
|
close: BrowserContext;
|
|
1971
2162
|
console: ConsoleMessage;
|
|
1972
2163
|
dialog: Dialog;
|
|
2164
|
+
download: Download;
|
|
2165
|
+
frameattached: Frame;
|
|
2166
|
+
framedetached: Frame;
|
|
2167
|
+
framenavigated: Frame;
|
|
1973
2168
|
page: Page;
|
|
2169
|
+
pageclose: Page;
|
|
2170
|
+
pageload: Page;
|
|
1974
2171
|
request: Request;
|
|
1975
2172
|
requestfailed: Request;
|
|
1976
2173
|
requestfinished: Request;
|
|
@@ -1983,7 +2180,13 @@ declare const eventMappings$1: {
|
|
|
1983
2180
|
readonly close: (context: BrowserContext) => PlaywrightBrowserContextService;
|
|
1984
2181
|
readonly console: (a: ConsoleMessage) => ConsoleMessage;
|
|
1985
2182
|
readonly dialog: (dialog: Dialog) => PlaywrightDialog;
|
|
2183
|
+
readonly download: (download: Download) => PlaywrightDownload;
|
|
2184
|
+
readonly frameattached: (frame: Frame) => PlaywrightFrameService;
|
|
2185
|
+
readonly framedetached: (frame: Frame) => PlaywrightFrameService;
|
|
2186
|
+
readonly framenavigated: (frame: Frame) => PlaywrightFrameService;
|
|
1986
2187
|
readonly page: (page: Page) => PlaywrightPageService;
|
|
2188
|
+
readonly pageclose: (page: Page) => PlaywrightPageService;
|
|
2189
|
+
readonly pageload: (page: Page) => PlaywrightPageService;
|
|
1987
2190
|
readonly request: (request: Request) => PlaywrightRequest;
|
|
1988
2191
|
readonly requestfailed: (request: Request) => PlaywrightRequest;
|
|
1989
2192
|
readonly requestfinished: (request: Request) => PlaywrightRequest;
|
|
@@ -2001,6 +2204,12 @@ interface PlaywrightBrowserContextService {
|
|
|
2001
2204
|
* Access the clock.
|
|
2002
2205
|
*/
|
|
2003
2206
|
readonly clock: PlaywrightClockService;
|
|
2207
|
+
/**
|
|
2208
|
+
* Access the tracing.
|
|
2209
|
+
*
|
|
2210
|
+
* @since 0.5.0
|
|
2211
|
+
*/
|
|
2212
|
+
readonly tracing: PlaywrightTracingService;
|
|
2004
2213
|
/**
|
|
2005
2214
|
* Returns the list of all open pages in the browser context.
|
|
2006
2215
|
*
|
|
@@ -2117,6 +2326,13 @@ interface PlaywrightBrowserContextService {
|
|
|
2117
2326
|
* @since 0.4.0
|
|
2118
2327
|
*/
|
|
2119
2328
|
readonly setDefaultTimeout: (timeout: number) => void;
|
|
2329
|
+
/**
|
|
2330
|
+
* Sets the storage state for the browser context.
|
|
2331
|
+
*
|
|
2332
|
+
* @see {@link BrowserContext.setStorageState}
|
|
2333
|
+
* @since 0.5.0
|
|
2334
|
+
*/
|
|
2335
|
+
readonly setStorageState: (options: Parameters<BrowserContext["setStorageState"]>[0]) => Effect.Effect<void, PlaywrightError>;
|
|
2120
2336
|
/**
|
|
2121
2337
|
* Creates a stream of the given event from the browser context.
|
|
2122
2338
|
*
|
|
@@ -2151,9 +2367,11 @@ type NewPageOptions = Parameters<Browser["newPage"]>[0];
|
|
|
2151
2367
|
type NewContextOptions = Parameters<Browser["newContext"]>[0];
|
|
2152
2368
|
interface BrowserEvents {
|
|
2153
2369
|
disconnected: Browser;
|
|
2370
|
+
context: BrowserContext;
|
|
2154
2371
|
}
|
|
2155
2372
|
declare const eventMappings: {
|
|
2156
2373
|
readonly disconnected: (browser: Browser) => PlaywrightBrowserService;
|
|
2374
|
+
readonly context: (context: BrowserContext) => PlaywrightBrowserContextService;
|
|
2157
2375
|
};
|
|
2158
2376
|
type BrowserWithPatchedEvents = PatchedEvents<Browser, BrowserEvents>;
|
|
2159
2377
|
/**
|
|
@@ -2194,26 +2412,42 @@ interface PlaywrightBrowserService {
|
|
|
2194
2412
|
*/
|
|
2195
2413
|
readonly close: Effect.Effect<void, PlaywrightError>;
|
|
2196
2414
|
/**
|
|
2197
|
-
*
|
|
2415
|
+
* Returns the list of all open browser contexts.
|
|
2198
2416
|
* @see {@link Browser.contexts}
|
|
2199
2417
|
*/
|
|
2200
2418
|
readonly contexts: () => Array<typeof PlaywrightBrowserContext.Service>;
|
|
2201
2419
|
readonly newContext: (options?: NewContextOptions) => Effect.Effect<typeof PlaywrightBrowserContext.Service, PlaywrightError, Scope$1>;
|
|
2202
2420
|
/**
|
|
2203
|
-
*
|
|
2421
|
+
* Returns the browser type (chromium, firefox or webkit) that the browser belongs to.
|
|
2204
2422
|
* @see {@link Browser.browserType}
|
|
2205
2423
|
*/
|
|
2206
2424
|
readonly browserType: () => BrowserType;
|
|
2207
2425
|
/**
|
|
2208
|
-
*
|
|
2426
|
+
* Returns the version of the browser.
|
|
2209
2427
|
* @see {@link Browser.version}
|
|
2210
2428
|
*/
|
|
2211
2429
|
readonly version: () => string;
|
|
2212
2430
|
/**
|
|
2213
|
-
*
|
|
2431
|
+
* Returns whether the browser is connected.
|
|
2214
2432
|
* @see {@link Browser.isConnected}
|
|
2215
2433
|
*/
|
|
2216
2434
|
readonly isConnected: () => boolean;
|
|
2435
|
+
/**
|
|
2436
|
+
* Binds the browser to a title.
|
|
2437
|
+
*
|
|
2438
|
+
* @see {@link Browser.bind}
|
|
2439
|
+
* @since 0.5.0
|
|
2440
|
+
*/
|
|
2441
|
+
readonly bind: (title: string, options?: Parameters<Browser["bind"]>[1]) => Effect.Effect<{
|
|
2442
|
+
endpoint: string;
|
|
2443
|
+
}, PlaywrightError>;
|
|
2444
|
+
/**
|
|
2445
|
+
* Unbinds the browser.
|
|
2446
|
+
*
|
|
2447
|
+
* @see {@link Browser.unbind}
|
|
2448
|
+
* @since 0.5.0
|
|
2449
|
+
*/
|
|
2450
|
+
readonly unbind: Effect.Effect<void, PlaywrightError>;
|
|
2217
2451
|
/**
|
|
2218
2452
|
* Creates a stream of the given event from the browser.
|
|
2219
2453
|
*
|
|
@@ -2254,12 +2488,12 @@ interface PlaywrightService {
|
|
|
2254
2488
|
* {@link launchScoped} instead.
|
|
2255
2489
|
*
|
|
2256
2490
|
* ```ts
|
|
2491
|
+
* import { Playwright, chromium } from "effect-playwright";
|
|
2257
2492
|
* import { Effect } from "effect";
|
|
2258
|
-
* import { Playwright } from "effect-playwright";
|
|
2259
|
-
* import { chromium } from "playwright-core";
|
|
2260
2493
|
*
|
|
2261
2494
|
* const program = Effect.gen(function* () {
|
|
2262
|
-
* const
|
|
2495
|
+
* const playwright = yield* Playwright;
|
|
2496
|
+
* const browser = yield* playwright.launch(chromium);
|
|
2263
2497
|
* // ... use browser ...
|
|
2264
2498
|
* yield* browser.close;
|
|
2265
2499
|
* });
|
|
@@ -2278,12 +2512,12 @@ interface PlaywrightService {
|
|
|
2278
2512
|
* This method automatically closes the browser when the scope is closed.
|
|
2279
2513
|
*
|
|
2280
2514
|
* ```ts
|
|
2515
|
+
* import { Playwright, chromium } from "effect-playwright";
|
|
2281
2516
|
* import { Effect } from "effect";
|
|
2282
|
-
* import { Playwright } from "effect-playwright";
|
|
2283
|
-
* import { chromium } from "playwright-core";
|
|
2284
2517
|
*
|
|
2285
2518
|
* const program = Effect.gen(function* () {
|
|
2286
|
-
* const
|
|
2519
|
+
* const playwright = yield* Playwright;
|
|
2520
|
+
* const browser = yield* playwright.launchScoped(chromium);
|
|
2287
2521
|
* // Browser will be closed automatically when scope closes
|
|
2288
2522
|
* });
|
|
2289
2523
|
*
|
|
@@ -2307,9 +2541,8 @@ interface PlaywrightService {
|
|
|
2307
2541
|
* Closing this context also closes the underlying browser process.
|
|
2308
2542
|
*
|
|
2309
2543
|
* ```ts
|
|
2544
|
+
* import { Playwright, chromium } from "effect-playwright";
|
|
2310
2545
|
* import { Effect } from "effect";
|
|
2311
|
-
* import { Playwright } from "effect-playwright";
|
|
2312
|
-
* import { chromium } from "playwright-core";
|
|
2313
2546
|
*
|
|
2314
2547
|
* const program = Effect.gen(function* () {
|
|
2315
2548
|
* const playwright = yield* Playwright;
|
|
@@ -2331,6 +2564,9 @@ interface PlaywrightService {
|
|
|
2331
2564
|
* If you call this non-scoped variant inside a scope, add a finalizer for cleanup:
|
|
2332
2565
|
*
|
|
2333
2566
|
* ```ts
|
|
2567
|
+
* import { Playwright, chromium } from "effect-playwright";
|
|
2568
|
+
* import { Effect } from "effect";
|
|
2569
|
+
*
|
|
2334
2570
|
* const program = Effect.gen(function* () {
|
|
2335
2571
|
* const playwright = yield* Playwright;
|
|
2336
2572
|
* const context = yield* playwright.launchPersistentContext(
|
|
@@ -2357,9 +2593,8 @@ interface PlaywrightService {
|
|
|
2357
2593
|
* when the scope is closed.
|
|
2358
2594
|
*
|
|
2359
2595
|
* ```ts
|
|
2596
|
+
* import { Playwright, chromium } from "effect-playwright";
|
|
2360
2597
|
* import { Effect } from "effect";
|
|
2361
|
-
* import { Playwright } from "effect-playwright";
|
|
2362
|
-
* import { chromium } from "playwright-core";
|
|
2363
2598
|
*
|
|
2364
2599
|
* const program = Effect.gen(function* () {
|
|
2365
2600
|
* const playwright = yield* Playwright;
|
|
@@ -2448,4 +2683,4 @@ declare class Playwright extends Playwright_base {
|
|
|
2448
2683
|
static readonly layer: Layer.Layer<Playwright, never, never>;
|
|
2449
2684
|
}
|
|
2450
2685
|
//#endregion
|
|
2451
|
-
export {
|
|
2686
|
+
export { PlaywrightFrameService as A, PlaywrightFileChooser as C, PlaywrightClock as D, PlaywrightWorker as E, PlaywrightLocatorService as M, PlaywrightError as N, PlaywrightClockService as O, PlaywrightErrorReason as P, PlaywrightDownload as S, PlaywrightResponse as T, PlaywrightMouse as _, PlaywrightService as a, PlaywrightKeyboardService as b, NewPageOptions as c, PlaywrightBrowserContext as d, PlaywrightBrowserContextService as f, PlaywrightTouchscreenService as g, PlaywrightTouchscreen as h, Playwright as i, PlaywrightLocator as j, PlaywrightFrame as k, PlaywrightBrowser as l, PlaywrightPageService as m, firefox as n, LaunchOptions$1 as o, PlaywrightPage as p, webkit as r, NewContextOptions as s, chromium$1 as t, PlaywrightBrowserService as u, PlaywrightMouseService as v, PlaywrightRequest as w, PlaywrightDialog as x, PlaywrightKeyboard as y };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as
|
|
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 };
|
|
1
|
+
import { A as PlaywrightFrameService, C as PlaywrightFileChooser, D as PlaywrightClock, E as PlaywrightWorker, M as PlaywrightLocatorService, N as PlaywrightError, O as PlaywrightClockService, P as PlaywrightErrorReason, S as PlaywrightDownload, T as PlaywrightResponse, _ as PlaywrightMouse, a as PlaywrightService, b as PlaywrightKeyboardService, c as NewPageOptions, d as PlaywrightBrowserContext, f as PlaywrightBrowserContextService, g as PlaywrightTouchscreenService, h as PlaywrightTouchscreen, i as Playwright, j as PlaywrightLocator, k as PlaywrightFrame, l as PlaywrightBrowser, m as PlaywrightPageService, n as firefox, o as LaunchOptions, p as PlaywrightPage, r as webkit, s as NewContextOptions, t as chromium, u as PlaywrightBrowserService, v as PlaywrightMouseService, w as PlaywrightRequest, x as PlaywrightDialog, y as PlaywrightKeyboard } from "./index-Byy8-OGM.mjs";
|
|
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, chromium, firefox, webkit };
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as
|
|
2
|
-
export { Playwright, PlaywrightBrowser, PlaywrightBrowserContext, PlaywrightClock, PlaywrightDialog, PlaywrightDownload, PlaywrightError, PlaywrightFileChooser, PlaywrightFrame, PlaywrightKeyboard, PlaywrightLocator, PlaywrightMouse, PlaywrightPage, PlaywrightRequest, PlaywrightResponse, PlaywrightTouchscreen, PlaywrightWorker };
|
|
1
|
+
import { _ as PlaywrightMouse, a as PlaywrightBrowser, b as PlaywrightError, c as PlaywrightDownload, d as PlaywrightResponse, f as PlaywrightWorker, g as PlaywrightTouchscreen, h as PlaywrightPage, i as Playwright, l as PlaywrightFileChooser, m as PlaywrightLocator, n as firefox, o as PlaywrightBrowserContext, p as PlaywrightFrame, r as webkit, s as PlaywrightDialog, t as chromium, u as PlaywrightRequest, v as PlaywrightKeyboard, y as PlaywrightClock } from "./src-D4xmzWgO.mjs";
|
|
2
|
+
export { Playwright, PlaywrightBrowser, PlaywrightBrowserContext, PlaywrightClock, PlaywrightDialog, PlaywrightDownload, PlaywrightError, PlaywrightFileChooser, PlaywrightFrame, PlaywrightKeyboard, PlaywrightLocator, PlaywrightMouse, PlaywrightPage, PlaywrightRequest, PlaywrightResponse, PlaywrightTouchscreen, PlaywrightWorker, chromium, firefox, webkit };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { chromium, chromium as chromium$1, errors, firefox, webkit } from "playwright-core";
|
|
1
2
|
import { Array, Context, Data, Effect, Layer, Match, Option, Predicate, Runtime, Stream, identity } from "effect";
|
|
2
|
-
import { chromium, errors } from "playwright-core";
|
|
3
3
|
import { Readable } from "node:stream";
|
|
4
4
|
//#region src/errors.ts
|
|
5
5
|
/**
|
|
@@ -141,6 +141,29 @@ var PlaywrightMouse = class PlaywrightMouse extends Context.Tag("effect-playwrig
|
|
|
141
141
|
}
|
|
142
142
|
};
|
|
143
143
|
//#endregion
|
|
144
|
+
//#region src/screencast.ts
|
|
145
|
+
/**
|
|
146
|
+
* @category tag
|
|
147
|
+
*/
|
|
148
|
+
var PlaywrightScreencast = class PlaywrightScreencast extends Context.Tag("effect-playwright/PlaywrightScreencast")() {
|
|
149
|
+
/**
|
|
150
|
+
* @category constructor
|
|
151
|
+
*/
|
|
152
|
+
static make(screencast) {
|
|
153
|
+
const use = useHelper(screencast);
|
|
154
|
+
return PlaywrightScreencast.of({
|
|
155
|
+
start: (options) => use((s) => s.start(options).then(() => {})),
|
|
156
|
+
stop: use((s) => s.stop()),
|
|
157
|
+
showActions: (options) => use((s) => s.showActions(options).then(() => {})),
|
|
158
|
+
hideActions: use((s) => s.hideActions()),
|
|
159
|
+
showChapter: (title, options) => use((s) => s.showChapter(title, options)),
|
|
160
|
+
showOverlay: (html, options) => use((s) => s.showOverlay(html, options).then(() => {})),
|
|
161
|
+
showOverlays: use((s) => s.showOverlays()),
|
|
162
|
+
hideOverlays: use((s) => s.hideOverlays())
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
//#endregion
|
|
144
167
|
//#region src/touchscreen.ts
|
|
145
168
|
/**
|
|
146
169
|
* @category tag
|
|
@@ -198,6 +221,7 @@ var PlaywrightPage = class PlaywrightPage extends Context.Tag("effect-playwright
|
|
|
198
221
|
keyboard: PlaywrightKeyboard.make(page.keyboard),
|
|
199
222
|
mouse: PlaywrightMouse.make(page.mouse),
|
|
200
223
|
touchscreen: PlaywrightTouchscreen.make(page.touchscreen),
|
|
224
|
+
screencast: PlaywrightScreencast.make(page.screencast),
|
|
201
225
|
goto: (url, options) => use((p) => p.goto(url, options)),
|
|
202
226
|
setContent: (html, options) => use((p) => p.setContent(html, options)),
|
|
203
227
|
waitForTimeout: (timeout) => use((p) => p.waitForTimeout(timeout)),
|
|
@@ -225,10 +249,17 @@ var PlaywrightPage = class PlaywrightPage extends Context.Tag("effect-playwright
|
|
|
225
249
|
getByPlaceholder: (text, options) => PlaywrightLocator.make(page.getByPlaceholder(text, options)),
|
|
226
250
|
getByTitle: (text, options) => PlaywrightLocator.make(page.getByTitle(text, options)),
|
|
227
251
|
url: () => page.url(),
|
|
252
|
+
hideHighlight: use((p) => p.hideHighlight()),
|
|
253
|
+
clearConsoleMessages: use((p) => p.clearConsoleMessages()),
|
|
254
|
+
clearPageErrors: use((p) => p.clearPageErrors()),
|
|
255
|
+
consoleMessages: (options) => use((p) => p.consoleMessages(options)),
|
|
256
|
+
pageErrors: (options) => use((p) => p.pageErrors(options)),
|
|
257
|
+
requests: use((p) => p.requests()).pipe(Effect.map(Array.map(PlaywrightRequest.make))),
|
|
258
|
+
pickLocator: use((p) => p.pickLocator().then(PlaywrightLocator.make)),
|
|
259
|
+
cancelPickLocator: use((p) => p.cancelPickLocator()),
|
|
260
|
+
ariaSnapshot: (options) => use((p) => p.ariaSnapshot(options)),
|
|
228
261
|
context: () => PlaywrightBrowserContext.make(page.context()),
|
|
229
262
|
opener: use((p) => p.opener()).pipe(Effect.map(Option.fromNullable), Effect.map(Option.map(PlaywrightPage.make))),
|
|
230
|
-
consoleMessages: use((p) => p.consoleMessages()),
|
|
231
|
-
pageErrors: use((p) => p.pageErrors()),
|
|
232
263
|
workers: () => page.workers().map(PlaywrightWorker.make),
|
|
233
264
|
frame: (frameSelector) => Option.fromNullable(page.frame(frameSelector)).pipe(Option.map(PlaywrightFrame.make)),
|
|
234
265
|
frames: use((p) => Promise.resolve(p.frames().map(PlaywrightFrame.make))),
|
|
@@ -333,7 +364,10 @@ var PlaywrightLocator = class PlaywrightLocator extends Context.Tag("effect-play
|
|
|
333
364
|
evaluateHandle: (pageFunction, arg) => use((l) => l.evaluateHandle(pageFunction, arg)),
|
|
334
365
|
elementHandle: (options) => use((l) => l.elementHandle(options)).pipe(Effect.map(Option.fromNullable)),
|
|
335
366
|
elementHandles: () => use((l) => l.elementHandles()),
|
|
336
|
-
highlight: () => use((l) => l.highlight()),
|
|
367
|
+
highlight: (options) => use((l) => l.highlight(options)),
|
|
368
|
+
hideHighlight: use((l) => l.hideHighlight()),
|
|
369
|
+
drop: (data, options) => use((l) => l.drop(data, options)),
|
|
370
|
+
normalize: () => use((l) => l.normalize().then(PlaywrightLocator.make)),
|
|
337
371
|
screenshot: (options) => use((l) => l.screenshot(options)),
|
|
338
372
|
blur: (options) => use((l) => l.blur(options)),
|
|
339
373
|
clear: (options) => use((l) => l.clear(options)),
|
|
@@ -533,13 +567,40 @@ var PlaywrightDownload = class PlaywrightDownload extends Data.TaggedClass("Play
|
|
|
533
567
|
}
|
|
534
568
|
};
|
|
535
569
|
//#endregion
|
|
570
|
+
//#region src/tracing.ts
|
|
571
|
+
/**
|
|
572
|
+
* @category tag
|
|
573
|
+
*/
|
|
574
|
+
var PlaywrightTracing = class PlaywrightTracing extends Context.Tag("effect-playwright/PlaywrightTracing")() {
|
|
575
|
+
/**
|
|
576
|
+
* @category constructor
|
|
577
|
+
*/
|
|
578
|
+
static make(tracing) {
|
|
579
|
+
const use = useHelper(tracing);
|
|
580
|
+
return PlaywrightTracing.of({
|
|
581
|
+
start: (options) => use((t) => t.start(options)),
|
|
582
|
+
startChunk: (options) => use((t) => t.startChunk(options)),
|
|
583
|
+
stopChunk: (options) => use((t) => t.stopChunk(options)),
|
|
584
|
+
stop: (options) => use((t) => t.stop(options)),
|
|
585
|
+
startHar: (options) => use((t) => t.startHar(options).then(() => {})),
|
|
586
|
+
stopHar: use((t) => t.stopHar())
|
|
587
|
+
});
|
|
588
|
+
}
|
|
589
|
+
};
|
|
590
|
+
//#endregion
|
|
536
591
|
//#region src/browser-context.ts
|
|
537
592
|
const eventMappings$1 = {
|
|
538
593
|
backgroundpage: (page) => PlaywrightPage.make(page),
|
|
539
594
|
close: (context) => PlaywrightBrowserContext.make(context),
|
|
540
595
|
console: identity,
|
|
541
596
|
dialog: (dialog) => PlaywrightDialog.make(dialog),
|
|
597
|
+
download: (download) => PlaywrightDownload.make(download),
|
|
598
|
+
frameattached: (frame) => PlaywrightFrame.make(frame),
|
|
599
|
+
framedetached: (frame) => PlaywrightFrame.make(frame),
|
|
600
|
+
framenavigated: (frame) => PlaywrightFrame.make(frame),
|
|
542
601
|
page: (page) => PlaywrightPage.make(page),
|
|
602
|
+
pageclose: (page) => PlaywrightPage.make(page),
|
|
603
|
+
pageload: (page) => PlaywrightPage.make(page),
|
|
543
604
|
request: (request) => PlaywrightRequest.make(request),
|
|
544
605
|
requestfailed: (request) => PlaywrightRequest.make(request),
|
|
545
606
|
requestfinished: (request) => PlaywrightRequest.make(request),
|
|
@@ -561,6 +622,7 @@ var PlaywrightBrowserContext = class PlaywrightBrowserContext extends Context.Ta
|
|
|
561
622
|
const use = useHelper(context);
|
|
562
623
|
return PlaywrightBrowserContext.of({
|
|
563
624
|
clock: PlaywrightClock.make(context.clock),
|
|
625
|
+
tracing: PlaywrightTracing.make(context.tracing),
|
|
564
626
|
pages: () => context.pages().map(PlaywrightPage.make),
|
|
565
627
|
newPage: use((c) => c.newPage().then(PlaywrightPage.make)),
|
|
566
628
|
close: use((c) => c.close()),
|
|
@@ -576,6 +638,7 @@ var PlaywrightBrowserContext = class PlaywrightBrowserContext extends Context.Ta
|
|
|
576
638
|
setOffline: (offline) => use((c) => c.setOffline(offline)),
|
|
577
639
|
setDefaultNavigationTimeout: (timeout) => context.setDefaultNavigationTimeout(timeout),
|
|
578
640
|
setDefaultTimeout: (timeout) => context.setDefaultTimeout(timeout),
|
|
641
|
+
setStorageState: (options) => use((c) => c.setStorageState(options)),
|
|
579
642
|
eventStream: (event) => Stream.asyncPush((emit) => Effect.acquireRelease(Effect.sync(() => {
|
|
580
643
|
context.on(event, emit.single);
|
|
581
644
|
context.once("close", emit.end);
|
|
@@ -591,7 +654,10 @@ var PlaywrightBrowserContext = class PlaywrightBrowserContext extends Context.Ta
|
|
|
591
654
|
};
|
|
592
655
|
//#endregion
|
|
593
656
|
//#region src/browser.ts
|
|
594
|
-
const eventMappings = {
|
|
657
|
+
const eventMappings = {
|
|
658
|
+
disconnected: (browser) => PlaywrightBrowser.make(browser),
|
|
659
|
+
context: (context) => PlaywrightBrowserContext.make(context)
|
|
660
|
+
};
|
|
595
661
|
/**
|
|
596
662
|
* @category tag
|
|
597
663
|
*/
|
|
@@ -609,6 +675,8 @@ var PlaywrightBrowser = class PlaywrightBrowser extends Context.Tag("effect-play
|
|
|
609
675
|
browserType: () => browser.browserType(),
|
|
610
676
|
version: () => browser.version(),
|
|
611
677
|
isConnected: () => browser.isConnected(),
|
|
678
|
+
bind: (title, options) => use((browser) => browser.bind(title, options)),
|
|
679
|
+
unbind: use((browser) => browser.unbind()),
|
|
612
680
|
eventStream: (event) => Stream.asyncPush((emit) => Effect.acquireRelease(Effect.sync(() => {
|
|
613
681
|
browser.on(event, emit.single);
|
|
614
682
|
browser.once("disconnected", emit.end);
|
|
@@ -664,4 +732,4 @@ var Playwright = class Playwright extends Context.Tag("effect-playwright/index/P
|
|
|
664
732
|
});
|
|
665
733
|
};
|
|
666
734
|
//#endregion
|
|
667
|
-
export {
|
|
735
|
+
export { PlaywrightMouse as _, PlaywrightBrowser as a, PlaywrightError as b, PlaywrightDownload as c, PlaywrightResponse as d, PlaywrightWorker as f, PlaywrightTouchscreen as g, PlaywrightPage as h, Playwright as i, PlaywrightFileChooser as l, PlaywrightLocator as m, firefox as n, PlaywrightBrowserContext as o, PlaywrightFrame as p, webkit as r, PlaywrightDialog as s, chromium$1 as t, PlaywrightRequest as u, PlaywrightKeyboard as v, PlaywrightClock as y };
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "effect-playwright",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.5.0",
|
|
5
5
|
"description": "An Effect-based Playwright library.",
|
|
6
6
|
"author": "Jobflow GmbH",
|
|
7
|
-
"license": "
|
|
7
|
+
"license": "MIT",
|
|
8
8
|
"homepage": "https://github.com/Jobflow-io/effect-playwright",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -18,8 +18,12 @@
|
|
|
18
18
|
"./experimental": "./dist/experimental/index.mjs",
|
|
19
19
|
"./package.json": "./package.json"
|
|
20
20
|
},
|
|
21
|
+
"bin": {
|
|
22
|
+
"effect-playwright": "./bin/cli.mjs"
|
|
23
|
+
},
|
|
21
24
|
"files": [
|
|
22
|
-
"dist"
|
|
25
|
+
"dist",
|
|
26
|
+
"bin"
|
|
23
27
|
],
|
|
24
28
|
"keywords": [
|
|
25
29
|
"effect",
|
|
@@ -29,28 +33,29 @@
|
|
|
29
33
|
"automation"
|
|
30
34
|
],
|
|
31
35
|
"dependencies": {
|
|
32
|
-
"playwright-core": "^1.
|
|
36
|
+
"playwright-core": "^1.60.0"
|
|
33
37
|
},
|
|
34
38
|
"peerDependencies": {
|
|
35
39
|
"@effect/platform": "^0.93.3",
|
|
36
40
|
"effect": "^3.19.6"
|
|
37
41
|
},
|
|
38
42
|
"devDependencies": {
|
|
39
|
-
"@biomejs/biome": "2.4.
|
|
40
|
-
"@effect/cli": "^0.75.
|
|
41
|
-
"@effect/language-service": "0.
|
|
42
|
-
"@effect/platform": "^0.96.
|
|
43
|
+
"@biomejs/biome": "2.4.14",
|
|
44
|
+
"@effect/cli": "^0.75.1",
|
|
45
|
+
"@effect/language-service": "0.85.1",
|
|
46
|
+
"@effect/platform": "^0.96.1",
|
|
43
47
|
"@effect/platform-node": "^0.106.0",
|
|
44
48
|
"@effect/vitest": "^0.29.0",
|
|
45
|
-
"@types/node": "^25.
|
|
46
|
-
"effect": "^3.21.
|
|
47
|
-
"playwright": "^1.
|
|
48
|
-
"ts-morph": "^
|
|
49
|
-
"tsdown": "0.
|
|
49
|
+
"@types/node": "^25.6.1",
|
|
50
|
+
"effect": "^3.21.2",
|
|
51
|
+
"playwright": "^1.60.0",
|
|
52
|
+
"ts-morph": "^28.0.0",
|
|
53
|
+
"tsdown": "0.22.0",
|
|
50
54
|
"tsx": "^4.21.0",
|
|
51
|
-
"typedoc": "^0.28.
|
|
52
|
-
"typescript": "^6.0.
|
|
53
|
-
"
|
|
55
|
+
"typedoc": "^0.28.19",
|
|
56
|
+
"typescript": "^6.0.3",
|
|
57
|
+
"vite": "^8.0.11",
|
|
58
|
+
"vitest": "^4.1.5"
|
|
54
59
|
},
|
|
55
60
|
"types": "./dist/index.d.mts",
|
|
56
61
|
"scripts": {
|
|
@@ -59,6 +64,7 @@
|
|
|
59
64
|
"type-check": "tsc --noEmit",
|
|
60
65
|
"coverage": "tsx scripts/coverage.ts",
|
|
61
66
|
"generate-docs": "typedoc",
|
|
62
|
-
"format": "biome format --fix"
|
|
67
|
+
"format": "biome format --fix",
|
|
68
|
+
"check": "biome check --fix"
|
|
63
69
|
}
|
|
64
70
|
}
|