chore: save downloads to outputDir (#310)

This commit is contained in:
Simon Knott
2025-05-02 10:57:31 +02:00
committed by GitHub
parent 23ce973377
commit a15f0f301b
5 changed files with 54 additions and 3 deletions

View File

@@ -16,6 +16,7 @@
import { test, expect } from './fixtures.js';
import fs from 'fs/promises';
import path from 'path';
test('browser_file_upload', async ({ client }) => {
expect(await client.callTool({
@@ -96,3 +97,27 @@ The tool "browser_file_upload" can only be used when there is related modal stat
- [File chooser]: can be handled by the "browser_file_upload" tool`);
}
});
test('clicking on download link emits download', async ({ startClient }, testInfo) => {
const outputDir = testInfo.outputPath('output');
const client = await startClient({
config: { outputDir },
});
expect(await client.callTool({
name: 'browser_navigate',
arguments: {
url: 'data:text/html,<a href="data:text/plain,Hello world!" download="test.txt">Download</a>',
},
})).toContainTextContent('- link "Download" [ref=s1e3]');
await expect.poll(() => client.callTool({
name: 'browser_click',
arguments: {
element: 'Download link',
ref: 's1e3',
},
})).toContainTextContent(`
### Downloads
- Downloaded file test.txt to ${path.join(outputDir, 'test-txt')}`);
});