effect-playwright 0.3.0 → 0.4.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.
|
@@ -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-AKFnbezx.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-bbEI8uuw.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);
|
|
@@ -443,7 +443,7 @@ declare class PlaywrightRequest extends PlaywrightRequest_base<{
|
|
|
443
443
|
* Returns the Frame that initiated this request.
|
|
444
444
|
* @see {@link Request.frame}
|
|
445
445
|
*/
|
|
446
|
-
frame: Effect.Effect<PlaywrightFrameService>;
|
|
446
|
+
frame: Effect.Effect<PlaywrightFrameService, PlaywrightError>;
|
|
447
447
|
/**
|
|
448
448
|
* Returns the value of the header matching the name. The name is case insensitive.
|
|
449
449
|
* @see {@link Request.headerValue}
|
|
@@ -538,7 +538,7 @@ declare class PlaywrightResponse extends PlaywrightResponse_base<{
|
|
|
538
538
|
allHeaders: Effect.Effect<Awaited<ReturnType<Response["allHeaders"]>>, PlaywrightError>;
|
|
539
539
|
body: Effect.Effect<Awaited<ReturnType<Response["body"]>>, PlaywrightError>;
|
|
540
540
|
finished: Effect.Effect<Awaited<ReturnType<Response["finished"]>>, PlaywrightError>;
|
|
541
|
-
frame: Effect.Effect<PlaywrightFrameService>;
|
|
541
|
+
frame: Effect.Effect<PlaywrightFrameService, PlaywrightError>;
|
|
542
542
|
fromServiceWorker: () => boolean;
|
|
543
543
|
headers: () => ReturnType<Response["headers"]>;
|
|
544
544
|
headersArray: Effect.Effect<Awaited<ReturnType<Response["headersArray"]>>, PlaywrightError>;
|
|
@@ -882,14 +882,14 @@ interface PlaywrightPageService {
|
|
|
882
882
|
* @see {@link Page.setDefaultNavigationTimeout}
|
|
883
883
|
* @since 0.3.0
|
|
884
884
|
*/
|
|
885
|
-
readonly setDefaultNavigationTimeout: (timeout: Parameters<Page["setDefaultNavigationTimeout"]>[0]) =>
|
|
885
|
+
readonly setDefaultNavigationTimeout: (timeout: Parameters<Page["setDefaultNavigationTimeout"]>[0]) => void;
|
|
886
886
|
/**
|
|
887
887
|
* This setting will change the default maximum time for all the methods accepting `timeout` option.
|
|
888
888
|
*
|
|
889
889
|
* @see {@link Page.setDefaultTimeout}
|
|
890
890
|
* @since 0.3.0
|
|
891
891
|
*/
|
|
892
|
-
readonly setDefaultTimeout: (timeout: Parameters<Page["setDefaultTimeout"]>[0]) =>
|
|
892
|
+
readonly setDefaultTimeout: (timeout: Parameters<Page["setDefaultTimeout"]>[0]) => void;
|
|
893
893
|
/**
|
|
894
894
|
* The extra HTTP headers will be sent with every request the page initiates.
|
|
895
895
|
*
|
|
@@ -1458,7 +1458,7 @@ interface PlaywrightBrowserContextService {
|
|
|
1458
1458
|
* @see {@link BrowserContext.pages}
|
|
1459
1459
|
* @since 0.1.0
|
|
1460
1460
|
*/
|
|
1461
|
-
readonly pages:
|
|
1461
|
+
readonly pages: () => Array<typeof PlaywrightPage.Service>;
|
|
1462
1462
|
/**
|
|
1463
1463
|
* Opens a new page in the browser context.
|
|
1464
1464
|
*
|
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-AKFnbezx.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 PlaywrightTouchscreen, f as PlaywrightMouse, g as PlaywrightClock, h as PlaywrightLocator, i as PlaywrightDialog, l as PlaywrightWorker, m as PlaywrightFrame, n as PlaywrightBrowser, o as PlaywrightFileChooser, p as PlaywrightKeyboard, r as PlaywrightBrowserContext, s as PlaywrightRequest, t as Playwright, u as PlaywrightPage } from "./src-
|
|
1
|
+
import { _ as PlaywrightError, a as PlaywrightDownload, c as PlaywrightResponse, d as PlaywrightTouchscreen, f as PlaywrightMouse, g as PlaywrightClock, h as PlaywrightLocator, i as PlaywrightDialog, l as PlaywrightWorker, m as PlaywrightFrame, n as PlaywrightBrowser, o as PlaywrightFileChooser, p as PlaywrightKeyboard, r as PlaywrightBrowserContext, s as PlaywrightRequest, t as Playwright, u as PlaywrightPage } from "./src-bbEI8uuw.mjs";
|
|
2
2
|
export { Playwright, PlaywrightBrowser, PlaywrightBrowserContext, PlaywrightClock, PlaywrightDialog, PlaywrightDownload, PlaywrightError, PlaywrightFileChooser, PlaywrightFrame, PlaywrightKeyboard, PlaywrightLocator, PlaywrightMouse, PlaywrightPage, PlaywrightRequest, PlaywrightResponse, PlaywrightTouchscreen, PlaywrightWorker };
|
|
@@ -240,8 +240,8 @@ var PlaywrightPage = class PlaywrightPage extends Context.Tag("effect-playwright
|
|
|
240
240
|
touchscreen: PlaywrightTouchscreen.make(page.touchscreen),
|
|
241
241
|
goto: (url, options) => use((p) => p.goto(url, options)),
|
|
242
242
|
setContent: (html, options) => use((p) => p.setContent(html, options)),
|
|
243
|
-
setDefaultNavigationTimeout: (timeout) =>
|
|
244
|
-
setDefaultTimeout: (timeout) =>
|
|
243
|
+
setDefaultNavigationTimeout: (timeout) => page.setDefaultNavigationTimeout(timeout),
|
|
244
|
+
setDefaultTimeout: (timeout) => page.setDefaultTimeout(timeout),
|
|
245
245
|
setExtraHTTPHeaders: (headers) => use((p) => p.setExtraHTTPHeaders(headers)),
|
|
246
246
|
setViewportSize: (viewportSize) => use((p) => p.setViewportSize(viewportSize)),
|
|
247
247
|
viewportSize: () => Option.fromNullable(page.viewportSize()),
|
|
@@ -311,7 +311,10 @@ var PlaywrightRequest = class PlaywrightRequest extends Data.TaggedClass("Playwr
|
|
|
311
311
|
return new PlaywrightRequest({
|
|
312
312
|
allHeaders: use(() => request.allHeaders()),
|
|
313
313
|
failure: Option.liftNullable(request.failure),
|
|
314
|
-
frame: Effect.
|
|
314
|
+
frame: Effect.try({
|
|
315
|
+
try: () => PlaywrightFrame.make(request.frame()),
|
|
316
|
+
catch: wrapError
|
|
317
|
+
}),
|
|
315
318
|
headerValue: (name) => use(() => request.headerValue(name)).pipe(Effect.map(Option.fromNullable)),
|
|
316
319
|
headers: () => request.headers(),
|
|
317
320
|
headersArray: use(() => request.headersArray()),
|
|
@@ -342,7 +345,10 @@ var PlaywrightResponse = class PlaywrightResponse extends Data.TaggedClass("Play
|
|
|
342
345
|
allHeaders: use(() => response.allHeaders()),
|
|
343
346
|
body: use(() => response.body()),
|
|
344
347
|
finished: use(() => response.finished()),
|
|
345
|
-
frame: Effect.
|
|
348
|
+
frame: Effect.try({
|
|
349
|
+
try: () => PlaywrightFrame.make(response.frame()),
|
|
350
|
+
catch: wrapError
|
|
351
|
+
}),
|
|
346
352
|
fromServiceWorker: () => response.fromServiceWorker(),
|
|
347
353
|
headers: () => response.headers(),
|
|
348
354
|
headersArray: use(() => response.headersArray()),
|
|
@@ -455,7 +461,7 @@ var PlaywrightBrowserContext = class PlaywrightBrowserContext extends Context.Ta
|
|
|
455
461
|
const use = useHelper(context);
|
|
456
462
|
return PlaywrightBrowserContext.of({
|
|
457
463
|
clock: PlaywrightClock.make(context.clock),
|
|
458
|
-
pages:
|
|
464
|
+
pages: () => context.pages().map(PlaywrightPage.make),
|
|
459
465
|
newPage: use((c) => c.newPage().then(PlaywrightPage.make)),
|
|
460
466
|
close: use((c) => c.close()),
|
|
461
467
|
addInitScript: (script, arg) => use((c) => c.addInitScript(script, arg)),
|