-
Notifications
You must be signed in to change notification settings - Fork 806
feat(web-integration): implement file upload functionality with tests and HTML fixture #1709
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 16 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
d7508b9
feat(web-integration): implement file upload functionality with tests…
quanru c64451f
feat(docs): add file upload functionality to agent with detailed para…
quanru 0606767
Update apps/site/docs/zh/api.mdx
quanru 553024b
Update packages/web-integration/src/puppeteer/base-page.ts
quanru 2281813
Update packages/web-integration/src/chrome-extension/page.ts
quanru 17887a4
Update packages/web-integration/src/puppeteer/base-page.ts
quanru 422767b
Update packages/core/src/agent/agent.ts
quanru 71b224c
Update apps/site/docs/en/api.mdx
quanru 27525cb
fix(tests): refactor file upload tests to use relative path for test …
quanru c10fde7
feat(web-integration): enhance file upload functionality in aiTap and…
quanru 7d2c09b
Update packages/web-integration/tests/ai/web/playwright/file-upload.s…
quanru 47b20c9
fix(tests): improve file upload tests with error handling and agent c…
quanru 57895a1
fix(base-page): optimize file handling by importing fs and path modul…
quanru 717c058
feat(core): enhance aiTap to handle file chooser setup and cleanup
quanru 8df55c2
refactor(base-page): unify file chooser handling with wrapper pattern
quanru 50f0cb9
feat(agent): implement file chooser capability with unified handling
quanru 00b5178
refactor(core): simplify actionTapParamSchema by removing file upload…
quanru 022f115
feat(agent): implement file upload handling with support for Puppetee…
quanru 2ea8890
refactor(core): file uploader (#1735)
yuyutaotao 585cb84
Revert "refactor(core): file uploader (#1735)"
yuyutaotao 53e9f76
fix(core): file upload codes (#1736)
yuyutaotao 00133e4
chore(core): merge main
yuyutaotao 819da54
fix(core): enhance file chooser handling and add related tests
quanru 2764a2c
docs(core): update document of aiAct
yuyutaotao File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
packages/web-integration/tests/ai/fixtures/file-upload.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| <!DOCTYPE html> | ||
| <html> | ||
| <head> | ||
| <title>File Upload Test</title> | ||
| <style> | ||
| body { font-family: Arial, sans-serif; padding: 20px; } | ||
| .upload-area { border: 2px dashed #ccc; padding: 20px; margin: 20px 0; text-align: center; } | ||
| .upload-btn { background: #007bff; color: white; padding: 10px 20px; border: none; cursor: pointer; } | ||
| .file-list { margin-top: 20px; } | ||
| .file-item { padding: 5px; background: #f0f0f0; margin: 5px 0; } | ||
| </style> | ||
| </head> | ||
| <body> | ||
| <h1>File Upload Test Page</h1> | ||
|
|
||
| <div class="upload-area"> | ||
| <input type="file" id="file-input" multiple style="display: none;"> | ||
| <button class="upload-btn" onclick="document.getElementById('file-input').click()">Choose Files</button> | ||
| <p>Supports multiple file upload</p> | ||
| </div> | ||
|
|
||
| <div class="upload-area"> | ||
| <input type="file" id="single-file-input" style="display: none;"> | ||
| <button class="upload-btn" onclick="document.getElementById('single-file-input').click()">Choose Single File</button> | ||
| <p>Supports single file upload only</p> | ||
| </div> | ||
|
|
||
| <div class="file-list" id="file-list"> | ||
| <h3>Selected Files:</h3> | ||
| <div id="selected-files"></div> | ||
| </div> | ||
|
|
||
| <script> | ||
| document.getElementById('file-input').addEventListener('change', function(e) { | ||
| const files = Array.from(e.target.files); | ||
| displayFiles(files, 'multiple'); | ||
| }); | ||
|
|
||
| document.getElementById('single-file-input').addEventListener('change', function(e) { | ||
| const files = Array.from(e.target.files); | ||
| displayFiles(files, 'single'); | ||
| }); | ||
|
|
||
| function displayFiles(files, type) { | ||
| const container = document.getElementById('selected-files'); | ||
| container.innerHTML = ''; | ||
|
|
||
| files.forEach(file => { | ||
| const div = document.createElement('div'); | ||
| div.className = 'file-item'; | ||
| div.textContent = `${file.name} (${file.size} bytes) - ${type}`; | ||
| container.appendChild(div); | ||
| }); | ||
| } | ||
| </script> | ||
| </body> | ||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Relative path test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Test file 1 content |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Test file 2 content |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| This is a test file for upload |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.