[ADF-4197] Automation test for redirection after page reload (#4412)

* [ADF-4197] Automation test for redirection after page reload

* Removing browser sleep
This commit is contained in:
Marouan Bentaleb
2019-03-13 14:54:04 +00:00
committed by Eugenio Romano
parent 250e5e52c4
commit 5193a42983
3 changed files with 70 additions and 4 deletions

View File

@@ -1,5 +1,5 @@
<header class="adf-logout-background"> <header class="adf-logout-background">
<div class="adf-logout-section"> <div class="adf-logout-section" data-automation-id="adf-logout-section">
<div class="adf-logout-headline"> <div class="adf-logout-headline">
<h1>{{ 'APP.LOGOUT.TITLE' | translate}}</h1> <h1>{{ 'APP.LOGOUT.TITLE' | translate}}</h1>
<h2>{{ 'APP.LOGOUT.SUB_TITLE' | translate}}</h2> <h2>{{ 'APP.LOGOUT.SUB_TITLE' | translate}}</h2>

View File

@@ -31,6 +31,7 @@ import AlfrescoApi = require('alfresco-js-api-node');
import { Util } from '../../util/util'; import { Util } from '../../util/util';
import { UploadActions } from '../../actions/ACS/upload.actions'; import { UploadActions } from '../../actions/ACS/upload.actions';
import { LogoutPage } from '../../pages/adf/demo-shell/logoutPage';
describe('Login component - Redirect', () => { describe('Login component - Redirect', () => {
@@ -47,6 +48,7 @@ describe('Login component - Redirect', () => {
}); });
let uploadedFolder; let uploadedFolder;
let uploadActions = new UploadActions(); let uploadActions = new UploadActions();
const logoutPage = new LogoutPage();
beforeAll(async (done) => { beforeAll(async (done) => {
this.alfrescoJsApi = new AlfrescoApi({ this.alfrescoJsApi = new AlfrescoApi({
@@ -119,11 +121,11 @@ describe('Login component - Redirect', () => {
expect(actualUrl).toEqual(TestConfig.adf.url + '/files/' + uploadedFolder.entry.id); expect(actualUrl).toEqual(TestConfig.adf.url + '/files/' + uploadedFolder.entry.id);
}); });
browser.driver.sleep(1000); contentServicesPage.waitForTableBody();
navigationBarPage.clickLogoutButton(); navigationBarPage.clickLogoutButton();
browser.driver.sleep(1000); logoutPage.checkLogoutSectionIsDisplayed();
navigationBarPage.openContentServicesFolder(uploadedFolder.entry.id); navigationBarPage.openContentServicesFolder(uploadedFolder.entry.id);
@@ -132,7 +134,43 @@ describe('Login component - Redirect', () => {
loginPage.enterPassword(user.password); loginPage.enterPassword(user.password);
loginPage.clickSignInButton(); 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) => { browser.getCurrentUrl().then((actualUrl) => {
expect(actualUrl).toEqual(TestConfig.adf.url + '/files/' + uploadedFolder.entry.id); expect(actualUrl).toEqual(TestConfig.adf.url + '/files/' + uploadedFolder.entry.id);

View File

@@ -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);
}
}