Skip to content

Conversation

@Skn0tt
Copy link
Member

@Skn0tt Skn0tt commented Mar 27, 2025

Resolves #31.

Prompt used for testing:

upload test.txt to dropbox

This won't work for asynchronously opened filechoosers, but let's start with the synchronous variant. I also tested with including the file chooser open state in the snapshot, but that didn't give better results.

I also tested with OneDrive and WeTransfer, but somehow our ARIA snapshots for those pages are missing some elements that are crucial to locate the upload buttons.

@Skn0tt Skn0tt requested review from Copilot and pavelfeldman March 27, 2025 12:48
@Skn0tt Skn0tt self-assigned this Mar 27, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new synchronous file chooser tool to enable uploading files via the browser, addressing issue #31.

  • Implements the browser_choose_file tool in common.ts using a zod schema for validation.
  • Updates index.ts to include the new tool in both snapshot and screenshot tool lists.
  • Extends the Context class in context.ts to listen for file chooser events and provide a method to submit files, and updates README.md with corresponding documentation.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/tools/common.ts Added the chooseFile tool using a zod schema for file paths.
src/index.ts Registered the chooseFile tool in both tool lists.
src/context.ts Added event handling for file chooser events and submission.
README.md Updated documentation to include information for browser_choose_file.
Comments suppressed due to low confidence (1)

src/context.ts:81

  • [nitpick] Consider providing a more descriptive error message in submitFileChooser to help with debugging when no file chooser is detected.
if (!this._fileChooser)

const page = context.existingPage();
await waitForCompletion(page, () => callback(page));
return snapshot ? captureAriaSnapshot(page, status) : {
return snapshot ? captureAriaSnapshot(context, page, status) : {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd clear the file chooser after the action.

@Skn0tt Skn0tt merged commit 5e20040 into microsoft:main Mar 27, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upload files is not supported

2 participants