diff --git a/e2e/suites/application/general.test.ts b/e2e/suites/application/general.test.ts
new file mode 100644
index 000000000..3ba41229e
--- /dev/null
+++ b/e2e/suites/application/general.test.ts
@@ -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 .
+ */
+
+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');
+ });
+
+ });
+
+});
diff --git a/e2e/utilities/repo-client/apis/authentication/authentication-api.ts b/e2e/utilities/repo-client/apis/authentication/authentication-api.ts
new file mode 100755
index 000000000..e7466c124
--- /dev/null
+++ b/e2e/utilities/repo-client/apis/authentication/authentication-api.ts
@@ -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 .
+ */
+
+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();
+ }
+}
diff --git a/e2e/utilities/repo-client/repo-client.ts b/e2e/utilities/repo-client/repo-client.ts
index b8b708df8..51e814231 100755
--- a/e2e/utilities/repo-client/repo-client.ts
+++ b/e2e/utilities/repo-client/repo-client.ts
@@ -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';
diff --git a/protractor.conf.js b/protractor.conf.js
index e6e81dbce..fdd13b802 100755
--- a/protractor.conf.js
+++ b/protractor.conf.js
@@ -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',
diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index dae38a1e0..780f0e181 100644
--- a/src/app/app.component.ts
+++ b/src/app/app.component.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();
}
}
});