Skip to content

Commit

Permalink
Merge pull request #6047 from owncloud/restore-deleted-tests
Browse files Browse the repository at this point in the history
[tests-only][full-ci]Add valid tests that were removed by PR `#5973`
  • Loading branch information
phil-davis authored Dec 2, 2021
2 parents 246ec14 + b5beb4a commit 0bf39e8
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ Other free text and markdown formatting can be used elsewhere in the document if
- [webUIFilesCopy/copy.feature:98](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIFilesCopy/copy.feature#L98)
- [webUIMoveFilesFolders/moveFiles.feature:97](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIMoveFilesFolders/moveFiles.feature#L97)
- [webUIMoveFilesFolders/moveFolders.feature:72](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIMoveFilesFolders/moveFolders.feature#L72)
- [webUIFilesActionMenu/versions.feature:90](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIFilesActionMenu/versions.feature#L90)

### [Accepting different shares with same filename from different users overwrites one file](https://github.com/owncloud/ocis/issues/713)
- [webUISharingAcceptShares/acceptShares.feature:212](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUISharingAcceptShares/acceptShares.feature#L212)
Expand Down
14 changes: 13 additions & 1 deletion tests/acceptance/features/webUIFilesActionMenu/versions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Feature: Versions of a file
| user0 |
| Alice |

@disablePreviews @skipOnOC10 @issue-5853
@disablePreviews @issue-5853
Scenario: upload new file with same name to see if different versions are shown
Given user "user0" has logged in using the webUI
And user "user0" has uploaded file "lorem.txt" to "lorem.txt"
Expand Down Expand Up @@ -85,3 +85,15 @@ Feature: Versions of a file
And the user uploads overwriting file "lorem.txt" using the webUI
And the user browses to display the "versions" details of file "lorem.txt"
Then the versions list should contain 1 entries

@issue-ocis-1328 @disablePreviews
Scenario: sharee can see the versions of a file
Given user "user0" has uploaded file with content "lorem content" to "lorem-file.txt"
And user "user0" has uploaded file with content "lorem" to "lorem-file.txt"
And user "user0" has uploaded file with content "new lorem content" to "lorem-file.txt"
And user "user0" has shared file "lorem-file.txt" with user "Alice"
And user "Alice" has logged in using the webUI
When the user browses to display the "versions" details of file "lorem-file.txt"
Then the content of file "lorem-file.txt" for user "Alice" should be "new lorem content"
And the versions list should contain 2 entries

Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,22 @@ Feature: files and folders can be deleted from the trashbin
| fo.xyz |
Then the deleted elements should not be listed on the webUI
And the deleted elements should not be listed on the webUI after a page reload

@issue-product-188 @issue-4582
Scenario: Select all except for some files and delete from trashbin in a batch
When the user marks all files for batch action using the webUI
And the user unmarks these files for batch action using the webUI
| name |
| lorem.txt |
| lorem-big.txt |
And the user batch deletes the marked files using the webUI
Then file "lorem.txt" should be listed on the webUI
And file "lorem-big.txt" should be listed on the webUI
But file "data.zip" should not be listed on the webUI
And folder "simple-folder" should not be listed on the webUI

@issue-product-188 @issue-4582
Scenario: Select all files and delete from trashbin in a batch
When the user marks all files for batch action using the webUI
And the user batch deletes the marked files using the webUI
Then there should be no resources listed on the webUI
48 changes: 17 additions & 31 deletions tests/acceptance/helpers/webdavHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,44 +192,30 @@ exports.createFolder = function (user, folderName) {
* @param {string} user
* @param {string} fileName
* @param {string} contents
* @param {number} waitMaxIfExisting
*/
exports.createFile = async function (user, fileName, contents = '', waitMaxIfExisting = 10000) {
exports.createFile = async function (user, fileName, contents = '') {
const davPath = exports.createDavPath(user, fileName)
/**
* makes sure upload operations are carried out maximum once a second to avoid version issues
* see https://github.com/owncloud/core/issues/23151
*/
uploadTimeStamps[user] = uploadTimeStamps[user] || {}

const pollCheck = async (retries = 0, waitFor = 100, waitMax = waitMaxIfExisting) => {
if (!uploadTimeStamps[user][fileName] || waitMax <= waitFor) {
return
} else {
uploadTimeStamps[user][fileName] = true
if (uploadTimeStamps[user] && uploadTimeStamps[user][fileName]) {
const timeSinceLastFileUpload = Date.now() - uploadTimeStamps[user][fileName]
if (timeSinceLastFileUpload <= 1600) {
await client.pause(1600 - timeSinceLastFileUpload)
}

retries++
await client.pause(waitFor)

// O(n)
await pollCheck(retries, waitFor * retries, waitMax)
}

await pollCheck()

const davPath = exports.createDavPath(user, fileName)
const putResponse = await httpHelper.put(davPath, user, contents)

delete uploadTimeStamps[user][fileName]

const statusResponse = await httpHelper.checkStatus(
putResponse,
`Could not create the file "${fileName}" for user "${user}".`
)

await client.pause(500)

return statusResponse.text()
return httpHelper
.put(davPath, user, contents)
.then(function (res) {
uploadTimeStamps[user] = uploadTimeStamps[user] || {}
uploadTimeStamps[user][fileName] = Date.now()
return httpHelper.checkStatus(
res,
`Could not create the file "${fileName}" for user "${user}".`
)
})
.then((res) => res.text())
}

/**
Expand Down

0 comments on commit 0bf39e8

Please sign in to comment.