Skip to content

Commit

Permalink
Add test about non-clickable breadcrumb
Browse files Browse the repository at this point in the history
  • Loading branch information
kulmann committed Jul 2, 2020
1 parent e3d2948 commit bc3efe7
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 3 deletions.
10 changes: 10 additions & 0 deletions tests/acceptance/features/webUIFiles/breadcrumb.feature
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ Feature: access breadcrumb
When the user opens folder "simple-folder" using the webUI
Then breadcrumb for folder "simple-folder" should be displayed on the webUI

Scenario: Breadcrumb navigation should not happen on last segment
Given the property "rootFolder" has been set to "" in phoenix config file
And user "user1" has created folder "simple-folder/subfolder"
And user "user1" has logged in using the webUI
When the user opens folder "simple-folder" using the webUI
And the user opens folder "subfolder" using the webUI
And the user browses to folder "subfolder" using the breadcrumb on the webUI
Then clickable breadcrumb for folder "simple-folder" should be displayed on the webUI
And non-clickable breadcrumb for folder "subfolder" should be displayed on the webUI

@ocis-reva-issue-106
Scenario: Change rootFolder to simple-folder and check for the displayed files
Given the property "rootFolder" has been set to "simple-folder" in phoenix config file
Expand Down
23 changes: 23 additions & 0 deletions tests/acceptance/pageObjects/filesPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,25 @@ module.exports = {
.click(resourceXpath)
.useCss()
},
/**
* Gets the breadcrumb element selector for the provided combination of clickable
* and non-clickable breadcrumb segments.
* Note: the combination (false,false) is invalid.
*
* @param clickable Whether a clickable breadcrumb is wanted
* @param nonClickable Whether a non-clickable breadcrumb is wanted
* @returns {null|{locateStrategy: string, selector: string}}
*/
getBreadcrumbSelector: function(clickable, nonClickable) {
if (clickable && nonClickable) {
return this.elements.resourceBreadcrumb
} else if (clickable) {
return this.elements.resourceBreadcrumbClickable
} else if (nonClickable) {
return this.elements.resourceBreadcrumbNonClickable
}
return null
},
/**
* Create a folder with the given name
*
Expand Down Expand Up @@ -320,6 +339,10 @@ module.exports = {
selector: '//div[@id="files-breadcrumb"]//a[contains(text(),"%s")]',
locateStrategy: 'xpath'
},
resourceBreadcrumbNonClickable: {
selector: '//div[@id="files-breadcrumb"]//span[contains(text(),"%s")]',
locateStrategy: 'xpath'
},
fileUploadButton: {
selector: '#files-file-upload-button'
},
Expand Down
20 changes: 17 additions & 3 deletions tests/acceptance/stepDefinitions/filesContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,20 @@ Then('there should be no breadcrumb displayed on the webUI', function() {
return assertBreadCrumbIsNotDisplayed()
})

Then('non-clickable breadcrumb for folder {string} should be displayed on the webUI', function(
resource
) {
return assertBreadcrumbIsDisplayedFor(resource, false, true)
})

Then('clickable breadcrumb for folder {string} should be displayed on the webUI', function(
resource
) {
return assertBreadcrumbIsDisplayedFor(resource, true, false)
})

Then('breadcrumb for folder {string} should be displayed on the webUI', function(resource) {
return assertBreadcrumbIsDisplayedFor(resource)
return assertBreadcrumbIsDisplayedFor(resource, true, true)
})

/**
Expand Down Expand Up @@ -580,9 +592,11 @@ const assertBreadCrumbIsNotDisplayed = function() {
/**
*
* @param {string} resource
* @param {boolean} clickable
* @param {boolean} nonClickable
*/
const assertBreadcrumbIsDisplayedFor = function(resource) {
const breadcrumbElement = client.page.filesPage().elements.resourceBreadcrumb
const assertBreadcrumbIsDisplayedFor = function(resource, clickable, nonClickable) {
const breadcrumbElement = client.page.filesPage().getBreadcrumbSelector(clickable, nonClickable)
const resourceBreadcrumbXpath = util.format(breadcrumbElement.selector, resource)
return client
.useStrategy(breadcrumbElement)
Expand Down

0 comments on commit bc3efe7

Please sign in to comment.