mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
[ACA-1569] Close dialogs on logout (#621)
* Close dialogs on logout * [ACA-1569] e2e tests * [ACA-1569] review required change on e2e test
This commit is contained in:
committed by
Denys Vuika
parent
aafa606ceb
commit
6e98721a62
84
e2e/suites/application/general.test.ts
Normal file
84
e2e/suites/application/general.test.ts
Normal file
@@ -0,0 +1,84 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2018 Alfresco Software Limited
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { browser } from 'protractor';
|
||||
import { BrowsingPage, LoginPage, LogoutPage } from '../../pages/pages';
|
||||
import { CreateOrEditFolderDialog } from '../../components/dialog/create-edit-folder-dialog';
|
||||
import { RepoClient } from '../../utilities/repo-client/repo-client';
|
||||
import { Utils } from '../../utilities/utils';
|
||||
|
||||
describe('General', () => {
|
||||
const loginPage = new LoginPage();
|
||||
const logoutPage = new LogoutPage();
|
||||
const page = new BrowsingPage();
|
||||
const createDialog = new CreateOrEditFolderDialog();
|
||||
const adminApi = new RepoClient();
|
||||
const { nodes: nodesApi, authentication: authApi } = adminApi;
|
||||
const folder = `folder-${Utils.random()}`;
|
||||
let folderId;
|
||||
xit('');
|
||||
|
||||
describe('on session expire', () => {
|
||||
beforeAll(async () => {
|
||||
folderId = (await nodesApi.createFolder(folder)).entry.id;
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await nodesApi.deleteNodeById(folderId);
|
||||
await logoutPage.load();
|
||||
});
|
||||
|
||||
it('should redirect user to login page' , async () => {
|
||||
await loginPage.loginWithAdmin();
|
||||
|
||||
await page.sidenav.openCreateDialog();
|
||||
await createDialog.waitForDialogToOpen();
|
||||
await createDialog.enterName(folder);
|
||||
|
||||
await authApi.logout();
|
||||
|
||||
await createDialog.clickCreate();
|
||||
expect(await browser.getTitle()).toContain('Sign in');
|
||||
});
|
||||
|
||||
it('should close opened dialogs', async () => {
|
||||
await loginPage.loginWithAdmin();
|
||||
|
||||
await page.sidenav.openCreateDialog();
|
||||
await createDialog.waitForDialogToOpen();
|
||||
await createDialog.enterName(folder);
|
||||
|
||||
await authApi.logout();
|
||||
|
||||
await createDialog.clickCreate();
|
||||
const message = await page.getSnackBarMessage();
|
||||
expect(message).toEqual('The action was unsuccessful. Try again or contact your IT Team.');
|
||||
|
||||
expect(createDialog.component.isPresent()).not.toBe(true, 'dialog is present');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
38
e2e/utilities/repo-client/apis/authentication/authentication-api.ts
Executable file
38
e2e/utilities/repo-client/apis/authentication/authentication-api.ts
Executable file
@@ -0,0 +1,38 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2018 Alfresco Software Limited
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { RepoApi } from '../repo-api';
|
||||
|
||||
export class AuthenticationApi extends RepoApi {
|
||||
|
||||
constructor(username?, password?) {
|
||||
super(username, password);
|
||||
}
|
||||
|
||||
async logout() {
|
||||
await this.apiAuth();
|
||||
return await this.alfrescoJsApi.logout();
|
||||
}
|
||||
}
|
@@ -33,6 +33,7 @@ import { SharedLinksApi } from './apis/shared-links/shared-links-api';
|
||||
import { TrashcanApi } from './apis/trashcan/trashcan-api';
|
||||
import { SearchApi } from './apis/search/search-api';
|
||||
import { UploadApi } from './apis/upload/upload-api';
|
||||
import { AuthenticationApi } from './apis/authentication/authentication-api';
|
||||
|
||||
export class RepoClient {
|
||||
constructor(
|
||||
@@ -76,6 +77,10 @@ export class RepoClient {
|
||||
get upload() {
|
||||
return new UploadApi(this.auth.username, this.auth.password);
|
||||
}
|
||||
|
||||
get authentication() {
|
||||
return new AuthenticationApi(this.auth.username, this.auth.password);
|
||||
}
|
||||
}
|
||||
|
||||
export * from './apis/nodes/node-body-create';
|
||||
|
@@ -16,7 +16,7 @@ exports.config = {
|
||||
specs: [
|
||||
'./e2e/suites/authentication/*.test.ts',
|
||||
'./e2e/suites/list-views/*.test.ts',
|
||||
'./e2e/suites/application/page-titles.test.ts',
|
||||
'./e2e/suites/application/*.test.ts',
|
||||
'./e2e/suites/navigation/*.test.ts',
|
||||
'./e2e/suites/pagination/*.test.ts',
|
||||
'./e2e/suites/actions/*.test.ts',
|
||||
|
@@ -43,6 +43,7 @@ import {
|
||||
} from './store/actions';
|
||||
import { AppStore, AppState, INITIAL_APP_STATE } from './store/states/app.state';
|
||||
import { filter } from 'rxjs/operators';
|
||||
import { MatDialog } from '@angular/material';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
@@ -59,7 +60,8 @@ export class AppComponent implements OnInit {
|
||||
private alfrescoApiService: AlfrescoApiService,
|
||||
private authenticationService: AuthenticationService,
|
||||
private uploadService: UploadService,
|
||||
private extensions: AppExtensionService
|
||||
private extensions: AppExtensionService,
|
||||
private dialogRef: MatDialog
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -68,6 +70,8 @@ export class AppComponent implements OnInit {
|
||||
if (!this.authenticationService.isLoggedIn()) {
|
||||
this.authenticationService.setRedirect({ provider: 'ECM', url: this.router.url });
|
||||
this.router.navigate(['/login']);
|
||||
|
||||
this.dialogRef.closeAll();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user