Skip to content

Commit

Permalink
Merge pull request #2806 from owncloud/userProfile
Browse files Browse the repository at this point in the history
Acceptance test to view user profile
  • Loading branch information
jasson99 authored Jan 8, 2020
2 parents fb1ab46 + 9abb5ba commit bdf0953
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/UserMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</oc-grid>
</oc-button>
<oc-drop toggle="#_userMenuButton" mode="click" :options="{pos:'bottom-right'}" class="uk-width-large" ref="menu">
<div class="uk-card-body uk-flex uk-flex-middle uk-flex-column">
<div class="uk-card-body uk-flex uk-flex-middle uk-flex-column" id="account-info-container">
<avatar
:userid="userId"
:userName="userDisplayName"
Expand Down
19 changes: 19 additions & 0 deletions tests/acceptance/features/webUIAccount/userProfile.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Feature: view profile
As a user
I want to be able to view and browse to my profile
So that I can manage my account

Background:
Given user "user1" has been created with default attributes

Scenario: view user profile for the logged in user
When user "user1" logs in using the webUI
Then the user profile should be visible in the webUI
When the user opens the user profile
Then username "User One" should be visible in the webUI

Scenario: browse to account page to manage user account
Given user "user1" has logged in using the webUI
When the user opens the user profile
And the user browses to manage the account
Then the accounts page should be visible in the webUI
14 changes: 13 additions & 1 deletion tests/acceptance/pageObjects/accountPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,23 @@ module.exports = {
logout: function () {
return this.waitForElementVisible('@logoutButton')
.click('@logoutButton')
},
isPageVisible: async function () {
let isVisible = false
const handle = []
await this.api.windowHandles(function (result) {
handle.push(result.value[1])
})
await this.api.switchWindow(handle[0])
await this.api.element('@accountDisplay', result => {
isVisible = Object.keys(result.value).length > 0
})
return isVisible
}
},
elements: {
accountDisplay: {
selector: '//div//span[@data-msgid="Account"]',
selector: '//div//span[.="Account"]',
locateStrategy: 'xpath'
},
accountInformationElements: {
Expand Down
3 changes: 3 additions & 0 deletions tests/acceptance/pageObjects/phoenixPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ module.exports = {
for (const btn of cancelButtons) {
await this.api.elementIdClick(btn.ELEMENT).waitForAnimationToFinish()
}
},
browseToUserProfile: function () {
return this.click('@userMenuButton')
}
},
elements: {
Expand Down
33 changes: 33 additions & 0 deletions tests/acceptance/pageObjects/profilePage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
module.exports = {
commands: {
getUserProfileName: async function () {
let userInfo
await this
.waitForElementVisible('@profileInfoContainer')
.waitForElementVisible('@userProfileName')
.api.element('@userProfileName', result => {
this.api.elementIdText(result.value.ELEMENT, text => {
userInfo = text.value
})
})
return userInfo
},
browseToManageAccount: function () {
return this.waitForElementVisible('@manageAccount')
.click('@manageAccount')
}
},
elements: {
profileInfoContainer: {
selector: '#account-info-container'
},
userProfileName: {
selector: '//div/h3[@class="uk-card-title"]',
locateStrategy: 'xpath'
},
manageAccount: {
selector: '//div//span[.="Manage your account"]',
locateStrategy: 'xpath'
}
}
}
22 changes: 22 additions & 0 deletions tests/acceptance/stepDefinitions/loginContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,25 @@ When('the user logs out of the webUI', () => {
When('the user re-logs in as {string} using the webUI', (user) => {
return loginHelper.reLoginAsUser(user)
})

Then('the user profile should be visible in the webUI', function () {
return client.page.phoenixPage().waitForElementVisible('@userMenuButton')
})

When('the user opens the user profile', function () {
return client.page.phoenixPage().browseToUserProfile()
})

Then('username {string} should be visible in the webUI', async function (username) {
const profileUserName = await client.page.profilePage().getUserProfileName()
assert.strictEqual(profileUserName, username)
})

When('the user browses to manage the account', function () {
return client.page.profilePage().browseToManageAccount()
})

Then('the accounts page should be visible in the webUI', async function () {
const isPageVisible = await client.page.accountPage().isPageVisible()
return assert.ok(isPageVisible)
})

0 comments on commit bdf0953

Please sign in to comment.