diff --git a/e2e/pages/login-page.ts b/e2e/pages/login-page.ts
index 2a6f90f33..d5ca2dc98 100644
--- a/e2e/pages/login-page.ts
+++ b/e2e/pages/login-page.ts
@@ -40,7 +40,10 @@ export class LoginPage extends Page {
const { submitButton } = this.login;
const hasSumbitButton = EC.presenceOf(submitButton);
- return browser.wait(hasSumbitButton, BROWSER_WAIT_TIMEOUT);
+ return browser.wait(hasSumbitButton, BROWSER_WAIT_TIMEOUT)
+ .then(() => browser.executeScript('window.localStorage.clear();'))
+ .then(() => browser.executeScript('window.sessionStorage.clear();'))
+ .then(() => browser.driver.manage().deleteAllCookies());
});
}
diff --git a/e2e/pages/logout-page.ts b/e2e/pages/logout-page.ts
index f1c0b65ce..5a8f6082a 100644
--- a/e2e/pages/logout-page.ts
+++ b/e2e/pages/logout-page.ts
@@ -22,7 +22,7 @@ import { APP_ROUTES } from '../configs';
export class LogoutPage extends Page {
/** @override */
constructor() {
- super(APP_ROUTES.LOGOUT);
+ super(APP_ROUTES.LOGIN);
}
/** @override */
diff --git a/e2e/suites/actions/create-folder.test.ts b/e2e/suites/actions/create-folder.test.ts
index 3bb9176bb..c608562cf 100644
--- a/e2e/suites/actions/create-folder.test.ts
+++ b/e2e/suites/actions/create-folder.test.ts
@@ -20,13 +20,14 @@ 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', () => {
const username = 'jane.doe';
const password = 'jane.doe';
+ const parent = 'parent-folder';
const folderName1 = 'my-folder1';
const folderName2 = 'my-folder2';
const folderDescription = 'description of my folder';
@@ -60,7 +61,7 @@ describe('Create folder', () => {
.then(() => apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PRIVATE))
.then(() => apis.admin.nodes.createFolders([ folderName1 ], `Sites/${siteName}/documentLibrary`))
.then(() => apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_CONSUMER))
- .then(() => apis.user.nodes.createFolders([ duplicateFolderName ]))
+ .then(() => apis.user.nodes.createFolders([ duplicateFolderName ], parent))
.then(() => loginPage.load())
.then(() => loginPage.loginWith(username, password))
.then(done);
@@ -79,72 +80,75 @@ describe('Create folder', () => {
afterAll(done => {
Promise
.all([
- apis.user.nodes.deleteNodes([
- folderName1,
- folderName2,
- duplicateFolderName,
- nameWithSpaces.trim()
- ]),
+ apis.user.nodes.deleteNodes([ parent ]),
logoutPage.load()
- .then(() => LocalStorageUtility.clear())
+ .then(() => Utils.clearLocalStorage())
])
.then(done);
});
it('option is enabled when having enough permissions', () => {
- personalFilesPage.sidenav.openNewMenu()
- .then((menu) => {
- const isEnabled = menu.getItemByLabel('Create folder').getWebElement().isEnabled();
+ personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
+ .then(() => personalFilesPage.sidenav.openNewMenu()
+ .then((menu) => {
+ const isEnabled = menu.getItemByLabel('Create folder').getWebElement().isEnabled();
- expect(isEnabled).toBe(true, 'Create folder is not enabled');
- });
+ expect(isEnabled).toBe(true, 'Create folder is not enabled');
+ })
+ );
});
it('creates new folder with name', () => {
- openCreateDialog()
- .then(() => createDialog.enterName(folderName1).clickCreate())
- .then(() => createDialog.waitForDialogToClose())
- .then(() => dataTable.waitForHeader())
- .then(() => {
- const isPresent = dataTable.getRowByContainingText(folderName1).isPresent();
- expect(isPresent).toBe(true, 'Folder not displayed in list view');
- });
+ personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
+ .then(() => openCreateDialog()
+ .then(() => createDialog.enterName(folderName1).clickCreate())
+ .then(() => createDialog.waitForDialogToClose())
+ .then(() => dataTable.waitForHeader())
+ .then(() => {
+ const isPresent = dataTable.getRowByContainingText(folderName1).isPresent();
+ expect(isPresent).toBe(true, 'Folder not displayed in list view');
+ })
+ );
});
it('creates new folder with name and description', () => {
- openCreateDialog()
- .then(() => {
- createDialog
- .enterName(folderName2)
- .enterDescription(folderDescription)
- .clickCreate();
- })
- .then(() => createDialog.waitForDialogToClose())
- .then(() => dataTable.waitForHeader())
- .then(() => {
- const isPresent = dataTable.getRowByContainingText(folderName2).isPresent();
- expect(isPresent).toBe(true, 'Folder not displayed in list view');
- })
- .then(() => {
- apis.user.nodes.getNodeDescription(folderName2)
- .then((description) => {
- expect(description).toEqual(folderDescription, 'Description is not correct');
- });
- });
+ personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
+ .then(() => openCreateDialog()
+ .then(() => {
+ createDialog
+ .enterName(folderName2)
+ .enterDescription(folderDescription)
+ .clickCreate();
+ })
+ .then(() => createDialog.waitForDialogToClose())
+ .then(() => dataTable.waitForHeader())
+ .then(() => {
+ const isPresent = dataTable.getRowByContainingText(folderName2).isPresent();
+ expect(isPresent).toBe(true, 'Folder not displayed in list view');
+ })
+ .then(() => {
+ apis.user.nodes.getNodeDescription(folderName2)
+ .then((description) => {
+ expect(description).toEqual(folderDescription, 'Description is not correct');
+ });
+ })
+ );
});
it('enabled option tooltip', () => {
- personalFilesPage.sidenav.openNewMenu()
- .then(menu => {
- const action = browser.actions().mouseMove(menu.getItemByLabel('Create folder'));
- action.perform();
+ personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
+ .then(() => personalFilesPage.sidenav.openNewMenu()
+ .then(menu => {
+ const action = browser.actions().mouseMove(menu.getItemByLabel('Create folder'));
+ action.perform();
- return menu;
- })
- .then((menu) => {
- const tooltip = menu.getItemTooltip('Create folder');
- expect(tooltip).toContain('Create new folder');
- });
+ return menu;
+ })
+ .then((menu) => {
+ const tooltip = menu.getItemTooltip('Create folder');
+ expect(tooltip).toContain('Create new folder');
+ })
+ );
});
it('option is disabled when not enough permissions', () => {
@@ -178,107 +182,123 @@ describe('Create folder', () => {
});
it('dialog UI elements', () => {
- openCreateDialog().then(() => {
- const dialogTitle = createDialog.getTitle();
- const isFolderNameDisplayed = createDialog.nameInput.getWebElement().isDisplayed();
- const isDescriptionDisplayed = createDialog.descriptionTextArea.getWebElement().isDisplayed();
- const isCreateEnabled = createDialog.createButton.getWebElement().isEnabled();
- const isCancelEnabled = createDialog.cancelButton.getWebElement().isEnabled();
+ personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
+ .then(() => openCreateDialog().then(() => {
+ const dialogTitle = createDialog.getTitle();
+ const isFolderNameDisplayed = createDialog.nameInput.getWebElement().isDisplayed();
+ const isDescriptionDisplayed = createDialog.descriptionTextArea.getWebElement().isDisplayed();
+ const isCreateEnabled = createDialog.createButton.getWebElement().isEnabled();
+ const isCancelEnabled = createDialog.cancelButton.getWebElement().isEnabled();
- expect(dialogTitle).toBe('Create new folder');
- expect(isFolderNameDisplayed).toBe(true, 'Name input is not displayed');
- expect(isDescriptionDisplayed).toBe(true, 'Description field is not displayed');
- expect(isCreateEnabled).toBe(false, 'Create button is not disabled');
- expect(isCancelEnabled).toBe(true, 'Cancel button is not enabled');
- });
+ expect(dialogTitle).toBe('Create new folder');
+ expect(isFolderNameDisplayed).toBe(true, 'Name input is not displayed');
+ expect(isDescriptionDisplayed).toBe(true, 'Description field is not displayed');
+ expect(isCreateEnabled).toBe(false, 'Create button is not disabled');
+ expect(isCancelEnabled).toBe(true, 'Cancel button is not enabled');
+ })
+ );
});
it('with empty folder name', () => {
- openCreateDialog()
- .then(() => {
- createDialog.deleteNameWithBackspace();
- })
- .then(() => {
- const isCreateEnabled = createDialog.createButton.getWebElement().isEnabled();
- const validationMessage = createDialog.getValidationMessage();
+ personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
+ .then(() => openCreateDialog()
+ .then(() => {
+ createDialog.deleteNameWithBackspace();
+ })
+ .then(() => {
+ const isCreateEnabled = createDialog.createButton.getWebElement().isEnabled();
+ const validationMessage = createDialog.getValidationMessage();
- expect(isCreateEnabled).toBe(false, 'Create button is enabled');
- expect(validationMessage).toMatch('Folder name is required');
- });
+ expect(isCreateEnabled).toBe(false, 'Create button is enabled');
+ expect(validationMessage).toMatch('Folder name is required');
+ })
+ );
});
it('with folder name ending with a dot "."', () => {
- openCreateDialog()
- .then(() => createDialog.enterName('folder-name.'))
- .then((dialog) => {
- const isCreateEnabled = dialog.createButton.getWebElement().isEnabled();
- const validationMessage = dialog.getValidationMessage();
+ personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
+ .then(() => openCreateDialog()
+ .then(() => createDialog.enterName('folder-name.'))
+ .then((dialog) => {
+ const isCreateEnabled = dialog.createButton.getWebElement().isEnabled();
+ const validationMessage = dialog.getValidationMessage();
- expect(isCreateEnabled).toBe(false, 'Create button is not disabled');
- expect(validationMessage).toMatch(`Folder name can't end with a period .`);
- });
+ expect(isCreateEnabled).toBe(false, 'Create button is not disabled');
+ expect(validationMessage).toMatch(`Folder name can't end with a period .`);
+ })
+ );
});
it('with folder name containing special characters', () => {
const namesWithSpecialChars = [ 'a*a', 'a"a', 'aa', `a\\a`, 'a/a', 'a?a', 'a:a', 'a|a' ];
- openCreateDialog()
- .then(() => {
- namesWithSpecialChars.forEach(name => {
- createDialog.enterName(name);
+ personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
+ .then(() => openCreateDialog()
+ .then(() => {
+ namesWithSpecialChars.forEach(name => {
+ createDialog.enterName(name);
- const isCreateEnabled = createDialog.createButton.getWebElement().isEnabled();
- const validationMessage = createDialog.getValidationMessage();
+ const isCreateEnabled = createDialog.createButton.getWebElement().isEnabled();
+ const validationMessage = createDialog.getValidationMessage();
- expect(isCreateEnabled).toBe(false, 'Create button is not disabled');
- expect(validationMessage).toContain(`Folder name can't contain these characters`);
- });
- });
+ expect(isCreateEnabled).toBe(false, 'Create button is not disabled');
+ expect(validationMessage).toContain(`Folder name can't contain these characters`);
+ });
+ })
+ );
});
it('with folder name containing only spaces', () => {
- openCreateDialog()
- .then(() => createDialog.enterName(' '))
- .then((dialog) => {
- const isCreateEnabled = dialog.createButton.getWebElement().isEnabled();
- const validationMessage = dialog.getValidationMessage();
+ personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
+ .then(() => openCreateDialog()
+ .then(() => createDialog.enterName(' '))
+ .then((dialog) => {
+ const isCreateEnabled = dialog.createButton.getWebElement().isEnabled();
+ const validationMessage = dialog.getValidationMessage();
- expect(isCreateEnabled).toBe(false, 'Create button is not disabled');
- expect(validationMessage).toMatch(`Folder name can't contain only spaces`);
- });
+ expect(isCreateEnabled).toBe(false, 'Create button is not disabled');
+ expect(validationMessage).toMatch(`Folder name can't contain only spaces`);
+ })
+ );
});
it('cancel folder creation', () => {
- openCreateDialog()
- .then(() => {
- createDialog
- .enterName('test')
- .enterDescription('test description')
- .clickCancel();
- })
- .then(() => expect(createDialog.component.isPresent()).not.toBe(true, 'dialog is not closed'));
+ personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
+ .then(() => openCreateDialog()
+ .then(() => {
+ createDialog
+ .enterName('test')
+ .enterDescription('test description')
+ .clickCancel();
+ })
+ .then(() => expect(createDialog.component.isPresent()).not.toBe(true, 'dialog is not closed'))
+ );
});
it('duplicate folder name', () => {
- openCreateDialog()
- .then(() => createDialog.enterName(duplicateFolderName).clickCreate())
- .then(() => {
- personalFilesPage.getSnackBarMessage()
- .then(message => {
- expect(message).toEqual(`There's already a folder with this name. Try a different name.`);
- expect(createDialog.component.isPresent()).toBe(true, 'dialog is not present');
- });
- });
+ personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
+ .then(() => openCreateDialog()
+ .then(() => createDialog.enterName(duplicateFolderName).clickCreate())
+ .then(() => {
+ personalFilesPage.getSnackBarMessage()
+ .then(message => {
+ expect(message).toEqual(`There's already a folder with this name. Try a different name.`);
+ expect(createDialog.component.isPresent()).toBe(true, 'dialog is not present');
+ });
+ })
+ );
});
it('trim ending spaces from folder name', () => {
- openCreateDialog()
- .then(() => createDialog.enterName(nameWithSpaces).clickCreate())
- .then(() => createDialog.waitForDialogToClose())
- .then(() => dataTable.waitForHeader())
- .then(() => {
- const isPresent = dataTable.getRowByContainingText(nameWithSpaces.trim()).isPresent();
- expect(isPresent).toBe(true, 'Folder not displayed in list view');
- });
+ personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
+ .then(() => openCreateDialog()
+ .then(() => createDialog.enterName(nameWithSpaces).clickCreate())
+ .then(() => createDialog.waitForDialogToClose())
+ .then(() => dataTable.waitForHeader())
+ .then(() => {
+ const isPresent = dataTable.getRowByContainingText(nameWithSpaces.trim()).isPresent();
+ expect(isPresent).toBe(true, 'Folder not displayed in list view');
+ })
+ );
});
});
diff --git a/e2e/suites/actions/edit-folder.test.ts b/e2e/suites/actions/edit-folder.test.ts
index c39de96ff..441ba60fa 100644
--- a/e2e/suites/actions/edit-folder.test.ts
+++ b/e2e/suites/actions/edit-folder.test.ts
@@ -20,12 +20,13 @@ 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';
- const password = 'jane.doe';
+ const username = 'john.doe';
+ const password = 'john.doe';
+ const parent = 'parent-folder';
const folderName = 'my-folder';
const folderDescription = 'my folder description';
@@ -58,11 +59,11 @@ describe('Edit folder', () => {
])
.then(() => apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_CONSUMER))
.then(() => Promise.all([
- apis.user.nodes.createNodeWithProperties( folderName, '', folderDescription ),
- apis.user.nodes.createFolders([ folderNameToEdit, duplicateFolderName ]),
+ apis.user.nodes.createNodeWithProperties( folderName, '', folderDescription, parent ),
+ apis.user.nodes.createFolders([ folderNameToEdit, duplicateFolderName ], parent),
loginPage.load()
]))
- .then(() => { loginPage.loginWith(username, password); })
+ .then(() => loginPage.loginWith(username, password))
.then(done);
});
@@ -80,53 +81,59 @@ describe('Edit folder', () => {
Promise
.all([
apis.admin.sites.deleteSite(siteName, true),
- apis.user.nodes.deleteNodes([ folderName, folderNameEdited, duplicateFolderName ]),
+ apis.user.nodes.deleteNodes([ parent ]),
logoutPage.load()
- .then(() => LocalStorageUtility.clear())
+ .then(() => Utils.clearLocalStorage())
])
.then(done);
});
it('button is enabled when having permissions', () => {
- dataTable.clickOnRowByContainingText(folderName)
- .then(() => {
- expect(editButton.isEnabled()).toBe(true);
- });
+ personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
+ .then(() => dataTable.clickOnRowByContainingText(folderName)
+ .then(() => {
+ expect(editButton.isEnabled()).toBe(true);
+ })
+ );
});
it('dialog UI defaults', () => {
- dataTable.clickOnRowByContainingText(folderName)
- .then(() => editButton.click())
- .then(() => {
- expect(editDialog.getTitle()).toBe('Edit folder');
- expect(editDialog.nameInput.getWebElement().getAttribute('value')).toBe(folderName);
- expect(editDialog.descriptionTextArea.getWebElement().getAttribute('value')).toBe(folderDescription);
- expect(editDialog.updateButton.getWebElement().isEnabled()).toBe(true, 'upload button is not enabled');
- expect(editDialog.cancelButton.getWebElement().isEnabled()).toBe(true, 'cancel button is not enabled');
- });
+ personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
+ .then(() => dataTable.clickOnRowByContainingText(folderName)
+ .then(() => editButton.click())
+ .then(() => {
+ expect(editDialog.getTitle()).toBe('Edit folder');
+ expect(editDialog.nameInput.getWebElement().getAttribute('value')).toBe(folderName);
+ expect(editDialog.descriptionTextArea.getWebElement().getAttribute('value')).toBe(folderDescription);
+ expect(editDialog.updateButton.getWebElement().isEnabled()).toBe(true, 'upload button is not enabled');
+ expect(editDialog.cancelButton.getWebElement().isEnabled()).toBe(true, 'cancel button is not enabled');
+ })
+ );
});
it('folder properties are modified when pressing OK', () => {
- dataTable.clickOnRowByContainingText(folderNameToEdit)
- .then(() => editButton.click())
- .then(() => {
- editDialog
- .enterName(folderNameEdited)
- .enterDescription(folderDescriptionEdited)
- .clickUpdate();
- })
- .then(() => editDialog.waitForDialogToClose())
- .then(() => dataTable.waitForHeader())
- .then(() => {
- const isPresent = dataTable.getRowByContainingText(folderNameEdited).isPresent();
- expect(isPresent).toBe(true, 'Folder not displayed in list view');
- })
- .then(() => {
- apis.user.nodes.getNodeDescription(folderNameEdited)
- .then((description) => {
- expect(description).toEqual(folderDescriptionEdited);
- });
- });
+ personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
+ .then(() => dataTable.clickOnRowByContainingText(folderNameToEdit)
+ .then(() => editButton.click())
+ .then(() => {
+ editDialog
+ .enterName(folderNameEdited)
+ .enterDescription(folderDescriptionEdited)
+ .clickUpdate();
+ })
+ .then(() => editDialog.waitForDialogToClose())
+ .then(() => dataTable.waitForHeader())
+ .then(() => {
+ const isPresent = dataTable.getRowByContainingText(folderNameEdited).isPresent();
+ expect(isPresent).toBe(true, 'Folder not displayed in list view');
+ })
+ .then(() => {
+ apis.user.nodes.getNodeDescription(folderNameEdited)
+ .then((description) => {
+ expect(description).toEqual(folderDescriptionEdited);
+ });
+ })
+ );
});
it('button is not displayed when not enough permissions', () => {
@@ -141,71 +148,85 @@ describe('Edit folder', () => {
});
it('with empty folder name', () => {
- dataTable.clickOnRowByContainingText(folderName)
- .then(() => editButton.click())
- .then(() => {
- editDialog.deleteNameWithBackspace();
- })
- .then(() => {
- expect(editDialog.updateButton.getWebElement().isEnabled()).toBe(false, 'upload button is not enabled');
- expect(editDialog.getValidationMessage()).toMatch('Folder name is required');
- });
+ personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
+ .then(() => dataTable.clickOnRowByContainingText(folderName)
+ .then(() => editButton.click())
+ .then(() => {
+ editDialog.deleteNameWithBackspace();
+ })
+ .then(() => {
+ expect(editDialog.updateButton.getWebElement().isEnabled()).toBe(false, 'upload button is not enabled');
+ expect(editDialog.getValidationMessage()).toMatch('Folder name is required');
+ })
+ );
});
it('with name with special characters', () => {
const namesWithSpecialChars = [ 'a*a', 'a"a', 'aa', `a\\a`, 'a/a', 'a?a', 'a:a', 'a|a' ];
- dataTable.clickOnRowByContainingText(folderName)
- .then(() => editButton.click())
- .then(() => {
- namesWithSpecialChars.forEach(name => {
- editDialog.enterName(name);
+ personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
+ .then(() => dataTable.clickOnRowByContainingText(folderName)
+ .then(() => editButton.click())
+ .then(() => {
+ namesWithSpecialChars.forEach(name => {
+ editDialog.enterName(name);
- expect(editDialog.updateButton.getWebElement().isEnabled()).toBe(false, 'upload button is not disabled');
- expect(editDialog.getValidationMessage()).toContain(`Folder name can't contain these characters`);
- });
- });
+ expect(editDialog.updateButton.getWebElement().isEnabled()).toBe(false, 'upload button is not disabled');
+ expect(editDialog.getValidationMessage()).toContain(`Folder name can't contain these characters`);
+ });
+ })
+ );
});
it('with name ending with a dot', () => {
- dataTable.clickOnRowByContainingText(folderName)
- .then(() => editButton.click())
- .then(() => editDialog.nameInput.sendKeys('.'))
- .then(() => {
- expect(editDialog.updateButton.getWebElement().isEnabled()).toBe(false, 'upload button is not enabled');
- expect(editDialog.getValidationMessage()).toMatch(`Folder name can't end with a period .`);
- });
+ personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
+ .then(() => dataTable.clickOnRowByContainingText(folderName)
+ .then(() => editButton.click())
+ .then(() => editDialog.nameInput.sendKeys('.'))
+ .then(() => {
+ expect(editDialog.updateButton.getWebElement().isEnabled()).toBe(false, 'upload button is not enabled');
+ expect(editDialog.getValidationMessage()).toMatch(`Folder name can't end with a period .`);
+ })
+ );
});
it('Cancel button', () => {
- dataTable.clickOnRowByContainingText(folderName)
- .then(() => editButton.click())
- .then(() => editDialog.clickCancel())
- .then(() => { expect(editDialog.component.isPresent()).not.toBe(true, 'dialog is not closed'); });
+ personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
+ .then(() => dataTable.clickOnRowByContainingText(folderName)
+ .then(() => editButton.click())
+ .then(() => editDialog.clickCancel())
+ .then(() => {
+ expect(editDialog.component.isPresent()).not.toBe(true, 'dialog is not closed');
+ })
+ );
});
it('with duplicate folder name', () => {
- dataTable.clickOnRowByContainingText(folderName)
- .then(() => editButton.click())
- .then(() => editDialog.enterName(duplicateFolderName).clickUpdate())
- .then(() => {
- personalFilesPage.getSnackBarMessage()
- .then(message => {
- expect(message).toEqual(`There's already a folder with this name. Try a different name.`);
- expect(editDialog.component.isPresent()).toBe(true, 'dialog is not present');
- });
- });
+ personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
+ .then(() => dataTable.clickOnRowByContainingText(folderName)
+ .then(() => editButton.click())
+ .then(() => editDialog.enterName(duplicateFolderName).clickUpdate())
+ .then(() => {
+ personalFilesPage.getSnackBarMessage()
+ .then(message => {
+ expect(message).toEqual(`There's already a folder with this name. Try a different name.`);
+ expect(editDialog.component.isPresent()).toBe(true, 'dialog is not present');
+ });
+ })
+ );
});
it('trim ending spaces', () => {
- dataTable.clickOnRowByContainingText(folderName)
- .then(() => editButton.click())
- .then(() => editDialog.nameInput.sendKeys(' '))
- .then(() => editDialog.clickUpdate())
- .then(() => editDialog.waitForDialogToClose())
- .then(() => {
- expect(personalFilesPage.snackBar.isPresent()).not.toBe(true, 'notification appears');
- expect(dataTable.getRowByContainingText(folderName).isPresent()).toBe(true, 'Folder not displayed in list view');
- });
+ personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
+ .then(() => dataTable.clickOnRowByContainingText(folderName)
+ .then(() => editButton.click())
+ .then(() => editDialog.nameInput.sendKeys(' '))
+ .then(() => editDialog.clickUpdate())
+ .then(() => editDialog.waitForDialogToClose())
+ .then(() => {
+ expect(personalFilesPage.snackBar.isPresent()).not.toBe(true, 'notification appears');
+ expect(dataTable.getRowByContainingText(folderName).isPresent()).toBe(true, 'Folder not displayed in list view');
+ })
+ );
});
});
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();');
}
}