@stablyai/playwright-base 2.0.12-rc.1 → 2.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +102 -151
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +227 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +3 -1
- package/dist/index.d.mts.map +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +71 -111
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -1,52 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
'use strict';
|
|
29
2
|
|
|
30
|
-
|
|
31
|
-
var
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
3
|
+
var test = require('@playwright/test');
|
|
4
|
+
var jpeg = require('jpeg-js');
|
|
5
|
+
var pngjs = require('pngjs');
|
|
6
|
+
var pRetry = require('p-retry');
|
|
7
|
+
|
|
8
|
+
function _interopNamespaceDefault(e) {
|
|
9
|
+
var n = Object.create(null);
|
|
10
|
+
if (e) {
|
|
11
|
+
Object.keys(e).forEach(function (k) {
|
|
12
|
+
if (k !== 'default') {
|
|
13
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
14
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () { return e[k]; }
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
n.default = e;
|
|
22
|
+
return Object.freeze(n);
|
|
23
|
+
}
|
|
44
24
|
|
|
45
|
-
|
|
46
|
-
var import_test = require("@playwright/test");
|
|
25
|
+
var jpeg__namespace = /*#__PURE__*/_interopNamespaceDefault(jpeg);
|
|
47
26
|
|
|
48
|
-
|
|
49
|
-
var configuredApiKey = process.env.STABLY_API_KEY;
|
|
27
|
+
let configuredApiKey = process.env.STABLY_API_KEY;
|
|
50
28
|
function setApiKey(apiKey) {
|
|
51
29
|
configuredApiKey = apiKey;
|
|
52
30
|
}
|
|
@@ -63,25 +41,22 @@ function requireApiKey() {
|
|
|
63
41
|
return apiKey;
|
|
64
42
|
}
|
|
65
43
|
|
|
66
|
-
|
|
67
|
-
var isObject = (value) => {
|
|
44
|
+
const isObject = (value) => {
|
|
68
45
|
return typeof value === "object" && value !== null;
|
|
69
46
|
};
|
|
70
47
|
|
|
71
|
-
|
|
72
|
-
var SDK_METADATA_HEADERS = {
|
|
48
|
+
const SDK_METADATA_HEADERS = {
|
|
73
49
|
"X-Client-Name": "stably-playwright-sdk-js",
|
|
74
|
-
"X-Client-Version": "2.0.12
|
|
50
|
+
"X-Client-Version": "2.0.12"
|
|
75
51
|
};
|
|
76
52
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
var PROMPT_ASSERTION_ENDPOINT = new URL(
|
|
53
|
+
const PROMPT_ASSERTION_PATH = "internal/v2/assert";
|
|
54
|
+
const STABLY_API_URL$2 = process.env.STABLY_API_URL || "https://api.stably.ai";
|
|
55
|
+
const PROMPT_ASSERTION_ENDPOINT = new URL(
|
|
81
56
|
PROMPT_ASSERTION_PATH,
|
|
82
|
-
STABLY_API_URL
|
|
57
|
+
STABLY_API_URL$2
|
|
83
58
|
).toString();
|
|
84
|
-
|
|
59
|
+
const parseSuccessResponse = (value) => {
|
|
85
60
|
if (!isObject(value)) {
|
|
86
61
|
throw new Error("Verify prompt returned unexpected response shape");
|
|
87
62
|
}
|
|
@@ -97,7 +72,7 @@ var parseSuccessResponse = (value) => {
|
|
|
97
72
|
success
|
|
98
73
|
};
|
|
99
74
|
};
|
|
100
|
-
|
|
75
|
+
const parseErrorResponse = (value) => {
|
|
101
76
|
if (!isObject(value)) {
|
|
102
77
|
return void 0;
|
|
103
78
|
}
|
|
@@ -142,7 +117,6 @@ async function verifyPrompt({
|
|
|
142
117
|
);
|
|
143
118
|
}
|
|
144
119
|
|
|
145
|
-
// src/playwright-type-predicates.ts
|
|
146
120
|
function isPage(candidate) {
|
|
147
121
|
return typeof candidate === "object" && candidate !== null && typeof candidate.screenshot === "function" && typeof candidate.goto === "function";
|
|
148
122
|
}
|
|
@@ -150,10 +124,6 @@ function isLocator(candidate) {
|
|
|
150
124
|
return typeof candidate === "object" && candidate !== null && typeof candidate.screenshot === "function" && typeof candidate.nth === "function";
|
|
151
125
|
}
|
|
152
126
|
|
|
153
|
-
// src/image-compare.ts
|
|
154
|
-
var jpeg = __toESM(require("jpeg-js"));
|
|
155
|
-
|
|
156
|
-
// ../../node_modules/.pnpm/pixelmatch@7.1.0/node_modules/pixelmatch/index.js
|
|
157
127
|
function pixelmatch(img1, img2, output, width, height, options = {}) {
|
|
158
128
|
const {
|
|
159
129
|
threshold = 0.1,
|
|
@@ -309,27 +279,25 @@ function drawGrayPixel(img, i, alpha, output) {
|
|
|
309
279
|
drawPixel(output, i, val, val, val);
|
|
310
280
|
}
|
|
311
281
|
|
|
312
|
-
|
|
313
|
-
var import_pngjs = require("pngjs");
|
|
314
|
-
var isPng = (buffer) => {
|
|
282
|
+
const isPng = (buffer) => {
|
|
315
283
|
return buffer.length >= 8 && buffer[0] === 137 && buffer[1] === 80 && buffer[2] === 78 && buffer[3] === 71 && buffer[4] === 13 && buffer[5] === 10 && buffer[6] === 26 && buffer[7] === 10;
|
|
316
284
|
};
|
|
317
|
-
|
|
285
|
+
const isJpeg = (buffer) => {
|
|
318
286
|
return buffer.length >= 2 && buffer[0] === 255 && buffer[1] === 216;
|
|
319
287
|
};
|
|
320
|
-
|
|
288
|
+
const decodeImage = (buffer) => {
|
|
321
289
|
if (isPng(buffer)) {
|
|
322
|
-
const png2 =
|
|
290
|
+
const png2 = pngjs.PNG.sync.read(buffer);
|
|
323
291
|
return { data: png2.data, height: png2.height, width: png2.width };
|
|
324
292
|
}
|
|
325
293
|
if (isJpeg(buffer)) {
|
|
326
|
-
const img =
|
|
294
|
+
const img = jpeg__namespace.decode(buffer, { maxMemoryUsageInMB: 1024 });
|
|
327
295
|
return { data: img.data, height: img.height, width: img.width };
|
|
328
296
|
}
|
|
329
|
-
const png =
|
|
297
|
+
const png = pngjs.PNG.sync.read(buffer);
|
|
330
298
|
return { data: png.data, height: png.height, width: png.width };
|
|
331
299
|
};
|
|
332
|
-
|
|
300
|
+
const imagesAreSimilar = ({
|
|
333
301
|
image1,
|
|
334
302
|
image2,
|
|
335
303
|
threshold
|
|
@@ -353,7 +321,6 @@ var imagesAreSimilar = ({
|
|
|
353
321
|
return numDiffPixels === 0;
|
|
354
322
|
};
|
|
355
323
|
|
|
356
|
-
// src/screenshot.ts
|
|
357
324
|
async function takeStableScreenshot(target, options) {
|
|
358
325
|
const page = isPage(target) ? target : target.page();
|
|
359
326
|
const totalTimeout = options?.timeout ?? 5e3;
|
|
@@ -400,8 +367,7 @@ async function takeStableScreenshot(target, options) {
|
|
|
400
367
|
return actual ?? await safeScreenshot();
|
|
401
368
|
}
|
|
402
369
|
|
|
403
|
-
|
|
404
|
-
var MAX_ATTACHMENT_NAME_LENGTH = 80;
|
|
370
|
+
const MAX_ATTACHMENT_NAME_LENGTH = 80;
|
|
405
371
|
function createFailureMessage({
|
|
406
372
|
condition,
|
|
407
373
|
didPass,
|
|
@@ -419,7 +385,7 @@ Reason: ${reason}`;
|
|
|
419
385
|
}
|
|
420
386
|
return message;
|
|
421
387
|
}
|
|
422
|
-
|
|
388
|
+
const stablyPlaywrightMatchers = {
|
|
423
389
|
async toMatchScreenshotPrompt(received, condition, options) {
|
|
424
390
|
const target = isPage(received) ? received : isLocator(received) ? received : void 0;
|
|
425
391
|
if (!target) {
|
|
@@ -434,7 +400,7 @@ var stablyPlaywrightMatchers = {
|
|
|
434
400
|
prompt: condition,
|
|
435
401
|
screenshot
|
|
436
402
|
});
|
|
437
|
-
const testInfo =
|
|
403
|
+
const testInfo = test.test.info();
|
|
438
404
|
const sanitizedName = condition.trim().toLowerCase().replace(/[^\w]+/g, "_").replace(/^_+|_+$/g, "").slice(0, MAX_ATTACHMENT_NAME_LENGTH) || "toMatchScreenshotPrompt";
|
|
439
405
|
testInfo.attachments.push(
|
|
440
406
|
{
|
|
@@ -475,14 +441,8 @@ var stablyPlaywrightMatchers = {
|
|
|
475
441
|
}
|
|
476
442
|
};
|
|
477
443
|
|
|
478
|
-
|
|
479
|
-
var import_test2 = require("@playwright/test");
|
|
480
|
-
var import_p_retry = __toESM(require("p-retry"));
|
|
481
|
-
|
|
482
|
-
// src/utils/truncate.ts
|
|
483
|
-
var truncate = (inp, length) => inp.length <= length || inp.length <= 3 ? inp : `${inp.slice(0, length - 3)}...`;
|
|
444
|
+
const truncate = (inp, length) => inp.length <= length || inp.length <= 3 ? inp : `${inp.slice(0, length - 3)}...`;
|
|
484
445
|
|
|
485
|
-
// src/playwright-augment/methods/agent/construct-payload.ts
|
|
486
446
|
function constructAgentPayload({
|
|
487
447
|
activePage,
|
|
488
448
|
additionalContext,
|
|
@@ -530,7 +490,6 @@ function constructAgentPayload({
|
|
|
530
490
|
return form;
|
|
531
491
|
}
|
|
532
492
|
|
|
533
|
-
// src/playwright-augment/methods/agent/scroll-helper.ts
|
|
534
493
|
async function scrollAtPosition({
|
|
535
494
|
amount,
|
|
536
495
|
direction,
|
|
@@ -567,8 +526,7 @@ async function scrollAtPosition({
|
|
|
567
526
|
}
|
|
568
527
|
}
|
|
569
528
|
|
|
570
|
-
|
|
571
|
-
var DEFAULT_AGENT_WAIT_MS = 3e3;
|
|
529
|
+
const DEFAULT_AGENT_WAIT_MS = 3e3;
|
|
572
530
|
async function execResponse({
|
|
573
531
|
activePage: initialActivePage,
|
|
574
532
|
agentResponse,
|
|
@@ -710,11 +668,10 @@ ${ariaSnapshot}` }
|
|
|
710
668
|
}
|
|
711
669
|
}
|
|
712
670
|
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
var Agent = class {
|
|
671
|
+
const AGENT_PATH = "internal/v3/agent";
|
|
672
|
+
const STABLY_API_URL$1 = process.env.STABLY_API_URL || "https://api.stably.ai";
|
|
673
|
+
const AGENT_ENDPOINT = new URL(AGENT_PATH, STABLY_API_URL$1).toString();
|
|
674
|
+
class Agent {
|
|
718
675
|
constructor(browserContext) {
|
|
719
676
|
this.browserContext = browserContext;
|
|
720
677
|
}
|
|
@@ -783,15 +740,15 @@ var Agent = class {
|
|
|
783
740
|
newPageOpenedMsg = `opened new tab ${alias} (${page.url()})`;
|
|
784
741
|
};
|
|
785
742
|
this.browserContext.on("page", onNewPage);
|
|
786
|
-
return await
|
|
743
|
+
return await test.test.step(`[Agent] ${prompt}`, async () => {
|
|
787
744
|
try {
|
|
788
745
|
for (let i = 0; i < maxCycles; i++) {
|
|
789
746
|
if (agentMessage.shouldTerminate) {
|
|
790
747
|
break;
|
|
791
748
|
}
|
|
792
|
-
const agentResponses = await
|
|
749
|
+
const agentResponses = await test.test.step(`[Thinking ${i + 1}]`, async (stepInfo) => {
|
|
793
750
|
const screenshot = await takeStableScreenshot(activePage);
|
|
794
|
-
const response = await (
|
|
751
|
+
const response = await pRetry(
|
|
795
752
|
() => fetch(AGENT_ENDPOINT, {
|
|
796
753
|
body: constructAgentPayload({
|
|
797
754
|
activePage,
|
|
@@ -879,22 +836,20 @@ var Agent = class {
|
|
|
879
836
|
}
|
|
880
837
|
});
|
|
881
838
|
}
|
|
882
|
-
}
|
|
883
|
-
|
|
839
|
+
}
|
|
840
|
+
const createNewAgent = (browserContext) => new Agent(browserContext);
|
|
884
841
|
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
var EXTRACT_ENDPOINT = new URL(EXTRACT_PATH, STABLY_API_URL3).toString();
|
|
890
|
-
var zodV4 = (() => {
|
|
842
|
+
const EXTRACT_PATH = "internal/v2/extract";
|
|
843
|
+
const STABLY_API_URL = process.env.STABLY_API_URL || "https://api.stably.ai";
|
|
844
|
+
const EXTRACT_ENDPOINT = new URL(EXTRACT_PATH, STABLY_API_URL).toString();
|
|
845
|
+
const zodV4 = (() => {
|
|
891
846
|
try {
|
|
892
847
|
return require("zod/v4/core");
|
|
893
848
|
} catch {
|
|
894
849
|
return void 0;
|
|
895
850
|
}
|
|
896
851
|
})();
|
|
897
|
-
|
|
852
|
+
const isExtractionResponse = (value) => {
|
|
898
853
|
if (!isObject(value)) {
|
|
899
854
|
return false;
|
|
900
855
|
}
|
|
@@ -903,16 +858,16 @@ var isExtractionResponse = (value) => {
|
|
|
903
858
|
}
|
|
904
859
|
return value.success === false && typeof value.error === "string";
|
|
905
860
|
};
|
|
906
|
-
|
|
861
|
+
const isErrorResponse = (value) => {
|
|
907
862
|
return isObject(value) && typeof value.error === "string";
|
|
908
863
|
};
|
|
909
|
-
|
|
864
|
+
class ExtractValidationError extends Error {
|
|
910
865
|
constructor(message, issues) {
|
|
911
866
|
super(message);
|
|
912
867
|
this.issues = issues;
|
|
913
868
|
this.name = "ExtractValidationError";
|
|
914
869
|
}
|
|
915
|
-
}
|
|
870
|
+
}
|
|
916
871
|
async function validateWithSchema(schema, value) {
|
|
917
872
|
const result = await schema.safeParseAsync(value);
|
|
918
873
|
if (!result.success) {
|
|
@@ -937,7 +892,7 @@ async function extract({
|
|
|
937
892
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
938
893
|
schema
|
|
939
894
|
) : void 0;
|
|
940
|
-
return await
|
|
895
|
+
return await test.test.step(`[Extract] ${prompt}`, async (stepInfo) => {
|
|
941
896
|
const apiKey = requireApiKey();
|
|
942
897
|
const form = new FormData();
|
|
943
898
|
form.append("prompt", prompt);
|
|
@@ -980,9 +935,8 @@ async function extract({
|
|
|
980
935
|
});
|
|
981
936
|
}
|
|
982
937
|
|
|
983
|
-
// src/playwright-augment/methods/extract.ts
|
|
984
938
|
function createExtract(pageOrLocator) {
|
|
985
|
-
const impl = async (prompt, options) => {
|
|
939
|
+
const impl = (async (prompt, options) => {
|
|
986
940
|
if (options?.schema) {
|
|
987
941
|
return extract({
|
|
988
942
|
pageOrLocator,
|
|
@@ -991,18 +945,17 @@ function createExtract(pageOrLocator) {
|
|
|
991
945
|
});
|
|
992
946
|
}
|
|
993
947
|
return extract({ pageOrLocator, prompt });
|
|
994
|
-
};
|
|
948
|
+
});
|
|
995
949
|
return impl;
|
|
996
950
|
}
|
|
997
|
-
|
|
998
|
-
|
|
951
|
+
const createLocatorExtract = (locator) => createExtract(locator);
|
|
952
|
+
const createPageExtract = (page) => createExtract(page);
|
|
999
953
|
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
var BROWSER_TYPE_PATCHED = Symbol.for("stably.playwright.browserTypePatched");
|
|
954
|
+
const LOCATOR_PATCHED = Symbol.for("stably.playwright.locatorPatched");
|
|
955
|
+
const PAGE_PATCHED = Symbol.for("stably.playwright.pagePatched");
|
|
956
|
+
const CONTEXT_PATCHED = Symbol.for("stably.playwright.contextPatched");
|
|
957
|
+
const BROWSER_PATCHED = Symbol.for("stably.playwright.browserPatched");
|
|
958
|
+
const BROWSER_TYPE_PATCHED = Symbol.for("stably.playwright.browserTypePatched");
|
|
1006
959
|
function defineHiddenProperty(target, key, value) {
|
|
1007
960
|
Object.defineProperty(target, key, {
|
|
1008
961
|
configurable: true,
|
|
@@ -1024,10 +977,10 @@ function augmentPage(page) {
|
|
|
1024
977
|
return page;
|
|
1025
978
|
}
|
|
1026
979
|
const originalLocator = page.locator.bind(page);
|
|
1027
|
-
page.locator = (...args) => {
|
|
980
|
+
page.locator = ((...args) => {
|
|
1028
981
|
const locator = originalLocator(...args);
|
|
1029
982
|
return augmentLocator(locator);
|
|
1030
|
-
};
|
|
983
|
+
});
|
|
1031
984
|
defineHiddenProperty(page, "extract", createPageExtract(page));
|
|
1032
985
|
defineHiddenProperty(page, PAGE_PATCHED, true);
|
|
1033
986
|
return page;
|
|
@@ -1037,13 +990,13 @@ function augmentBrowserContext(context) {
|
|
|
1037
990
|
return context;
|
|
1038
991
|
}
|
|
1039
992
|
const originalNewPage = context.newPage.bind(context);
|
|
1040
|
-
context.newPage = async (...args) => {
|
|
993
|
+
context.newPage = (async (...args) => {
|
|
1041
994
|
const page = await originalNewPage(...args);
|
|
1042
995
|
return augmentPage(page);
|
|
1043
|
-
};
|
|
996
|
+
});
|
|
1044
997
|
const originalPages = context.pages?.bind(context);
|
|
1045
998
|
if (originalPages) {
|
|
1046
|
-
context.pages = () => originalPages().map((page) => augmentPage(page));
|
|
999
|
+
context.pages = (() => originalPages().map((page) => augmentPage(page)));
|
|
1047
1000
|
}
|
|
1048
1001
|
if (!context.newAgent) {
|
|
1049
1002
|
defineHiddenProperty(context, "newAgent", () => {
|
|
@@ -1058,19 +1011,19 @@ function augmentBrowser(browser) {
|
|
|
1058
1011
|
return browser;
|
|
1059
1012
|
}
|
|
1060
1013
|
const originalNewContext = browser.newContext.bind(browser);
|
|
1061
|
-
browser.newContext = async (...args) => {
|
|
1014
|
+
browser.newContext = (async (...args) => {
|
|
1062
1015
|
const context = await originalNewContext(...args);
|
|
1063
1016
|
return augmentBrowserContext(context);
|
|
1064
|
-
};
|
|
1017
|
+
});
|
|
1065
1018
|
const originalNewPage = browser.newPage.bind(browser);
|
|
1066
|
-
browser.newPage = async (...args) => {
|
|
1019
|
+
browser.newPage = (async (...args) => {
|
|
1067
1020
|
const page = await originalNewPage(...args);
|
|
1068
1021
|
return augmentPage(page);
|
|
1069
|
-
};
|
|
1022
|
+
});
|
|
1070
1023
|
const originalContexts = browser.contexts.bind(browser);
|
|
1071
|
-
browser.contexts = () => originalContexts().map(
|
|
1024
|
+
browser.contexts = (() => originalContexts().map(
|
|
1072
1025
|
(context) => augmentBrowserContext(context)
|
|
1073
|
-
);
|
|
1026
|
+
));
|
|
1074
1027
|
if (!browser.newAgent) {
|
|
1075
1028
|
defineHiddenProperty(browser, "newAgent", () => {
|
|
1076
1029
|
const contexts = browser.contexts();
|
|
@@ -1086,46 +1039,44 @@ function augmentBrowserType(browserType) {
|
|
|
1086
1039
|
return browserType;
|
|
1087
1040
|
}
|
|
1088
1041
|
const originalLaunch = browserType.launch.bind(browserType);
|
|
1089
|
-
browserType.launch = async (...args) => {
|
|
1042
|
+
browserType.launch = (async (...args) => {
|
|
1090
1043
|
const browser = await originalLaunch(...args);
|
|
1091
1044
|
return augmentBrowser(browser);
|
|
1092
|
-
};
|
|
1045
|
+
});
|
|
1093
1046
|
const originalConnect = browserType.connect?.bind(browserType);
|
|
1094
1047
|
if (originalConnect) {
|
|
1095
|
-
browserType.connect = async (...args) => {
|
|
1048
|
+
browserType.connect = (async (...args) => {
|
|
1096
1049
|
const browser = await originalConnect(...args);
|
|
1097
1050
|
return augmentBrowser(browser);
|
|
1098
|
-
};
|
|
1051
|
+
});
|
|
1099
1052
|
}
|
|
1100
1053
|
const originalConnectOverCDP = browserType.connectOverCDP?.bind(
|
|
1101
1054
|
browserType
|
|
1102
1055
|
);
|
|
1103
1056
|
if (originalConnectOverCDP) {
|
|
1104
|
-
browserType.connectOverCDP = async (...args) => {
|
|
1057
|
+
browserType.connectOverCDP = (async (...args) => {
|
|
1105
1058
|
const browser = await originalConnectOverCDP(...args);
|
|
1106
1059
|
return augmentBrowser(browser);
|
|
1107
|
-
};
|
|
1060
|
+
});
|
|
1108
1061
|
}
|
|
1109
1062
|
const originalLaunchPersistentContext = browserType.launchPersistentContext?.bind(browserType);
|
|
1110
1063
|
if (originalLaunchPersistentContext) {
|
|
1111
|
-
browserType.launchPersistentContext = async (...args) => {
|
|
1064
|
+
browserType.launchPersistentContext = (async (...args) => {
|
|
1112
1065
|
const context = await originalLaunchPersistentContext(...args);
|
|
1113
1066
|
return augmentBrowserContext(context);
|
|
1114
|
-
};
|
|
1067
|
+
});
|
|
1115
1068
|
}
|
|
1116
1069
|
defineHiddenProperty(browserType, BROWSER_TYPE_PATCHED, true);
|
|
1117
1070
|
return browserType;
|
|
1118
1071
|
}
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
});
|
|
1131
|
-
//# sourceMappingURL=index.cjs.map
|
|
1072
|
+
|
|
1073
|
+
exports.Agent = Agent;
|
|
1074
|
+
exports.augmentBrowser = augmentBrowser;
|
|
1075
|
+
exports.augmentBrowserContext = augmentBrowserContext;
|
|
1076
|
+
exports.augmentBrowserType = augmentBrowserType;
|
|
1077
|
+
exports.augmentLocator = augmentLocator;
|
|
1078
|
+
exports.augmentPage = augmentPage;
|
|
1079
|
+
exports.requireApiKey = requireApiKey;
|
|
1080
|
+
exports.setApiKey = setApiKey;
|
|
1081
|
+
exports.stablyPlaywrightMatchers = stablyPlaywrightMatchers;
|
|
1082
|
+
//# sourceMappingURL=index.cjs.map
|