mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-08 05:09:46 -06:00
Add acceptance tests
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
<oc-grid gutter="small">
|
||||
<label>
|
||||
<oc-text-input
|
||||
id="accounts-new-account-input-username"
|
||||
type="text"
|
||||
v-model="username"
|
||||
:error-message="usernameError"
|
||||
@@ -14,6 +15,7 @@
|
||||
</label>
|
||||
<label>
|
||||
<oc-text-input
|
||||
id="accounts-new-account-input-email"
|
||||
type="email"
|
||||
v-model="email"
|
||||
:error-message="emailError"
|
||||
@@ -25,6 +27,7 @@
|
||||
<label>
|
||||
<div class="uk-flex uk-flex-middle">
|
||||
<oc-text-input
|
||||
id="accounts-new-account-input-password"
|
||||
:type="passwordInputType"
|
||||
v-model="password"
|
||||
:error-message="passwordError"
|
||||
@@ -40,7 +43,7 @@
|
||||
</label>
|
||||
<div>
|
||||
<oc-button v-text="$gettext('Cancel')" @click="emitCancel" class="uk-margin-xsmall-right" />
|
||||
<oc-button v-text="$gettext('Create')" variation="primary" @click="createAccount" />
|
||||
<oc-button id="accounts-new-account-button-confirm" v-text="$gettext('Create')" variation="primary" @click="createAccount" />
|
||||
</div>
|
||||
</oc-grid>
|
||||
</oc-table-cell>
|
||||
|
||||
@@ -59,3 +59,15 @@ Feature: Accounts
|
||||
Then the status indicator of user "einstein,marie" should be "enabled" on the WebUI
|
||||
# And user "einstein" should be able to log in
|
||||
# And user "marie" should be able to log in
|
||||
|
||||
Scenario: create a user
|
||||
Given user "Moss" has logged in using the webUI
|
||||
And the user browses to the accounts page
|
||||
When the user creates a new user with username "bob", email "bob@example.org" and password "bob" using the WebUI
|
||||
Then user "bob" should be displayed in the accounts list on the WebUI
|
||||
|
||||
Scenario: delete a user
|
||||
Given user "Moss" has logged in using the webUI
|
||||
And the user browses to the accounts page
|
||||
When the user deletes user "bob" using the WebUI
|
||||
Then user "bob" should not be displayed in the accounts list on the WebUI
|
||||
@@ -43,17 +43,9 @@ module.exports = {
|
||||
},
|
||||
|
||||
toggleUserStatus: function (usernames, status) {
|
||||
usernames = usernames.split(',')
|
||||
const actionSelector = status === 'enabled' ? this.elements.enableAction : this.elements.disableAction
|
||||
|
||||
// Select users
|
||||
for (const username of usernames) {
|
||||
const checkboxSelector =
|
||||
util.format(this.elements.rowByUsername.selector, username) +
|
||||
this.elements.rowCheckbox.selector
|
||||
|
||||
this.useXpath().click(checkboxSelector)
|
||||
}
|
||||
this.selectUsers(usernames)
|
||||
|
||||
return this
|
||||
.waitForElementVisible('@actionsDropdownTrigger')
|
||||
@@ -76,6 +68,37 @@ module.exports = {
|
||||
}
|
||||
|
||||
return this
|
||||
},
|
||||
|
||||
deleteUsers: function (usernames) {
|
||||
this.selectUsers(usernames)
|
||||
|
||||
return this
|
||||
.waitForElementVisible('@actionsDropdownTrigger')
|
||||
.click('@actionsDropdownTrigger')
|
||||
.click('@newAccountButtonConfirm')
|
||||
},
|
||||
|
||||
selectUsers: function (usernames) {
|
||||
usernames = usernames.split(',')
|
||||
|
||||
for (const username of usernames) {
|
||||
const checkboxSelector =
|
||||
util.format(this.elements.rowByUsername.selector, username) +
|
||||
this.elements.rowCheckbox.selector
|
||||
|
||||
this.useXpath().click(checkboxSelector)
|
||||
}
|
||||
|
||||
return this
|
||||
},
|
||||
|
||||
createUser: function (username, email, password) {
|
||||
return this
|
||||
.setValue('@newAccountInputUsername', username)
|
||||
.setValue('@newAccountInputEmail', email)
|
||||
.setValue('@newAccountInputPassword', password)
|
||||
.click('@newAccountButtonConfirm')
|
||||
}
|
||||
},
|
||||
|
||||
@@ -129,6 +152,18 @@ module.exports = {
|
||||
statusIndicator: {
|
||||
selector: '//span[contains(@class, "accounts-status-indicator-%s")]',
|
||||
locateStrategy: 'xpath'
|
||||
},
|
||||
newAccountInputUsername: {
|
||||
selector: '#accounts-new-account-input-username'
|
||||
},
|
||||
newAccountInputEmail: {
|
||||
selector: '#accounts-new-account-input-email'
|
||||
},
|
||||
newAccountInputPassword: {
|
||||
selector: '#accounts-new-account-input-password'
|
||||
},
|
||||
newAccountButtonConfirm: {
|
||||
selector: '#accounts-new-account-button-confirm'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,3 +42,14 @@ When('the user enables user/users {string} using the WebUI', function (usernames
|
||||
Then('the status indicator of user/users {string} should be {string} on the WebUI', function (usernames, status) {
|
||||
return client.page.accountsPage().checkUsersStatus(usernames, status)
|
||||
})
|
||||
|
||||
When(
|
||||
'the user creates a new user with username {string}, email {email} and password {password} using the WebUI',
|
||||
function (username, email, password) {
|
||||
return client.page.accountsPage().createUser(username, email, password)
|
||||
}
|
||||
)
|
||||
|
||||
When('the user deletes user/users {string} using the WebUI', function (usernames) {
|
||||
return client.page.accounts().deleteUsers(usernames)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user