Skip to content

Commit

Permalink
add test download previos version of file. Add check download file
Browse files Browse the repository at this point in the history
  • Loading branch information
ScharfViktor committed Aug 12, 2021
1 parent d659d82 commit 9493b89
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 11 deletions.
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ services:
volumes:
- /dev/shm:/dev/shm
- ./tests/acceptance/filesForUpload:/uploads:ro
- ./tests/acceptance/download:/home/seluser/Downloads
extra_hosts:
- host.docker.internal:${DOCKER_HOST:-host-gateway}
environment:
Expand Down
13 changes: 13 additions & 0 deletions tests/acceptance/customCommands/checkFileExists.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const fs = require('fs-extra')

function checkFileExists() {}

checkFileExists.prototype.command = function(path) {
if (fs.existsSync(path)) {
console.log('The file Exists')
} else {
throw new Error("The File Doesn't exist")
}
}

module.exports = checkFileExists
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -170,5 +170,5 @@ Other free text and markdown formatting can be used elsewhere in the document if
### [reshared share that is shared with a group the sharer is part of shows twice on "Share with me" page](https://github.com/owncloud/web/issues/2512)
- [webUISharingAcceptShares/acceptShares.feature:31](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUISharingAcceptShares/acceptShares.feature#L31)

### [Change the file content of a received shared file](https://github.com/owncloud/ocis/issues/2319)
- [webUIFilesActionMenu/versions.feature:88](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIFilesActionMenu/versions.feature#L88)
### [downloading an old version of a file returns 501](https://github.com/owncloud/ocis/issues/2261)
- [webUIFilesActionMenu/versions.feature:102](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIFilesActionMenu/versions.feature#L102)
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ Other free text and markdown formatting can be used elsewhere in the document if
- [webUIFilesActionMenu/versions.feature:59](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIFilesActionMenu/versions.feature#L59)
- [webUIFilesActionMenu/versions.feature:74](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIFilesActionMenu/versions.feature#L74)

### [Change the file content of a received shared file](https://github.com/owncloud/ocis/issues/2319)
- [webUIFilesActionMenu/versions.feature:88](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIFilesActionMenu/versions.feature#L88)
### [downloading an old version of a file returns 501](https://github.com/owncloud/ocis/issues/2261)
- [webUIFilesActionMenu/versions.feature:102](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIFilesActionMenu/versions.feature#L102)

### [No occ command in ocis](https://github.com/owncloud/ocis/issues/1317)
- [webUIRestrictSharing/restrictReSharing.feature:23](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIRestrictSharing/restrictReSharing.feature#L23)
Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/features/webUIFiles/download.feature
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ Feature: download files
Given user "Alice" has created file "sample,1.txt"
When the user browses to the files page
And the user downloads file "sample,1.txt" using the webUI
Then no message should be displayed on the webUI
Then file "sample,1.txt" should be downloaded successfully
25 changes: 19 additions & 6 deletions tests/acceptance/features/webUIFilesActionMenu/versions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,27 @@ Feature: Versions of a file
When the user re-logs in as "Alice" using the webUI
And the user browses to display the "versions" details of file "lorem-file.txt"
Then the versions list should contain 0 entries

@issue-ocis-2319
Scenario: change the file content of a received shared file
Given user "Brian" has created file "lorem.txt"
And user "Brian" has shared file "lorem.txt" with user "Alice" with "all" permissions
And user "Alice" has accepted the share "lorem.txt" offered by user "Brian"
Scenario: change the file content of a received shared folder
Given user "Brian" has been created with default attributes and without skeleton files
And user "Brian" has created folder "simple-folder"
And user "Brian" has created file "simple-folder/lorem.txt"
And user "Brian" has shared folder "simple-folder" with user "Alice" with "all" permissions
And user "Alice" has accepted the share "simple-folder" offered by user "Brian"
And user "Alice" has logged in using the webUI
And the user has opened folder "Shares" using the webUI
And the user has opened folder "Shares"
And the user has opened folder "simple-folder"
When 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-2261
Scenario: user downloads a previous version of the file
Given user "Alice" has uploaded file with content "lorem" to "lorem.txt"
And user "Alice" has uploaded file with content "lorem content" to "lorem.txt"
And user "Alice" has logged in using the webUI
When the user browses to display the "versions" details of file "lorem.txt"
When the user downloads a file of a previous version using the webUI
Then file "lorem.txt" should be downloaded successfully

12 changes: 12 additions & 0 deletions tests/acceptance/pageObjects/FilesPageElement/versionsDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ module.exports = {
.initAjaxCounters()
.click('@restorePreviousVersion')
.waitForOutstandingAjaxCalls()
},
/**
* @returns {*}
*/
downloadFilePreviousVersion: function() {
return this.waitForElementVisible('@downloadPreviousVersion').click(
'@downloadPreviousVersion'
)
}
},
elements: {
Expand All @@ -29,6 +37,10 @@ module.exports = {
selector:
'(//div[contains(@id,"oc-file-versions")]//tbody/tr[@class="file-row"])[1]//button[1]',
locateStrategy: 'xpath'
},
downloadPreviousVersion: {
selector: '//button[contains(@aria-label, "Download older version")]',
locateStrategy: 'xpath'
}
}
}
9 changes: 9 additions & 0 deletions tests/acceptance/stepDefinitions/filesContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,10 @@ When('the user restores the file to last version using the webUI', function() {
return client.page.FilesPageElement.versionsDialog().restoreToPreviousVersion()
})

When('the user downloads a file of a previous version using the webUI', function() {
return client.page.FilesPageElement.versionsDialog().downloadFilePreviousVersion()
})

When('the user/public reloads the current page of the webUI', function() {
return client.refresh()
})
Expand Down Expand Up @@ -1153,6 +1157,11 @@ When('the user downloads file/folder {string} using the webUI', function(file) {
return client.page.FilesPageElement.filesList().downloadFile(file)
})

Then('file {string} should be downloaded successfully', function(file) {
client.pause(5000) // We should waiting for the file to download
return client.checkFileExists(path.join(__dirname, '/../download/', file))
})

Then('the following resources should have share indicators on the webUI', async function(
dataTable
) {
Expand Down

0 comments on commit 9493b89

Please sign in to comment.