playwright 1.56.0-alpha-2025-08-31 → 1.56.0-alpha-2025-09-01

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.
@@ -283,21 +283,26 @@ async function toHaveScreenshot(pageOrLocator, nameOrOptions = {}, optOptions =
283
283
  const expected = await import_fs.default.promises.readFile(helper.expectedPath);
284
284
  expectScreenshotOptions.expected = helper.updateSnapshots === "all" ? void 0 : expected;
285
285
  const { actual, previous, diff, errorMessage, log, timedOut } = await page._expectScreenshot(expectScreenshotOptions);
286
- const writeFiles = () => {
287
- writeFileSync(helper.expectedPath, actual);
288
- writeFileSync(helper.actualPath, actual);
286
+ const writeFiles = (actualBuffer) => {
287
+ writeFileSync(helper.expectedPath, actualBuffer);
288
+ writeFileSync(helper.actualPath, actualBuffer);
289
289
  console.log(helper.expectedPath + " is re-generated, writing actual.");
290
290
  return helper.createMatcherResult(helper.expectedPath + " running with --update-snapshots, writing actual.", true);
291
291
  };
292
292
  if (!errorMessage) {
293
293
  if (helper.updateSnapshots === "all" && actual && (0, import_utils.compareBuffersOrStrings)(actual, expected)) {
294
294
  console.log(helper.expectedPath + " is re-generated, writing actual.");
295
- return writeFiles();
295
+ return writeFiles(actual);
296
296
  }
297
297
  return helper.handleMatching();
298
298
  }
299
- if (helper.updateSnapshots === "changed" || helper.updateSnapshots === "all")
300
- return writeFiles();
299
+ if (helper.updateSnapshots === "changed" || helper.updateSnapshots === "all") {
300
+ if (actual)
301
+ return writeFiles(actual);
302
+ let header2 = (0, import_matcherHint.matcherHint)(this, void 0, "toHaveScreenshot", receiver, void 0, void 0, timedOut ? timeout : void 0);
303
+ header2 += " Failed to re-generate expected.\n";
304
+ return helper.handleDifferent(actual, expectScreenshotOptions.expected, previous, diff, header2, errorMessage, log, this._stepInfo);
305
+ }
301
306
  const header = (0, import_matcherHint.matcherHint)(this, void 0, "toHaveScreenshot", receiver, void 0, void 0, timedOut ? timeout : void 0);
302
307
  return helper.handleDifferent(actual, expectScreenshotOptions.expected, previous, diff, header, errorMessage, log, this._stepInfo);
303
308
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playwright",
3
- "version": "1.56.0-alpha-2025-08-31",
3
+ "version": "1.56.0-alpha-2025-09-01",
4
4
  "description": "A high-level API to automate web browsers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -61,7 +61,7 @@
61
61
  },
62
62
  "license": "Apache-2.0",
63
63
  "dependencies": {
64
- "playwright-core": "1.56.0-alpha-2025-08-31"
64
+ "playwright-core": "1.56.0-alpha-2025-09-01"
65
65
  },
66
66
  "optionalDependencies": {
67
67
  "fsevents": "2.3.2"