Skip to content
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

[Feature] Drag and Drop for uploading folders #9823

Closed
Vanish404 opened this issue Oct 27, 2021 · 6 comments
Closed

[Feature] Drag and Drop for uploading folders #9823

Vanish404 opened this issue Oct 27, 2021 · 6 comments

Comments

@Vanish404
Copy link

I wondering, is it possible to simulate drag and drop from file manger? For example Finder. I just want to drag and drop multiple folders and files and upload them directly to the S3. The problem is that File class has path field that read only. So if I drop a folder I will get

{
  name: "a.txt", // file name
  path: "/folder/a.txt",
  size: 2473, // 2kb
  type: "text/plain",
  lastModifiedDate: ...,
...

Do you have some workaround to set this path field?

@dgozman
Copy link
Contributor

dgozman commented Oct 27, 2021

@Vanish404 I am not sure I understand the exact question. Do you have a page that accepts dropped files/folders and you'd like to test that?

Perhaps you'd like some kind of API for external drag&drop? Here is a proposal (does not exist today):

await page.drop('/path/to/folder');

@Vanish404
Copy link
Author

@Vanish404 I am not sure I understand the exact question. Do you have a page that accepts dropped files/folders and you'd like to test that?

@dgozman I built an example, so you can play around https://codesandbox.io/s/dreamy-frost-3eziz. I also add console.log() when folder will be dropped. I dropped test-folder with files and get a result:

Screenshot 2021-10-28 at 15 55 56

Screenshot 2021-10-28 at 16 02 48

Perhaps you'd like some kind of API for external drag&drop? Here is a proposal (does not exist today):

await page.drop('/path/to/folder');

I suppose yes, because page.dragAndDrop method works only with css selectors on the same page as I understood. In my case, I just want to drag and drop some folders from file manager (like finder) using playwright. My test-case looks like that:

  1. I open window,
  2. find the file input
  3. open Finder if it possible or simulate it
  4. drag and drop some folder from finder to the file input area. note: (!) => onDrop callback returns array of File class and I can read path field by using JS. When I create request to the S3 I use path field to build path to the S3.
  5. click upload btn
  6. wait and check that folder was successfully uploaded.

@dgozman
Copy link
Contributor

dgozman commented Oct 29, 2021

@Vanish404 This makes sense. Let me change the title to a feature request, because we don't have such API right now.

@dgozman dgozman changed the title [Question] Drag and Drop for uploading folders [Feature] Drag and Drop for uploading folders Oct 29, 2021
@Vanish404
Copy link
Author

Hey @dgozman, any updates? or mb some workaround?

@dgozman
Copy link
Contributor

dgozman commented Jun 27, 2022

@Vanish404 No updates on this one, sorry.

@pavelfeldman
Copy link
Member

Why was this issue closed?

Thank you for your involvement. This issue was closed due to limited engagement (upvotes/activity), lack of recent activity, and insufficient actionability. To maintain a manageable database, we prioritize issues based on these factors.

If you disagree with this closure, please open a new issue and reference this one. More support or clarity on its necessity may prompt a review. Your understanding and cooperation are appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants