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 29, 2020
1 parent 42f4d8b commit 307902b
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
@@ -1 +1,4 @@
# this file contains the scenarios from web tests that are currently expected to fail on oC10

https://github.com/owncloud/web/issues/4564
webUILogin/login.feature:59
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
# this file contains the scenarios from phoenix tests that are currently expected to fail on OCIS with owncloud storage

https://github.com/owncloud/web/issues/4564
https://github.com/owncloud/ocis/issues/1129
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 307902b

Please sign in to comment.