Skip to content

Commit

Permalink
Merge pull request #4543 from owncloud/test-user-session
Browse files Browse the repository at this point in the history
[Tests-Only] Add ui test for checking the browser session of deleted user
  • Loading branch information
dpakach authored Dec 29, 2020
2 parents 65aa114 + 29a2091 commit 62d3be6
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/acceptance/expected-failures-with-oc10-server.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@
#
webUIPreview/imageMediaViewer.feature:70
webUIPreview/imageMediaViewer.feature:76

# https://github.com/owncloud/web/issues/4564 authentication dialog appears when user is deleted
webUILogin/login.feature:59
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@
#
webUIPreview/imageMediaViewer.feature:70
webUIPreview/imageMediaViewer.feature:76

# https://github.com/owncloud/web/issues/4564 authentication dialog appears when user is deleted
# https://github.com/owncloud/ocis/issues/1129 login error page loops when logged in user is deleted
webUILogin/login.feature:59
11 changes: 11 additions & 0 deletions tests/acceptance/features/webUILogin/login.feature
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,14 @@ Feature: login users
Then the files table should be displayed
# Then the warning 'Logon failed. Please verify your credentials and try again.' should be displayed on the login page

Scenario: the user session of a deleted user is cleared properly
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
And user "user1" has been deleted
When the user reloads the current page of the webUI
Then the user should be redirected to the login error page
When the user exits the login error page
Then the user should be redirected to the login page
27 changes: 27 additions & 0 deletions tests/acceptance/pageObjects/loginErrorPage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { join } from '../helpers/path'

module.exports = {
url: function() {
return join(this.api.launchUrl, '/#/access-denied')
},
elements: {
body: 'body',
loginErrorMessage: {
locateStrategy: 'xpath',
selector: '//span[@data-msgid="Login Error"]'
},
exitButton: {
selector: '#exitAnchor'
}
},
commands: {
waitTillLoaded: function() {
const element = this.elements.loginErrorMessage
return this.useStrategy(element).waitForElementVisible(element)
},
exit: function() {
const exitBtn = this.elements.exitButton
return this.waitForElementVisible(exitBtn).click(exitBtn)
}
}
}
8 changes: 8 additions & 0 deletions tests/acceptance/stepDefinitions/loginContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,11 @@ Then('the user should be redirected to the IdP login page', function() {

return client.page.ownCloudAuthorizePage().waitForPage()
})

Then('the user should be redirected to the login error page', function() {
return client.page.loginErrorPage().waitTillLoaded()
})

When('the user exits the login error page', function() {
return client.page.loginErrorPage().exit()
})
4 changes: 4 additions & 0 deletions tests/acceptance/stepDefinitions/provisioningContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ Given('user {string} has been created with default attributes', async function(u
await initUser(userId)
})

Given('user {string} has been deleted', function(userId) {
return deleteUser(userId)
})

Given('user {string} has been created with default attributes on remote server', function(userId) {
return backendHelper.runOnRemoteBackend(async function() {
await deleteUser()
Expand Down

0 comments on commit 62d3be6

Please sign in to comment.