playwright 1.56.0-alpha-2025-09-15 → 1.56.0-alpha-1758061937000
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.
|
@@ -139,6 +139,8 @@ function configFromCLIOptions(cliOptions) {
|
|
|
139
139
|
contextOptions.ignoreHTTPSErrors = true;
|
|
140
140
|
if (cliOptions.blockServiceWorkers)
|
|
141
141
|
contextOptions.serviceWorkers = "block";
|
|
142
|
+
if (cliOptions.grantPermissions)
|
|
143
|
+
contextOptions.permissions = cliOptions.grantPermissions;
|
|
142
144
|
const result = {
|
|
143
145
|
browser: {
|
|
144
146
|
browserName,
|
|
@@ -182,6 +184,7 @@ function configFromEnv() {
|
|
|
182
184
|
options.config = envToString(process.env.PLAYWRIGHT_MCP_CONFIG);
|
|
183
185
|
options.device = envToString(process.env.PLAYWRIGHT_MCP_DEVICE);
|
|
184
186
|
options.executablePath = envToString(process.env.PLAYWRIGHT_MCP_EXECUTABLE_PATH);
|
|
187
|
+
options.grantPermissions = commaSeparatedList(process.env.PLAYWRIGHT_MCP_GRANT_PERMISSIONS);
|
|
185
188
|
options.headless = envToBoolean(process.env.PLAYWRIGHT_MCP_HEADLESS);
|
|
186
189
|
options.host = envToString(process.env.PLAYWRIGHT_MCP_HOST);
|
|
187
190
|
options.ignoreHttpsErrors = envToBoolean(process.env.PLAYWRIGHT_MCP_IGNORE_HTTPS_ERRORS);
|
package/lib/mcp/program.js
CHANGED
|
@@ -41,7 +41,7 @@ var import_browserServerBackend = require("./browser/browserServerBackend");
|
|
|
41
41
|
var import_extensionContextFactory = require("./extension/extensionContextFactory");
|
|
42
42
|
var import_host = require("./vscode/host");
|
|
43
43
|
function decorateCommand(command, version) {
|
|
44
|
-
command.option("--allowed-origins <origins>", "semicolon-separated list of origins to allow the browser to request. Default is to allow all.", import_config.semicolonSeparatedList).option("--blocked-origins <origins>", "semicolon-separated list of origins to block the browser from requesting. Blocklist is evaluated before allowlist. If used without the allowlist, requests not matching the blocklist are still allowed.", import_config.semicolonSeparatedList).option("--block-service-workers", "block service workers").option("--browser <browser>", "browser or chrome channel to use, possible values: chrome, firefox, webkit, msedge.").option("--caps <caps>", "comma-separated list of additional capabilities to enable, possible values: vision, pdf.", import_config.commaSeparatedList).option("--cdp-endpoint <endpoint>", "CDP endpoint to connect to.").option("--cdp-header <headers...>", "CDP headers to send with the connect request, multiple can be specified.", import_config.headerParser).option("--config <path>", "path to the configuration file.").option("--device <device>", 'device to emulate, for example: "iPhone 15"').option("--executable-path <path>", "path to the browser executable.").option("--extension", 'Connect to a running browser instance (Edge/Chrome only). Requires the "Playwright MCP Bridge" browser extension to be installed.').option("--headless", "run browser in headless mode, headed by default").option("--host <host>", "host to bind server to. Default is localhost. Use 0.0.0.0 to bind to all interfaces.").option("--ignore-https-errors", "ignore https errors").option("--isolated", "keep the browser profile in memory, do not save it to disk.").option("--image-responses <mode>", 'whether to send image responses to the client. Can be "allow" or "omit", Defaults to "allow".').option("--no-sandbox", "disable the sandbox for all process types that are normally sandboxed.").option("--output-dir <path>", "path to the directory for output files.").option("--port <port>", "port to listen on for SSE transport.").option("--proxy-bypass <bypass>", 'comma-separated domains to bypass proxy, for example ".com,chromium.org,.domain.com"').option("--proxy-server <proxy>", 'specify proxy server, for example "http://myproxy:3128" or "socks5://myproxy:8080"').option("--save-session", "Whether to save the Playwright MCP session into the output directory.").option("--save-trace", "Whether to save the Playwright Trace of the session into the output directory.").option("--secrets <path>", "path to a file containing secrets in the dotenv format", import_config.dotenvFileLoader).option("--storage-state <path>", "path to the storage state file for isolated sessions.").option("--timeout-action <timeout>", "specify action timeout in milliseconds, defaults to 5000ms", import_config.numberParser).option("--timeout-navigation <timeout>", "specify navigation timeout in milliseconds, defaults to 60000ms", import_config.numberParser).option("--user-agent <ua string>", "specify user agent string").option("--user-data-dir <path>", "path to the user data directory. If not specified, a temporary directory will be created.").option("--viewport-size <size>", 'specify browser viewport size in pixels, for example "1280, 720"').addOption(new import_utilsBundle.ProgramOption("--connect-tool", "Allow to switch between different browser connection methods.").hideHelp()).addOption(new import_utilsBundle.ProgramOption("--vscode", "VS Code tools.").hideHelp()).addOption(new import_utilsBundle.ProgramOption("--vision", "Legacy option, use --caps=vision instead").hideHelp()).action(async (options) => {
|
|
44
|
+
command.option("--allowed-origins <origins>", "semicolon-separated list of origins to allow the browser to request. Default is to allow all.", import_config.semicolonSeparatedList).option("--blocked-origins <origins>", "semicolon-separated list of origins to block the browser from requesting. Blocklist is evaluated before allowlist. If used without the allowlist, requests not matching the blocklist are still allowed.", import_config.semicolonSeparatedList).option("--block-service-workers", "block service workers").option("--browser <browser>", "browser or chrome channel to use, possible values: chrome, firefox, webkit, msedge.").option("--caps <caps>", "comma-separated list of additional capabilities to enable, possible values: vision, pdf.", import_config.commaSeparatedList).option("--cdp-endpoint <endpoint>", "CDP endpoint to connect to.").option("--cdp-header <headers...>", "CDP headers to send with the connect request, multiple can be specified.", import_config.headerParser).option("--config <path>", "path to the configuration file.").option("--device <device>", 'device to emulate, for example: "iPhone 15"').option("--executable-path <path>", "path to the browser executable.").option("--extension", 'Connect to a running browser instance (Edge/Chrome only). Requires the "Playwright MCP Bridge" browser extension to be installed.').option("--grant-permissions <permissions...>", 'List of permissions to grant to the browser context, for example "geolocation", "clipboard-read", "clipboard-write".', import_config.commaSeparatedList).option("--headless", "run browser in headless mode, headed by default").option("--host <host>", "host to bind server to. Default is localhost. Use 0.0.0.0 to bind to all interfaces.").option("--ignore-https-errors", "ignore https errors").option("--isolated", "keep the browser profile in memory, do not save it to disk.").option("--image-responses <mode>", 'whether to send image responses to the client. Can be "allow" or "omit", Defaults to "allow".').option("--no-sandbox", "disable the sandbox for all process types that are normally sandboxed.").option("--output-dir <path>", "path to the directory for output files.").option("--port <port>", "port to listen on for SSE transport.").option("--proxy-bypass <bypass>", 'comma-separated domains to bypass proxy, for example ".com,chromium.org,.domain.com"').option("--proxy-server <proxy>", 'specify proxy server, for example "http://myproxy:3128" or "socks5://myproxy:8080"').option("--save-session", "Whether to save the Playwright MCP session into the output directory.").option("--save-trace", "Whether to save the Playwright Trace of the session into the output directory.").option("--secrets <path>", "path to a file containing secrets in the dotenv format", import_config.dotenvFileLoader).option("--storage-state <path>", "path to the storage state file for isolated sessions.").option("--timeout-action <timeout>", "specify action timeout in milliseconds, defaults to 5000ms", import_config.numberParser).option("--timeout-navigation <timeout>", "specify navigation timeout in milliseconds, defaults to 60000ms", import_config.numberParser).option("--user-agent <ua string>", "specify user agent string").option("--user-data-dir <path>", "path to the user data directory. If not specified, a temporary directory will be created.").option("--viewport-size <size>", 'specify browser viewport size in pixels, for example "1280, 720"').addOption(new import_utilsBundle.ProgramOption("--connect-tool", "Allow to switch between different browser connection methods.").hideHelp()).addOption(new import_utilsBundle.ProgramOption("--vscode", "VS Code tools.").hideHelp()).addOption(new import_utilsBundle.ProgramOption("--vision", "Legacy option, use --caps=vision instead").hideHelp()).action(async (options) => {
|
|
45
45
|
(0, import_watchdog.setupExitWatchdog)();
|
|
46
46
|
if (options.vision) {
|
|
47
47
|
console.error("The --vision option is deprecated, use --caps=vision instead");
|
|
@@ -144,7 +144,10 @@ const setupPage = (0, import_testTool.defineTestTool)({
|
|
|
144
144
|
let testLocation = params.testLocation;
|
|
145
145
|
if (!testLocation) {
|
|
146
146
|
testLocation = ".template.spec.ts";
|
|
147
|
-
const
|
|
147
|
+
const config = await testRunner.loadConfig();
|
|
148
|
+
const project = params.project ? config.projects.find((p) => p.project.name === params.project) : config.projects[0];
|
|
149
|
+
const testDir = project?.project.testDir || configDir;
|
|
150
|
+
const templateFile = import_path.default.join(testDir, testLocation);
|
|
148
151
|
if (!import_fs.default.existsSync(templateFile)) {
|
|
149
152
|
await import_fs.default.promises.writeFile(templateFile, `
|
|
150
153
|
import { test, expect } from '@playwright/test';
|
package/lib/runner/testRunner.js
CHANGED
|
@@ -95,6 +95,12 @@ class TestRunner extends import_events.default {
|
|
|
95
95
|
const executables = import_server.registry.defaultExecutables();
|
|
96
96
|
await import_server.registry.install(executables, false);
|
|
97
97
|
}
|
|
98
|
+
async loadConfig() {
|
|
99
|
+
const { config, error } = await this._loadConfig(this._configCLIOverrides);
|
|
100
|
+
if (config)
|
|
101
|
+
return config;
|
|
102
|
+
throw new Error("Failed to load config: " + (error ? error.message : "Unknown error"));
|
|
103
|
+
}
|
|
98
104
|
async runGlobalSetup(userReporters) {
|
|
99
105
|
await this.runGlobalTeardown();
|
|
100
106
|
const reporter = new import_internalReporter.InternalReporter(userReporters);
|
|
@@ -96,6 +96,8 @@ class Fixture {
|
|
|
96
96
|
this._selfTeardownComplete = (async () => {
|
|
97
97
|
try {
|
|
98
98
|
await this.registration.fn(params, useFunc, info);
|
|
99
|
+
if (!useFuncStarted.isDone())
|
|
100
|
+
throw new Error(`use() was not called in fixture "${this.registration.name}"`);
|
|
99
101
|
} catch (error) {
|
|
100
102
|
this.failed = true;
|
|
101
103
|
if (!useFuncStarted.isDone())
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "playwright",
|
|
3
|
-
"version": "1.56.0-alpha-
|
|
3
|
+
"version": "1.56.0-alpha-1758061937000",
|
|
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-
|
|
67
|
+
"playwright-core": "1.56.0-alpha-1758061937000"
|
|
68
68
|
},
|
|
69
69
|
"optionalDependencies": {
|
|
70
70
|
"fsevents": "2.3.2"
|
package/types/test.d.ts
CHANGED
|
@@ -1388,8 +1388,8 @@ interface TestConfig<TestArgs = {}, WorkerArgs = {}> {
|
|
|
1388
1388
|
maxFailures?: number;
|
|
1389
1389
|
|
|
1390
1390
|
/**
|
|
1391
|
-
* Metadata contains key-value pairs to be included in the report. For example,
|
|
1392
|
-
*
|
|
1391
|
+
* Metadata contains key-value pairs to be included in the report. For example, the JSON report will include metadata
|
|
1392
|
+
* serialized as JSON.
|
|
1393
1393
|
*
|
|
1394
1394
|
* **Usage**
|
|
1395
1395
|
*
|
|
@@ -1852,7 +1852,7 @@ interface TestConfig<TestArgs = {}, WorkerArgs = {}> {
|
|
|
1852
1852
|
* Whether to update expected snapshots with the actual results produced by the test run. Defaults to `'missing'`.
|
|
1853
1853
|
* - `'all'` - All tests that are executed will update snapshots.
|
|
1854
1854
|
* - `'changed'` - All tests that are executed will update snapshots that did not match. Matching snapshots will not
|
|
1855
|
-
* be updated.
|
|
1855
|
+
* be updated. Also creates missing snapshots.
|
|
1856
1856
|
* - `'missing'` - Missing snapshots are created, for example when authoring a new test and running it for the first
|
|
1857
1857
|
* time. This is the default.
|
|
1858
1858
|
* - `'none'` - No snapshots are updated.
|