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

Acceptance test to create hidden file #2153

Merged
merged 1 commit into from
Oct 25, 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
7 changes: 7 additions & 0 deletions tests/acceptance/features/webUIFiles/hiddenFile.feature
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,10 @@ Feature: Hide file/folders
Then folder ".xyz" should not be listed on the webUI
When the user enables the setting to view hidden folders on the webUI
Then folder ".xyz" should be listed on the webUI

Scenario: create a hidden file
When the user creates a file with the name ".hiddenFile.txt" using the webUI
And the user browses to the files page
Then file ".hiddenFile.txt" should not be listed on the webUI
When the user enables the setting to view hidden files on the webUI
Then file ".hiddenFile.txt" should be listed on the webUI
37 changes: 37 additions & 0 deletions tests/acceptance/pageObjects/filesPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,32 @@ module.exports = {
}
return this
},
/**
* Create a file with the given name
*
* @param {string} name to set or null to use default value from dialog
* @param {boolean} expectToSucceed
*/
createFile: function (name, expectToSucceed = true) {
jasson99 marked this conversation as resolved.
Show resolved Hide resolved
this
.waitForElementVisible('@newFileMenuButton')
.click('@newFileMenuButton')
.waitForElementVisible('@newFileButton')
.click('@newFileButton')
.waitForElementVisible('@newFileInput')
if (name !== null) {
this.clearValueWithEvent('@newFileInput')
this.setValue('@newFileInput', name)
}
this
.click('@newFileOkButton')
.waitForElementNotPresent('@createFileLoadingIndicator')
if (expectToSucceed) {
this.waitForElementNotVisible('@newFileDialog')
.waitForAnimationToFinish()
}
return this
},
selectFileForUpload: function (localFileName) {
return this
.waitForElementVisible('@newFileMenuButton')
Expand Down Expand Up @@ -236,9 +262,16 @@ module.exports = {
newFolderDialog: {
selector: '#new-folder-dialog'
},
newFileDialog: {
selector: '#new-file-dialog'
},
newFolderInput: {
selector: '#new-folder-input'
},
newFileInput: {
selector: "//input[@placeholder='Create new file…']",
locateStrategy: 'xpath'
},
newFolderOkButton: {
selector: '#new-folder-ok'
},
Expand Down Expand Up @@ -281,6 +314,10 @@ module.exports = {
selector: '//div[@id="new-folder-dialog"]//div[@class="oc-loader"]',
locateStrategy: 'xpath'
},
createFileLoadingIndicator: {
selector: '//div[@id="new-file-dialog"]//div[@class="oc-loader"]',
locateStrategy: 'xpath'
},
fileUploadButton: {
selector: '#files-file-upload-button'
},
Expand Down
6 changes: 5 additions & 1 deletion tests/acceptance/stepDefinitions/filesContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ When('the user creates a folder with the name {string} using the webUI', functio
return client.page.filesPage().createFolder(folderName)
})

When('the user creates a file with the name {string} using the webUI', function (fileName) {
return client.page.filesPage().createFile(fileName)
})

When('the user creates a folder with default name using the webUI', function () {
return client.page.filesPage().createFolder(null, false)
})
Expand All @@ -124,7 +128,7 @@ Given('the user has opened the share dialog for folder {string}', function (file
return client.page.FilesPageElement.filesList().openSharingDialog(fileName)
})

When('the user enables the setting to view hidden folders on the webUI', function () {
When('the user enables the setting to view hidden files/folders on the webUI', function () {
return client.page.filesPage().showHiddenFiles()
})

Expand Down