mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
rename utils file to allow future more utils to be added
This commit is contained in:
@@ -20,7 +20,7 @@ import { protractor, browser, by, ElementFinder } from 'protractor';
|
|||||||
import { APP_ROUTES, BROWSER_WAIT_TIMEOUT, SITE_VISIBILITY, SITE_ROLES } from '../../configs';
|
import { APP_ROUTES, BROWSER_WAIT_TIMEOUT, SITE_VISIBILITY, SITE_ROLES } from '../../configs';
|
||||||
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
||||||
import { CreateOrEditFolderDialog } from '../../components/dialog/create-edit-folder-dialog';
|
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';
|
import { RepoClient, NodeContentTree } from '../../utilities/repo-client/repo-client';
|
||||||
|
|
||||||
describe('Create folder', () => {
|
describe('Create folder', () => {
|
||||||
@@ -86,7 +86,7 @@ describe('Create folder', () => {
|
|||||||
nameWithSpaces.trim()
|
nameWithSpaces.trim()
|
||||||
]),
|
]),
|
||||||
logoutPage.load()
|
logoutPage.load()
|
||||||
.then(() => LocalStorageUtility.clear())
|
.then(() => Utils.clearLocalStorage())
|
||||||
])
|
])
|
||||||
.then(done);
|
.then(done);
|
||||||
});
|
});
|
||||||
|
@@ -20,7 +20,7 @@ import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
|||||||
import { APP_ROUTES, SITE_VISIBILITY, SITE_ROLES } from '../../configs';
|
import { APP_ROUTES, SITE_VISIBILITY, SITE_ROLES } from '../../configs';
|
||||||
import { RepoClient } from '../../utilities/repo-client/repo-client';
|
import { RepoClient } from '../../utilities/repo-client/repo-client';
|
||||||
import { CreateOrEditFolderDialog } from '../../components/dialog/create-edit-folder-dialog';
|
import { CreateOrEditFolderDialog } from '../../components/dialog/create-edit-folder-dialog';
|
||||||
import { LocalStorageUtility } from '../../utilities/local-storage';
|
import { Utils } from '../../utilities/utils';
|
||||||
|
|
||||||
describe('Edit folder', () => {
|
describe('Edit folder', () => {
|
||||||
const username = 'jane.doe';
|
const username = 'jane.doe';
|
||||||
@@ -82,7 +82,7 @@ describe('Edit folder', () => {
|
|||||||
apis.admin.sites.deleteSite(siteName, true),
|
apis.admin.sites.deleteSite(siteName, true),
|
||||||
apis.user.nodes.deleteNodes([ folderName, folderNameEdited, duplicateFolderName ]),
|
apis.user.nodes.deleteNodes([ folderName, folderNameEdited, duplicateFolderName ]),
|
||||||
logoutPage.load()
|
logoutPage.load()
|
||||||
.then(() => LocalStorageUtility.clear())
|
.then(() => Utils.clearLocalStorage())
|
||||||
])
|
])
|
||||||
.then(done);
|
.then(done);
|
||||||
});
|
});
|
||||||
|
@@ -19,7 +19,7 @@ import { browser } from 'protractor';
|
|||||||
|
|
||||||
import { SIDEBAR_LABELS } from '../../configs';
|
import { SIDEBAR_LABELS } from '../../configs';
|
||||||
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
||||||
import { LocalStorageUtility } from '../../utilities/local-storage';
|
import { Utils } from '../../utilities/utils';
|
||||||
|
|
||||||
describe('Page titles', () => {
|
describe('Page titles', () => {
|
||||||
const loginPage = new LoginPage();
|
const loginPage = new LoginPage();
|
||||||
@@ -65,7 +65,7 @@ describe('Page titles', () => {
|
|||||||
|
|
||||||
afterAll(done => {
|
afterAll(done => {
|
||||||
logoutPage.load()
|
logoutPage.load()
|
||||||
.then(() => LocalStorageUtility.clear())
|
.then(() => Utils.clearLocalStorage())
|
||||||
.then(done);
|
.then(done);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -19,7 +19,7 @@ import { browser } from 'protractor';
|
|||||||
|
|
||||||
import { APP_ROUTES } from '../../configs';
|
import { APP_ROUTES } from '../../configs';
|
||||||
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
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';
|
import { RepoClient } from '../../utilities/repo-client/repo-client';
|
||||||
|
|
||||||
describe('Login', () => {
|
describe('Login', () => {
|
||||||
@@ -63,7 +63,7 @@ describe('Login', () => {
|
|||||||
|
|
||||||
afterEach(done => {
|
afterEach(done => {
|
||||||
logoutPage.load()
|
logoutPage.load()
|
||||||
.then(() => LocalStorageUtility.clear())
|
.then(() => Utils.clearLocalStorage())
|
||||||
.then(done);
|
.then(done);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -19,7 +19,7 @@ import { browser } from 'protractor';
|
|||||||
|
|
||||||
import { APP_ROUTES, BROWSER_WAIT_TIMEOUT } from '../../configs';
|
import { APP_ROUTES, BROWSER_WAIT_TIMEOUT } from '../../configs';
|
||||||
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
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';
|
import { RepoClient } from '../../utilities/repo-client/repo-client';
|
||||||
|
|
||||||
describe('Logout', () => {
|
describe('Logout', () => {
|
||||||
@@ -48,7 +48,7 @@ describe('Logout', () => {
|
|||||||
|
|
||||||
afterEach((done) => {
|
afterEach((done) => {
|
||||||
logoutPage.load()
|
logoutPage.load()
|
||||||
.then(() => LocalStorageUtility.clear())
|
.then(() => Utils.clearLocalStorage())
|
||||||
.then(done);
|
.then(done);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -19,7 +19,7 @@ import { browser } from 'protractor';
|
|||||||
|
|
||||||
import { APP_ROUTES } from '../../configs';
|
import { APP_ROUTES } from '../../configs';
|
||||||
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
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';
|
import { RepoClient, NodeContentTree } from '../../utilities/repo-client/repo-client';
|
||||||
|
|
||||||
describe('Personal Files', () => {
|
describe('Personal Files', () => {
|
||||||
@@ -81,7 +81,7 @@ describe('Personal Files', () => {
|
|||||||
|
|
||||||
afterAll(done => {
|
afterAll(done => {
|
||||||
logoutPage.load()
|
logoutPage.load()
|
||||||
.then(() => LocalStorageUtility.clear())
|
.then(() => Utils.clearLocalStorage())
|
||||||
.then(done);
|
.then(done);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -109,7 +109,7 @@ describe('Personal Files', () => {
|
|||||||
|
|
||||||
afterAll(done => {
|
afterAll(done => {
|
||||||
logoutPage.load()
|
logoutPage.load()
|
||||||
.then(() => LocalStorageUtility.clear())
|
.then(() => Utils.clearLocalStorage())
|
||||||
.then(done);
|
.then(done);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -19,7 +19,7 @@ import { browser } from 'protractor';
|
|||||||
|
|
||||||
import { APP_ROUTES, SIDEBAR_LABELS } from '../../configs';
|
import { APP_ROUTES, SIDEBAR_LABELS } from '../../configs';
|
||||||
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
||||||
import { LocalStorageUtility } from '../../utilities/local-storage';
|
import { Utils } from '../../utilities/utils';
|
||||||
|
|
||||||
describe('Side navigation', () => {
|
describe('Side navigation', () => {
|
||||||
const loginPage = new LoginPage();
|
const loginPage = new LoginPage();
|
||||||
@@ -38,7 +38,7 @@ describe('Side navigation', () => {
|
|||||||
|
|
||||||
afterAll(done => {
|
afterAll(done => {
|
||||||
logoutPage.load()
|
logoutPage.load()
|
||||||
.then(() => LocalStorageUtility.clear())
|
.then(() => Utils.clearLocalStorage())
|
||||||
.then(done);
|
.then(done);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -19,7 +19,7 @@ import { browser } from 'protractor';
|
|||||||
|
|
||||||
import { APP_ROUTES } from '../../configs';
|
import { APP_ROUTES } from '../../configs';
|
||||||
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
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';
|
import { RepoClient, NodeContentTree } from '../../utilities/repo-client/repo-client';
|
||||||
|
|
||||||
describe('Pagination', () => {
|
describe('Pagination', () => {
|
||||||
@@ -75,7 +75,7 @@ describe('Pagination', () => {
|
|||||||
afterAll(done => {
|
afterAll(done => {
|
||||||
logoutPage
|
logoutPage
|
||||||
.load()
|
.load()
|
||||||
.then(() => LocalStorageUtility.clear())
|
.then(() => Utils.clearLocalStorage())
|
||||||
.then(() => nodesApi.deleteNodes([ content.name ]))
|
.then(() => nodesApi.deleteNodes([ content.name ]))
|
||||||
.then(done);
|
.then(done);
|
||||||
});
|
});
|
||||||
|
@@ -17,18 +17,14 @@
|
|||||||
|
|
||||||
import { browser, promise } from 'protractor';
|
import { browser, promise } from 'protractor';
|
||||||
|
|
||||||
declare var window;
|
export class Utils {
|
||||||
|
// generate a random value
|
||||||
export class LocalStorageUtility {
|
static random(): string {
|
||||||
static clear(): promise.Promise<any> {
|
return Math.random().toString(36).substring(3, 10);
|
||||||
return browser.executeScript(() => {
|
|
||||||
return window.localStorage.clear();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static getTicket(): promise.Promise<any> {
|
// local storage
|
||||||
return browser.executeScript(() => {
|
static clearLocalStorage(): promise.Promise<any> {
|
||||||
return window.localStorage.getItem('ticket-ECM');
|
return browser.executeScript('window.localStorage.clear();');
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user