Add basic test scenario

This commit is contained in:
Lukas Hirt
2020-08-21 11:45:04 +02:00
committed by Benedikt Kulmann
parent 74bb429a34
commit f8fa36381c
4 changed files with 54 additions and 5 deletions
@@ -21,6 +21,25 @@ module.exports = {
user = result
})
return user.value
},
selectRole: function (username, role) {
const roleSelector =
util.format(this.elements.rowByUsername.selector, username) +
util.format(this.elements.roleInRolesDropdown.selector, role)
return this
.click('@rolesDropdownTrigger')
.waitForElementVisible(roleSelector)
.click(roleSelector)
},
checkUsersRole: function (username, role) {
const roleSelector =
util.format(this.elements.rowByUsername.selector, username) +
util.format(this.elements.currentRole.selector, role)
return this.useXpath().expect.element(roleSelector).to.be.visible
}
},
@@ -36,6 +55,22 @@ module.exports = {
userInAccountsList: {
selector: '//table//td[text()="%s"]',
locateStrategy: 'xpath'
},
rowByUsername: {
selector: '//table//td[text()="%s"]/ancestor::tr',
locateStrategy: 'xpath'
},
currentRole: {
selector: '//span[contains(@class, "accounts-roles-current-role") and text()="%s"]',
locateStrategy: 'xpath'
},
roleInRolesDropdown: {
selector: '//label[@class="accounts-roles-dropdown-role" and normalize-space()="%s"]',
locateStrategy: 'xpath'
},
rolesDropdownTrigger: {
selector: '//button[@class="accounts-roles-select-trigger"]',
locateStrategy: 'xpath'
}
}
}