playwright 1.56.0-alpha-2025-09-12 → 1.56.0-alpha-2025-09-14

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.
@@ -147,11 +147,11 @@ class Context {
147
147
  if (this.config.network?.allowedOrigins?.length) {
148
148
  await context.route("**", (route) => route.abort("blockedbyclient"));
149
149
  for (const origin of this.config.network.allowedOrigins)
150
- await context.route(`*://${origin}/**`, (route) => route.continue());
150
+ await context.route(originOrHostGlob(origin), (route) => route.continue());
151
151
  }
152
152
  if (this.config.network?.blockedOrigins?.length) {
153
153
  for (const origin of this.config.network.blockedOrigins)
154
- await context.route(`*://${origin}/**`, (route) => route.abort("blockedbyclient"));
154
+ await context.route(originOrHostGlob(origin), (route) => route.abort("blockedbyclient"));
155
155
  }
156
156
  }
157
157
  async ensureBrowserContext() {
@@ -197,6 +197,15 @@ class Context {
197
197
  };
198
198
  }
199
199
  }
200
+ function originOrHostGlob(originOrHost) {
201
+ try {
202
+ const url = new URL(originOrHost);
203
+ if (url.origin !== "null")
204
+ return `${url.origin}/**`;
205
+ } catch {
206
+ }
207
+ return `*://${originOrHost}/**`;
208
+ }
200
209
  class InputRecorder {
201
210
  constructor(context, browserContext) {
202
211
  this._context = context;
@@ -34,6 +34,8 @@ __export(testTools_exports, {
34
34
  setupPage: () => setupPage
35
35
  });
36
36
  module.exports = __toCommonJS(testTools_exports);
37
+ var import_fs = __toESM(require("fs"));
38
+ var import_path = __toESM(require("path"));
37
39
  var import_utils = require("playwright-core/lib/utils");
38
40
  var import_bundle = require("../sdk/bundle");
39
41
  var import_base = require("../../reporters/base");
@@ -127,9 +129,10 @@ const setupPage = (0, import_testTool.defineTestTool)({
127
129
  schema: {
128
130
  name: "test_setup_page",
129
131
  title: "Setup page",
130
- description: "Runs a blank test to setup the page for interaction",
132
+ description: "Setup the page for test",
131
133
  inputSchema: import_bundle.z.object({
132
- testLocation: import_bundle.z.string().describe('Location of the blank test to use for setup. For example: "test/e2e/file.spec.ts:20"')
134
+ project: import_bundle.z.string().optional().describe('Project to use for setup. For example: "chromium", if no project is provided uses the first project in the config.'),
135
+ testLocation: import_bundle.z.string().optional().describe('Location of the test to use for setup. For example: "test/e2e/file.spec.ts:20". Sets up blank page if no location is provided.')
133
136
  }),
134
137
  type: "readOnly"
135
138
  },
@@ -138,9 +141,21 @@ const setupPage = (0, import_testTool.defineTestTool)({
138
141
  const configDir = context.configLocation.configDir;
139
142
  const reporter = new import_list.default({ configDir, screen });
140
143
  const testRunner = await context.createTestRunner();
144
+ let testLocation = params.testLocation;
145
+ if (!testLocation) {
146
+ testLocation = ".template.spec.ts";
147
+ const templateFile = import_path.default.join(configDir, testLocation);
148
+ if (!import_fs.default.existsSync(templateFile)) {
149
+ await import_fs.default.promises.writeFile(templateFile, `
150
+ import { test, expect } from '@playwright/test';
151
+ test('template', async ({ page }) => {});
152
+ `);
153
+ }
154
+ }
141
155
  const result = await testRunner.runTests(reporter, {
142
156
  headed: !context.options?.headless,
143
- locations: [params.testLocation],
157
+ locations: [testLocation],
158
+ projects: params.project ? [params.project] : void 0,
144
159
  timeout: 0,
145
160
  workers: 1,
146
161
  pauseAtEnd: true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playwright",
3
- "version": "1.56.0-alpha-2025-09-12",
3
+ "version": "1.56.0-alpha-2025-09-14",
4
4
  "description": "A high-level API to automate web browsers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -64,7 +64,7 @@
64
64
  },
65
65
  "license": "Apache-2.0",
66
66
  "dependencies": {
67
- "playwright-core": "1.56.0-alpha-2025-09-12"
67
+ "playwright-core": "1.56.0-alpha-2025-09-14"
68
68
  },
69
69
  "optionalDependencies": {
70
70
  "fsevents": "2.3.2"