mirror of
https://github.com/microsoft/playwright-mcp.git
synced 2026-02-03 08:53:38 +00:00
chore: only reset network log upon explicit navigation (#377)
Fixes https://github.com/microsoft/playwright-mcp/issues/376
This commit is contained in:
@@ -31,11 +31,8 @@ const fetchPage = async (client: Client, url: string) => {
|
||||
};
|
||||
|
||||
test('default to allow all', async ({ server, client }) => {
|
||||
server.route('/ppp', (_req, res) => {
|
||||
res.writeHead(200, { 'Content-Type': 'text/html' });
|
||||
res.end('content:PPP');
|
||||
});
|
||||
const result = await fetchPage(client, server.PREFIX + '/ppp');
|
||||
server.setContent('/ppp', 'content:PPP', 'text/html');
|
||||
const result = await fetchPage(client, server.PREFIX + 'ppp');
|
||||
expect(result).toContain('content:PPP');
|
||||
});
|
||||
|
||||
@@ -48,14 +45,11 @@ test('blocked works', async ({ startClient }) => {
|
||||
});
|
||||
|
||||
test('allowed works', async ({ server, startClient }) => {
|
||||
server.route('/ppp', (_req, res) => {
|
||||
res.writeHead(200, { 'Content-Type': 'text/html' });
|
||||
res.end('content:PPP');
|
||||
});
|
||||
server.setContent('/ppp', 'content:PPP', 'text/html');
|
||||
const client = await startClient({
|
||||
args: ['--allowed-origins', `microsoft.com;${new URL(server.PREFIX).host};playwright.dev`]
|
||||
});
|
||||
const result = await fetchPage(client, server.PREFIX + '/ppp');
|
||||
const result = await fetchPage(client, server.PREFIX + 'ppp');
|
||||
expect(result).toContain('content:PPP');
|
||||
});
|
||||
|
||||
@@ -79,13 +73,10 @@ test('allowed without blocked blocks all non-explicitly specified origins', asyn
|
||||
});
|
||||
|
||||
test('blocked without allowed allows non-explicitly specified origins', async ({ server, startClient }) => {
|
||||
server.route('/ppp', (_req, res) => {
|
||||
res.writeHead(200, { 'Content-Type': 'text/html' });
|
||||
res.end('content:PPP');
|
||||
});
|
||||
server.setContent('/ppp', 'content:PPP', 'text/html');
|
||||
const client = await startClient({
|
||||
args: ['--blocked-origins', 'example.com'],
|
||||
});
|
||||
const result = await fetchPage(client, server.PREFIX + '/ppp');
|
||||
const result = await fetchPage(client, server.PREFIX + 'ppp');
|
||||
expect(result).toContain('content:PPP');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user