Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

feat(mcp): do not include successful static resources by default (#38440)

Pavel Feldman205f436df650
diff --git a/package.json b/package.json
index d16ed039ee..7136a01bb3 100644
--- a/package.json
+++ b/package.json
@@ -30,7 +30,7 @@
"test": "playwright test --config=tests/library/playwright.config.ts",
"test-mcp": "playwright test --config=tests/mcp/playwright.config.ts",
"ctest-mcp": "playwright test --config=tests/mcp/playwright.config.ts --project=chrome",
- "eval-mcp": "playwright test --config=tests/mcp/playwright.config.ts --project=eval",
+ "etest-mcp": "playwright test --config=tests/mcp/playwright.config.ts --project=eval",
"eslint": "eslint --cache",
"tsc": "tsc -p . && tsc -p packages/html-reporter/",
"doc": "node utils/doclint/cli.js",
diff --git a/packages/playwright/src/mcp/browser/tools/network.ts b/packages/playwright/src/mcp/browser/tools/network.ts
index 09c955789c..13e5fb3a5e 100644
--- a/packages/playwright/src/mcp/browser/tools/network.ts
+++ b/packages/playwright/src/mcp/browser/tools/network.ts
@@ -27,26 +27,34 @@ const requests = defineTabTool({
name: 'browser_network_requests',
title: 'List network requests',
description: 'Returns all network requests since loading the page',
- inputSchema: z.object({}),
+ inputSchema: z.object({
+ includeStatic: z.boolean().default(false).describe('Whether to include successful static resources like images, fonts, scripts, etc. Defaults to false.'),
+ }),
type: 'readOnly',
},
handle: async (tab, params, response) => {
const requests = await tab.requests();
- for (const request of requests)
- response.addResult(await renderRequest(request));
+ for (const request of requests) {
+ const rendered = await renderRequest(request, params.includeStatic);
+ if (rendered)
+ response.addResult(rendered);
+ }
},
});
-async function renderRequest(request: playwright.Request) {
+async function renderRequest(request: playwright.Request, includeStatic: boolean): Promise<string | undefined> {
+ const response = (request as Request)._hasResponse ? await request.response() : undefined;
+ const isStaticRequest = ['document', 'stylesheet', 'image', 'media', 'font', 'script', 'manifest'].includes(request.resourceType());
+ const isSuccessfulRequest = !response || response.status() < 400;
+
+ if (isStaticRequest && isSuccessfulRequest && !includeStatic)
+ return undefined;
+
const result: string[] = [];
result.push(`[${request.method().toUpperCase()}] ${request.url()}`);
- const hasResponse = (request as Request)._hasResponse;
- if (hasResponse) {
- const response = await request.response();
- if (response)
- result.push(`=> [${response.status()}] ${response.statusText()}`);
- }
+ if (response)
+ result.push(`=> [${response.status()}] ${response.statusText()}`);
return result.join(' ');
}
diff --git a/tests/mcp/__cache__/copilot/mcp-browser-eval-fill-the-form-repeat0.json b/tests/mcp/__cache__/copilot/mcp-browser-eval-fill-the-form-repeat0.json
index 69e8c7ef74..4634c34ee1 100644
--- a/tests/mcp/__cache__/copilot/mcp-browser-eval-fill-the-form-repeat0.json
+++ b/tests/mcp/__cache__/copilot/mcp-browser-eval-fill-the-form-repeat0.json
@@ -1,73 +1,66 @@
{
- "1f67d34de9dca04e9ec4d9d7b590b48b6e67fd08": {
+ "3ead929e37fa1cb83a37e09ee827c20293652543": {
"result": {
"role": "assistant",
"content": [
{
"type": "text",
- "text": "I'll help you navigate to the form, fill it out with the specified details, and report back the pricing and delivery information."
+ "text": "I'll help you navigate to the form, fill it out to order a blue table and green desk, and report back the results."
}
]
},
"usage": {
- "input": 4429,
- "output": 120
+ "input": 4471,
+ "output": 116
}
},
- "4498c58367500860e392c029b7f90d23ca898b50": {
+ "3219899a2bc56b57af31754f9ca6180f988cf2fe": {
"result": {
"role": "assistant",
"content": [
{
"type": "text",
- "text": "Navigate to the form page to start the ordering process",
- "copilotToolCallId": "toolu_vrtx_0129qd3zaawZfjyTyiNQ8dbY"
- },
- {
- "type": "tool_call",
- "name": "browser_navigate",
- "arguments": {
- "url": "http://localhost:<PORT>/evals/fill-form.html"
- },
- "id": "toolu_vrtx_0129qd3zaawZfjyTyiNQ8dbY"
+ "text": "I'll start by navigating to the form and then proceed with filling it out."
}
]
},
"usage": {
- "input": 4486,
- "output": 93
+ "input": 4529,
+ "output": 107
}
},
- "1f4cb362bd2e2d63916d74077a8cd478a0f0b1a5": {
+ "c331f7d028fdc2c008445aeccf1381511958c1ec": {
"result": {
"role": "assistant",
"content": [
{
"type": "text",
- "text": "Get current page state to identify form fields for the first item (blue table)",
- "copilotToolCallId": "toolu_vrtx_01Sqo3h7zZGVZYkVDWBrmhfg"
+ "text": "Navigate to the form page",
+ "copilotToolCallId": "toolu_vrtx_01F7ZmAjLNmvezxFfGNeXacs"
},
{
"type": "tool_call",
- "name": "browser_snapshot",
- "arguments": {},
- "id": "toolu_vrtx_01Sqo3h7zZGVZYkVDWBrmhfg"
+ "name": "browser_navigate",
+ "arguments": {
+ "url": "http://localhost:<PORT>/evals/fill-form.html"
+ },
+ "id": "toolu_vrtx_01F7ZmAjLNmvezxFfGNeXacs"
}
]
},
"usage": {
- "input": 5200,
- "output": 67
+ "input": 4577,
+ "output": 88
}
},
- "54801f22b272e5a430fd56cc07ab4b11d87c6514": {
+ "bc220b4e13c6dc33750280791d7e129da176ae08": {
"result": {
"role": "assistant",
"content": [
{
"type": "text",
- "text": "Select Table as the product type for the first order",
- "copilotToolCallId": "toolu_vrtx_01KZtfPrpLh9Pg7D8hzZwfw5"
+ "text": "Select Table as the first product",
+ "copilotToolCallId": "toolu_vrtx_018Nhst3Sa7BQMD21R1W5eAv"
},
{
"type": "tool_call",
@@ -79,23 +72,23 @@
"Table"
]
},
- "id": "toolu_vrtx_01KZtfPrpLh9Pg7D8hzZwfw5"
+ "id": "toolu_vrtx_018Nhst3Sa7BQMD21R1W5eAv"
}
]
},
"usage": {
- "input": 5858,
- "output": 120
+ "input": 5286,
+ "output": 116
}
},
- "8585f97b99c7165ca864db490da286f768b8b883": {
+ "aa16e56b7dbe11331771f4b202462a761adcb0d6": {
"result": {
"role": "assistant",
"content": [
{
"type": "text",
"text": "Select Blue as the color for the table",
- "copilotToolCallId": "toolu_vrtx_01XGcSSgUwBCcgqLu11QqxRQ"
+ "copilotToolCallId": "toolu_vrtx_01Gk4qurt6wv2p5TXw2rfyk8"
},
{
"type": "tool_call",
@@ -107,23 +100,23 @@
"Blue"
]
},
- "id": "toolu_vrtx_01XGcSSgUwBCcgqLu11QqxRQ"
+ "id": "toolu_vrtx_01Gk4qurt6wv2p5TXw2rfyk8"
}
]
},
"usage": {
- "input": 6125,
+ "input": 5549,
"output": 117
}
},
- "d78aa88a096ad38aea37e1b0b73aefd529845ab8": {
+ "19053de781776232ada37a39b113987cdfacdf41": {
"result": {
"role": "assistant",
"content": [
{
"type": "text",
- "text": "Fill in customer information for the order",
- "copilotToolCallId": "toolu_vrtx_01Vk16c9EpV35aGtSjn2J6Pk"
+ "text": "Fill in the customer details for the first order",
+ "copilotToolCallId": "toolu_vrtx_01N527bhb1DzBQAs532f4WQJ"
},
{
"type": "tool_call",
@@ -158,7 +151,7 @@
"name": "State/Province",
"type": "textbox",
"ref": "e25",
- "value": "XYZ"
+ "value": "XYZ state"
},
{
"name": "ZIP/Postal Code",
@@ -168,23 +161,23 @@
}
]
},
- "id": "toolu_vrtx_01Vk16c9EpV35aGtSjn2J6Pk"
+ "id": "toolu_vrtx_01N527bhb1DzBQAs532f4WQJ"
}
]
},
"usage": {
- "input": 6391,
- "output": 343
+ "input": 5815,
+ "output": 274
}
},
- "1380ec99c1a8290d52dd9d4bb008bc5add1efb54": {
+ "d5ac4e87e2af7f0f6e80eabefb485dbe45c9921d": {
"result": {
"role": "assistant",
"content": [
{
"type": "text",
- "text": "Submit the order for the blue table",
- "copilotToolCallId": "toolu_vrtx_011CLYRgGn3zonGBT97Wxr4r"
+ "text": "Submit the first order for blue table",
+ "copilotToolCallId": "toolu_vrtx_01NQqfZy2VZXGhaFASZqBcaF"
},
{
"type": "tool_call",
@@ -193,23 +186,23 @@
"element": "Order button",
"ref": "e29"
},
- "id": "toolu_vrtx_011CLYRgGn3zonGBT97Wxr4r"
+ "id": "toolu_vrtx_01NQqfZy2VZXGhaFASZqBcaF"
}
]
},
"usage": {
- "input": 6840,
+ "input": 6268,
"output": 95
}
},
- "6ae203915486aa37b263ad3ad8af6af4a0c9e9f6": {
+ "4e2825b7b8d7ec20c52b14540dae9e12dcdfd743": {
"result": {
"role": "assistant",
"content": [
{
"type": "text",
- "text": "Accept the confirmation dialog for the blue table order",
- "copilotToolCallId": "toolu_vrtx_01BVGW6UrHvCKQ7v5xNPv1xv"
+ "text": "Accept the confirmation dialog for blue table",
+ "copilotToolCallId": "toolu_vrtx_013gcm6ax8g2JWKssZfL3Sog"
},
{
"type": "tool_call",
@@ -217,23 +210,23 @@
"arguments": {
"accept": true
},
- "id": "toolu_vrtx_01BVGW6UrHvCKQ7v5xNPv1xv"
+ "id": "toolu_vrtx_013gcm6ax8g2JWKssZfL3Sog"
}
]
},
"usage": {
- "input": 7010,
- "output": 80
+ "input": 6438,
+ "output": 78
}
},
- "9ec58f784b989e7cbbbde0656d22e6be1c5075dd": {
+ "8bfe6aa2bdaaedcef7a1c73f4d420d55e6c292d0": {
"result": {
"role": "assistant",
"content": [
{
"type": "text",
- "text": "Click the button to place another order for the green desk",
- "copilotToolCallId": "toolu_vrtx_016rQY2JhLzVu3TpokRVqdor"
+ "text": "Click to place another order for the green desk",
+ "copilotToolCallId": "toolu_vrtx_01HRHawjDCbqqVhW7PcxmY3r"
},
{
"type": "tool_call",
@@ -242,23 +235,23 @@
"element": "Place Another Order button",
"ref": "e58"
},
- "id": "toolu_vrtx_016rQY2JhLzVu3TpokRVqdor"
+ "id": "toolu_vrtx_01HRHawjDCbqqVhW7PcxmY3r"
}
]
},
"usage": {
- "input": 7897,
- "output": 101
+ "input": 7326,
+ "output": 99
}
},
- "83a5695faf3e865ff1654007db08a088bc2b9412": {
+ "012fc6fa5f4a194ce969dbdece4f32835bbd5f3f": {
"result": {
"role": "assistant",
"content": [
{
"type": "text",
- "text": "Select Desk as the product type for the second order",
- "copilotToolCallId": "toolu_vrtx_01WnDXifmCJWtEMduSaUjHU8"
+ "text": "Select Desk for the second product",
+ "copilotToolCallId": "toolu_vrtx_01YHy8qDmTAnrffRhxo8uneD"
},
{
"type": "tool_call",
@@ -270,23 +263,23 @@
"Desk"
]
},
- "id": "toolu_vrtx_01WnDXifmCJWtEMduSaUjHU8"
+ "id": "toolu_vrtx_01YHy8qDmTAnrffRhxo8uneD"
}
]
},
"usage": {
- "input": 8618,
- "output": 122
+ "input": 8045,
+ "output": 118
}
},
- "117e2c52b10e5288047ef65ac10a59c9e2275674": {
+ "d5ee9fb0a787ecd5ee180fd181e4a3d5fb6a68f2": {
"result": {
"role": "assistant",
"content": [
{
"type": "text",
"text": "Select Green as the color for the desk",
- "copilotToolCallId": "toolu_vrtx_01462K6LBMFTWaVWPmegByzb"
+ "copilotToolCallId": "toolu_vrtx_016tGB5BYqmwKAxhynpyMmdm"
},
{
"type": "tool_call",
@@ -298,23 +291,23 @@
"Green"
]
},
- "id": "toolu_vrtx_01462K6LBMFTWaVWPmegByzb"
+ "id": "toolu_vrtx_016tGB5BYqmwKAxhynpyMmdm"
}
]
},
"usage": {
- "input": 8888,
+ "input": 8311,
"output": 117
}
},
- "ad76fc7dda0725834872ca9b8f4395722197026a": {
+ "440ee34411e291b4dbe9617db95c196eace37f1e": {
"result": {
"role": "assistant",
"content": [
{
"type": "text",
- "text": "Fill in customer information for the second order",
- "copilotToolCallId": "toolu_vrtx_01Bonk7ZwhuGS7yc67tAqJMd"
+ "text": "Fill in the customer details for the second order",
+ "copilotToolCallId": "toolu_vrtx_01Af37pxR5WzUMaws88V3sa2"
},
{
"type": "tool_call",
@@ -349,7 +342,7 @@
"name": "State/Province",
"ref": "e25",
"type": "textbox",
- "value": "XYZ"
+ "value": "XYZ state"
},
{
"name": "ZIP/Postal Code",
@@ -359,23 +352,23 @@
}
]
},
- "id": "toolu_vrtx_01Bonk7ZwhuGS7yc67tAqJMd"
+ "id": "toolu_vrtx_01Af37pxR5WzUMaws88V3sa2"
}
]
},
"usage": {
- "input": 9154,
- "output": 264
+ "input": 8577,
+ "output": 266
}
},
- "2dd639bc23dfba249c89bacb6f09a6219538a99d": {
+ "81089209173d7b018430ef6887a408fcb2e24e84": {
"result": {
"role": "assistant",
"content": [
{
"type": "text",
- "text": "Submit the order for the green desk",
- "copilotToolCallId": "toolu_vrtx_01B3Hfa3jbKn1278dRq9izUB"
+ "text": "Submit the second order for green desk",
+ "copilotToolCallId": "toolu_vrtx_01JqdAnXaitbPWsyUAP4KuzW"
},
{
"type": "tool_call",
@@ -384,23 +377,23 @@
"element": "Order button",
"ref": "e29"
},
- "id": "toolu_vrtx_01B3Hfa3jbKn1278dRq9izUB"
+ "id": "toolu_vrtx_01JqdAnXaitbPWsyUAP4KuzW"
}
]
},
"usage": {
- "input": 9604,
+ "input": 9030,
"output": 95
}
},
- "df594f27d4f66356f38861d693b8f14a66ef0af4": {
+ "74c9b7b48c20ea2d1385fba336bb20d392637d6c": {
"result": {
"role": "assistant",
"content": [
{
"type": "text",
- "text": "Accept the confirmation dialog for the green desk order",
- "copilotToolCallId": "toolu_vrtx_01HPLerVExZZZ15M7UeJsh3X"
+ "text": "Accept the confirmation dialog for green desk",
+ "copilotToolCallId": "toolu_vrtx_01UHoxYquxpfX4meEBSstWZh"
},
{
"type": "tool_call",
@@ -408,23 +401,23 @@
"arguments": {
"accept": true
},
- "id": "toolu_vrtx_01HPLerVExZZZ15M7UeJsh3X"
+ "id": "toolu_vrtx_01UHoxYquxpfX4meEBSstWZh"
}
]
},
"usage": {
- "input": 9774,
- "output": 80
+ "input": 9200,
+ "output": 78
}
},
- "a6b8bcc69f1ddb715921d1814326fea5e5a96f22": {
+ "90563878bf810e2606705227663679163b7359b0": {
"result": {
"role": "assistant",
"content": [
{
"type": "text",
- "text": "Report the total price and maximum delivery time for both orders - blue table ($353.98) and green desk ($299.98)",
- "copilotToolCallId": "toolu_vrtx_019b25HJgtNdXAz3QjmCnHYw"
+ "text": "Report the combined total price and maximum delivery time for both orders",
+ "copilotToolCallId": "toolu_vrtx_01La4TqsDPCAXcofLq5LApTh"
},
{
"type": "tool_call",
@@ -433,13 +426,13 @@
"price": 653.96,
"deliveryDays": 3
},
- "id": "toolu_vrtx_019b25HJgtNdXAz3QjmCnHYw"
+ "id": "toolu_vrtx_01La4TqsDPCAXcofLq5LApTh"
}
]
},
"usage": {
- "input": 10662,
- "output": 117
+ "input": 10089,
+ "output": 103
}
}
}
\ No newline at end of file
diff --git a/tests/mcp/__cache__/copilot/mcp-browser-eval-fill-the-form-repeat1.json b/tests/mcp/__cache__/copilot/mcp-browser-eval-fill-the-form-repeat1.json
index 67864d8c09..cf0083d92d 100644
--- a/tests/mcp/__cache__/copilot/mcp-browser-eval-fill-the-form-repeat1.json
+++ b/tests/mcp/__cache__/copilot/mcp-browser-eval-fill-the-form-repeat1.json
@@ -1,27 +1,27 @@
{
- "1f67d34de9dca04e9ec4d9d7b590b48b6e67fd08": {
+ "3ead929e37fa1cb83a37e09ee827c20293652543": {
"result": {
"role": "assistant",
"content": [
{
"type": "text",
- "text": "I'll help you navigate to the form, fill it out, and order the items. Let me start by navigating to the URL and taking a snapshot to see the page structure."
+ "text": "I'll help you navigate to the form, fill it out with the specified details, and report back the price and delivery information."
}
]
},
"usage": {
- "input": 4429,
- "output": 131
+ "input": 4471,
+ "output": 115
}
},
- "eb602996f263d0f29d50e40769506f6f47394046": {
+ "b863793e2b65f06307dd0e7f06d79c720ddf6518": {
"result": {
"role": "assistant",
"content": [
{
"type": "text",
- "text": "Navigate to the form page",
- "copilotToolCallId": "toolu_vrtx_016zERgz28Qc3mWdBLi5V2Xp"
+ "text": "Navigate to the form page to start the task",
+ "copilotToolCallId": "toolu_vrtx_01EtHjyUbs5JU6AqdzHh3k44"
},
{
"type": "tool_call",
@@ -29,23 +29,23 @@
"arguments": {
"url": "http://localhost:<PORT>/evals/fill-form.html"
},
- "id": "toolu_vrtx_016zERgz28Qc3mWdBLi5V2Xp"
+ "id": "toolu_vrtx_01EtHjyUbs5JU6AqdzHh3k44"
}
]
},
"usage": {
- "input": 4497,
- "output": 88
+ "input": 4528,
+ "output": 92
}
},
- "ae111fb9371c47d04762f81458d5557be0ca760c": {
+ "874e465379d3c65b5c2be0a270730c1242c1dbde": {
"result": {
"role": "assistant",
"content": [
{
"type": "text",
"text": "Select Table as the first product",
- "copilotToolCallId": "toolu_vrtx_017WjVw9bpcfDw5892VkuT76"
+ "copilotToolCallId": "toolu_vrtx_012DUPssGjyvzP2i8Ga7e4LV"
},
{
"type": "tool_call",
@@ -57,23 +57,23 @@
"Table"
]
},
- "id": "toolu_vrtx_017WjVw9bpcfDw5892VkuT76"
+ "id": "toolu_vrtx_012DUPssGjyvzP2i8Ga7e4LV"
}
]
},
"usage": {
- "input": 5206,
+ "input": 5241,
"output": 116
}
},
- "08407b7115ec34eea2a164355fe32b570e965d41": {
+ "2b5eec7b6cf93f318562e07f971ac93aaf177fed": {
"result": {
"role": "assistant",
"content": [
{
"type": "text",
- "text": "Select Blue as the color for the table",
- "copilotToolCallId": "toolu_vrtx_01S7UqYcgtqNzZS4zrHwWHpu"
+ "text": "Select Blue color for the table",
+ "copilotToolCallId": "toolu_vrtx_017NBjQL34v9FM1xUPp8mxYw"
},
{
"type": "tool_call",
@@ -85,23 +85,23 @@
"Blue"
]
},
- "id": "toolu_vrtx_01S7UqYcgtqNzZS4zrHwWHpu"
+ "id": "toolu_vrtx_017NBjQL34v9FM1xUPp8mxYw"
}
]
},
"usage": {
- "input": 5469,
- "output": 117
+ "input": 5504,
+ "output": 115
}
},
- "ebcd1168f56b45b7402e8af39ab3532456911205": {
+ "495aa09d1f5a15bd7d5ea2a13fc8e536a8553d8e": {
"result": {
"role": "assistant",
"content": [
{
"type": "text",
- "text": "Fill in all the required customer information fields",
- "copilotToolCallId": "toolu_vrtx_011f5gY6a6DjTX4w5Ddzdeeh"
+ "text": "Fill in all the customer information fields",
+ "copilotToolCallId": "toolu_vrtx_01E2kVwYUZy4tYqUYc7CBku2"
},
{
"type": "tool_call",
@@ -146,23 +146,23 @@
}
]
},
- "id": "toolu_vrtx_011f5gY6a6DjTX4w5Ddzdeeh"
+ "id": "toolu_vrtx_01E2kVwYUZy4tYqUYc7CBku2"
}
]
},
"usage": {
- "input": 5735,
- "output": 345
+ "input": 5768,
+ "output": 344
}
},
- "a56bfd7a019d224004464dbe721e3cc0038886d6": {
+ "dcd381e74fa1687308551cdad91683e7b1b498ee": {
"result": {
"role": "assistant",
"content": [
{
"type": "text",
"text": "Click the Order button to submit the first item (blue table)",
- "copilotToolCallId": "toolu_vrtx_013SEMdk1Hq4L5Co41uVazFk"
+ "copilotToolCallId": "toolu_vrtx_014nFz1pRcwFfs5vv4SjJhYL"
},
{
"type": "tool_call",
@@ -171,23 +171,23 @@
"element": "Order button",
"ref": "e29"
},
- "id": "toolu_vrtx_013SEMdk1Hq4L5Co41uVazFk"
+ "id": "toolu_vrtx_014nFz1pRcwFfs5vv4SjJhYL"
}
]
},
"usage": {
- "input": 6187,
+ "input": 6219,
"output": 100
}
},
- "a238d85438b602deb2f96c474f8da1ba4829aba8": {
+ "19664a3e596c10157b109c88f2d66e4cb13cc5db": {
"result": {
"role": "assistant",
"content": [
{
"type": "text",
"text": "Accept the confirmation dialog for the blue table order",
- "copilotToolCallId": "toolu_vrtx_018RwPsNMBXzSZ57LVQqCxrQ"
+ "copilotToolCallId": "toolu_vrtx_01NvPAjDPFV9kCUb4e34YMPV"
},
{
"type": "tool_call",
@@ -195,23 +195,23 @@
"arguments": {
"accept": true
},
- "id": "toolu_vrtx_018RwPsNMBXzSZ57LVQqCxrQ"
+ "id": "toolu_vrtx_01NvPAjDPFV9kCUb4e34YMPV"
}
]
},
"usage": {
- "input": 6362,
+ "input": 6394,
"output": 80
}
},
- "e0b33dfe71582534d7ce4b55c37d7c649f42584a": {
+ "91a65f3c9adf4ecc0f2541db1da36e61844a3200": {
"result": {
"role": "assistant",
"content": [
{
"type": "text",
- "text": "Click to place another order for the green desk",
- "copilotToolCallId": "toolu_vrtx_018NyzMBhTPq4LisBkd4sQ4H"
+ "text": "Click Place Another Order to order the second item (green desk)",
+ "copilotToolCallId": "toolu_vrtx_01Ko8Nf61uLZmXBLU7usYUup"
},
{
"type": "tool_call",
@@ -220,23 +220,23 @@
"element": "Place Another Order button",
"ref": "e58"
},
- "id": "toolu_vrtx_018NyzMBhTPq4LisBkd4sQ4H"
+ "id": "toolu_vrtx_01Ko8Nf61uLZmXBLU7usYUup"
}
]
},
"usage": {
- "input": 7252,
- "output": 99
+ "input": 7284,
+ "output": 102
}
},
- "cc3f1e930399f534ab8b20c7eb2835c64fba1734": {
+ "5f0e607d8750e68007f731bdd9c82d1e73c3b8ff": {
"result": {
"role": "assistant",
"content": [
{
"type": "text",
"text": "Select Desk as the second product",
- "copilotToolCallId": "toolu_vrtx_01Ltk3N21eQvg1KbBhmPRpFp"
+ "copilotToolCallId": "toolu_vrtx_01Mci1LUTixN6P6X7jM5AXqi"
},
{
"type": "tool_call",
@@ -248,23 +248,23 @@
"Desk"
]
},
- "id": "toolu_vrtx_01Ltk3N21eQvg1KbBhmPRpFp"
+ "id": "toolu_vrtx_01Mci1LUTixN6P6X7jM5AXqi"
}
]
},
"usage": {
- "input": 7971,
+ "input": 8006,
"output": 118
}
},
- "ab6e810564774b9fe4f7c834a4929ec7b7083836": {
+ "d4e8a88c5cd3e8c102920f0fd9b17f9fd932bf4d": {
"result": {
"role": "assistant",
"content": [
{
"type": "text",
- "text": "Select Green as the color for the desk",
- "copilotToolCallId": "toolu_vrtx_0176CAudgGEug4v6LMeDiGvm"
+ "text": "Select Green color for the desk",
+ "copilotToolCallId": "toolu_vrtx_018NKZFMWDtMrud3cxqcx7nu"
},
{
"type": "tool_call",
@@ -276,23 +276,23 @@
"Green"
]
},
- "id": "toolu_vrtx_0176CAudgGEug4v6LMeDiGvm"
+ "id": "toolu_vrtx_018NKZFMWDtMrud3cxqcx7nu"
}
]
},
"usage": {
- "input": 8237,
- "output": 117
+ "input": 8272,
+ "output": 115
}
},
- "b8132fab3f5a79ff4d0b8c7167b0fc8bd1599a5c": {
+ "f02a2ac089582728acf943c2871a0791dfb6bcd4": {
"result": {
"role": "assistant",
"content": [
{
"type": "text",
- "text": "Fill in all the required customer information fields for the second order",
- "copilotToolCallId": "toolu_vrtx_01ESimVVXfk6MxSe1yHmaywy"
+ "text": "Fill in all the customer information fields for the second order",
+ "copilotToolCallId": "toolu_vrtx_014FYeLbYMadQ89LzaQXFdoy"
},
{
"type": "tool_call",
@@ -337,23 +337,23 @@
}
]
},
- "id": "toolu_vrtx_01ESimVVXfk6MxSe1yHmaywy"
+ "id": "toolu_vrtx_014FYeLbYMadQ89LzaQXFdoy"
}
]
},
"usage": {
- "input": 8503,
- "output": 269
+ "input": 8536,
+ "output": 268
}
},
- "b089efdaa78963cf4111a62cdcce00f6b0e37da4": {
+ "50baf0fb89e0d4b60244120121fb12d9ec326131": {
"result": {
"role": "assistant",
"content": [
{
"type": "text",
"text": "Click the Order button to submit the second item (green desk)",
- "copilotToolCallId": "toolu_vrtx_01CCUVfDLfRxZQnmRHhoSRMw"
+ "copilotToolCallId": "toolu_vrtx_01WCTR9W4hh6CrYNvgm25Yjo"
},
{
"type": "tool_call",
@@ -362,23 +362,23 @@
"element": "Order button",
"ref": "e29"
},
- "id": "toolu_vrtx_01CCUVfDLfRxZQnmRHhoSRMw"
+ "id": "toolu_vrtx_01WCTR9W4hh6CrYNvgm25Yjo"
}
]
},
"usage": {
- "input": 8959,
+ "input": 8991,
"output": 100
}
},
- "4ddf2575fb5623b5c9ccc345d065b0d6dd071681": {
+ "f58af62434ae328de38eee3842082050991524de": {
"result": {
"role": "assistant",
"content": [
{
"type": "text",
"text": "Accept the confirmation dialog for the green desk order",
- "copilotToolCallId": "toolu_vrtx_01Wgbaa8QXuE76APMMV3f9nE"
+ "copilotToolCallId": "toolu_vrtx_01D8bGvuBZnBaaHg9vEPhkto"
},
{
"type": "tool_call",
@@ -386,23 +386,23 @@
"arguments": {
"accept": true
},
- "id": "toolu_vrtx_01Wgbaa8QXuE76APMMV3f9nE"
+ "id": "toolu_vrtx_01D8bGvuBZnBaaHg9vEPhkto"
}
]
},
"usage": {
- "input": 9134,
+ "input": 9166,
"output": 80
}
},
- "a6c801faaf41a1b323f5d01ac5b7a95c54a4f29c": {
+ "5c0839470e9ae67f3beeaa8113b7d39e52c616c9": {
"result": {
"role": "assistant",
"content": [
{
"type": "text",
- "text": "Report the combined results for both orders: blue table ($353.98) and green desk ($299.98), with a maximum delivery time of 3 days",
- "copilotToolCallId": "toolu_vrtx_01Wn2WotjzPSUTWaYVu4Ymg8"
+ "text": "Report the total price and maximum estimated delivery for both orders. Blue table: $353.98, 3 days. Green desk: $299.98, 3 days. Total: $653.96, max delivery: 3 days.",
+ "copilotToolCallId": "toolu_vrtx_01KyKWN5mj68Pe9d7DUbiEpi"
},
{
"type": "tool_call",
@@ -411,13 +411,13 @@
"price": 653.96,
"deliveryDays": 3
},
- "id": "toolu_vrtx_01Wn2WotjzPSUTWaYVu4Ymg8"
+ "id": "toolu_vrtx_01KyKWN5mj68Pe9d7DUbiEpi"
}
]
},
"usage": {
- "input": 10025,
- "output": 124
+ "input": 10057,
+ "output": 143
}
}
}
\ No newline at end of file
diff --git a/tests/mcp/__cache__/copilot/mcp-browser-eval-fill-the-form-repeat2.json b/tests/mcp/__cache__/copilot/mcp-browser-eval-fill-the-form-repeat2.json
index 5f95f099ac..56a5bf4b2f 100644
--- a/tests/mcp/__cache__/copilot/mcp-browser-eval-fill-the-form-repeat2.json
+++ b/tests/mcp/__cache__/copilot/mcp-browser-eval-fill-the-form-repeat2.json
@@ -1,27 +1,42 @@
{
- "1f67d34de9dca04e9ec4d9d7b590b48b6e67fd08": {
+ "3ead929e37fa1cb83a37e09ee827c20293652543": {
"result": {
"role": "assistant",
"content": [
{
"type": "text",
- "text": "I'll help you navigate to the form, fill in the order details, and report back the price and delivery information."
+ "text": "I'll help you navigate to the form, fill it out with the details provided, and report back the price and delivery information."
}
]
},
"usage": {
- "input": 4429,
- "output": 114
+ "input": 4471,
+ "output": 115
}
},
- "498aeb8d624d9373c7e5b5b1dff78828566dc900": {
+ "f2ac9e2c1fb83e54daedc3a1607ee770dd6cd05c": {
"result": {
"role": "assistant",
"content": [
{
"type": "text",
- "text": "Navigate to the order form page",
- "copilotToolCallId": "toolu_vrtx_01XPsGbYiofMbWmfgtdWBK7N"
+ "text": "I'll navigate to the page and complete the form as requested."
+ }
+ ]
+ },
+ "usage": {
+ "input": 4528,
+ "output": 107
+ }
+ },
+ "82c674fde5a1942a704bedf38590a35c19551537": {
+ "result": {
+ "role": "assistant",
+ "content": [
+ {
+ "type": "text",
+ "text": "Navigate to the form page",
+ "copilotToolCallId": "toolu_vrtx_01PUGZnaWbXrBgkeYjhWXPui"
},
{
"type": "tool_call",
@@ -29,41 +44,85 @@
"arguments": {
"url": "http://localhost:<PORT>/evals/fill-form.html"
},
- "id": "toolu_vrtx_01XPsGbYiofMbWmfgtdWBK7N"
+ "id": "toolu_vrtx_01PUGZnaWbXrBgkeYjhWXPui"
}
]
},
"usage": {
- "input": 4484,
- "output": 89
+ "input": 4572,
+ "output": 88
}
},
- "95fe071871583b1a5ddca2286d61680674dd9fd6": {
+ "d1b4efddf9cbdf8b21ebca18d5a73515bbc1ccd1": {
"result": {
"role": "assistant",
"content": [
{
"type": "text",
- "text": "Fill in the order form for a blue table with customer details",
- "copilotToolCallId": "toolu_vrtx_01E9xJ27rpZVDGuRiEKuYgFe"
+ "text": "Select Table as the product type",
+ "copilotToolCallId": "toolu_vrtx_01CjJV9pdnAYmTgMmw2xqCik"
+ },
+ {
+ "type": "tool_call",
+ "name": "browser_select_option",
+ "arguments": {
+ "element": "Product Type dropdown",
+ "ref": "e7",
+ "values": [
+ "Table"
+ ]
+ },
+ "id": "toolu_vrtx_01CjJV9pdnAYmTgMmw2xqCik"
+ }
+ ]
+ },
+ "usage": {
+ "input": 5281,
+ "output": 116
+ }
+ },
+ "1340b24ab7000c3ecfe415e169728e151270b626": {
+ "result": {
+ "role": "assistant",
+ "content": [
+ {
+ "type": "text",
+ "text": "Select Blue as the color",
+ "copilotToolCallId": "toolu_vrtx_01HdgVvtbHAEew3V3SAhSE8e"
+ },
+ {
+ "type": "tool_call",
+ "name": "browser_select_option",
+ "arguments": {
+ "element": "Color dropdown",
+ "ref": "e10",
+ "values": [
+ "Blue"
+ ]
+ },
+ "id": "toolu_vrtx_01HdgVvtbHAEew3V3SAhSE8e"
+ }
+ ]
+ },
+ "usage": {
+ "input": 5544,
+ "output": 114
+ }
+ },
+ "246c11ed0315d3cf3f8362a31b75f996e0b2c75b": {
+ "result": {
+ "role": "assistant",
+ "content": [
+ {
+ "type": "text",
+ "text": "Fill in the customer details for the first order",
+ "copilotToolCallId": "toolu_vrtx_013EpJmdkVhMZ4vVp7rQcuj9"
},
{
"type": "tool_call",
"name": "browser_fill_form",
"arguments": {
"fields": [
- {
- "name": "Product Type",
- "type": "combobox",
- "ref": "e7",
- "value": "Table"
- },
- {
- "name": "Color",
- "type": "combobox",
- "ref": "e10",
- "value": "Blue"
- },
{
"name": "Full Name",
"type": "textbox",
@@ -80,7 +139,19 @@
"name": "Street Address",
"type": "textbox",
"ref": "e19",
- "value": "123 Main St, Anytown, XYZ state"
+ "value": "123 Main St"
+ },
+ {
+ "name": "City",
+ "type": "textbox",
+ "ref": "e22",
+ "value": "Anytown"
+ },
+ {
+ "name": "State/Province",
+ "type": "textbox",
+ "ref": "e25",
+ "value": "XYZ state"
},
{
"name": "ZIP/Postal Code",
@@ -90,174 +161,159 @@
}
]
},
- "id": "toolu_vrtx_01E9xJ27rpZVDGuRiEKuYgFe"
+ "id": "toolu_vrtx_013EpJmdkVhMZ4vVp7rQcuj9"
}
]
},
"usage": {
- "input": 5194,
- "output": 354
+ "input": 5807,
+ "output": 274
}
},
- "b33fa200303dc6e1c5e5d06e5566d11af9ee1100": {
+ "90fd25992c1a647531b834bb4c37dd1aa507a875": {
"result": {
"role": "assistant",
"content": [
{
"type": "text",
- "text": "Check if City field needs to be filled before submitting",
- "copilotToolCallId": "toolu_vrtx_01EyB4XTMFwAVCkJTVZegHBg"
+ "text": "Submit the first order for the blue table",
+ "copilotToolCallId": "toolu_vrtx_019fyjP8YWhpbkWqCuWEaEEz"
},
{
"type": "tool_call",
- "name": "browser_snapshot",
- "arguments": {},
- "id": "toolu_vrtx_01EyB4XTMFwAVCkJTVZegHBg"
+ "name": "browser_click",
+ "arguments": {
+ "element": "Order button",
+ "ref": "e29"
+ },
+ "id": "toolu_vrtx_019fyjP8YWhpbkWqCuWEaEEz"
}
]
},
"usage": {
- "input": 5642,
- "output": 63
+ "input": 6260,
+ "output": 96
}
},
- "ddfd3471dba960dd013273a8ff6aa41c21a73ba0": {
+ "95b5282664361cd6416210e38366b8aecce3022f": {
"result": {
"role": "assistant",
"content": [
{
"type": "text",
- "text": "Fill in the missing City and State fields that are required",
- "copilotToolCallId": "toolu_vrtx_01WQQgr577X5DKLNM66yaJvc"
+ "text": "Accept the confirmation dialog for the blue table order",
+ "copilotToolCallId": "toolu_vrtx_016sk3xCVtw6856vxqGGBdkB"
},
{
"type": "tool_call",
- "name": "browser_fill_form",
+ "name": "browser_handle_dialog",
"arguments": {
- "fields": [
- {
- "name": "City",
- "ref": "e22",
- "type": "textbox",
- "value": "Anytown"
- },
- {
- "name": "State/Province",
- "ref": "e25",
- "type": "textbox",
- "value": "XYZ"
- }
- ]
+ "accept": true
},
- "id": "toolu_vrtx_01WQQgr577X5DKLNM66yaJvc"
+ "id": "toolu_vrtx_016sk3xCVtw6856vxqGGBdkB"
}
]
},
"usage": {
- "input": 6345,
- "output": 142
+ "input": 6431,
+ "output": 80
}
},
- "6e1d42a5ece3458887bb317028560156de53d25d": {
+ "db78696f00789b6fedb3d4f75b7acae7d43514ec": {
"result": {
"role": "assistant",
"content": [
{
"type": "text",
- "text": "Submit the order for the blue table",
- "copilotToolCallId": "toolu_vrtx_01YQTMoAzSpRRw9J7kzMeAno"
+ "text": "Click the button to place another order for the green desk",
+ "copilotToolCallId": "toolu_vrtx_01KmgEbnjXQaUcxsqucKXmKF"
},
{
"type": "tool_call",
"name": "browser_click",
"arguments": {
- "element": "Order button",
- "ref": "e29"
+ "element": "Place Another Order button",
+ "ref": "e58"
},
- "id": "toolu_vrtx_01YQTMoAzSpRRw9J7kzMeAno"
+ "id": "toolu_vrtx_01KmgEbnjXQaUcxsqucKXmKF"
}
]
},
"usage": {
- "input": 6560,
- "output": 95
+ "input": 7321,
+ "output": 101
}
},
- "3090a7d97bc75644ff00d8b32d7fdbcf26c55f6a": {
+ "66d11ebd5aa97fcbf9002ac6cf7e25453bcca8f7": {
"result": {
"role": "assistant",
"content": [
{
"type": "text",
- "text": "Confirm the order for the blue table",
- "copilotToolCallId": "toolu_vrtx_01LvLQ372U35LRjMhjzg6Dme"
+ "text": "Select Desk as the product type for the second order",
+ "copilotToolCallId": "toolu_vrtx_01Qwp1HZ551btMZqVfuhmg7K"
},
{
"type": "tool_call",
- "name": "browser_handle_dialog",
+ "name": "browser_select_option",
"arguments": {
- "accept": true
+ "element": "Product Type dropdown",
+ "ref": "e7",
+ "values": [
+ "Desk"
+ ]
},
- "id": "toolu_vrtx_01LvLQ372U35LRjMhjzg6Dme"
+ "id": "toolu_vrtx_01Qwp1HZ551btMZqVfuhmg7K"
}
]
},
"usage": {
- "input": 6730,
- "output": 79
+ "input": 8042,
+ "output": 122
}
},
- "326f425b7b11f30fb2caef078ed93f7932923edc": {
+ "b9ea532ba3932051ca53f8995e4a84673ac15f15": {
"result": {
"role": "assistant",
"content": [
{
"type": "text",
- "text": "Click on Place Another Order button to order the second item (green desk)",
- "copilotToolCallId": "toolu_vrtx_01LEuTE7DgrAUMint4khguYr"
+ "text": "Select Green as the color for the desk",
+ "copilotToolCallId": "toolu_vrtx_01UcgZrsRtnDRtamzcXiyhEz"
},
{
"type": "tool_call",
- "name": "browser_click",
+ "name": "browser_select_option",
"arguments": {
- "element": "Place Another Order button",
- "ref": "e58"
+ "element": "Color dropdown",
+ "ref": "e10",
+ "values": [
+ "Green"
+ ]
},
- "id": "toolu_vrtx_01LEuTE7DgrAUMint4khguYr"
+ "id": "toolu_vrtx_01UcgZrsRtnDRtamzcXiyhEz"
}
]
},
"usage": {
- "input": 7641,
- "output": 104
+ "input": 8312,
+ "output": 117
}
},
- "9128e6e3f63a0d1eaf2972336082bde3db8449ce": {
+ "f062f1459e30461f856bac9eaf6c9ba4c0c83445": {
"result": {
"role": "assistant",
"content": [
{
"type": "text",
- "text": "Fill in the order form for a green desk with the same customer details",
- "copilotToolCallId": "toolu_vrtx_01SboLoRCoYELQtRzgagA1EC"
+ "text": "Fill in the customer details for the second order",
+ "copilotToolCallId": "toolu_vrtx_01S4ko4cV4txtLXSwhz12t1d"
},
{
"type": "tool_call",
"name": "browser_fill_form",
"arguments": {
"fields": [
- {
- "name": "Product Type",
- "ref": "e7",
- "type": "combobox",
- "value": "Desk"
- },
- {
- "name": "Color",
- "ref": "e10",
- "type": "combobox",
- "value": "Green"
- },
{
"name": "Full Name",
"ref": "e13",
@@ -274,7 +330,7 @@
"name": "Street Address",
"ref": "e19",
"type": "textbox",
- "value": "123 Main St, Anytown, XYZ state"
+ "value": "123 Main St"
},
{
"name": "City",
@@ -286,7 +342,7 @@
"name": "State/Province",
"ref": "e25",
"type": "textbox",
- "value": "XYZ"
+ "value": "XYZ state"
},
{
"name": "ZIP/Postal Code",
@@ -296,23 +352,23 @@
}
]
},
- "id": "toolu_vrtx_01SboLoRCoYELQtRzgagA1EC"
+ "id": "toolu_vrtx_01S4ko4cV4txtLXSwhz12t1d"
}
]
},
"usage": {
- "input": 8365,
- "output": 337
+ "input": 8578,
+ "output": 266
}
},
- "ccd12e74f5216b77104f1e2e6199519ef6bce9c0": {
+ "fdcd0330d001ae7fd2401858d3ece675b149b65d": {
"result": {
"role": "assistant",
"content": [
{
"type": "text",
- "text": "Submit the order for the green desk",
- "copilotToolCallId": "toolu_vrtx_01HsUFw6GuXR6J4YYiNnEHMe"
+ "text": "Submit the second order for the green desk",
+ "copilotToolCallId": "toolu_vrtx_015dGJ2kCyGMmwB7P6e3vRcE"
},
{
"type": "tool_call",
@@ -321,23 +377,23 @@
"element": "Order button",
"ref": "e29"
},
- "id": "toolu_vrtx_01HsUFw6GuXR6J4YYiNnEHMe"
+ "id": "toolu_vrtx_015dGJ2kCyGMmwB7P6e3vRcE"
}
]
},
"usage": {
- "input": 8931,
- "output": 95
+ "input": 9031,
+ "output": 96
}
},
- "f3d9f4f90ffe9d6f68f0de098d16e50a7012bf6a": {
+ "09e90872eebfad23b65c6b8baf6a21f4d3e3be13": {
"result": {
"role": "assistant",
"content": [
{
"type": "text",
- "text": "Confirm the order for the green desk",
- "copilotToolCallId": "toolu_vrtx_01EhMR6qGdFTfFJuC4GgTrzw"
+ "text": "Accept the confirmation dialog for the green desk order",
+ "copilotToolCallId": "toolu_vrtx_017Aese7AEKa1XYZoZjeTw6z"
},
{
"type": "tool_call",
@@ -345,23 +401,23 @@
"arguments": {
"accept": true
},
- "id": "toolu_vrtx_01EhMR6qGdFTfFJuC4GgTrzw"
+ "id": "toolu_vrtx_017Aese7AEKa1XYZoZjeTw6z"
}
]
},
"usage": {
- "input": 9101,
- "output": 79
+ "input": 9202,
+ "output": 80
}
},
- "53eabaad4c0c8ed9499bada78403a56fa3ab6307": {
+ "28d9510654099e5564df19869f8609adff0bfaae": {
"result": {
"role": "assistant",
"content": [
{
"type": "text",
- "text": "Report the total price for both items and maximum estimated delivery. Blue table: $353.98, Green desk: $299.98. Total: $653.96. Both orders have 3 days estimated delivery.",
- "copilotToolCallId": "toolu_vrtx_01VsdeN1JruLTtnoA2hNUu7u"
+ "text": "Report the total price and maximum delivery time for both orders. Blue table: $353.98, 3 days. Green desk: $299.98, 3 days. Total: $653.96, Max delivery: 3 days.",
+ "copilotToolCallId": "toolu_vrtx_01Umx8ecJT1VFHfNNJx6vcX5"
},
{
"type": "tool_call",
@@ -370,13 +426,13 @@
"price": 653.96,
"deliveryDays": 3
},
- "id": "toolu_vrtx_01VsdeN1JruLTtnoA2hNUu7u"
+ "id": "toolu_vrtx_01Umx8ecJT1VFHfNNJx6vcX5"
}
]
},
"usage": {
- "input": 10013,
- "output": 135
+ "input": 10093,
+ "output": 143
}
}
}
\ No newline at end of file
diff --git a/tests/mcp/network.spec.ts b/tests/mcp/network.spec.ts
index a47bcce4ae..9bfdbe337b 100644
--- a/tests/mcp/network.spec.ts
+++ b/tests/mcp/network.spec.ts
@@ -14,11 +14,12 @@
* limitations under the License.
*/
-import { test, expect } from './fixtures';
+import { test, expect, parseResponse } from './fixtures';
test('browser_network_requests', async ({ client, server }) => {
server.setContent('/', `
<button onclick="fetch('/json')">Click me</button>
+ <img src="/image.png" />
`, 'text/html');
server.setContent('/json', JSON.stringify({ name: 'John Doe' }), 'application/json');
@@ -38,10 +39,24 @@ test('browser_network_requests', async ({ client, server }) => {
},
});
- await expect.poll(() => client.callTool({
- name: 'browser_network_requests',
- })).toHaveResponse({
- result: expect.stringContaining(`[GET] ${`${server.PREFIX}/`} => [200] OK
-[GET] ${`${server.PREFIX}/json`} => [200] OK`),
- });
+ {
+ const response = parseResponse(await client.callTool({
+ name: 'browser_network_requests',
+ }));
+ expect(response.result).not.toContain(`[GET] ${`${server.PREFIX}/`} => [200] OK`);
+ expect(response.result).toContain(`[GET] ${`${server.PREFIX}/json`} => [200] OK`);
+ expect(response.result).toContain(`[GET] ${`${server.PREFIX}/image.png`} => [404]`);
+ }
+
+ {
+ const response = parseResponse(await client.callTool({
+ name: 'browser_network_requests',
+ arguments: {
+ includeStatic: true,
+ },
+ }));
+ expect(response.result).toContain(`[GET] ${`${server.PREFIX}/`} => [200] OK`);
+ expect(response.result).toContain(`[GET] ${`${server.PREFIX}/json`} => [200] OK`);
+ expect(response.result).toContain(`[GET] ${`${server.PREFIX}/image.png`} => [404]`);
+ }
});
diff --git a/tests/mcp/test-debug.spec.ts b/tests/mcp/test-debug.spec.ts
index b060380e12..fb43b8445d 100644
--- a/tests/mcp/test-debug.spec.ts
+++ b/tests/mcp/test-debug.spec.ts
@@ -92,8 +92,9 @@ test('test_debug (browser_snapshot/network/console)', async ({ startClient, serv
import { test, expect } from '@playwright/test';
test('fail', async ({ page }) => {
await page.goto(${JSON.stringify(server.HELLO_WORLD)});
- await page.evaluate(() => {
+ await page.evaluate(async () => {
console.log('hello from console');
+ await fetch('/missing');
setTimeout(() => { throw new Error('error from page'); }, 0);
});
await expect(page.getByRole('button', { name: 'Missing' })).toBeVisible({ timeout: 1000 });
@@ -108,12 +109,12 @@ test('test_debug (browser_snapshot/network/console)', async ({ startClient, serv
await expect.poll(() => client.callTool({
name: 'browser_network_requests',
})).toHaveResponse({
- result: expect.stringContaining(`[GET] ${server.HELLO_WORLD} => [200] OK`),
+ result: expect.stringContaining(`[GET] ${server.PREFIX}/missing => [404]`),
});
expect(await client.callTool({
name: 'browser_console_messages',
})).toHaveResponse({
- result: expect.stringMatching(/\[LOG\] hello from console.*\nError: error from page/),
+ result: expect.stringMatching(/\[LOG\] hello from console.*\n.*404.*\nError: error from page/),
});
expect(await client.callTool({
name: 'browser_snapshot',
@@ -403,7 +404,7 @@ Error: expect(locator).toBeVisible() failed`));
expect(await client.callTool({
name: 'browser_network_requests',
})).toHaveResponse({
- result: `\[GET\] ${server.HELLO_WORLD} => [200] OK\n\[GET\] ${server.PREFIX}/missing => [404] Not Found`,
+ result: `[GET\] ${server.PREFIX}/missing => [404] Not Found`,
});
});