diff --git a/e2e/suites/actions/create-folder.test.ts b/e2e/suites/actions/create-folder.test.ts index 3bb9176bb..b5ea9a296 100644 --- a/e2e/suites/actions/create-folder.test.ts +++ b/e2e/suites/actions/create-folder.test.ts @@ -20,7 +20,7 @@ import { protractor, browser, by, ElementFinder } from 'protractor'; import { APP_ROUTES, BROWSER_WAIT_TIMEOUT, SITE_VISIBILITY, SITE_ROLES } from '../../configs'; import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages'; import { CreateOrEditFolderDialog } from '../../components/dialog/create-edit-folder-dialog'; -import { LocalStorageUtility } from '../../utilities/local-storage'; +import { Utils } from '../../utilities/utils'; import { RepoClient, NodeContentTree } from '../../utilities/repo-client/repo-client'; describe('Create folder', () => { @@ -86,7 +86,7 @@ describe('Create folder', () => { nameWithSpaces.trim() ]), logoutPage.load() - .then(() => LocalStorageUtility.clear()) + .then(() => Utils.clearLocalStorage()) ]) .then(done); }); diff --git a/e2e/suites/actions/edit-folder.test.ts b/e2e/suites/actions/edit-folder.test.ts index c39de96ff..497fd00df 100644 --- a/e2e/suites/actions/edit-folder.test.ts +++ b/e2e/suites/actions/edit-folder.test.ts @@ -20,7 +20,7 @@ import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages'; import { APP_ROUTES, SITE_VISIBILITY, SITE_ROLES } from '../../configs'; import { RepoClient } from '../../utilities/repo-client/repo-client'; import { CreateOrEditFolderDialog } from '../../components/dialog/create-edit-folder-dialog'; -import { LocalStorageUtility } from '../../utilities/local-storage'; +import { Utils } from '../../utilities/utils'; describe('Edit folder', () => { const username = 'jane.doe'; @@ -82,7 +82,7 @@ describe('Edit folder', () => { apis.admin.sites.deleteSite(siteName, true), apis.user.nodes.deleteNodes([ folderName, folderNameEdited, duplicateFolderName ]), logoutPage.load() - .then(() => LocalStorageUtility.clear()) + .then(() => Utils.clearLocalStorage()) ]) .then(done); }); diff --git a/e2e/suites/application/page-titles.test.ts b/e2e/suites/application/page-titles.test.ts index b9085a6f7..6906435af 100644 --- a/e2e/suites/application/page-titles.test.ts +++ b/e2e/suites/application/page-titles.test.ts @@ -19,7 +19,7 @@ import { browser } from 'protractor'; import { SIDEBAR_LABELS } from '../../configs'; import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages'; -import { LocalStorageUtility } from '../../utilities/local-storage'; +import { Utils } from '../../utilities/utils'; describe('Page titles', () => { const loginPage = new LoginPage(); @@ -65,7 +65,7 @@ describe('Page titles', () => { afterAll(done => { logoutPage.load() - .then(() => LocalStorageUtility.clear()) + .then(() => Utils.clearLocalStorage()) .then(done); }); diff --git a/e2e/suites/authentication/login.test.ts b/e2e/suites/authentication/login.test.ts index 922386dad..56d804805 100644 --- a/e2e/suites/authentication/login.test.ts +++ b/e2e/suites/authentication/login.test.ts @@ -19,7 +19,7 @@ import { browser } from 'protractor'; import { APP_ROUTES } from '../../configs'; import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages'; -import { LocalStorageUtility } from '../../utilities/local-storage'; +import { Utils } from '../../utilities/utils'; import { RepoClient } from '../../utilities/repo-client/repo-client'; describe('Login', () => { @@ -63,7 +63,7 @@ describe('Login', () => { afterEach(done => { logoutPage.load() - .then(() => LocalStorageUtility.clear()) + .then(() => Utils.clearLocalStorage()) .then(done); }); diff --git a/e2e/suites/authentication/logout.test.ts b/e2e/suites/authentication/logout.test.ts index 050e2913a..6a48edc25 100644 --- a/e2e/suites/authentication/logout.test.ts +++ b/e2e/suites/authentication/logout.test.ts @@ -19,7 +19,7 @@ import { browser } from 'protractor'; import { APP_ROUTES, BROWSER_WAIT_TIMEOUT } from '../../configs'; import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages'; -import { LocalStorageUtility } from '../../utilities/local-storage'; +import { Utils } from '../../utilities/utils'; import { RepoClient } from '../../utilities/repo-client/repo-client'; describe('Logout', () => { @@ -48,7 +48,7 @@ describe('Logout', () => { afterEach((done) => { logoutPage.load() - .then(() => LocalStorageUtility.clear()) + .then(() => Utils.clearLocalStorage()) .then(done); }); diff --git a/e2e/suites/list-views/personal-files.test.ts b/e2e/suites/list-views/personal-files.test.ts index 891e729a6..efe263793 100644 --- a/e2e/suites/list-views/personal-files.test.ts +++ b/e2e/suites/list-views/personal-files.test.ts @@ -19,7 +19,7 @@ import { browser } from 'protractor'; import { APP_ROUTES } from '../../configs'; import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages'; -import { LocalStorageUtility } from '../../utilities/local-storage'; +import { Utils } from '../../utilities/utils'; import { RepoClient, NodeContentTree } from '../../utilities/repo-client/repo-client'; describe('Personal Files', () => { @@ -81,7 +81,7 @@ describe('Personal Files', () => { afterAll(done => { logoutPage.load() - .then(() => LocalStorageUtility.clear()) + .then(() => Utils.clearLocalStorage()) .then(done); }); @@ -109,7 +109,7 @@ describe('Personal Files', () => { afterAll(done => { logoutPage.load() - .then(() => LocalStorageUtility.clear()) + .then(() => Utils.clearLocalStorage()) .then(done); }); diff --git a/e2e/suites/navigation/side-navigation.test.ts b/e2e/suites/navigation/side-navigation.test.ts index 93e6219fe..bf6c8541d 100644 --- a/e2e/suites/navigation/side-navigation.test.ts +++ b/e2e/suites/navigation/side-navigation.test.ts @@ -19,7 +19,7 @@ import { browser } from 'protractor'; import { APP_ROUTES, SIDEBAR_LABELS } from '../../configs'; import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages'; -import { LocalStorageUtility } from '../../utilities/local-storage'; +import { Utils } from '../../utilities/utils'; describe('Side navigation', () => { const loginPage = new LoginPage(); @@ -38,7 +38,7 @@ describe('Side navigation', () => { afterAll(done => { logoutPage.load() - .then(() => LocalStorageUtility.clear()) + .then(() => Utils.clearLocalStorage()) .then(done); }); diff --git a/e2e/suites/pagination/pagination.test.ts b/e2e/suites/pagination/pagination.test.ts index f0298ff51..7fb40c359 100644 --- a/e2e/suites/pagination/pagination.test.ts +++ b/e2e/suites/pagination/pagination.test.ts @@ -19,7 +19,7 @@ import { browser } from 'protractor'; import { APP_ROUTES } from '../../configs'; import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages'; -import { LocalStorageUtility } from '../../utilities/local-storage'; +import { Utils } from '../../utilities/utils'; import { RepoClient, NodeContentTree } from '../../utilities/repo-client/repo-client'; describe('Pagination', () => { @@ -75,7 +75,7 @@ describe('Pagination', () => { afterAll(done => { logoutPage .load() - .then(() => LocalStorageUtility.clear()) + .then(() => Utils.clearLocalStorage()) .then(() => nodesApi.deleteNodes([ content.name ])) .then(done); }); diff --git a/e2e/utilities/local-storage.ts b/e2e/utilities/utils.ts similarity index 64% rename from e2e/utilities/local-storage.ts rename to e2e/utilities/utils.ts index 46d7d7926..0a6072f68 100644 --- a/e2e/utilities/local-storage.ts +++ b/e2e/utilities/utils.ts @@ -17,18 +17,14 @@ import { browser, promise } from 'protractor'; -declare var window; - -export class LocalStorageUtility { - static clear(): promise.Promise { - return browser.executeScript(() => { - return window.localStorage.clear(); - }); +export class Utils { + // generate a random value + static random(): string { + return Math.random().toString(36).substring(3, 10); } - static getTicket(): promise.Promise { - return browser.executeScript(() => { - return window.localStorage.getItem('ticket-ECM'); - }); + // local storage + static clearLocalStorage(): promise.Promise { + return browser.executeScript('window.localStorage.clear();'); } }