Fix step definition for checking deleted users

This commit is contained in:
Benedikt Kulmann
2020-09-09 18:03:08 +02:00
parent 4d0b7ea86b
commit 2b8dab06df
2 changed files with 14 additions and 7 deletions

View File

@@ -14,13 +14,14 @@ module.exports = {
return this.waitForElementVisible('@accountsListTable')
},
isUserListed: async function (username) {
let user
const usernameInTable = util.format(this.elements.userInAccountsList.selector, username)
await this.useXpath().waitForElementVisible(usernameInTable)
.getText(usernameInTable, (result) => {
user = result
})
return user.value
return true
},
isUserDeleted: async function (username) {
const usernameInTable = util.format(this.elements.userInAccountsList.selector, username)
await this.useXpath().waitForElementNotPresent(usernameInTable)
return true
},
selectRole: function (username, role) {

View File

@@ -7,9 +7,15 @@ When('the user browses to the accounts page', function () {
})
Then('user {string} should be displayed in the accounts list on the WebUI', async function (username) {
await client.page.accountsPage().accountsList(username)
await client.page.accountsPage().accountsList()
const userListed = await client.page.accountsPage().isUserListed(username)
return assert.strictEqual(userListed, username)
return assert.strictEqual(userListed, true)
})
Then('user {string} should not be displayed in the accounts list on the WebUI', async function (username) {
await client.page.accountsPage().accountsList()
const userDeleted = await client.page.accountsPage().isUserDeleted(username)
return assert.strictEqual(userDeleted, true)
})
Given('the user has changed the role of user {string} to {string}', function (username, role) {