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

[tests-only] add test download previos version of file. Add check download file #5661

Closed
wants to merge 4 commits into from
Closed
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
22 changes: 22 additions & 0 deletions .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -1338,6 +1338,9 @@ def acceptance(ctx):
# Copy files for upload
steps += copyFilesForUpload()

# Add folder download to volume
steps += addDownloadToVolume()

# run the acceptance tests
steps += runWebuiAcceptanceTests(ctx, suite, alternateSuiteName, params["filterTags"], params["extraEnvironment"], browser, params["visualTesting"], params["screenShots"])

Expand Down Expand Up @@ -1509,6 +1512,9 @@ def browserService(alternateSuiteName, browser):
"volumes": [{
"name": "uploads",
"path": "/uploads",
}, {
"name": "download",
"path": "/home/seluser/Downloads",
}],
}]

Expand All @@ -1519,6 +1525,9 @@ def browserService(alternateSuiteName, browser):
"volumes": [{
"name": "uploads",
"path": "/uploads",
}, {
"name": "download",
"path": "/home/seluser/Downloads",
}],
}]

Expand Down Expand Up @@ -2284,6 +2293,19 @@ def copyFilesForUpload():
}]

def runWebuiAcceptanceTests(ctx, suite, alternateSuiteName, filterTags, extraEnvironment, browser, visualTesting, screenShots):

def addDownloadToVolume():
return [{
"name": "add-folder-download",
"pull": "always",
"image": "selenium/standalone-firefox-debug:3.141.59",
"volumes": [{
"name": "download",
"path": "tests/acceptance/download",
}]
}]

def runWebuiAcceptanceTests(suite, alternateSuiteName, filterTags, extraEnvironment, browser, visualTesting, screenShots):
environment = {}
if (filterTags != ""):
environment["TEST_TAGS"] = filterTags
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,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 @@ -199,3 +199,5 @@ Other free text and markdown formatting can be used elsewhere in the document if
- [webUISharingFilePermissionsGroups/sharePermissionsGroup.feature:66](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUISharingFilePermissionsGroups/sharePermissionsGroup.feature#L66)
- [webUISharingPermissionToRoot/shareFileWithMultipleUsers.feature:66](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUISharingPermissionToRoot/shareFileWithMultipleUsers.feature#L66)

### [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 @@ -122,8 +122,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
11 changes: 10 additions & 1 deletion tests/acceptance/features/webUIFiles/download.feature
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,17 @@ Feature: download files
And as "Alice" file "lorem.txt" should not exist


# don't work in chrome
@skip
Scenario: download file with comma in the filename
Given user "Alice" has created file "sample,1.txt"
When the user has browsed 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


Scenario: download file
Given user "Alice" has created file "lorem.txt"
When the user browses to the files page
And the user downloads file "lorem.txt" using the webUI
Then file "lorem.txt" should be downloaded successfully
31 changes: 21 additions & 10 deletions tests/acceptance/features/webUIFilesActionMenu/versions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +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 the setting "shareapi_auto_accept_share" of app "core" has been set to "no"
And the administrator has set the default folder for received shares to "Shares"
And user "user0" has uploaded file with content "a text file" to "lorem.txt"
And user "user0" has shared file "lorem.txt" with user "Alice" with "all" permissions
And user "Alice" has accepted the share "Shares/lorem.txt" offered by user "user0"
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
When the user opens folder "Shares" using the webUI
And the user uploads overwriting file "lorem.txt" 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
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'
}
}
}
32 changes: 30 additions & 2 deletions tests/acceptance/stepDefinitions/filesContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,12 @@ When('the user restores the file to last version using the webUI', function () {
return client.page.FilesPageElement.versionsDialog().restoreToPreviousVersion()
})

When('the user/public reloads the current page of the webUI', function () {

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 @@ -1247,8 +1252,31 @@ Then(
']'
)
}
Then('file {string} should be downloaded successfully', function(file) {
client.pause(2000) // 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
) {
for (const { fileName, expectedIndicators } of dataTable.hashes()) {
const indicatorsArray = await client.page.FilesPageElement.filesList().getShareIndicatorsForResourceWithRetry(
fileName,
true
)
const expectedIndicatorsArray = expectedIndicators.split(',').map(s => s.trim())
assert.ok(
_.intersection(indicatorsArray, expectedIndicatorsArray).length ===
expectedIndicatorsArray.length,
`Expected share indicators to be the same for "${fileName}": expected [` +
expectedIndicatorsArray.join(', ') +
'] got [' +
indicatorsArray.join(', ') +
']'
)
}
)
})

Then(
'the following resources should not have share indicators on the webUI',
Expand Down