playwright 1.54.0-alpha-2025-07-03 → 1.54.0-alpha-2025-07-05

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.

Potentially problematic release.


This version of playwright might be problematic. Click here for more details.

package/lib/index.js CHANGED
@@ -382,10 +382,9 @@ const playwrightFixtures = {
382
382
  }
383
383
  const defaultContextOptions = playwright.chromium._defaultContextOptions;
384
384
  const context = await browser._newContextForReuse(defaultContextOptions);
385
- context[kIsReusedContext] = true;
386
385
  await use(context);
387
386
  const closeReason = testInfo.status === "timedOut" ? "Test timeout of " + testInfo.timeout + "ms exceeded." : "Test ended.";
388
- await browser._stopPendingOperations(closeReason);
387
+ await browser._disconnectFromReusedContext(closeReason);
389
388
  },
390
389
  page: async ({ context, _reuseContext }, use) => {
391
390
  if (!_reuseContext) {
@@ -461,7 +460,6 @@ function resolveClientCerticates(clientCertificates) {
461
460
  return clientCertificates;
462
461
  }
463
462
  const kTracingStarted = Symbol("kTracingStarted");
464
- const kIsReusedContext = Symbol("kReusedContext");
465
463
  function connectOptionsFromEnv() {
466
464
  const wsEndpoint = process.env.PW_TEST_CONNECT_WS_ENDPOINT;
467
465
  if (!wsEndpoint)
@@ -545,8 +543,6 @@ class SnapshotRecorder {
545
543
  }
546
544
  class ArtifactsRecorder {
547
545
  constructor(playwright, artifactsDir, screenshot) {
548
- this._reusedContexts = /* @__PURE__ */ new Set();
549
- this._sourceCache = /* @__PURE__ */ new Map();
550
546
  this._playwright = playwright;
551
547
  this._artifactsDir = artifactsDir;
552
548
  const screenshotOptions = typeof screenshot === "string" ? void 0 : screenshot;
@@ -559,23 +555,14 @@ class ArtifactsRecorder {
559
555
  this._testInfo = testInfo;
560
556
  testInfo._onDidFinishTestFunction = () => this.didFinishTestFunction();
561
557
  this._screenshotRecorder.fixOrdinal();
562
- await Promise.all(this._playwright._allContexts().map(async (context) => {
563
- if (context[kIsReusedContext])
564
- this._reusedContexts.add(context);
565
- else
566
- await this.didCreateBrowserContext(context);
567
- }));
568
- {
569
- const existingApiRequests = Array.from(this._playwright.request._contexts);
570
- await Promise.all(existingApiRequests.map((c) => this.didCreateRequestContext(c)));
571
- }
558
+ await Promise.all(this._playwright._allContexts().map((context) => this.didCreateBrowserContext(context)));
559
+ const existingApiRequests = Array.from(this._playwright.request._contexts);
560
+ await Promise.all(existingApiRequests.map((c) => this.didCreateRequestContext(c)));
572
561
  }
573
562
  async didCreateBrowserContext(context) {
574
563
  await this._startTraceChunkOnContextCreation(context.tracing);
575
564
  }
576
565
  async willCloseBrowserContext(context) {
577
- if (this._reusedContexts.has(context))
578
- return;
579
566
  await this._stopTracing(context.tracing);
580
567
  await this._screenshotRecorder.captureTemporary(context);
581
568
  await this._takePageSnapshot(context);
@@ -606,7 +593,7 @@ class ArtifactsRecorder {
606
593
  }
607
594
  async didFinishTest() {
608
595
  await this.didFinishTestFunction();
609
- const leftoverContexts = this._playwright._allContexts().filter((context2) => !this._reusedContexts.has(context2));
596
+ const leftoverContexts = this._playwright._allContexts();
610
597
  const leftoverApiRequests = Array.from(this._playwright.request._contexts);
611
598
  await Promise.all(leftoverContexts.map(async (context2) => {
612
599
  await this._stopTracing(context2.tracing);
@@ -107,7 +107,7 @@ class HtmlReporter {
107
107
  async onEnd(result) {
108
108
  const projectSuites = this.suite.suites;
109
109
  await (0, import_utils.removeFolders)([this._outputFolder]);
110
- const builder = new HtmlBuilder(this.config, this._outputFolder, this._attachmentsBaseURL, process.env.PLAYWRIGHT_HTML_TITLE || this._options.title);
110
+ const builder = new HtmlBuilder(this.config, this._outputFolder, this._attachmentsBaseURL, process.env.PLAYWRIGHT_HTML_TITLE || this._options.title, this._options.snippets);
111
111
  this._buildResult = await builder.build(this.config.metadata, projectSuites, result, this._topLevelErrors);
112
112
  }
113
113
  async onExit() {
@@ -191,11 +191,12 @@ function startHtmlReportServer(folder) {
191
191
  return server;
192
192
  }
193
193
  class HtmlBuilder {
194
- constructor(config, outputDir, attachmentsBaseURL, title) {
194
+ constructor(config, outputDir, attachmentsBaseURL, title, snippets = true) {
195
195
  this._stepsInFile = new import_utils.MultiMap();
196
196
  this._hasTraces = false;
197
197
  this._config = config;
198
198
  this._reportFolder = outputDir;
199
+ this._snippets = snippets;
199
200
  import_fs.default.mkdirSync(this._reportFolder, { recursive: true });
200
201
  this._dataZipFile = new import_zipBundle.yazl.ZipFile();
201
202
  this._attachmentsBaseURL = attachmentsBaseURL;
@@ -224,7 +225,8 @@ class HtmlBuilder {
224
225
  }
225
226
  }
226
227
  }
227
- createSnippets(this._stepsInFile);
228
+ if (this._snippets)
229
+ createSnippets(this._stepsInFile);
228
230
  let ok = true;
229
231
  for (const [fileId, { testFile, testFileSummary }] of data) {
230
232
  const stats = testFileSummary.stats;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playwright",
3
- "version": "1.54.0-alpha-2025-07-03",
3
+ "version": "1.54.0-alpha-2025-07-05",
4
4
  "description": "A high-level API to automate web browsers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -56,7 +56,7 @@
56
56
  },
57
57
  "license": "Apache-2.0",
58
58
  "dependencies": {
59
- "playwright-core": "1.54.0-alpha-2025-07-03"
59
+ "playwright-core": "1.54.0-alpha-2025-07-05"
60
60
  },
61
61
  "optionalDependencies": {
62
62
  "fsevents": "2.3.2"
package/types/test.d.ts CHANGED
@@ -22,7 +22,7 @@ export type BlobReporterOptions = { outputDir?: string, fileName?: string };
22
22
  export type ListReporterOptions = { printSteps?: boolean };
23
23
  export type JUnitReporterOptions = { outputFile?: string, stripANSIControlSequences?: boolean, includeProjectInTestName?: boolean };
24
24
  export type JsonReporterOptions = { outputFile?: string };
25
- export type HtmlReporterOptions = { outputFolder?: string, open?: 'always' | 'never' | 'on-failure', host?: string, port?: number, attachmentsBaseURL?: string, title?: string };
25
+ export type HtmlReporterOptions = { outputFolder?: string, open?: 'always' | 'never' | 'on-failure', host?: string, port?: number, attachmentsBaseURL?: string, title?: string, snippets?: boolean };
26
26
 
27
27
  export type ReporterDescription = Readonly<
28
28
  ['blob'] | ['blob', BlobReporterOptions] |