Skip to content

Commit

Permalink
[Tests-Only] Add ui test for checking the browser session of deleted …
Browse files Browse the repository at this point in the history
…user
  • Loading branch information
dpakach committed Dec 22, 2020
1 parent 769d204 commit 59154d1
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/acceptance/features/webUILogin/login.feature
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,22 @@ 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

@issue-1129
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 uploads file "new-lorem.txt" using the webUI
# Then the error message with header 'File upload failed…' should be displayed on the webUI
When the user reloads the current page of the webUI
# Then an alert box with title "sign in" must be displayed on the webUI
When the user dismisses the alert
# When the user logs out of the webUI
Then the user should be redirected to the login error page
When the user exits the login error page
# Uncomment this line once the issue is fixed
# Then the user should be redirected to the login page
Then the user should be redirected to the login error 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)
}
}
}
10 changes: 10 additions & 0 deletions tests/acceptance/stepDefinitions/generalContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,3 +302,13 @@ Given('default expiration date for users is set to {int} day/days', function(day

return this
})

Then('an alert box with title {string} must be displayed on the webUI', async function(title) {
await client.getAlertText(text => {
console.log(text)
})
})

When('the user dismisses the alert', async function() {
await client.dismissAlert()
})
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 59154d1

Please sign in to comment.