@smoothdeploy/playwright 1.61.0 → 1.62.1-beta-1790342324000
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/lib/agents/copilot-setup-steps.yml +2 -2
- package/lib/cli/reportActions.js +2 -2
- package/lib/common/index.js +74 -51
- package/lib/common/index.js.txt +10 -11
- package/lib/errorContext.js +2 -3
- package/lib/index.js +31 -8
- package/lib/matchers/expect.js +4814 -4380
- package/lib/matchers/expect.js.LICENSE +87 -140
- package/lib/matchers/expect.js.txt +30 -35
- package/lib/program.js +19 -0
- package/lib/runner/index.js +615 -299
- package/lib/runner/index.js.txt +15 -13
- package/lib/transform/babelBundle.js +12899 -11654
- package/lib/transform/babelBundle.js.LICENSE +379 -354
- package/lib/transform/babelBundle.js.txt +39 -39
- package/lib/transform/esmLoader.js +3126 -1115
- package/lib/transform/esmLoader.js.LICENSE +81 -61
- package/lib/transform/esmLoader.js.txt +21 -18
- package/lib/util.js +2 -29
- package/lib/worker/workerProcessEntry.js +17 -33
- package/lib/worker/workerProcessEntry.js.txt +7 -8
- package/package.json +3 -6
- package/types/test.d.ts +391 -4
- package/types/testReporter.d.ts +79 -4
package/lib/cli/reportActions.js
CHANGED
|
@@ -55,8 +55,8 @@ async function mergeReports(reportDir, opts) {
|
|
|
55
55
|
if (!reporterDescriptions)
|
|
56
56
|
reporterDescriptions = [[import_common.config.defaultReporter]];
|
|
57
57
|
const rootDirOverride = configFile ? config.config.rootDir : void 0;
|
|
58
|
-
await import_runner.merge.createMergedReport(config, dir, reporterDescriptions, rootDirOverride);
|
|
59
|
-
gracefullyProcessExitDoNotHang(0);
|
|
58
|
+
const result = await import_runner.merge.createMergedReport(config, dir, reporterDescriptions, rootDirOverride);
|
|
59
|
+
gracefullyProcessExitDoNotHang(result === "failed" ? 1 : 0);
|
|
60
60
|
}
|
|
61
61
|
function resolveReporterOption(reporter) {
|
|
62
62
|
if (!reporter || !reporter.length)
|
package/lib/common/index.js
CHANGED
|
@@ -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
|
}
|
|
@@ -869,7 +858,7 @@ function resolve(specifier, context, nextResolve) {
|
|
|
869
858
|
const filename = import_url.default.fileURLToPath(context.parentURL);
|
|
870
859
|
const resolved = resolveHook(filename, specifier);
|
|
871
860
|
if (resolved !== void 0) {
|
|
872
|
-
specifier = context.conditions
|
|
861
|
+
specifier = new Set(context.conditions).has("import") ? import_url.default.pathToFileURL(resolved).toString() : resolved;
|
|
873
862
|
}
|
|
874
863
|
}
|
|
875
864
|
const result2 = nextResolve(specifier, context);
|
|
@@ -894,7 +883,8 @@ function load(moduleUrl, context, nextLoad) {
|
|
|
894
883
|
const filename = import_url.default.fileURLToPath(moduleUrl);
|
|
895
884
|
if (!shouldTransform(filename))
|
|
896
885
|
return nextLoad(moduleUrl, context);
|
|
897
|
-
const
|
|
886
|
+
const isRequire = !new Set(context.conditions).has("import");
|
|
887
|
+
const format = isRequire ? "commonjs" : kSupportedFormats.get(context.format) || (fileIsModule(filename) ? "module" : "commonjs");
|
|
898
888
|
const code = import_fs5.default.readFileSync(filename, "utf-8");
|
|
899
889
|
const transformed = transformHook(code, filename, format === "module" ? moduleUrl : void 0);
|
|
900
890
|
return {
|
|
@@ -1270,7 +1260,7 @@ async function incorporateCompilationCache() {
|
|
|
1270
1260
|
|
|
1271
1261
|
// packages/playwright/src/common/configLoader.ts
|
|
1272
1262
|
var { isRegExp: isRegExp2 } = require("playwright-core/lib/coreBundle").iso;
|
|
1273
|
-
var kDefineConfigWasUsed = Symbol("defineConfigWasUsed");
|
|
1263
|
+
var kDefineConfigWasUsed = /* @__PURE__ */ Symbol("defineConfigWasUsed");
|
|
1274
1264
|
var defineConfig = (...configs) => {
|
|
1275
1265
|
let result2 = configs[0];
|
|
1276
1266
|
for (let i = 1; i < configs.length; ++i) {
|
|
@@ -1456,6 +1446,10 @@ function validateConfig(file2, config) {
|
|
|
1456
1446
|
if (typeof config.updateSnapshots !== "string" || !["all", "changed", "missing", "none"].includes(config.updateSnapshots))
|
|
1457
1447
|
throw errorWithFile(file2, `config.updateSnapshots must be one of "all", "changed", "missing" or "none"`);
|
|
1458
1448
|
}
|
|
1449
|
+
if ("retryStrategy" in config && config.retryStrategy !== void 0) {
|
|
1450
|
+
if (typeof config.retryStrategy !== "string" || !["immediate", "isolated"].includes(config.retryStrategy))
|
|
1451
|
+
throw errorWithFile(file2, `config.retryStrategy must be one of "immediate" or "isolated"`);
|
|
1452
|
+
}
|
|
1459
1453
|
if ("tsconfig" in config && config.tsconfig !== void 0) {
|
|
1460
1454
|
if (typeof config.tsconfig !== "string")
|
|
1461
1455
|
throw errorWithFile(file2, `config.tsconfig must be a string`);
|
|
@@ -1564,6 +1558,7 @@ __export(fixtures_exports, {
|
|
|
1564
1558
|
inheritFixtureNames: () => inheritFixtureNames
|
|
1565
1559
|
});
|
|
1566
1560
|
var import_crypto2 = __toESM(require("crypto"));
|
|
1561
|
+
var { filterStackFile } = require("playwright-core/lib/coreBundle").utils;
|
|
1567
1562
|
var kScopeOrder = ["test", "worker"];
|
|
1568
1563
|
function isFixtureTuple(value) {
|
|
1569
1564
|
return Array.isArray(value) && typeof value[1] === "object";
|
|
@@ -1571,6 +1566,11 @@ function isFixtureTuple(value) {
|
|
|
1571
1566
|
function isFixtureOption(value) {
|
|
1572
1567
|
return isFixtureTuple(value) && !!value[1].option;
|
|
1573
1568
|
}
|
|
1569
|
+
function isOptionFixture(registration) {
|
|
1570
|
+
while (!registration.option && registration.super)
|
|
1571
|
+
registration = registration.super;
|
|
1572
|
+
return registration.option;
|
|
1573
|
+
}
|
|
1574
1574
|
var FixturePool = class {
|
|
1575
1575
|
constructor(fixturesList, onLoadError, parentPool, disallowWorkerFixtures, optionOverrides) {
|
|
1576
1576
|
this._registrations = new Map(parentPool ? parentPool._registrations : []);
|
|
@@ -1590,7 +1590,7 @@ var FixturePool = class {
|
|
|
1590
1590
|
if (optionOverrides) {
|
|
1591
1591
|
for (const key of overrideKeys) {
|
|
1592
1592
|
const registration = this._registrations.get(key);
|
|
1593
|
-
if (registration && !registration
|
|
1593
|
+
if (registration && !isOptionFixture(registration))
|
|
1594
1594
|
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);
|
|
1595
1595
|
}
|
|
1596
1596
|
}
|
|
@@ -1606,7 +1606,7 @@ var FixturePool = class {
|
|
|
1606
1606
|
options = {
|
|
1607
1607
|
auto: value[1].auto ?? false,
|
|
1608
1608
|
scope: value[1].scope || "test",
|
|
1609
|
-
option:
|
|
1609
|
+
option: value[1].option,
|
|
1610
1610
|
timeout: value[1].timeout,
|
|
1611
1611
|
customTitle: value[1].title,
|
|
1612
1612
|
box: value[1].box
|
|
@@ -1624,6 +1624,10 @@ var FixturePool = class {
|
|
|
1624
1624
|
this._addLoadError(`Fixture "${name}" has already been registered as a { auto: '${previous.scope}' } fixture defined in ${formatLocation(previous.location)}.`, location);
|
|
1625
1625
|
continue;
|
|
1626
1626
|
}
|
|
1627
|
+
if (previous.option !== options.option && options.option !== void 0) {
|
|
1628
|
+
this._addLoadError(`Fixture "${name}" has already been registered as a { option: ${previous.option} } fixture defined in ${formatLocation(previous.location)}.`, location);
|
|
1629
|
+
continue;
|
|
1630
|
+
}
|
|
1627
1631
|
} else if (previous) {
|
|
1628
1632
|
options = { auto: previous.auto, scope: previous.scope, option: previous.option, timeout: previous.timeout, customTitle: previous.customTitle };
|
|
1629
1633
|
} else if (!options) {
|
|
@@ -1638,14 +1642,14 @@ var FixturePool = class {
|
|
|
1638
1642
|
Make it top-level in the test file or put in the configuration file.`, location);
|
|
1639
1643
|
continue;
|
|
1640
1644
|
}
|
|
1641
|
-
if (fn === void 0 &&
|
|
1645
|
+
if (fn === void 0 && previous && isOptionFixture(previous)) {
|
|
1642
1646
|
let original = previous;
|
|
1643
1647
|
while (!original.optionOverride && original.super)
|
|
1644
1648
|
original = original.super;
|
|
1645
1649
|
fn = original.fn;
|
|
1646
1650
|
}
|
|
1647
1651
|
const deps = fixtureParameterNames(fn, location, (e) => this._onLoadError(e));
|
|
1648
|
-
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 };
|
|
1652
|
+
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 };
|
|
1649
1653
|
registrationId(registration);
|
|
1650
1654
|
this._registrations.set(name, registration);
|
|
1651
1655
|
}
|
|
@@ -1729,7 +1733,7 @@ Make it top-level in the test file or put in the configuration file.`, location)
|
|
|
1729
1733
|
this._onLoadError({ message, location });
|
|
1730
1734
|
}
|
|
1731
1735
|
};
|
|
1732
|
-
var signatureSymbol = Symbol("signature");
|
|
1736
|
+
var signatureSymbol = /* @__PURE__ */ Symbol("signature");
|
|
1733
1737
|
function formatPotentiallyInternalLocation(location) {
|
|
1734
1738
|
const isUserFixture = location && filterStackFile(location.file);
|
|
1735
1739
|
return isUserFixture ? formatLocation(location) : "<builtin>";
|
|
@@ -1938,9 +1942,11 @@ __export(process_exports, {
|
|
|
1938
1942
|
startProcessRunner: () => startProcessRunner
|
|
1939
1943
|
});
|
|
1940
1944
|
var import_bootstrap = require("playwright-core/lib/bootstrap");
|
|
1945
|
+
var import_package4 = require("../package");
|
|
1941
1946
|
var { ManualPromise } = require("playwright-core/lib/coreBundle").iso;
|
|
1942
1947
|
var { setTimeOrigin } = require("playwright-core/lib/coreBundle").iso;
|
|
1943
1948
|
var { startProfiling, stopProfiling } = require("playwright-core/lib/coreBundle").utils;
|
|
1949
|
+
var { setBoxedStackPrefixes } = require("playwright-core/lib/coreBundle").utils;
|
|
1944
1950
|
var ProcessRunner = class {
|
|
1945
1951
|
async gracefullyClose() {
|
|
1946
1952
|
}
|
|
@@ -1961,6 +1967,7 @@ var forceExitInitiated = false;
|
|
|
1961
1967
|
var processRunner;
|
|
1962
1968
|
var processName;
|
|
1963
1969
|
var startingEnv = { ...process.env };
|
|
1970
|
+
setBoxedStackPrefixes([import_package4.packageRoot]);
|
|
1964
1971
|
function startProcessRunner(create) {
|
|
1965
1972
|
sendMessageToParent({ method: "ready" });
|
|
1966
1973
|
process.on("disconnect", () => gracefullyCloseAndExit(true));
|
|
@@ -2210,7 +2217,7 @@ var { monotonicTime } = require("playwright-core/lib/coreBundle").iso;
|
|
|
2210
2217
|
var { raceAgainstDeadline } = require("playwright-core/lib/coreBundle").iso;
|
|
2211
2218
|
var { getPackageManagerExecCommand } = require("playwright-core/lib/coreBundle").utils;
|
|
2212
2219
|
var { currentZone } = require("playwright-core/lib/coreBundle").utils;
|
|
2213
|
-
var testTypeSymbol = Symbol("testType");
|
|
2220
|
+
var testTypeSymbol = /* @__PURE__ */ Symbol("testType");
|
|
2214
2221
|
var TestTypeImpl = class _TestTypeImpl {
|
|
2215
2222
|
constructor(fixtures) {
|
|
2216
2223
|
this.fixtures = fixtures;
|
|
@@ -2594,6 +2601,13 @@ var Suite = class _Suite extends Base {
|
|
|
2594
2601
|
suite.parent = this;
|
|
2595
2602
|
this._entries.unshift(suite);
|
|
2596
2603
|
}
|
|
2604
|
+
_detach(child) {
|
|
2605
|
+
const idx = this._entries.indexOf(child);
|
|
2606
|
+
if (idx !== -1)
|
|
2607
|
+
this._entries.splice(idx, 1);
|
|
2608
|
+
if (this._entries.length === 0)
|
|
2609
|
+
this.parent?._detach(this);
|
|
2610
|
+
}
|
|
2597
2611
|
allTests() {
|
|
2598
2612
|
const result2 = [];
|
|
2599
2613
|
const visit = (suite) => {
|
|
@@ -2751,6 +2765,7 @@ var TestCase = class _TestCase extends Base {
|
|
|
2751
2765
|
this._projectId = "";
|
|
2752
2766
|
// Explicitly declared tags that are not a part of the title.
|
|
2753
2767
|
this._tags = [];
|
|
2768
|
+
this._planAnnotations = [];
|
|
2754
2769
|
this.fn = fn;
|
|
2755
2770
|
this._testType = testType;
|
|
2756
2771
|
this.location = location;
|
|
@@ -2777,6 +2792,14 @@ var TestCase = class _TestCase extends Base {
|
|
|
2777
2792
|
...this._tags
|
|
2778
2793
|
];
|
|
2779
2794
|
}
|
|
2795
|
+
_applyPlanAnnotation(annotation) {
|
|
2796
|
+
this.annotations.push(annotation);
|
|
2797
|
+
this._planAnnotations.push(annotation);
|
|
2798
|
+
if (annotation.type === "skip" || annotation.type === "fixme")
|
|
2799
|
+
this.expectedStatus = "skipped";
|
|
2800
|
+
else if (annotation.type === "fail" && this.expectedStatus !== "skipped")
|
|
2801
|
+
this.expectedStatus = "failed";
|
|
2802
|
+
}
|
|
2780
2803
|
_serialize() {
|
|
2781
2804
|
return {
|
|
2782
2805
|
kind: "test",
|
package/lib/common/index.js.txt
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
# packages/playwright/lib/common/index.js
|
|
2
|
-
# total:
|
|
2
|
+
# total: 114.2 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.
|
|
19
|
-
1.
|
|
18
|
+
9.7 KB packages/playwright/src/transform/compilationCache.ts
|
|
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
23
|
2.9 KB packages/playwright/src/transform/tsconfig-loader.ts
|
|
24
|
-
7.
|
|
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
|
package/lib/errorContext.js
CHANGED
|
@@ -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;
|
package/lib/index.js
CHANGED
|
@@ -45,7 +45,6 @@ var import_utilsBundle = require("playwright-core/lib/utilsBundle");
|
|
|
45
45
|
var import_errorContext = require("./errorContext");
|
|
46
46
|
var import_common = require("./common");
|
|
47
47
|
var globals = __toESM(require("./globals"));
|
|
48
|
-
var import_package = require("./package");
|
|
49
48
|
var import_browserBackend = require("./mcp/test/browserBackend");
|
|
50
49
|
var import_expect = require("./matchers/expect");
|
|
51
50
|
var import_common2 = require("./common");
|
|
@@ -56,10 +55,9 @@ const { escapeHTML } = require("playwright-core/lib/coreBundle").iso;
|
|
|
56
55
|
const { jsonStringifyForceASCII } = require("playwright-core/lib/coreBundle").utils;
|
|
57
56
|
const { createGuid } = require("playwright-core/lib/coreBundle").utils;
|
|
58
57
|
const { debugMode } = require("playwright-core/lib/coreBundle").utils;
|
|
59
|
-
const {
|
|
58
|
+
const { debugLogger } = require("playwright-core/lib/coreBundle").utils;
|
|
60
59
|
const { currentZone } = require("playwright-core/lib/coreBundle").utils;
|
|
61
60
|
const _baseTest = import_common.testType.rootTestType.test;
|
|
62
|
-
setBoxedStackPrefixes([import_package.packageRoot]);
|
|
63
61
|
if (process["__pw_initiator__"]) {
|
|
64
62
|
const originalStackTraceLimit = Error.stackTraceLimit;
|
|
65
63
|
Error.stackTraceLimit = 200;
|
|
@@ -111,6 +109,7 @@ const utilityFixtures = {
|
|
|
111
109
|
category: "pw:api",
|
|
112
110
|
title: renderTitle(channel.type, channel.method, channel.params, data.title),
|
|
113
111
|
apiName: data.apiName,
|
|
112
|
+
channelMethod: `${channel.type}.${channel.method}`,
|
|
114
113
|
params: channel.params,
|
|
115
114
|
group: getActionGroup({ type: channel.type, method: channel.method })
|
|
116
115
|
}, tracingGroupSteps[tracingGroupSteps.length - 1]);
|
|
@@ -434,9 +433,10 @@ const playwrightFixtures = {
|
|
|
434
433
|
}, { scope: "test", title: "context", box: true }],
|
|
435
434
|
_optionContextReuseMode: ["none", { scope: "worker", option: true, box: true }],
|
|
436
435
|
_optionConnectOptions: [void 0, { scope: "worker", option: true, box: true }],
|
|
437
|
-
|
|
436
|
+
reuseContext: [false, { scope: "worker", option: true, box: true }],
|
|
437
|
+
_reuseContext: [async ({ video, _optionContextReuseMode, reuseContext }, use) => {
|
|
438
438
|
let mode = _optionContextReuseMode;
|
|
439
|
-
if (process.env.PW_TEST_REUSE_CONTEXT)
|
|
439
|
+
if (process.env.PW_TEST_REUSE_CONTEXT || reuseContext)
|
|
440
440
|
mode = "when-possible";
|
|
441
441
|
const reuse = mode === "when-possible" && normalizeVideoMode(video) === "off";
|
|
442
442
|
await use(reuse);
|
|
@@ -468,6 +468,28 @@ const playwrightFixtures = {
|
|
|
468
468
|
if (!page)
|
|
469
469
|
page = await context.newPage();
|
|
470
470
|
await use(page);
|
|
471
|
+
},
|
|
472
|
+
mount: async ({ page, baseURL }, use) => {
|
|
473
|
+
const callMount = (params) => page.evaluate(async (p) => {
|
|
474
|
+
const w = window;
|
|
475
|
+
if (typeof w.mount !== "function")
|
|
476
|
+
throw new Error("The gallery page does not define window.mount().");
|
|
477
|
+
await w.mount(p);
|
|
478
|
+
}, params, { exposeFunctions: true });
|
|
479
|
+
await use(async (storyId, props) => {
|
|
480
|
+
if (!baseURL)
|
|
481
|
+
throw new Error("mount() requires `baseURL` to point at the component gallery. Set it in your Playwright config.");
|
|
482
|
+
await page.goto(baseURL);
|
|
483
|
+
await callMount({ story: storyId, props });
|
|
484
|
+
return Object.assign(page.locator("#root"), {
|
|
485
|
+
// update() re-renders the same story with new props without navigating; if the gallery
|
|
486
|
+
// reuses its root/instance, the framework reconciles and component state is preserved.
|
|
487
|
+
update: (newProps) => callMount({ story: storyId, props: newProps }),
|
|
488
|
+
unmount: () => page.evaluate(async () => {
|
|
489
|
+
await window.unmount?.();
|
|
490
|
+
})
|
|
491
|
+
});
|
|
492
|
+
});
|
|
471
493
|
}
|
|
472
494
|
};
|
|
473
495
|
function normalizeVideoMode(video) {
|
|
@@ -533,7 +555,7 @@ function resolveClientCerticates(clientCertificates) {
|
|
|
533
555
|
}
|
|
534
556
|
return clientCertificates;
|
|
535
557
|
}
|
|
536
|
-
const kTracingStarted = Symbol("kTracingStarted");
|
|
558
|
+
const kTracingStarted = /* @__PURE__ */ Symbol("kTracingStarted");
|
|
537
559
|
function connectOptionsFromEnv() {
|
|
538
560
|
const wsEndpoint = process.env.PW_TEST_CONNECT_WS_ENDPOINT;
|
|
539
561
|
if (!wsEndpoint)
|
|
@@ -622,7 +644,7 @@ class ArtifactsRecorder {
|
|
|
622
644
|
this._resultScreenshots = resultScreenshots;
|
|
623
645
|
this._pauseOnFailure = pauseOnFailure;
|
|
624
646
|
const screenshotOptions = typeof screenshot === "string" ? void 0 : screenshot;
|
|
625
|
-
this._startedCollectingArtifacts = Symbol("startedCollectingArtifacts");
|
|
647
|
+
this._startedCollectingArtifacts = /* @__PURE__ */ Symbol("startedCollectingArtifacts");
|
|
626
648
|
this._screenshotRecorder = new SnapshotRecorder(this, normalizeScreenshotMode(screenshot), "screenshot", "image/png", ".png", async (page, path2) => {
|
|
627
649
|
await page._wrapApiCall(async () => {
|
|
628
650
|
await page.screenshot({ ...screenshotOptions, timeout: 5e3, path: path2, caret: "initial" });
|
|
@@ -661,7 +683,8 @@ class ArtifactsRecorder {
|
|
|
661
683
|
await page._wrapApiCall(async () => {
|
|
662
684
|
this._pageSnapshot = await page.ariaSnapshot({ mode: "ai", timeout: 5e3 });
|
|
663
685
|
}, { internal: true });
|
|
664
|
-
} catch {
|
|
686
|
+
} catch (error) {
|
|
687
|
+
debugLogger.log("error", `failed to capture aria snapshot: ${error}`);
|
|
665
688
|
}
|
|
666
689
|
}
|
|
667
690
|
async didCreateRequestContext(context) {
|