Skip to content

Commit

Permalink
Merge pull request #2100 from owncloud/tests-logout-step
Browse files Browse the repository at this point in the history
Added logout step for acceptance tests
  • Loading branch information
Vincent Petry authored Oct 1, 2019
2 parents 0370481 + 874e8ae commit 5b65bb3
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/Menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<translate>Account</translate>
</oc-sidebar-nav-item>

<oc-sidebar-nav-item active icon="exit_to_app" @click="logout()" :isolate="true">{{ _logoutItemText }}</oc-sidebar-nav-item>
<oc-sidebar-nav-item id="logoutMenuItem" active icon="exit_to_app" @click="logout()" :isolate="true">{{ _logoutItemText }}</oc-sidebar-nav-item>

<span class="uk-position-bottom uk-padding-small">Version: {{appVersion.version}}-{{appVersion.hash}} ({{appVersion.buildDate}})</span>
</oc-application-menu>
Expand Down
10 changes: 10 additions & 0 deletions tests/acceptance/features/webUILogin/login.feature
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,13 @@ Feature: login users
And the user authorizes access to phoenix
Then the files table should be displayed
And the files table should not be empty

Scenario: logging out
Given these users have been created with default attributes:
| username |
| user1 |
And user "user1" has logged in using the webUI
And the user has browsed to the files page
When the user logs out of the webUI
Then the authentication page should be visible

11 changes: 11 additions & 0 deletions tests/acceptance/helpers/loginHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,16 @@ module.exports = {
await startWebDriver({ env })
await createSession({ env })
return this.loginAsUser(userId)
},

logout: function (userId) {
const phoenixPage = client.page.phoenixPage()
return phoenixPage
.navigate()
.waitForElementVisible('@menuButton')
.click('@menuButton')
.waitForElementVisible('@logoutMenuItem')
.waitForAnimationToFinish()
.click('@logoutMenuItem')
}
}
3 changes: 3 additions & 0 deletions tests/acceptance/pageObjects/phoenixPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ module.exports = {
selector: '//ul[contains(@class, "oc-main-menu")]/li/a[contains(text(),"%s")]',
locateStrategy: 'xpath'
},
logoutMenuItem: {
selector: '#logoutMenuItem'
},
messageCloseIcon: {
selector: '.oc-alert-close-icon'
}
Expand Down
12 changes: 12 additions & 0 deletions tests/acceptance/stepDefinitions/loginContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,23 @@ Then('the files table should not be empty',
.waitForElementVisible('@fileRows')
})

Then('the authentication page should be visible',
() => {
const loginPage = client
.page.loginPage()
return loginPage
.waitForElementPresent('@authenticateButton')
})

// combined step
Given('user {string} has logged in using the webUI', (user) => {
return loginHelper.loginAsUser(user)
})

When('the user logs out of the webUI', () => {
return loginHelper.logout()
})

When('the user re-logs in as {string} using the webUI', (user) => {
return loginHelper.reLoginAsUser(user)
})

0 comments on commit 5b65bb3

Please sign in to comment.