Merge pull request #107 from owncloud/tests-accounts-update-roles

[Tests-Only ] webUI tests for non-admin user and guest user
This commit is contained in:
Swoichha Adhikari
2020-09-03 17:01:09 +05:45
committed by GitHub
3 changed files with 33 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
Feature: Accounts
Scenario: list accounts
Scenario: admin checks accounts list
Given user "Moss" has logged in using the webUI
When the user browses to the accounts page
Then user "einstein" should be displayed in the accounts list on the WebUI
@@ -9,7 +9,7 @@ Feature: Accounts
And user "reva" should be displayed in the accounts list on the WebUI
And user "richard" should be displayed in the accounts list on the WebUI
Scenario: change users role
Scenario: admin changes non-admin user's role to admin
Given user "Moss" has logged in using the webUI
When the user browses to the accounts page
Then user "einstein" should be displayed in the accounts list on the WebUI
@@ -17,3 +17,18 @@ Feature: Accounts
Then the displayed role of user "einstein" should be "Admin" on the WebUI
When the user reloads the current page of the webUI
Then the displayed role of user "einstein" should be "Admin" on the WebUI
Scenario: regular user should not be able to see accounts list
Given user "Marie" has logged in using the webUI
When the user browses to the accounts page
Then the user should not be able to see the accounts list on the WebUI
Scenario: guest user should not be able to see accounts list
Given user "Moss" has logged in using the webUI
When the user browses to the accounts page
Then user "einstein" should be displayed in the accounts list on the WebUI
When the user changes the role of user "einstein" to "Guest" using the WebUI
And the user logs out of the webUI
And user "Einstein" logs in using the webUI
And the user browses to the accounts page
Then the user should not be able to see the accounts list on the WebUI

View File

@@ -71,6 +71,10 @@ module.exports = {
rolesDropdownTrigger: {
selector: '//button[contains(@class, "accounts-roles-select-trigger")]',
locateStrategy: 'xpath'
},
loadingAccountsList: {
selector: '//div[contains(@class, "oc-loader")]',
locateStrategy: 'xpath'
}
}
}

View File

@@ -1,6 +1,6 @@
const assert = require('assert')
const { client } = require('nightwatch-api')
const { When, Then } = require('cucumber')
const { Given, When, Then } = require('cucumber')
When('the user browses to the accounts page', function () {
return client.page.accountsPage().navigateAndWaitTillLoaded()
@@ -12,6 +12,10 @@ Then('user {string} should be displayed in the accounts list on the WebUI', asyn
return assert.strictEqual(userListed, username)
})
Given('the user has changed the role of user {string} to {string}', function (username, role) {
return client.page.accountsPage().selectRole(username, role)
})
When('the user changes the role of user {string} to {string} using the WebUI', function (username, role) {
return client.page.accountsPage().selectRole(username, role)
})
@@ -19,3 +23,10 @@ When('the user changes the role of user {string} to {string} using the WebUI', f
Then('the displayed role of user {string} should be {string} on the WebUI', function (username, role) {
return client.page.accountsPage().checkUsersRole(username, role)
})
Then('the user should not be able to see the accounts list on the WebUI', async function () {
return client.page.accountsPage()
.waitForAjaxCallsToStartAndFinish()
.waitForElementVisible('@loadingAccountsList')
.waitForElementNotPresent('@accountsListTable')
})