diff --git a/apps/files/src/mixins.js b/apps/files/src/mixins.js index bf8f62c6098..3cfa752f072 100644 --- a/apps/files/src/mixins.js +++ b/apps/files/src/mixins.js @@ -226,7 +226,7 @@ export default { let p if (this.publicPage()) { - p = this.queue.add(() => this.$client.publicFiles.createFolder(this.rootPath + directory)) + p = this.queue.add(() => this.$client.publicFiles.createFolder(this.rootPath, directory, this.publicLinkPassword)) } else { p = this.queue.add(() => this.$client.files.createFolder(this.rootPath + directory)) } diff --git a/tests/acceptance/features/webUISharingPublic/shareByPublicLink.feature b/tests/acceptance/features/webUISharingPublic/shareByPublicLink.feature index 436451f4999..73521cf6ce2 100644 --- a/tests/acceptance/features/webUISharingPublic/shareByPublicLink.feature +++ b/tests/acceptance/features/webUISharingPublic/shareByPublicLink.feature @@ -101,6 +101,40 @@ Feature: Share by public link When the public uses the webUI to access the last public link created by user "user1" Then it should not be possible to delete file "lorem.txt" using the webUI + Scenario: creating a public link with "Editor" role makes it possible to upload a file + Given user "user1" has shared folder "simple-folder" with link with "read, change, create, delete" permissions + When the public uses the webUI to access the last public link created by user "user1" + And the user uploads file "new-lorem.txt" using the webUI + Then file "new-lorem.txt" should be listed on the webUI + And as "user1" file "simple-folder/new-lorem.txt" should exist + + Scenario: creating a public link with "Editor" role makes it possible to upload a file inside a subdirectory + Given user "user1" has shared folder "simple-folder" with link with "read, change, create, delete" permissions and password "pass123" + When the public uses the webUI to access the last public link created by user "user1" with password "pass123" + And the user opens folder "simple-empty-folder" using the webUI + And the user uploads file "new-lorem.txt" using the webUI + Then file "new-lorem.txt" should be listed on the webUI + And as "user1" file "simple-folder/simple-empty-folder/new-lorem.txt" should exist + + Scenario: creating a public link with "Editor" role makes it possible to upload a folder + Given user "user1" has shared folder "simple-folder" with link with "read, change, create, delete" permissions + When the public uses the webUI to access the last public link created by user "user1" + And the user uploads folder "PARENT" using the webUI + Then folder "PARENT" should be listed on the webUI + And folder "CHILD" should be listed in the folder "PARENT" on the webUI + And file "child.txt" should be listed in the folder "CHILD" on the webUI + And as "user1" file "simple-folder/PARENT/CHILD/child.txt" should exist + + Scenario: creating a public link with "Editor" role makes it possible to upload a folder inside a subdirectory + Given user "user1" has shared folder "simple-folder" with link with "read, change, create, delete" permissions + When the public uses the webUI to access the last public link created by user "user1" + And the user opens folder "simple-empty-folder" using the webUI + And the user uploads folder "PARENT" using the webUI + Then folder "PARENT" should be listed on the webUI + And folder "CHILD" should be listed in the folder "PARENT" on the webUI + And file "child.txt" should be listed in the folder "CHILD" on the webUI + And as "user1" file "simple-folder/simple-empty-folder/PARENT/CHILD/child.txt" should exist + Scenario: creating a public link with "Editor" role makes it possible to upload files via the link even with password set Given user "user1" has shared folder "simple-folder" with link with "read, change, create, delete" permissions and password "pass123" When the public uses the webUI to access the last public link created by user "user1" with password "pass123" @@ -108,6 +142,34 @@ Feature: Share by public link Then file "new-lorem.txt" should be listed on the webUI And as "user1" file "simple-folder/new-lorem.txt" should exist + Scenario: creating a public link with "Editor" role makes it possible to upload files inside a subdirectory even without password + Given user "user1" has shared folder "simple-folder" with link with "read, change, create, delete" permissions + When the public uses the webUI to access the last public link created by user "user1" + And the user uploads folder "PARENT" using the webUI + Then folder "PARENT" should be listed on the webUI + And folder "CHILD" should be listed in the folder "PARENT" on the webUI + And file "child.txt" should be listed in the folder "CHILD" on the webUI + And as "user1" file "simple-folder/PARENT/CHILD/child.txt" should exist + + Scenario: creating a public link with "Editor" role makes it possible to upload a folder even with password set + Given user "user1" has shared folder "simple-folder" with link with "read, change, create, delete" permissions and password "pass123" + When the public uses the webUI to access the last public link created by user "user1" with password "pass123" + And the user uploads folder "PARENT" using the webUI + Then folder "PARENT" should be listed on the webUI + And folder "CHILD" should be listed in the folder "PARENT" on the webUI + And file "child.txt" should be listed in the folder "CHILD" on the webUI + And as "user1" file "simple-folder/PARENT/CHILD/child.txt" should exist + + Scenario: creating a public link with "Editor" role makes it possible to upload a folder inside a sub-directory even with password set + Given user "user1" has shared folder "simple-folder" with link with "read, change, create, delete" permissions and password "pass123" + When the public uses the webUI to access the last public link created by user "user1" with password "pass123" + And the user opens folder "simple-empty-folder" using the webUI + And the user uploads folder "PARENT" using the webUI + Then folder "PARENT" should be listed on the webUI + And folder "CHILD" should be listed in the folder "PARENT" on the webUI + And file "child.txt" should be listed in the folder "CHILD" on the webUI + And as "user1" file "simple-folder/simple-empty-folder/PARENT/CHILD/child.txt" should exist + Scenario: creating a public link with "Viewer" role makes it possible to create files via the link even with password set Given user "user1" has shared folder "simple-folder" with link with "read" permissions and password "pass123" When the public uses the webUI to access the last public link created by user "user1" with password "pass123" diff --git a/tests/acceptance/features/webUIUpload/upload.feature b/tests/acceptance/features/webUIUpload/upload.feature index 70f70827c6e..ec22dd04087 100644 --- a/tests/acceptance/features/webUIUpload/upload.feature +++ b/tests/acceptance/features/webUIUpload/upload.feature @@ -60,7 +60,7 @@ Feature: File Upload @smokeTest Scenario: uploading a big file (when chunking is implemented this upload should be chunked) Given a file with the size of "30000000" bytes and the name "big-video.mp4" has been created locally - When the user uploads file "big-video.mp4" using the webUI + When the user uploads a created file "big-video.mp4" using the webUI Then no message should be displayed on the webUI And file "big-video.mp4" should be listed on the webUI And as "user1" the content of "big-video.mp4" should be the same as the local "big-video.mp4" diff --git a/tests/acceptance/features/webUIUpload/uploadEdgecases.feature b/tests/acceptance/features/webUIUpload/uploadEdgecases.feature index a77473cedcc..f1a8609e286 100644 --- a/tests/acceptance/features/webUIUpload/uploadEdgecases.feature +++ b/tests/acceptance/features/webUIUpload/uploadEdgecases.feature @@ -28,7 +28,7 @@ Feature: File Upload Scenario Outline: upload a new file into a sub folder Given a file with the size of "3000" bytes and the name "0" has been created locally When the user opens folder "" using the webUI - And the user uploads file "0" using the webUI + And the user uploads a created file "0" using the webUI Then file "0" should be listed on the webUI And as "user1" the content of "/0" should be the same as the local "0" @@ -85,7 +85,7 @@ Feature: File Upload Scenario Outline: upload a big file using difficult names (when chunking in implemented that upload should be chunked) Given a file with the size of "30000000" bytes and the name has been created locally - When the user uploads file using the webUI + When the user uploads a created file using the webUI Then file should be listed on the webUI And as "user1" the content of should be the same as the local Examples: @@ -97,6 +97,6 @@ Feature: File Upload Scenario: Upload a big file called "0" (when chunking in implemented that upload should be chunked) Given a file with the size of "30000000" bytes and the name "0" has been created locally When the user opens folder "simple-folder" using the webUI - And the user uploads file "0" using the webUI + And the user uploads a created file "0" using the webUI Then file "0" should be listed on the webUI And as "user1" the content of "simple-folder/0" should be the same as the local "0" diff --git a/tests/acceptance/features/webUIUpload/uploadFileGreaterThanQuotaSize.feature b/tests/acceptance/features/webUIUpload/uploadFileGreaterThanQuotaSize.feature index 1c6e5a2e739..e7b3fe213e3 100644 --- a/tests/acceptance/features/webUIUpload/uploadFileGreaterThanQuotaSize.feature +++ b/tests/acceptance/features/webUIUpload/uploadFileGreaterThanQuotaSize.feature @@ -15,7 +15,7 @@ Feature: Upload a file And user "user1" has logged in using the webUI And the user has browsed to the files page And a file with the size of "30000000" bytes and the name "big-video.mp4" has been created locally - When the user uploads file "big-video.mp4" using the webUI + When the user uploads a created file "big-video.mp4" using the webUI Then file "big-video.mp4" should not be listed on the webUI Then the error message 'File upload failed…' should be displayed on the webUI #And a error message should be displayed on the webUI with the text matching diff --git a/tests/acceptance/pageObjects/filesPage.js b/tests/acceptance/pageObjects/filesPage.js index 3bd051afe4e..fe4dad43203 100644 --- a/tests/acceptance/pageObjects/filesPage.js +++ b/tests/acceptance/pageObjects/filesPage.js @@ -80,25 +80,20 @@ module.exports = { } return this }, - selectFileForUpload: function (localFileName) { + selectFileForUpload: function (filePath) { return this .waitForElementVisible('@newFileMenuButton') .click('@newFileMenuButton') .waitForElementVisible('@fileUploadButton') - .uploadRemote( - require('path').join(this.api.globals.filesForUpload, localFileName), - filePath => { - this.api.setValue(this.elements.fileUploadInput.selector, filePath) - } - ) + .setValue('@fileUploadInput', filePath) }, /** * - * @param {string} localFileName + * @param {string} filePath */ - uploadFile: function (localFileName) { + uploadFile: function (filePath) { return this - .selectFileForUpload(localFileName) + .selectFileForUpload(filePath) .waitForElementVisible( '@fileUploadProgress', this.api.globals.waitForConditionTimeout, diff --git a/tests/acceptance/stepDefinitions/filesContext.js b/tests/acceptance/stepDefinitions/filesContext.js index 5bffcf3ed50..b99097367f7 100644 --- a/tests/acceptance/stepDefinitions/filesContext.js +++ b/tests/acceptance/stepDefinitions/filesContext.js @@ -193,7 +193,15 @@ Given('the following files have been deleted by user {string}', async function ( }) When('the user uploads file {string} using the webUI', function (element) { - return client.page.filesPage().uploadFile(element) + const uploadPath = path.join(client.globals.mountedUploadDir, element) + return client.page.filesPage().uploadFile(uploadPath) +}) + +When('the user uploads a created file {string} using the webUI', function (element) { + const filePath = path.join(client.globals.filesForUpload, element) + return client.uploadRemote(filePath, function (uploadPath) { + client.page.filesPage().uploadFile(uploadPath) + }) }) When('the user uploads folder {string} using the webUI', function (element) { @@ -558,7 +566,7 @@ Then('the following files/folders/resources should be listed on the webUI', func return assertElementsAreListed([].concat.apply([], table.rows())) }) -Then('file {string} should be listed in the folder {string} on the webUI', function (file, folder) { +Then('file/folder {string} should be listed in the folder {string} on the webUI', function (file, folder) { return client .page .FilesPageElement @@ -653,7 +661,8 @@ Then('it should not be possible to delete file/folder {string} using the webUI', }) When('the user uploads overwriting file {string} using the webUI', function (file) { - return client.page.filesPage().selectFileForUpload(file) + const uploadPath = path.join(client.globals.mountedUploadDir, file) + return client.page.filesPage().selectFileForUpload(uploadPath) .then(() => client.page.filesPage().confirmFileOverwrite()) }) diff --git a/tests/acceptance/stepDefinitions/publicLinkContext.js b/tests/acceptance/stepDefinitions/publicLinkContext.js index 6e7fc832c18..cac9d9942f4 100644 --- a/tests/acceptance/stepDefinitions/publicLinkContext.js +++ b/tests/acceptance/stepDefinitions/publicLinkContext.js @@ -34,7 +34,6 @@ When('the public uses the webUI to access the last public link created by user { When('the public uses the webUI to access the last public link created by user {string} with password {string}', async function (linkCreator, password) { const lastShareToken = await sharingHelper.fetchLastPublicLinkShare(linkCreator) - await client.page.publicLinkFilesPage().navigateAndWaitForPasswordPage(lastShareToken) return client.page.publicLinkPasswordPage().submitPublicLinkPassword(password)