@smoothdeploy/playwright 1.61.0 → 1.62.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,9 +17,9 @@ jobs:
17
17
  contents: read
18
18
 
19
19
  steps:
20
- - uses: actions/checkout@v4
20
+ - uses: actions/checkout@v6
21
21
 
22
- - uses: actions/setup-node@v4
22
+ - uses: actions/setup-node@v6
23
23
  with:
24
24
  node-version: lts/*
25
25
 
@@ -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)
@@ -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: import_fs.default.readFileSync(cache.codePath, "utf-8") };
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 = import_fs.default.readFileSync(codePath, "utf8");
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
- import_fs.default.writeFileSync(codePath, code, "utf8");
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").minimatch;
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 { parseStackFrame, stringifyStackFrames } = require("playwright-core/lib/coreBundle").iso;
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 * (parseInt(workers, 10) / 100)));
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;
@@ -869,7 +861,7 @@ function resolve(specifier, context, nextResolve) {
869
861
  const filename = import_url.default.fileURLToPath(context.parentURL);
870
862
  const resolved = resolveHook(filename, specifier);
871
863
  if (resolved !== void 0) {
872
- specifier = context.conditions?.includes("import") ? import_url.default.pathToFileURL(resolved).toString() : resolved;
864
+ specifier = new Set(context.conditions).has("import") ? import_url.default.pathToFileURL(resolved).toString() : resolved;
873
865
  }
874
866
  }
875
867
  const result2 = nextResolve(specifier, context);
@@ -894,7 +886,8 @@ function load(moduleUrl, context, nextLoad) {
894
886
  const filename = import_url.default.fileURLToPath(moduleUrl);
895
887
  if (!shouldTransform(filename))
896
888
  return nextLoad(moduleUrl, context);
897
- const format = kSupportedFormats.get(context.format) || (fileIsModule(filename) ? "module" : "commonjs");
889
+ const isRequire = !new Set(context.conditions).has("import");
890
+ const format = isRequire ? "commonjs" : kSupportedFormats.get(context.format) || (fileIsModule(filename) ? "module" : "commonjs");
898
891
  const code = import_fs5.default.readFileSync(filename, "utf-8");
899
892
  const transformed = transformHook(code, filename, format === "module" ? moduleUrl : void 0);
900
893
  return {
@@ -1270,7 +1263,7 @@ async function incorporateCompilationCache() {
1270
1263
 
1271
1264
  // packages/playwright/src/common/configLoader.ts
1272
1265
  var { isRegExp: isRegExp2 } = require("playwright-core/lib/coreBundle").iso;
1273
- var kDefineConfigWasUsed = Symbol("defineConfigWasUsed");
1266
+ var kDefineConfigWasUsed = /* @__PURE__ */ Symbol("defineConfigWasUsed");
1274
1267
  var defineConfig = (...configs) => {
1275
1268
  let result2 = configs[0];
1276
1269
  for (let i = 1; i < configs.length; ++i) {
@@ -1456,6 +1449,10 @@ function validateConfig(file2, config) {
1456
1449
  if (typeof config.updateSnapshots !== "string" || !["all", "changed", "missing", "none"].includes(config.updateSnapshots))
1457
1450
  throw errorWithFile(file2, `config.updateSnapshots must be one of "all", "changed", "missing" or "none"`);
1458
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
+ }
1459
1456
  if ("tsconfig" in config && config.tsconfig !== void 0) {
1460
1457
  if (typeof config.tsconfig !== "string")
1461
1458
  throw errorWithFile(file2, `config.tsconfig must be a string`);
@@ -1564,6 +1561,7 @@ __export(fixtures_exports, {
1564
1561
  inheritFixtureNames: () => inheritFixtureNames
1565
1562
  });
1566
1563
  var import_crypto2 = __toESM(require("crypto"));
1564
+ var { filterStackFile } = require("playwright-core/lib/coreBundle").utils;
1567
1565
  var kScopeOrder = ["test", "worker"];
1568
1566
  function isFixtureTuple(value) {
1569
1567
  return Array.isArray(value) && typeof value[1] === "object";
@@ -1571,6 +1569,11 @@ function isFixtureTuple(value) {
1571
1569
  function isFixtureOption(value) {
1572
1570
  return isFixtureTuple(value) && !!value[1].option;
1573
1571
  }
1572
+ function isOptionFixture(registration) {
1573
+ while (!registration.option && registration.super)
1574
+ registration = registration.super;
1575
+ return registration.option;
1576
+ }
1574
1577
  var FixturePool = class {
1575
1578
  constructor(fixturesList, onLoadError, parentPool, disallowWorkerFixtures, optionOverrides) {
1576
1579
  this._registrations = new Map(parentPool ? parentPool._registrations : []);
@@ -1590,7 +1593,7 @@ var FixturePool = class {
1590
1593
  if (optionOverrides) {
1591
1594
  for (const key of overrideKeys) {
1592
1595
  const registration = this._registrations.get(key);
1593
- if (registration && !registration.option)
1596
+ if (registration && !isOptionFixture(registration))
1594
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);
1595
1598
  }
1596
1599
  }
@@ -1606,7 +1609,7 @@ var FixturePool = class {
1606
1609
  options = {
1607
1610
  auto: value[1].auto ?? false,
1608
1611
  scope: value[1].scope || "test",
1609
- option: !!value[1].option,
1612
+ option: value[1].option,
1610
1613
  timeout: value[1].timeout,
1611
1614
  customTitle: value[1].title,
1612
1615
  box: value[1].box
@@ -1624,6 +1627,10 @@ var FixturePool = class {
1624
1627
  this._addLoadError(`Fixture "${name}" has already been registered as a { auto: '${previous.scope}' } fixture defined in ${formatLocation(previous.location)}.`, location);
1625
1628
  continue;
1626
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
+ }
1627
1634
  } else if (previous) {
1628
1635
  options = { auto: previous.auto, scope: previous.scope, option: previous.option, timeout: previous.timeout, customTitle: previous.customTitle };
1629
1636
  } else if (!options) {
@@ -1638,14 +1645,14 @@ var FixturePool = class {
1638
1645
  Make it top-level in the test file or put in the configuration file.`, location);
1639
1646
  continue;
1640
1647
  }
1641
- if (fn === void 0 && options.option && previous) {
1648
+ if (fn === void 0 && previous && isOptionFixture(previous)) {
1642
1649
  let original = previous;
1643
1650
  while (!original.optionOverride && original.super)
1644
1651
  original = original.super;
1645
1652
  fn = original.fn;
1646
1653
  }
1647
1654
  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 };
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 };
1649
1656
  registrationId(registration);
1650
1657
  this._registrations.set(name, registration);
1651
1658
  }
@@ -1729,7 +1736,7 @@ Make it top-level in the test file or put in the configuration file.`, location)
1729
1736
  this._onLoadError({ message, location });
1730
1737
  }
1731
1738
  };
1732
- var signatureSymbol = Symbol("signature");
1739
+ var signatureSymbol = /* @__PURE__ */ Symbol("signature");
1733
1740
  function formatPotentiallyInternalLocation(location) {
1734
1741
  const isUserFixture = location && filterStackFile(location.file);
1735
1742
  return isUserFixture ? formatLocation(location) : "<builtin>";
@@ -1938,9 +1945,11 @@ __export(process_exports, {
1938
1945
  startProcessRunner: () => startProcessRunner
1939
1946
  });
1940
1947
  var import_bootstrap = require("playwright-core/lib/bootstrap");
1948
+ var import_package4 = require("../package");
1941
1949
  var { ManualPromise } = require("playwright-core/lib/coreBundle").iso;
1942
1950
  var { setTimeOrigin } = require("playwright-core/lib/coreBundle").iso;
1943
1951
  var { startProfiling, stopProfiling } = require("playwright-core/lib/coreBundle").utils;
1952
+ var { setBoxedStackPrefixes } = require("playwright-core/lib/coreBundle").utils;
1944
1953
  var ProcessRunner = class {
1945
1954
  async gracefullyClose() {
1946
1955
  }
@@ -1961,6 +1970,7 @@ var forceExitInitiated = false;
1961
1970
  var processRunner;
1962
1971
  var processName;
1963
1972
  var startingEnv = { ...process.env };
1973
+ setBoxedStackPrefixes([import_package4.packageRoot]);
1964
1974
  function startProcessRunner(create) {
1965
1975
  sendMessageToParent({ method: "ready" });
1966
1976
  process.on("disconnect", () => gracefullyCloseAndExit(true));
@@ -2210,7 +2220,7 @@ var { monotonicTime } = require("playwright-core/lib/coreBundle").iso;
2210
2220
  var { raceAgainstDeadline } = require("playwright-core/lib/coreBundle").iso;
2211
2221
  var { getPackageManagerExecCommand } = require("playwright-core/lib/coreBundle").utils;
2212
2222
  var { currentZone } = require("playwright-core/lib/coreBundle").utils;
2213
- var testTypeSymbol = Symbol("testType");
2223
+ var testTypeSymbol = /* @__PURE__ */ Symbol("testType");
2214
2224
  var TestTypeImpl = class _TestTypeImpl {
2215
2225
  constructor(fixtures) {
2216
2226
  this.fixtures = fixtures;
@@ -2594,6 +2604,13 @@ var Suite = class _Suite extends Base {
2594
2604
  suite.parent = this;
2595
2605
  this._entries.unshift(suite);
2596
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
+ }
2597
2614
  allTests() {
2598
2615
  const result2 = [];
2599
2616
  const visit = (suite) => {
@@ -2751,6 +2768,7 @@ var TestCase = class _TestCase extends Base {
2751
2768
  this._projectId = "";
2752
2769
  // Explicitly declared tags that are not a part of the title.
2753
2770
  this._tags = [];
2771
+ this._planAnnotations = [];
2754
2772
  this.fn = fn;
2755
2773
  this._testType = testType;
2756
2774
  this.location = location;
@@ -2777,6 +2795,14 @@ var TestCase = class _TestCase extends Base {
2777
2795
  ...this._tags
2778
2796
  ];
2779
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
+ }
2780
2806
  _serialize() {
2781
2807
  return {
2782
2808
  kind: "test",
@@ -1,29 +1,29 @@
1
1
  # packages/playwright/lib/common/index.js
2
- # total: 112.8 KB
2
+ # total: 114.5 KB
3
3
 
4
4
  ## Inlined (20)
5
- 11.7 KB packages/playwright/src/common/config.ts
6
- 13.4 KB packages/playwright/src/common/configLoader.ts
7
- 10.9 KB packages/playwright/src/common/fixtures.ts
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.7 KB packages/playwright/src/common/process.ts
11
+ 3.9 KB packages/playwright/src/common/process.ts
12
12
  4.7 KB packages/playwright/src/common/suiteUtils.ts
13
- 7.9 KB packages/playwright/src/common/test.ts
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.6 KB packages/playwright/src/transform/compilationCache.ts
19
- 1.6 KB packages/playwright/src/transform/esmLoaderSync.ts
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
- 2.9 KB packages/playwright/src/transform/tsconfig-loader.ts
24
- 7.8 KB packages/playwright/src/util.ts
23
+ 3.2 KB packages/playwright/src/transform/tsconfig-loader.ts
24
+ 7.0 KB packages/playwright/src/util.ts
25
25
 
26
- ## External (9)
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").iso;
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, import_path.default.sep);
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 { setBoxedStackPrefixes } = require("playwright-core/lib/coreBundle").utils;
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;
@@ -434,9 +432,10 @@ const playwrightFixtures = {
434
432
  }, { scope: "test", title: "context", box: true }],
435
433
  _optionContextReuseMode: ["none", { scope: "worker", option: true, box: true }],
436
434
  _optionConnectOptions: [void 0, { scope: "worker", option: true, box: true }],
437
- _reuseContext: [async ({ video, _optionContextReuseMode }, use) => {
435
+ reuseContext: [false, { scope: "worker", option: true, box: true }],
436
+ _reuseContext: [async ({ video, _optionContextReuseMode, reuseContext }, use) => {
438
437
  let mode = _optionContextReuseMode;
439
- if (process.env.PW_TEST_REUSE_CONTEXT)
438
+ if (process.env.PW_TEST_REUSE_CONTEXT || reuseContext)
440
439
  mode = "when-possible";
441
440
  const reuse = mode === "when-possible" && normalizeVideoMode(video) === "off";
442
441
  await use(reuse);
@@ -468,6 +467,28 @@ const playwrightFixtures = {
468
467
  if (!page)
469
468
  page = await context.newPage();
470
469
  await use(page);
470
+ },
471
+ mount: async ({ page, baseURL }, use) => {
472
+ const callMount = (params) => page.evaluate(async (p) => {
473
+ const w = window;
474
+ if (typeof w.mount !== "function")
475
+ throw new Error("The gallery page does not define window.mount().");
476
+ await w.mount(p);
477
+ }, params, { exposeFunctions: true });
478
+ await use(async (storyId, props) => {
479
+ if (!baseURL)
480
+ throw new Error("mount() requires `baseURL` to point at the component gallery. Set it in your Playwright config.");
481
+ await page.goto(baseURL);
482
+ await callMount({ story: storyId, props });
483
+ return Object.assign(page.locator("#root"), {
484
+ // update() re-renders the same story with new props without navigating; if the gallery
485
+ // reuses its root/instance, the framework reconciles and component state is preserved.
486
+ update: (newProps) => callMount({ story: storyId, props: newProps }),
487
+ unmount: () => page.evaluate(async () => {
488
+ await window.unmount?.();
489
+ })
490
+ });
491
+ });
471
492
  }
472
493
  };
473
494
  function normalizeVideoMode(video) {
@@ -533,7 +554,7 @@ function resolveClientCerticates(clientCertificates) {
533
554
  }
534
555
  return clientCertificates;
535
556
  }
536
- const kTracingStarted = Symbol("kTracingStarted");
557
+ const kTracingStarted = /* @__PURE__ */ Symbol("kTracingStarted");
537
558
  function connectOptionsFromEnv() {
538
559
  const wsEndpoint = process.env.PW_TEST_CONNECT_WS_ENDPOINT;
539
560
  if (!wsEndpoint)
@@ -622,7 +643,7 @@ class ArtifactsRecorder {
622
643
  this._resultScreenshots = resultScreenshots;
623
644
  this._pauseOnFailure = pauseOnFailure;
624
645
  const screenshotOptions = typeof screenshot === "string" ? void 0 : screenshot;
625
- this._startedCollectingArtifacts = Symbol("startedCollectingArtifacts");
646
+ this._startedCollectingArtifacts = /* @__PURE__ */ Symbol("startedCollectingArtifacts");
626
647
  this._screenshotRecorder = new SnapshotRecorder(this, normalizeScreenshotMode(screenshot), "screenshot", "image/png", ".png", async (page, path2) => {
627
648
  await page._wrapApiCall(async () => {
628
649
  await page.screenshot({ ...screenshotOptions, timeout: 5e3, path: path2, caret: "initial" });
@@ -661,7 +682,8 @@ class ArtifactsRecorder {
661
682
  await page._wrapApiCall(async () => {
662
683
  this._pageSnapshot = await page.ariaSnapshot({ mode: "ai", timeout: 5e3 });
663
684
  }, { internal: true });
664
- } catch {
685
+ } catch (error) {
686
+ debugLogger.log("error", `failed to capture aria snapshot: ${error}`);
665
687
  }
666
688
  }
667
689
  async didCreateRequestContext(context) {