diff --git a/demo-shell/src/app/components/logout/logout.component.html b/demo-shell/src/app/components/logout/logout.component.html index e156a55850..1ed2d72e02 100644 --- a/demo-shell/src/app/components/logout/logout.component.html +++ b/demo-shell/src/app/components/logout/logout.component.html @@ -1,5 +1,5 @@
-
+

{{ 'APP.LOGOUT.TITLE' | translate}}

{{ 'APP.LOGOUT.SUB_TITLE' | translate}}

diff --git a/e2e/core/login/redirection.e2e.ts b/e2e/core/login/redirection.e2e.ts index 357119e4c0..3c53c8e60a 100644 --- a/e2e/core/login/redirection.e2e.ts +++ b/e2e/core/login/redirection.e2e.ts @@ -31,6 +31,7 @@ import AlfrescoApi = require('alfresco-js-api-node'); import { Util } from '../../util/util'; import { UploadActions } from '../../actions/ACS/upload.actions'; +import { LogoutPage } from '../../pages/adf/demo-shell/logoutPage'; describe('Login component - Redirect', () => { @@ -47,6 +48,7 @@ describe('Login component - Redirect', () => { }); let uploadedFolder; let uploadActions = new UploadActions(); + const logoutPage = new LogoutPage(); beforeAll(async (done) => { this.alfrescoJsApi = new AlfrescoApi({ @@ -119,11 +121,11 @@ describe('Login component - Redirect', () => { expect(actualUrl).toEqual(TestConfig.adf.url + '/files/' + uploadedFolder.entry.id); }); - browser.driver.sleep(1000); + contentServicesPage.waitForTableBody(); navigationBarPage.clickLogoutButton(); - browser.driver.sleep(1000); + logoutPage.checkLogoutSectionIsDisplayed(); navigationBarPage.openContentServicesFolder(uploadedFolder.entry.id); @@ -132,7 +134,43 @@ describe('Login component - Redirect', () => { loginPage.enterPassword(user.password); loginPage.clickSignInButton(); - browser.driver.sleep(1000); + navigationBarPage.checkMenuButtonIsDisplayed(); + + browser.getCurrentUrl().then((actualUrl) => { + expect(actualUrl).toEqual(TestConfig.adf.url + '/files/' + uploadedFolder.entry.id); + }); + }); + + }); + + it('[C299161] Should redirect user to requested URL after reloading login page', () => { + settingsPage.setProviderEcm(); + loginPage.login(user.id, user.password); + + browser.controlFlow().execute(async () => { + + navigationBarPage.openContentServicesFolder(uploadedFolder.entry.id); + + browser.getCurrentUrl().then((actualUrl) => { + expect(actualUrl).toEqual(TestConfig.adf.url + '/files/' + uploadedFolder.entry.id); + }); + + contentServicesPage.waitForTableBody(); + + navigationBarPage.clickLogoutButton(); + + logoutPage.checkLogoutSectionIsDisplayed(); + + navigationBarPage.openContentServicesFolder(uploadedFolder.entry.id); + loginPage.waitForElements(); + browser.refresh(); + loginPage.waitForElements(); + + loginPage.enterUsername(user.id); + loginPage.enterPassword(user.password); + loginPage.clickSignInButton(); + + navigationBarPage.checkMenuButtonIsDisplayed(); browser.getCurrentUrl().then((actualUrl) => { expect(actualUrl).toEqual(TestConfig.adf.url + '/files/' + uploadedFolder.entry.id); diff --git a/e2e/pages/adf/demo-shell/logoutPage.ts b/e2e/pages/adf/demo-shell/logoutPage.ts new file mode 100644 index 0000000000..385109c538 --- /dev/null +++ b/e2e/pages/adf/demo-shell/logoutPage.ts @@ -0,0 +1,28 @@ +/*! + * @license + * Copyright 2019 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { by, element } from 'protractor'; +import { Util } from '../../../util/util'; + +export class LogoutPage { + + logoutSection = element(by.css('div[data-automation-id="adf-logout-section"]')); + + checkLogoutSectionIsDisplayed() { + return Util.waitUntilElementIsVisible(this.logoutSection); + } +}