Skip to content
This repository has been archived by the owner on Jan 27, 2021. It is now read-only.

Commit

Permalink
Merge pull request #107 from owncloud/tests-accounts-update-roles
Browse files Browse the repository at this point in the history
[Tests-Only ] webUI tests for non-admin user and guest user
  • Loading branch information
swoichha authored Sep 3, 2020
2 parents a8a95bc + 3910f37 commit 4598747
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
19 changes: 17 additions & 2 deletions ui/tests/acceptance/features/accounts.feature
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -9,11 +9,26 @@ 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
When the user changes the role of user "einstein" to "Admin" using the WebUI
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
4 changes: 4 additions & 0 deletions ui/tests/acceptance/pageobjects/accountsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
}
}
13 changes: 12 additions & 1 deletion ui/tests/acceptance/stepDefinitions/accountsContext.js
Original file line number Diff line number Diff line change
@@ -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()
Expand All @@ -12,10 +12,21 @@ 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)
})

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')
})

0 comments on commit 4598747

Please sign in to comment.