pi-lean-dimension 0.2.4 → 0.3.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/README.md +1 -1
- package/node_modules/pi-lean-portal/AGENTS.md +15 -23
- package/node_modules/pi-lean-portal/README.md +35 -7
- package/node_modules/pi-lean-portal/__tests__/browser-toggle-profile.test.ts +12 -1
- package/node_modules/pi-lean-portal/__tests__/browser-toggle.test.ts +263 -1126
- package/node_modules/pi-lean-portal/__tests__/fetch-backend.test.ts +6 -32
- package/node_modules/pi-lean-portal/__tests__/helpers/mock-python-bridge.py +1 -1
- package/node_modules/pi-lean-portal/__tests__/helpers/probe-user-backend.ts +1 -2
- package/node_modules/pi-lean-portal/__tests__/helpers/setup-temp-dir.ts +26 -0
- package/node_modules/pi-lean-portal/__tests__/plugin-config-browser.test.ts +1 -1
- package/node_modules/pi-lean-portal/__tests__/plugin-contract.test.ts +1 -1
- package/node_modules/pi-lean-portal/__tests__/plugin-loading.test.ts +1 -1
- package/node_modules/pi-lean-portal/__tests__/probe-user-backend.test.ts +1 -1
- package/node_modules/pi-lean-portal/__tests__/python-adapter.test.ts +65 -69
- package/node_modules/pi-lean-portal/__tests__/router-dispatch.test.ts +1 -14
- package/node_modules/pi-lean-portal/__tests__/run-contributed-suites.test.ts +31 -16
- package/node_modules/pi-lean-portal/__tests__/snapshot-cache.test.ts +1 -1
- package/node_modules/pi-lean-portal/__tests__/web-guides.test.ts +146 -19
- package/node_modules/pi-lean-portal/backends/playwright-base/playwright-plugin.ts +1 -1
- package/node_modules/pi-lean-portal/backends/python-adapter.ts +3 -3
- package/node_modules/pi-lean-portal/backends/python-base/pi_browser_bridge/__init__.py +2 -4
- package/node_modules/pi-lean-portal/backends/python-base/pi_browser_bridge/__pycache__/__init__.cpython-312.pyc +0 -0
- package/node_modules/pi-lean-portal/backends/python-base/pi_browser_bridge/__pycache__/__init__.cpython-313.pyc +0 -0
- package/node_modules/pi-lean-portal/backends/python-base/pi_browser_bridge/__pycache__/playwright_base.cpython-312.pyc +0 -0
- package/node_modules/pi-lean-portal/backends/python-base/pi_browser_bridge/__pycache__/playwright_base.cpython-313.pyc +0 -0
- package/node_modules/pi-lean-portal/backends/python-base/pi_browser_bridge/playwright_base.py +572 -81
- package/node_modules/pi-lean-portal/backends/python-base/tests/__pycache__/test_playwright_base_quirks.cpython-313-pytest-9.1.1.pyc +0 -0
- package/node_modules/pi-lean-portal/backends/python-base/tests/test_playwright_base_quirks.py +13 -43
- package/node_modules/pi-lean-portal/browser-profile.ts +2 -3
- package/node_modules/pi-lean-portal/browser-toggle.ts +168 -385
- package/node_modules/pi-lean-portal/contributed/CHOOSING.md +2 -2
- package/node_modules/pi-lean-portal/contributed/README.md +65 -6
- package/node_modules/pi-lean-portal/contributed/camoufox-py/__pycache__/bridge.cpython-312.pyc +0 -0
- package/node_modules/pi-lean-portal/contributed/camoufox-py/bridge.py +108 -14
- package/node_modules/pi-lean-portal/contributed/camoufox-py/pin.json +4 -0
- package/node_modules/pi-lean-portal/core/fetch-backend.ts +10 -30
- package/node_modules/pi-lean-portal/core/guides.ts +14 -18
- package/node_modules/pi-lean-portal/core/router.ts +2 -20
- package/node_modules/pi-lean-portal/core/shared/bot-detection.ts +19 -30
- package/node_modules/pi-lean-portal/core/shared/browser-data.ts +4 -4
- package/node_modules/pi-lean-portal/core/shared/nav-settle.ts +2 -2
- package/node_modules/pi-lean-portal/core/shared/paths.ts +16 -2
- package/node_modules/pi-lean-portal/core/shared/settings-reader.ts +2 -7
- package/node_modules/pi-lean-portal/core/shared/snapshot-cache.ts +1 -1
- package/node_modules/pi-lean-portal/index.ts +8 -1
- package/node_modules/pi-lean-portal/package.json +2 -1
- package/node_modules/pi-lean-portal/tools/web-learn.ts +1 -4
- package/node_modules/pi-lean-search/__tests__/web-search.test.ts +87 -0
- package/node_modules/pi-lean-search/index.ts +134 -64
- package/node_modules/pi-lean-search/package.json +2 -1
- package/node_modules/playwright/README.md +3 -3
- package/node_modules/playwright/lib/agents/copilot-setup-steps.yml +2 -2
- package/node_modules/playwright/lib/cli/reportActions.js +2 -2
- package/node_modules/playwright/lib/common/index.js +77 -52
- package/node_modules/playwright/lib/common/index.js.txt +10 -11
- package/node_modules/playwright/lib/errorContext.js +2 -3
- package/node_modules/playwright/lib/index.js +30 -8
- package/node_modules/playwright/lib/matchers/expect.js +4811 -4379
- package/node_modules/playwright/lib/matchers/expect.js.LICENSE +87 -140
- package/node_modules/playwright/lib/matchers/expect.js.txt +30 -35
- package/node_modules/playwright/lib/program.js +19 -0
- package/node_modules/playwright/lib/runner/index.js +309 -153
- package/node_modules/playwright/lib/runner/index.js.txt +13 -12
- package/node_modules/playwright/lib/transform/babelBundle.js +12899 -11654
- package/node_modules/playwright/lib/transform/babelBundle.js.LICENSE +379 -354
- package/node_modules/playwright/lib/transform/babelBundle.js.txt +39 -39
- package/node_modules/playwright/lib/transform/esmLoader.js +3129 -1116
- package/node_modules/playwright/lib/transform/esmLoader.js.LICENSE +81 -61
- package/node_modules/playwright/lib/transform/esmLoader.js.txt +21 -18
- package/node_modules/playwright/lib/util.js +2 -29
- package/node_modules/playwright/lib/worker/workerProcessEntry.js +14 -32
- package/node_modules/playwright/lib/worker/workerProcessEntry.js.txt +7 -8
- package/node_modules/playwright/package.json +3 -6
- package/node_modules/playwright/types/test.d.ts +391 -4
- package/node_modules/playwright/types/testReporter.d.ts +79 -4
- package/node_modules/playwright-core/browsers.json +12 -18
- package/node_modules/playwright-core/lib/bootstrap.js +1 -1
- package/node_modules/playwright-core/lib/coreBundle.js +11344 -9900
- package/node_modules/playwright-core/lib/server/electron/loader.js +5 -2
- package/node_modules/playwright-core/lib/serverRegistry.js +5 -1
- package/node_modules/playwright-core/lib/tools/cli-client/help.json +21 -6
- package/node_modules/playwright-core/lib/tools/cli-client/program.js +1 -1
- package/node_modules/playwright-core/lib/tools/cli-client/session.js +4 -0
- package/node_modules/playwright-core/lib/tools/{cli-client/skill → skills/playwright-cli}/SKILL.md +21 -5
- package/node_modules/playwright-core/lib/tools/{cli-client/skill/references/spec-driven-testing.md → skills/playwright-cli/references/test-generation.md} +135 -7
- package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/SKILL.md +143 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/gallery-spec.md +144 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/migration.md +85 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/react.md +67 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/vue.md +75 -0
- package/node_modules/playwright-core/lib/tools/utils/extension.js +31 -8
- package/node_modules/playwright-core/lib/utilsBundle.js +37698 -33670
- package/node_modules/playwright-core/lib/utilsBundle.js.LICENSE +391 -268
- package/node_modules/playwright-core/lib/vite/dashboard/assets/index-CyWAfh-p.js +11 -0
- package/node_modules/playwright-core/lib/vite/dashboard/assets/index-DhC616m4.css +1 -0
- package/node_modules/playwright-core/lib/vite/dashboard/index.html +2 -2
- package/node_modules/playwright-core/lib/vite/htmlReport/report.css +2 -1
- package/node_modules/playwright-core/lib/vite/htmlReport/report.js +15 -55
- package/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule--QdMvsKi.css +1 -0
- package/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule-CwYYHbcZ.js +32 -0
- package/node_modules/playwright-core/lib/vite/recorder/assets/index-DYjdXIbE.js +129 -0
- package/node_modules/playwright-core/lib/vite/recorder/assets/index-l_lX622x.css +1 -0
- package/node_modules/playwright-core/lib/vite/recorder/index.html +2 -2
- package/node_modules/playwright-core/lib/vite/traceViewer/assets/codeMirrorModule-By56iMx7.js +32 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/assets/defaultSettingsView-B34OrIms.js +181 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/assets/urlMatch-L3liM589.js +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/assets/xtermModule-COQkjINf.js +7 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/codeMirrorModule.-QdMvsKi.css +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/defaultSettingsView.BLFoOugd.css +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/index.B_TqY17P.css +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/index.Dl36UVQT.js +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/index.html +5 -5
- package/node_modules/playwright-core/lib/vite/traceViewer/snapshot.B_Jk1wbt.js +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/snapshot.html +2 -2
- package/node_modules/playwright-core/lib/vite/traceViewer/sw.bundle.js +3 -4
- package/node_modules/playwright-core/lib/vite/traceViewer/uiMode.C7UW1sC9.css +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/uiMode.D962mr9b.js +5 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/uiMode.html +5 -5
- package/node_modules/playwright-core/lib/vite/traceViewer/xtermModule.kHJ-D0s7.css +1 -0
- package/node_modules/playwright-core/lib/webp_codec.LICENSE +173 -0
- package/node_modules/playwright-core/lib/webp_codec.wasm +0 -0
- package/node_modules/playwright-core/lib/xdg-open +338 -137
- package/node_modules/playwright-core/package.json +2 -2
- package/node_modules/playwright-core/types/protocol.d.ts +249 -36
- package/node_modules/playwright-core/types/structs.d.ts +3 -1
- package/node_modules/playwright-core/types/types.d.ts +2009 -266
- package/package.json +3 -3
- package/node_modules/pi-lean-portal/__tests__/url-safety.test.ts +0 -188
- package/node_modules/pi-lean-portal/backends/python-base/pi_browser_bridge/bridge.py +0 -525
- package/node_modules/pi-lean-portal/core/shared/url-safety.ts +0 -164
- package/node_modules/playwright-core/lib/server/deviceDescriptorsSource.json +0 -2739
- package/node_modules/playwright-core/lib/tools/cli-client/skill/references/test-generation.md +0 -134
- package/node_modules/playwright-core/lib/vite/dashboard/assets/index-BY2S1tHT.css +0 -1
- package/node_modules/playwright-core/lib/vite/dashboard/assets/index-C_5TMfeg.js +0 -52
- package/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule-DYBRYzYX.css +0 -1
- package/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule-DeBYQozu.js +0 -32
- package/node_modules/playwright-core/lib/vite/recorder/assets/index-4ZiSSCmn.css +0 -1
- package/node_modules/playwright-core/lib/vite/recorder/assets/index-Bq-mQf8S.js +0 -193
- package/node_modules/playwright-core/lib/vite/traceViewer/assets/codeMirrorModule-LEHpjmcn.js +0 -32
- package/node_modules/playwright-core/lib/vite/traceViewer/assets/defaultSettingsView-BNmKHKpQ.js +0 -264
- package/node_modules/playwright-core/lib/vite/traceViewer/assets/urlMatch-BYQrIQwR.js +0 -1
- package/node_modules/playwright-core/lib/vite/traceViewer/assets/xtermModule-CsJ4vdCR.js +0 -9
- package/node_modules/playwright-core/lib/vite/traceViewer/codeMirrorModule.DYBRYzYX.css +0 -1
- package/node_modules/playwright-core/lib/vite/traceViewer/defaultSettingsView.CjdS-WJx.css +0 -1
- package/node_modules/playwright-core/lib/vite/traceViewer/index.CzXZzn5A.css +0 -1
- package/node_modules/playwright-core/lib/vite/traceViewer/index.DMMX1gXU.js +0 -2
- package/node_modules/playwright-core/lib/vite/traceViewer/snapshot.v8KI4P3m.js +0 -2
- package/node_modules/playwright-core/lib/vite/traceViewer/uiMode.BZQ54Kgt.css +0 -1
- package/node_modules/playwright-core/lib/vite/traceViewer/uiMode.Ut8wwJNp.js +0 -6
- package/node_modules/playwright-core/lib/vite/traceViewer/xtermModule.DYP7pi_n.css +0 -32
- /package/node_modules/playwright-core/lib/tools/{cli-client/skill → skills/playwright-cli}/references/element-attributes.md +0 -0
- /package/node_modules/playwright-core/lib/tools/{cli-client/skill → skills/playwright-cli}/references/playwright-tests.md +0 -0
- /package/node_modules/playwright-core/lib/tools/{cli-client/skill → skills/playwright-cli}/references/request-mocking.md +0 -0
- /package/node_modules/playwright-core/lib/tools/{cli-client/skill → skills/playwright-cli}/references/running-code.md +0 -0
- /package/node_modules/playwright-core/lib/tools/{cli-client/skill → skills/playwright-cli}/references/session-management.md +0 -0
- /package/node_modules/playwright-core/lib/tools/{cli-client/skill → skills/playwright-cli}/references/storage-state.md +0 -0
- /package/node_modules/playwright-core/lib/tools/{cli-client/skill → skills/playwright-cli}/references/tracing.md +0 -0
- /package/node_modules/playwright-core/lib/tools/{cli-client/skill → skills/playwright-cli}/references/video-recording.md +0 -0
- /package/node_modules/playwright-core/lib/tools/{trace → skills/playwright-trace}/SKILL.md +0 -0
|
@@ -78,7 +78,6 @@ var import_globals = require("../globals");
|
|
|
78
78
|
var import_package = require("../package");
|
|
79
79
|
var sourceMapSupport = require("playwright-core/lib/utilsBundle").sourceMapSupport;
|
|
80
80
|
var { calculateSha1 } = require("playwright-core/lib/coreBundle").utils;
|
|
81
|
-
var { isUnderTest } = require("playwright-core/lib/coreBundle").utils;
|
|
82
81
|
var cacheDir = process.env.PWTEST_CACHE_DIR || (() => {
|
|
83
82
|
if (process.platform === "win32")
|
|
84
83
|
return import_path.default.join(import_os.default.tmpdir(), `playwright-transform-cache`);
|
|
@@ -88,15 +87,12 @@ var sourceMaps = /* @__PURE__ */ new Map();
|
|
|
88
87
|
var memoryCache = /* @__PURE__ */ new Map();
|
|
89
88
|
var fileDependencies = /* @__PURE__ */ new Map();
|
|
90
89
|
var externalDependencies = /* @__PURE__ */ new Map();
|
|
91
|
-
var devSourceInfix = import_path.default.sep + "playwright" + import_path.default.sep + "packages" + import_path.default.sep;
|
|
92
90
|
function installSourceMapSupport() {
|
|
93
91
|
Error.stackTraceLimit = 200;
|
|
94
92
|
sourceMapSupport.install({
|
|
95
93
|
environment: "node",
|
|
96
94
|
handleUncaughtExceptions: false,
|
|
97
95
|
retrieveSourceMap(source) {
|
|
98
|
-
if (!process.env.PWDEBUGIMPL && isUnderTest() && source.includes(devSourceInfix))
|
|
99
|
-
return { map: identitySourceMap(source), url: source };
|
|
100
96
|
if (!sourceMaps.has(source))
|
|
101
97
|
return null;
|
|
102
98
|
const sourceMapPath = sourceMaps.get(source);
|
|
@@ -111,14 +107,6 @@ function installSourceMapSupport() {
|
|
|
111
107
|
}
|
|
112
108
|
});
|
|
113
109
|
}
|
|
114
|
-
function identitySourceMap(source) {
|
|
115
|
-
const lineCount = import_fs.default.readFileSync(source, "utf8").split("\n").length;
|
|
116
|
-
return {
|
|
117
|
-
version: 3,
|
|
118
|
-
sources: [source],
|
|
119
|
-
mappings: lineCount ? "AAAA" + ";AACA".repeat(lineCount - 1) : ""
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
110
|
function _innerAddToCompilationCacheAndSerialize(filename, entry) {
|
|
123
111
|
sourceMaps.set(entry.moduleUrl || filename, entry.sourceMapPath);
|
|
124
112
|
memoryCache.set(filename, entry);
|
|
@@ -129,11 +117,29 @@ function _innerAddToCompilationCacheAndSerialize(filename, entry) {
|
|
|
129
117
|
externalDependencies: []
|
|
130
118
|
};
|
|
131
119
|
}
|
|
120
|
+
function writeCodeCache(codePath, code) {
|
|
121
|
+
import_fs.default.writeFileSync(codePath, `// ${calculateSha1(code)}
|
|
122
|
+
${code}`, "utf8");
|
|
123
|
+
}
|
|
124
|
+
function readCodeCache(codePath) {
|
|
125
|
+
const content = import_fs.default.readFileSync(codePath, "utf8");
|
|
126
|
+
const newLineIndex = content.indexOf("\n");
|
|
127
|
+
if (newLineIndex === -1)
|
|
128
|
+
throw new Error(`Cache file is missing the hash header`);
|
|
129
|
+
const firstLine = content.substring(0, newLineIndex);
|
|
130
|
+
const sha1Length = 40;
|
|
131
|
+
if (firstLine.length !== "// ".length + sha1Length || !firstLine.startsWith("// "))
|
|
132
|
+
throw new Error(`Cache file has a malformed hash header`);
|
|
133
|
+
const code = content.substring(newLineIndex + 1);
|
|
134
|
+
if (calculateSha1(code) !== firstLine.substring("// ".length))
|
|
135
|
+
throw new Error(`Cache file content does not match the hash header`);
|
|
136
|
+
return code;
|
|
137
|
+
}
|
|
132
138
|
function getFromCompilationCache(filename, contentHash, moduleUrl) {
|
|
133
139
|
const cache = memoryCache.get(filename);
|
|
134
140
|
if (cache?.codePath) {
|
|
135
141
|
try {
|
|
136
|
-
return { cachedCode:
|
|
142
|
+
return { cachedCode: readCodeCache(cache.codePath) };
|
|
137
143
|
} catch {
|
|
138
144
|
}
|
|
139
145
|
}
|
|
@@ -145,7 +151,7 @@ function getFromCompilationCache(filename, contentHash, moduleUrl) {
|
|
|
145
151
|
const sourceMapPath = cachePath + ".map";
|
|
146
152
|
const dataPath = cachePath + ".data";
|
|
147
153
|
try {
|
|
148
|
-
const cachedCode =
|
|
154
|
+
const cachedCode = readCodeCache(codePath);
|
|
149
155
|
const serializedCache = _innerAddToCompilationCacheAndSerialize(filename, { codePath, sourceMapPath, dataPath, moduleUrl });
|
|
150
156
|
return { cachedCode, serializedCache };
|
|
151
157
|
} catch {
|
|
@@ -160,7 +166,7 @@ function getFromCompilationCache(filename, contentHash, moduleUrl) {
|
|
|
160
166
|
import_fs.default.writeFileSync(sourceMapPath, JSON.stringify(map), "utf8");
|
|
161
167
|
if (data.size)
|
|
162
168
|
import_fs.default.writeFileSync(dataPath, JSON.stringify(Object.fromEntries(data.entries()), void 0, 2), "utf8");
|
|
163
|
-
|
|
169
|
+
writeCodeCache(codePath, code);
|
|
164
170
|
const serializedCache = _innerAddToCompilationCacheAndSerialize(filename, { codePath, sourceMapPath, dataPath, moduleUrl });
|
|
165
171
|
return { serializedCache };
|
|
166
172
|
}
|
|
@@ -313,14 +319,12 @@ var import_path2 = __toESM(require("path"));
|
|
|
313
319
|
var import_util = __toESM(require("util"));
|
|
314
320
|
var debug = require("playwright-core/lib/utilsBundle").debug;
|
|
315
321
|
var mime = require("playwright-core/lib/utilsBundle").mime;
|
|
316
|
-
var minimatch = require("playwright-core/lib/utilsBundle")
|
|
322
|
+
var { minimatch } = require("playwright-core/lib/utilsBundle");
|
|
317
323
|
var { calculateSha1: calculateSha12 } = require("playwright-core/lib/coreBundle").utils;
|
|
318
324
|
var { sanitizeForFilePath } = require("playwright-core/lib/coreBundle").utils;
|
|
319
325
|
var { isRegExp } = require("playwright-core/lib/coreBundle").iso;
|
|
320
|
-
var {
|
|
326
|
+
var { stringifyStackFrames, filteredStackTrace } = require("playwright-core/lib/coreBundle").utils;
|
|
321
327
|
var { ansiRegex, isString, stripAnsiEscapes } = require("playwright-core/lib/coreBundle").iso;
|
|
322
|
-
var PLAYWRIGHT_TEST_PATH = import_path2.default.join(__dirname, "..");
|
|
323
|
-
var PLAYWRIGHT_CORE_PATH = import_path2.default.dirname(require.resolve("playwright-core/package.json"));
|
|
324
328
|
function filterStackTrace(e) {
|
|
325
329
|
const name = e.name ? e.name + ": " : "";
|
|
326
330
|
const cause = e.cause instanceof Error ? filterStackTrace(e.cause) : void 0;
|
|
@@ -333,27 +337,6 @@ function filterStackTrace(e) {
|
|
|
333
337
|
cause
|
|
334
338
|
};
|
|
335
339
|
}
|
|
336
|
-
function filterStackFile(file2) {
|
|
337
|
-
if (process.env.PWDEBUGIMPL)
|
|
338
|
-
return true;
|
|
339
|
-
if (file2.startsWith(PLAYWRIGHT_TEST_PATH))
|
|
340
|
-
return false;
|
|
341
|
-
if (file2.startsWith(PLAYWRIGHT_CORE_PATH))
|
|
342
|
-
return false;
|
|
343
|
-
return true;
|
|
344
|
-
}
|
|
345
|
-
function filteredStackTrace(rawStack) {
|
|
346
|
-
const frames = [];
|
|
347
|
-
for (const line of rawStack) {
|
|
348
|
-
const frame = parseStackFrame(line, import_path2.default.sep, !!process.env.PWDEBUGIMPL);
|
|
349
|
-
if (!frame || !frame.file)
|
|
350
|
-
continue;
|
|
351
|
-
if (!filterStackFile(frame.file))
|
|
352
|
-
continue;
|
|
353
|
-
frames.push(frame);
|
|
354
|
-
}
|
|
355
|
-
return frames;
|
|
356
|
-
}
|
|
357
340
|
function serializeError(error) {
|
|
358
341
|
if (error instanceof Error)
|
|
359
342
|
return filterStackTrace(error);
|
|
@@ -556,6 +539,7 @@ var FullConfigInternal = class {
|
|
|
556
539
|
this.plugins = (privateConfiguration?.plugins || []).map((p) => ({ factory: p }));
|
|
557
540
|
this.singleTSConfigPath = pathResolve(configDir, userConfig.tsconfig);
|
|
558
541
|
this.captureGitInfo = userConfig.captureGitInfo;
|
|
542
|
+
this.retryStrategy = takeFirst(userConfig.retryStrategy, "immediate");
|
|
559
543
|
this.globalSetups = (Array.isArray(userConfig.globalSetup) ? userConfig.globalSetup : [userConfig.globalSetup]).map((s) => resolveScript(s, configDir)).filter((script) => script !== void 0);
|
|
560
544
|
this.globalTeardowns = (Array.isArray(userConfig.globalTeardown) ? userConfig.globalTeardown : [userConfig.globalTeardown]).map((s) => resolveScript(s, configDir)).filter((script) => script !== void 0);
|
|
561
545
|
userConfig.metadata = userConfig.metadata || {};
|
|
@@ -686,8 +670,13 @@ function resolveReporters(reporters, rootDir) {
|
|
|
686
670
|
function resolveWorkers(workers) {
|
|
687
671
|
if (typeof workers === "string") {
|
|
688
672
|
if (workers.endsWith("%")) {
|
|
673
|
+
const percent = parseInt(workers, 10);
|
|
674
|
+
if (isNaN(percent))
|
|
675
|
+
throw new Error(`Workers ${workers} must be a number or percentage.`);
|
|
676
|
+
if (percent < 1)
|
|
677
|
+
throw new Error(`Workers must be a positive number, received ${percent}.`);
|
|
689
678
|
const cpus = import_os2.default.cpus().length;
|
|
690
|
-
return Math.max(1, Math.floor(cpus * (
|
|
679
|
+
return Math.max(1, Math.floor(cpus * (percent / 100)));
|
|
691
680
|
}
|
|
692
681
|
const parsedWorkers = parseInt(workers, 10);
|
|
693
682
|
if (isNaN(parsedWorkers))
|
|
@@ -751,7 +740,7 @@ function resolveScript(id, rootDir) {
|
|
|
751
740
|
}
|
|
752
741
|
var defaultGrep = /.*/;
|
|
753
742
|
var defaultReporter = process.env.CI ? "dot" : "list";
|
|
754
|
-
var configInternalSymbol = Symbol("configInternalSymbol");
|
|
743
|
+
var configInternalSymbol = /* @__PURE__ */ Symbol("configInternalSymbol");
|
|
755
744
|
function getProjectId(project) {
|
|
756
745
|
return project.__projectId;
|
|
757
746
|
}
|
|
@@ -804,13 +793,16 @@ function loadTsConfig(configPath) {
|
|
|
804
793
|
${e.message}`);
|
|
805
794
|
}
|
|
806
795
|
}
|
|
807
|
-
function resolveConfigFile(baseConfigFile, referencedConfigFile) {
|
|
796
|
+
function resolveConfigFile(baseConfigFile, referencedConfigFile, kind) {
|
|
797
|
+
const originalReferencedConfigFile = referencedConfigFile;
|
|
808
798
|
if (!referencedConfigFile.endsWith(".json"))
|
|
809
799
|
referencedConfigFile += ".json";
|
|
810
800
|
const currentDir = import_path4.default.dirname(baseConfigFile);
|
|
811
801
|
let resolvedConfigFile = import_path4.default.resolve(currentDir, referencedConfigFile);
|
|
812
802
|
if (referencedConfigFile.includes("/") && referencedConfigFile.includes(".") && !import_fs4.default.existsSync(resolvedConfigFile))
|
|
813
803
|
resolvedConfigFile = import_path4.default.join(currentDir, "node_modules", referencedConfigFile);
|
|
804
|
+
if (!import_fs4.default.existsSync(resolvedConfigFile))
|
|
805
|
+
throw new Error(`Failed to resolve "${kind}" path "${originalReferencedConfigFile}" referenced from ${baseConfigFile}`);
|
|
814
806
|
return resolvedConfigFile;
|
|
815
807
|
}
|
|
816
808
|
function innerLoadTsConfig(configFilePath, references, visited = /* @__PURE__ */ new Map()) {
|
|
@@ -827,7 +819,7 @@ function innerLoadTsConfig(configFilePath, references, visited = /* @__PURE__ */
|
|
|
827
819
|
const parsedConfig = json5.parse(cleanedJson);
|
|
828
820
|
const extendsArray = Array.isArray(parsedConfig.extends) ? parsedConfig.extends : parsedConfig.extends ? [parsedConfig.extends] : [];
|
|
829
821
|
for (const extendedConfig of extendsArray) {
|
|
830
|
-
const extendedConfigPath = resolveConfigFile(configFilePath, extendedConfig);
|
|
822
|
+
const extendedConfigPath = resolveConfigFile(configFilePath, extendedConfig, "extends");
|
|
831
823
|
const base = innerLoadTsConfig(extendedConfigPath, references, visited);
|
|
832
824
|
Object.assign(result2, base, { tsConfigPath: configFilePath });
|
|
833
825
|
}
|
|
@@ -843,7 +835,7 @@ function innerLoadTsConfig(configFilePath, references, visited = /* @__PURE__ */
|
|
|
843
835
|
result2.absoluteBaseUrl = import_path4.default.resolve(import_path4.default.dirname(configFilePath), parsedConfig.compilerOptions.baseUrl);
|
|
844
836
|
}
|
|
845
837
|
for (const ref of parsedConfig.references || [])
|
|
846
|
-
references.push(innerLoadTsConfig(resolveConfigFile(configFilePath, ref.path), references, visited));
|
|
838
|
+
references.push(innerLoadTsConfig(resolveConfigFile(configFilePath, ref.path, "references"), references, visited));
|
|
847
839
|
if (import_path4.default.basename(configFilePath) === "jsconfig.json" && result2.allowJs === void 0)
|
|
848
840
|
result2.allowJs = true;
|
|
849
841
|
return result2;
|
|
@@ -1271,7 +1263,7 @@ async function incorporateCompilationCache() {
|
|
|
1271
1263
|
|
|
1272
1264
|
// packages/playwright/src/common/configLoader.ts
|
|
1273
1265
|
var { isRegExp: isRegExp2 } = require("playwright-core/lib/coreBundle").iso;
|
|
1274
|
-
var kDefineConfigWasUsed = Symbol("defineConfigWasUsed");
|
|
1266
|
+
var kDefineConfigWasUsed = /* @__PURE__ */ Symbol("defineConfigWasUsed");
|
|
1275
1267
|
var defineConfig = (...configs) => {
|
|
1276
1268
|
let result2 = configs[0];
|
|
1277
1269
|
for (let i = 1; i < configs.length; ++i) {
|
|
@@ -1457,6 +1449,10 @@ function validateConfig(file2, config) {
|
|
|
1457
1449
|
if (typeof config.updateSnapshots !== "string" || !["all", "changed", "missing", "none"].includes(config.updateSnapshots))
|
|
1458
1450
|
throw errorWithFile(file2, `config.updateSnapshots must be one of "all", "changed", "missing" or "none"`);
|
|
1459
1451
|
}
|
|
1452
|
+
if ("retryStrategy" in config && config.retryStrategy !== void 0) {
|
|
1453
|
+
if (typeof config.retryStrategy !== "string" || !["immediate", "isolated"].includes(config.retryStrategy))
|
|
1454
|
+
throw errorWithFile(file2, `config.retryStrategy must be one of "immediate" or "isolated"`);
|
|
1455
|
+
}
|
|
1460
1456
|
if ("tsconfig" in config && config.tsconfig !== void 0) {
|
|
1461
1457
|
if (typeof config.tsconfig !== "string")
|
|
1462
1458
|
throw errorWithFile(file2, `config.tsconfig must be a string`);
|
|
@@ -1565,6 +1561,7 @@ __export(fixtures_exports, {
|
|
|
1565
1561
|
inheritFixtureNames: () => inheritFixtureNames
|
|
1566
1562
|
});
|
|
1567
1563
|
var import_crypto2 = __toESM(require("crypto"));
|
|
1564
|
+
var { filterStackFile } = require("playwright-core/lib/coreBundle").utils;
|
|
1568
1565
|
var kScopeOrder = ["test", "worker"];
|
|
1569
1566
|
function isFixtureTuple(value) {
|
|
1570
1567
|
return Array.isArray(value) && typeof value[1] === "object";
|
|
@@ -1572,6 +1569,11 @@ function isFixtureTuple(value) {
|
|
|
1572
1569
|
function isFixtureOption(value) {
|
|
1573
1570
|
return isFixtureTuple(value) && !!value[1].option;
|
|
1574
1571
|
}
|
|
1572
|
+
function isOptionFixture(registration) {
|
|
1573
|
+
while (!registration.option && registration.super)
|
|
1574
|
+
registration = registration.super;
|
|
1575
|
+
return registration.option;
|
|
1576
|
+
}
|
|
1575
1577
|
var FixturePool = class {
|
|
1576
1578
|
constructor(fixturesList, onLoadError, parentPool, disallowWorkerFixtures, optionOverrides) {
|
|
1577
1579
|
this._registrations = new Map(parentPool ? parentPool._registrations : []);
|
|
@@ -1591,7 +1593,7 @@ var FixturePool = class {
|
|
|
1591
1593
|
if (optionOverrides) {
|
|
1592
1594
|
for (const key of overrideKeys) {
|
|
1593
1595
|
const registration = this._registrations.get(key);
|
|
1594
|
-
if (registration && !registration
|
|
1596
|
+
if (registration && !isOptionFixture(registration))
|
|
1595
1597
|
this._addLoadError(`Fixture "${key}" cannot be overridden in the configuration "use" section. Only fixtures registered with { option: true } can be set in the config.`, optionOverrides.location);
|
|
1596
1598
|
}
|
|
1597
1599
|
}
|
|
@@ -1607,7 +1609,7 @@ var FixturePool = class {
|
|
|
1607
1609
|
options = {
|
|
1608
1610
|
auto: value[1].auto ?? false,
|
|
1609
1611
|
scope: value[1].scope || "test",
|
|
1610
|
-
option:
|
|
1612
|
+
option: value[1].option,
|
|
1611
1613
|
timeout: value[1].timeout,
|
|
1612
1614
|
customTitle: value[1].title,
|
|
1613
1615
|
box: value[1].box
|
|
@@ -1625,6 +1627,10 @@ var FixturePool = class {
|
|
|
1625
1627
|
this._addLoadError(`Fixture "${name}" has already been registered as a { auto: '${previous.scope}' } fixture defined in ${formatLocation(previous.location)}.`, location);
|
|
1626
1628
|
continue;
|
|
1627
1629
|
}
|
|
1630
|
+
if (previous.option !== options.option && options.option !== void 0) {
|
|
1631
|
+
this._addLoadError(`Fixture "${name}" has already been registered as a { option: ${previous.option} } fixture defined in ${formatLocation(previous.location)}.`, location);
|
|
1632
|
+
continue;
|
|
1633
|
+
}
|
|
1628
1634
|
} else if (previous) {
|
|
1629
1635
|
options = { auto: previous.auto, scope: previous.scope, option: previous.option, timeout: previous.timeout, customTitle: previous.customTitle };
|
|
1630
1636
|
} else if (!options) {
|
|
@@ -1639,14 +1645,14 @@ var FixturePool = class {
|
|
|
1639
1645
|
Make it top-level in the test file or put in the configuration file.`, location);
|
|
1640
1646
|
continue;
|
|
1641
1647
|
}
|
|
1642
|
-
if (fn === void 0 &&
|
|
1648
|
+
if (fn === void 0 && previous && isOptionFixture(previous)) {
|
|
1643
1649
|
let original = previous;
|
|
1644
1650
|
while (!original.optionOverride && original.super)
|
|
1645
1651
|
original = original.super;
|
|
1646
1652
|
fn = original.fn;
|
|
1647
1653
|
}
|
|
1648
1654
|
const deps = fixtureParameterNames(fn, location, (e) => this._onLoadError(e));
|
|
1649
|
-
const registration = { id: "", name, location, scope: options.scope, fn, auto: options.auto, option: options.option, timeout: options.timeout, customTitle: options.customTitle, box: options.box, deps, super: previous, optionOverride: isOptionsOverride };
|
|
1655
|
+
const registration = { id: "", name, location, scope: options.scope, fn, auto: options.auto, option: !!options.option, timeout: options.timeout, customTitle: options.customTitle, box: options.box, deps, super: previous, optionOverride: isOptionsOverride };
|
|
1650
1656
|
registrationId(registration);
|
|
1651
1657
|
this._registrations.set(name, registration);
|
|
1652
1658
|
}
|
|
@@ -1730,7 +1736,7 @@ Make it top-level in the test file or put in the configuration file.`, location)
|
|
|
1730
1736
|
this._onLoadError({ message, location });
|
|
1731
1737
|
}
|
|
1732
1738
|
};
|
|
1733
|
-
var signatureSymbol = Symbol("signature");
|
|
1739
|
+
var signatureSymbol = /* @__PURE__ */ Symbol("signature");
|
|
1734
1740
|
function formatPotentiallyInternalLocation(location) {
|
|
1735
1741
|
const isUserFixture = location && filterStackFile(location.file);
|
|
1736
1742
|
return isUserFixture ? formatLocation(location) : "<builtin>";
|
|
@@ -1939,9 +1945,11 @@ __export(process_exports, {
|
|
|
1939
1945
|
startProcessRunner: () => startProcessRunner
|
|
1940
1946
|
});
|
|
1941
1947
|
var import_bootstrap = require("playwright-core/lib/bootstrap");
|
|
1948
|
+
var import_package4 = require("../package");
|
|
1942
1949
|
var { ManualPromise } = require("playwright-core/lib/coreBundle").iso;
|
|
1943
1950
|
var { setTimeOrigin } = require("playwright-core/lib/coreBundle").iso;
|
|
1944
1951
|
var { startProfiling, stopProfiling } = require("playwright-core/lib/coreBundle").utils;
|
|
1952
|
+
var { setBoxedStackPrefixes } = require("playwright-core/lib/coreBundle").utils;
|
|
1945
1953
|
var ProcessRunner = class {
|
|
1946
1954
|
async gracefullyClose() {
|
|
1947
1955
|
}
|
|
@@ -1962,6 +1970,7 @@ var forceExitInitiated = false;
|
|
|
1962
1970
|
var processRunner;
|
|
1963
1971
|
var processName;
|
|
1964
1972
|
var startingEnv = { ...process.env };
|
|
1973
|
+
setBoxedStackPrefixes([import_package4.packageRoot]);
|
|
1965
1974
|
function startProcessRunner(create) {
|
|
1966
1975
|
sendMessageToParent({ method: "ready" });
|
|
1967
1976
|
process.on("disconnect", () => gracefullyCloseAndExit(true));
|
|
@@ -2211,7 +2220,7 @@ var { monotonicTime } = require("playwright-core/lib/coreBundle").iso;
|
|
|
2211
2220
|
var { raceAgainstDeadline } = require("playwright-core/lib/coreBundle").iso;
|
|
2212
2221
|
var { getPackageManagerExecCommand } = require("playwright-core/lib/coreBundle").utils;
|
|
2213
2222
|
var { currentZone } = require("playwright-core/lib/coreBundle").utils;
|
|
2214
|
-
var testTypeSymbol = Symbol("testType");
|
|
2223
|
+
var testTypeSymbol = /* @__PURE__ */ Symbol("testType");
|
|
2215
2224
|
var TestTypeImpl = class _TestTypeImpl {
|
|
2216
2225
|
constructor(fixtures) {
|
|
2217
2226
|
this.fixtures = fixtures;
|
|
@@ -2595,6 +2604,13 @@ var Suite = class _Suite extends Base {
|
|
|
2595
2604
|
suite.parent = this;
|
|
2596
2605
|
this._entries.unshift(suite);
|
|
2597
2606
|
}
|
|
2607
|
+
_detach(child) {
|
|
2608
|
+
const idx = this._entries.indexOf(child);
|
|
2609
|
+
if (idx !== -1)
|
|
2610
|
+
this._entries.splice(idx, 1);
|
|
2611
|
+
if (this._entries.length === 0)
|
|
2612
|
+
this.parent?._detach(this);
|
|
2613
|
+
}
|
|
2598
2614
|
allTests() {
|
|
2599
2615
|
const result2 = [];
|
|
2600
2616
|
const visit = (suite) => {
|
|
@@ -2752,6 +2768,7 @@ var TestCase = class _TestCase extends Base {
|
|
|
2752
2768
|
this._projectId = "";
|
|
2753
2769
|
// Explicitly declared tags that are not a part of the title.
|
|
2754
2770
|
this._tags = [];
|
|
2771
|
+
this._planAnnotations = [];
|
|
2755
2772
|
this.fn = fn;
|
|
2756
2773
|
this._testType = testType;
|
|
2757
2774
|
this.location = location;
|
|
@@ -2778,6 +2795,14 @@ var TestCase = class _TestCase extends Base {
|
|
|
2778
2795
|
...this._tags
|
|
2779
2796
|
];
|
|
2780
2797
|
}
|
|
2798
|
+
_applyPlanAnnotation(annotation) {
|
|
2799
|
+
this.annotations.push(annotation);
|
|
2800
|
+
this._planAnnotations.push(annotation);
|
|
2801
|
+
if (annotation.type === "skip" || annotation.type === "fixme")
|
|
2802
|
+
this.expectedStatus = "skipped";
|
|
2803
|
+
else if (annotation.type === "fail" && this.expectedStatus !== "skipped")
|
|
2804
|
+
this.expectedStatus = "failed";
|
|
2805
|
+
}
|
|
2781
2806
|
_serialize() {
|
|
2782
2807
|
return {
|
|
2783
2808
|
kind: "test",
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
# packages/playwright/lib/common/index.js
|
|
2
|
-
# total:
|
|
2
|
+
# total: 114.4 KB
|
|
3
3
|
|
|
4
4
|
## Inlined (20)
|
|
5
|
-
|
|
6
|
-
13.
|
|
7
|
-
|
|
5
|
+
12.0 KB packages/playwright/src/common/config.ts
|
|
6
|
+
13.7 KB packages/playwright/src/common/configLoader.ts
|
|
7
|
+
11.5 KB packages/playwright/src/common/fixtures.ts
|
|
8
8
|
0.8 KB packages/playwright/src/common/index.ts
|
|
9
9
|
1.3 KB packages/playwright/src/common/ipc.ts
|
|
10
10
|
2.1 KB packages/playwright/src/common/poolBuilder.ts
|
|
11
|
-
3.
|
|
11
|
+
3.9 KB packages/playwright/src/common/process.ts
|
|
12
12
|
4.7 KB packages/playwright/src/common/suiteUtils.ts
|
|
13
|
-
|
|
13
|
+
8.5 KB packages/playwright/src/common/test.ts
|
|
14
14
|
2.0 KB packages/playwright/src/common/testLoader.ts
|
|
15
15
|
12.6 KB packages/playwright/src/common/testType.ts
|
|
16
16
|
1.2 KB packages/playwright/src/common/validators.ts
|
|
17
17
|
1.3 KB packages/playwright/src/isomorphic/teleReceiver.ts
|
|
18
|
-
9.
|
|
18
|
+
9.7 KB packages/playwright/src/transform/compilationCache.ts
|
|
19
19
|
1.7 KB packages/playwright/src/transform/esmLoaderSync.ts
|
|
20
20
|
1.1 KB packages/playwright/src/transform/pirates.ts
|
|
21
21
|
1.1 KB packages/playwright/src/transform/portTransport.ts
|
|
22
22
|
12.3 KB packages/playwright/src/transform/transform.ts
|
|
23
|
-
2
|
|
24
|
-
7.
|
|
23
|
+
3.2 KB packages/playwright/src/transform/tsconfig-loader.ts
|
|
24
|
+
7.0 KB packages/playwright/src/util.ts
|
|
25
25
|
|
|
26
|
-
## External (
|
|
26
|
+
## External (8)
|
|
27
27
|
../globals
|
|
28
28
|
../matchers/expect
|
|
29
29
|
../package
|
|
@@ -32,4 +32,3 @@
|
|
|
32
32
|
playwright-core/lib/bootstrap
|
|
33
33
|
playwright-core/lib/coreBundle
|
|
34
34
|
playwright-core/lib/utilsBundle
|
|
35
|
-
playwright-core/package.json
|
|
@@ -32,9 +32,8 @@ __export(errorContext_exports, {
|
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(errorContext_exports);
|
|
34
34
|
var import_fs = __toESM(require("fs"));
|
|
35
|
-
var import_path = __toESM(require("path"));
|
|
36
35
|
var import_util = require("./util");
|
|
37
|
-
const { parseErrorStack } = require("playwright-core/lib/coreBundle").
|
|
36
|
+
const { parseErrorStack } = require("playwright-core/lib/coreBundle").utils;
|
|
38
37
|
const { stripAnsiEscapes } = require("playwright-core/lib/coreBundle").iso;
|
|
39
38
|
const fixTestInstructions = `# Instructions
|
|
40
39
|
|
|
@@ -101,7 +100,7 @@ function buildCodeFrame(error, testLocation) {
|
|
|
101
100
|
const stack = error.stack;
|
|
102
101
|
if (!stack)
|
|
103
102
|
return void 0;
|
|
104
|
-
const parsed = parseErrorStack(stack
|
|
103
|
+
const parsed = parseErrorStack(stack);
|
|
105
104
|
const errorLocation = parsed.location;
|
|
106
105
|
if (!errorLocation)
|
|
107
106
|
return void 0;
|
|
@@ -43,7 +43,6 @@ var playwrightLibrary = __toESM(require("playwright-core"));
|
|
|
43
43
|
var import_errorContext = require("./errorContext");
|
|
44
44
|
var import_common = require("./common");
|
|
45
45
|
var globals = __toESM(require("./globals"));
|
|
46
|
-
var import_package = require("./package");
|
|
47
46
|
var import_browserBackend = require("./mcp/test/browserBackend");
|
|
48
47
|
var import_expect = require("./matchers/expect");
|
|
49
48
|
var import_common2 = require("./common");
|
|
@@ -54,10 +53,9 @@ const { escapeHTML } = require("playwright-core/lib/coreBundle").iso;
|
|
|
54
53
|
const { jsonStringifyForceASCII } = require("playwright-core/lib/coreBundle").utils;
|
|
55
54
|
const { createGuid } = require("playwright-core/lib/coreBundle").utils;
|
|
56
55
|
const { debugMode } = require("playwright-core/lib/coreBundle").utils;
|
|
57
|
-
const {
|
|
56
|
+
const { debugLogger } = require("playwright-core/lib/coreBundle").utils;
|
|
58
57
|
const { currentZone } = require("playwright-core/lib/coreBundle").utils;
|
|
59
58
|
const _baseTest = import_common.testType.rootTestType.test;
|
|
60
|
-
setBoxedStackPrefixes([import_package.packageRoot]);
|
|
61
59
|
if (process["__pw_initiator__"]) {
|
|
62
60
|
const originalStackTraceLimit = Error.stackTraceLimit;
|
|
63
61
|
Error.stackTraceLimit = 200;
|
|
@@ -416,9 +414,10 @@ const playwrightFixtures = {
|
|
|
416
414
|
}, { scope: "test", title: "context", box: true }],
|
|
417
415
|
_optionContextReuseMode: ["none", { scope: "worker", option: true, box: true }],
|
|
418
416
|
_optionConnectOptions: [void 0, { scope: "worker", option: true, box: true }],
|
|
419
|
-
|
|
417
|
+
reuseContext: [false, { scope: "worker", option: true, box: true }],
|
|
418
|
+
_reuseContext: [async ({ video, _optionContextReuseMode, reuseContext }, use) => {
|
|
420
419
|
let mode = _optionContextReuseMode;
|
|
421
|
-
if (process.env.PW_TEST_REUSE_CONTEXT)
|
|
420
|
+
if (process.env.PW_TEST_REUSE_CONTEXT || reuseContext)
|
|
422
421
|
mode = "when-possible";
|
|
423
422
|
const reuse = mode === "when-possible" && normalizeVideoMode(video) === "off";
|
|
424
423
|
await use(reuse);
|
|
@@ -450,6 +449,28 @@ const playwrightFixtures = {
|
|
|
450
449
|
if (!page)
|
|
451
450
|
page = await context.newPage();
|
|
452
451
|
await use(page);
|
|
452
|
+
},
|
|
453
|
+
mount: async ({ page, baseURL }, use) => {
|
|
454
|
+
const callMount = (params) => page.evaluate(async (p) => {
|
|
455
|
+
const w = window;
|
|
456
|
+
if (typeof w.mount !== "function")
|
|
457
|
+
throw new Error("The gallery page does not define window.mount().");
|
|
458
|
+
await w.mount(p);
|
|
459
|
+
}, params, { exposeFunctions: true });
|
|
460
|
+
await use(async (storyId, props) => {
|
|
461
|
+
if (!baseURL)
|
|
462
|
+
throw new Error("mount() requires `baseURL` to point at the component gallery. Set it in your Playwright config.");
|
|
463
|
+
await page.goto(baseURL);
|
|
464
|
+
await callMount({ story: storyId, props });
|
|
465
|
+
return Object.assign(page.locator("#root"), {
|
|
466
|
+
// update() re-renders the same story with new props without navigating; if the gallery
|
|
467
|
+
// reuses its root/instance, the framework reconciles and component state is preserved.
|
|
468
|
+
update: (newProps) => callMount({ story: storyId, props: newProps }),
|
|
469
|
+
unmount: () => page.evaluate(async () => {
|
|
470
|
+
await window.unmount?.();
|
|
471
|
+
})
|
|
472
|
+
});
|
|
473
|
+
});
|
|
453
474
|
}
|
|
454
475
|
};
|
|
455
476
|
function normalizeVideoMode(video) {
|
|
@@ -515,7 +536,7 @@ function resolveClientCerticates(clientCertificates) {
|
|
|
515
536
|
}
|
|
516
537
|
return clientCertificates;
|
|
517
538
|
}
|
|
518
|
-
const kTracingStarted = Symbol("kTracingStarted");
|
|
539
|
+
const kTracingStarted = /* @__PURE__ */ Symbol("kTracingStarted");
|
|
519
540
|
function connectOptionsFromEnv() {
|
|
520
541
|
const wsEndpoint = process.env.PW_TEST_CONNECT_WS_ENDPOINT;
|
|
521
542
|
if (!wsEndpoint)
|
|
@@ -602,7 +623,7 @@ class ArtifactsRecorder {
|
|
|
602
623
|
this._playwright = playwright;
|
|
603
624
|
this._artifactsDir = artifactsDir;
|
|
604
625
|
const screenshotOptions = typeof screenshot === "string" ? void 0 : screenshot;
|
|
605
|
-
this._startedCollectingArtifacts = Symbol("startedCollectingArtifacts");
|
|
626
|
+
this._startedCollectingArtifacts = /* @__PURE__ */ Symbol("startedCollectingArtifacts");
|
|
606
627
|
this._screenshotRecorder = new SnapshotRecorder(this, normalizeScreenshotMode(screenshot), "screenshot", "image/png", ".png", async (page, path2) => {
|
|
607
628
|
await page._wrapApiCall(async () => {
|
|
608
629
|
await page.screenshot({ ...screenshotOptions, timeout: 5e3, path: path2, caret: "initial" });
|
|
@@ -641,7 +662,8 @@ class ArtifactsRecorder {
|
|
|
641
662
|
await page._wrapApiCall(async () => {
|
|
642
663
|
this._pageSnapshot = await page.ariaSnapshot({ mode: "ai", timeout: 5e3 });
|
|
643
664
|
}, { internal: true });
|
|
644
|
-
} catch {
|
|
665
|
+
} catch (error) {
|
|
666
|
+
debugLogger.log("error", `failed to capture aria snapshot: ${error}`);
|
|
645
667
|
}
|
|
646
668
|
}
|
|
647
669
|
async didCreateRequestContext(context) {
|