Write smoke tests for drag&drop upload
Current state
We support uploads via drag&drop, but don't have them covered in our test suite
Acceptance criteria
Write two smoke tests
- [x] upload file via drag&drop and assert that it
- [x] is visible on the web UI https://github.com/owncloud/web/pull/9065
- [x] arrives in the backend https://github.com/owncloud/web/pull/9065
- [ ] upload a folder (containing files & folders) via drag&drop and assert that it - still relevant. We cannot use solution from #9065 because
Error: EISDIR: illegal operation on a directory, read- [ ] is visible on the web UI
- [ ] arrives in the backend
For information, in oC10 we "simulate":
- drag-and-drop of a file/folder from outside the browser
- selection of a file/folder to upload (that would actually open some file explorer interface to browse to the file to upload).
- drag-and-drop of a file/folder from its source in the browser into another folder
When the user uploads file "new-lorem.txt" using the webUI
ends up calling https://github.com/owncloud/core/blob/master/tests/acceptance/features/lib/FilesPageCRUD.php uploadFile
That calls:
$uploadField->attachFile(UploadHelper::getUploadFilesDir($name));
attachFile() is a method in Behat-Mink that interfaces through selenium to the browser and "knows" how to insert a file reference into a file-input field. The actual user "motion" of drag-and-drop or browsing the file system outside of the browser does not happen. But after the file-input field is filled, the browser responds and does the action to the server to do the upload.
moveFileTo() uses a dragTo() method provided by Behat-Mink to selenium and the browser that "simulates" dragging a UI element (e.g. a file) onto another UI element (e.g. a folder). That achieves drag-and-drop between elements that are already visible in the browser tab.
Maybe Playwright and/or Nightwatch will have similar abstractions available.
@ScharfViktor seems like the Playwright team received a feature request for that functionality recently: https://github.com/microsoft/playwright/issues/9823 Perhaps best to wait a bit until they fully support it?
@pascalwengerter this is very similar to our case, we should wait. it would be great to use the custom method Today I tried how the "page.dragAndDrop" method works. It works within a single page and is suitable for "Move" and "Copy". But it doesn't suit uploading a file or folder
drag'n'drop folder uploads still don't seem to be supported in playwright, see https://github.com/microsoft/playwright/issues/6854 (old issue was closed due to inactivity)
Reached a dead-end. Could not find a working solution for uploading Folder via drag-n-drop event. For Files upload, we do have some tests.
@saw-jan "Could find a working solution" Do you mean "could not"?
Do you mean "could not"?
yeah, updated the comment :sweat_smile:
Reached a dead-end. Could not find a working solution for uploading
Foldervia drag-n-drop event. ForFilesupload, we do have some tests.
Test for folder upload added in https://github.com/owncloud/web/pull/12540