Skip to content

Commit

Permalink
Merge pull request #2153 from jasson99/create-file
Browse files Browse the repository at this point in the history
Acceptance test to create hidden file
  • Loading branch information
DeepDiver1975 authored Oct 25, 2019
2 parents b6419a8 + 61039ee commit dd459c8
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 1 deletion.
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) {
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

0 comments on commit dd459c8

Please sign in to comment.