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

Test public link uploads with/without password #2400

Merged
merged 2 commits into from
Nov 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/files/src/mixins.js
Original file line number Diff line number Diff line change
Expand Up @@ -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))
LukasHirt marked this conversation as resolved.
Show resolved Hide resolved
} else {
p = this.queue.add(() => this.$client.files.createFolder(this.rootPath + directory))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,75 @@ 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
Copy link
Member Author

@skshetry skshetry Nov 8, 2019

Choose a reason for hiding this comment

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

This should have been the following, but, I just noticed. I already have a PR in the works that fixes this.
It'll be fixed in the "other" PR. Or, if anything needs to be fixed, I'll do this in this same PR.

Suggested change
Scenario: creating a public link with "Editor" role makes it possible to upload a file inside a subdirectory
Scenario: creating a public link with "Editor" role makes it possible to upload a file inside a subdirectory 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 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"
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 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"
Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/features/webUIUpload/upload.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions tests/acceptance/features/webUIUpload/uploadEdgecases.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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 "<folder-to-upload-to>" 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 "<folder-to-upload-to>/0" should be the same as the local "0"

Expand Down Expand Up @@ -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 <file-name> has been created locally
When the user uploads file <file-name> using the webUI
When the user uploads a created file <file-name> using the webUI
Then file <file-name> should be listed on the webUI
And as "user1" the content of <file-name> should be the same as the local <file-name>
Examples:
Expand All @@ -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"
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 5 additions & 10 deletions tests/acceptance/pageObjects/filesPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
15 changes: 12 additions & 3 deletions tests/acceptance/stepDefinitions/filesContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
dpakach marked this conversation as resolved.
Show resolved Hide resolved
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) {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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())
})

Expand Down
1 change: 0 additions & 1 deletion tests/acceptance/stepDefinitions/publicLinkContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down