mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-12 17:04:46 +00:00
[ACA-990] stabilise e2e tests (#104)
This commit is contained in:
parent
2ce7d57737
commit
2d6ae127aa
@ -21,11 +21,11 @@ import { Component } from '../component';
|
||||
|
||||
export class CreateOrEditFolderDialog extends Component {
|
||||
private static selectors = {
|
||||
root: '.mat-dialog-container',
|
||||
root: 'adf-folder-dialog',
|
||||
|
||||
title: '.mat-dialog-title',
|
||||
nameInput: '.mat-dialog-container .mat-input-element[placeholder="Name"]',
|
||||
descriptionTextArea: '.mat-dialog-container .mat-input-element[placeholder="Description"]',
|
||||
nameInput: 'input',
|
||||
descriptionTextArea: 'textarea',
|
||||
button: '.mat-dialog-actions button',
|
||||
validationMessage: '.mat-hint span'
|
||||
};
|
||||
@ -64,33 +64,27 @@ export class CreateOrEditFolderDialog extends Component {
|
||||
.catch(() => '');
|
||||
}
|
||||
|
||||
enterName(name: string): CreateOrEditFolderDialog {
|
||||
const { nameInput } = this;
|
||||
enterName(name: string): promise.Promise<CreateOrEditFolderDialog> {
|
||||
return this.nameInput.clear()
|
||||
.then(() => this.nameInput.sendKeys(name))
|
||||
.then(() => this);
|
||||
}
|
||||
|
||||
nameInput.clear();
|
||||
nameInput.sendKeys(name);
|
||||
|
||||
return this;
|
||||
enterDescription(description: string): promise.Promise<CreateOrEditFolderDialog> {
|
||||
return this.descriptionTextArea.clear()
|
||||
.then(() => {
|
||||
browser.actions().click(this.descriptionTextArea).sendKeys(description).perform();
|
||||
})
|
||||
.then(() => this);
|
||||
}
|
||||
|
||||
deleteNameWithBackspace(): promise.Promise<void> {
|
||||
const { nameInput } = this;
|
||||
|
||||
return nameInput.clear()
|
||||
return this.nameInput.clear()
|
||||
.then(() => {
|
||||
return nameInput.sendKeys(' ', protractor.Key.CONTROL, 'a', protractor.Key.NULL, protractor.Key.BACK_SPACE);
|
||||
return this.nameInput.sendKeys(' ', protractor.Key.CONTROL, 'a', protractor.Key.NULL, protractor.Key.BACK_SPACE);
|
||||
});
|
||||
}
|
||||
|
||||
enterDescription(description: string): CreateOrEditFolderDialog {
|
||||
const { descriptionTextArea } = this;
|
||||
|
||||
descriptionTextArea.clear();
|
||||
descriptionTextArea.sendKeys(description);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
clickCreate() {
|
||||
return this.createButton.click();
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
import { protractor, browser, by, ElementFinder } from 'protractor';
|
||||
|
||||
import { APP_ROUTES, BROWSER_WAIT_TIMEOUT, SITE_VISIBILITY, SITE_ROLES } from '../../configs';
|
||||
import { SIDEBAR_LABELS, 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 { Utils } from '../../utilities/utils';
|
||||
@ -42,16 +42,13 @@ describe('Create folder', () => {
|
||||
|
||||
const loginPage = new LoginPage();
|
||||
const logoutPage = new LogoutPage();
|
||||
const personalFilesPage = new BrowsingPage(APP_ROUTES.PERSONAL_FILES);
|
||||
const personalFilesPage = new BrowsingPage();
|
||||
const createDialog = new CreateOrEditFolderDialog();
|
||||
const dataTable = personalFilesPage.dataTable;
|
||||
const { dataTable } = personalFilesPage;
|
||||
|
||||
function openCreateDialog(): any {
|
||||
return personalFilesPage.sidenav
|
||||
.openNewMenu()
|
||||
.then((menu) => {
|
||||
menu.clickMenuItem('Create folder');
|
||||
})
|
||||
return personalFilesPage.sidenav.openNewMenu()
|
||||
.then(menu => menu.clickMenuItem('Create folder'))
|
||||
.then(() => createDialog.waitForDialogToOpen());
|
||||
}
|
||||
|
||||
@ -61,25 +58,25 @@ describe('Create folder', () => {
|
||||
.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 ], parent))
|
||||
.then(() => loginPage.load()
|
||||
.then(() => loginPage.loginWith(username))
|
||||
.then(done));
|
||||
.then(() => loginPage.load())
|
||||
.then(() => loginPage.loginWith(username))
|
||||
.then(done);
|
||||
});
|
||||
|
||||
beforeEach(done => {
|
||||
personalFilesPage.load()
|
||||
personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(done);
|
||||
});
|
||||
|
||||
afterEach(done => {
|
||||
browser.$('body').sendKeys(protractor.Key.ESCAPE).then(done);
|
||||
browser.actions().sendKeys(protractor.Key.ESCAPE).perform().then(done);
|
||||
});
|
||||
|
||||
afterAll(done => {
|
||||
Promise
|
||||
.all([
|
||||
apis.admin.sites.deleteSite(siteName, true),
|
||||
apis.admin.sites.deleteSite(siteName),
|
||||
apis.user.nodes.deleteNodes([ parent ]),
|
||||
logoutPage.load()
|
||||
])
|
||||
@ -88,214 +85,187 @@ describe('Create folder', () => {
|
||||
|
||||
it('option is enabled when having enough permissions', () => {
|
||||
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||
.then(() => personalFilesPage.sidenav.openNewMenu()
|
||||
.then((menu) => {
|
||||
const isEnabled = menu.getItemByLabel('Create folder').getWebElement().isEnabled();
|
||||
|
||||
expect(isEnabled).toBe(true, 'Create folder is not enabled');
|
||||
})
|
||||
);
|
||||
.then(() => personalFilesPage.sidenav.openNewMenu())
|
||||
.then(menu => {
|
||||
const isEnabled = menu.getItemByLabel('Create folder').isEnabled();
|
||||
expect(isEnabled).toBe(true, 'Create folder is not enabled');
|
||||
});
|
||||
});
|
||||
|
||||
it('creates new folder with name', () => {
|
||||
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||
.then(() => openCreateDialog()
|
||||
.then(() => createDialog.enterName(folderName1).clickCreate())
|
||||
.then(() => createDialog.waitForDialogToClose())
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(() => {
|
||||
const isPresent = dataTable.getRowByName(folderName1).isPresent();
|
||||
expect(isPresent).toBe(true, 'Folder not displayed in list view');
|
||||
})
|
||||
);
|
||||
.then(() => openCreateDialog())
|
||||
.then(() => createDialog.enterName(folderName1))
|
||||
.then(() => createDialog.clickCreate())
|
||||
.then(() => createDialog.waitForDialogToClose())
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(() => {
|
||||
const isPresent = dataTable.getRowByName(folderName1).isPresent();
|
||||
expect(isPresent).toBe(true, 'Folder not displayed in list view');
|
||||
});
|
||||
});
|
||||
|
||||
it('creates new folder with name and description', () => {
|
||||
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||
.then(() => openCreateDialog()
|
||||
.then(() => {
|
||||
createDialog
|
||||
.enterName(folderName2)
|
||||
.enterDescription(folderDescription)
|
||||
.clickCreate();
|
||||
})
|
||||
.then(() => createDialog.waitForDialogToClose())
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(() => {
|
||||
const isPresent = dataTable.getRowByName(folderName2).isPresent();
|
||||
expect(isPresent).toBe(true, 'Folder not displayed in list view');
|
||||
})
|
||||
.then(() => {
|
||||
apis.user.nodes.getNodeDescription(folderName2)
|
||||
.then((description) => expect(description).toEqual(folderDescription));
|
||||
})
|
||||
);
|
||||
.then(() => openCreateDialog())
|
||||
.then(() => createDialog.enterName(folderName2))
|
||||
.then(() => createDialog.enterDescription(folderDescription))
|
||||
.then(() => createDialog.clickCreate())
|
||||
.then(() => createDialog.waitForDialogToClose())
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(() => {
|
||||
const isPresent = dataTable.getRowByName(folderName2).isPresent();
|
||||
expect(isPresent).toBe(true, 'Folder not displayed in list view');
|
||||
})
|
||||
.then(() => {
|
||||
expect(apis.user.nodes.getNodeDescription(folderName2)).toEqual(folderDescription);
|
||||
});
|
||||
});
|
||||
|
||||
it('enabled option tooltip', () => {
|
||||
personalFilesPage.dataTable.doubleClickOnItemName(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');
|
||||
})
|
||||
);
|
||||
.then(() => personalFilesPage.sidenav.openNewMenu())
|
||||
.then(menu => browser.actions().mouseMove(menu.getItemByLabel('Create folder')).perform()
|
||||
.then(() => menu))
|
||||
.then(menu => {
|
||||
expect(menu.getItemTooltip('Create folder')).toContain('Create new folder');
|
||||
});
|
||||
});
|
||||
|
||||
it('option is disabled when not enough permissions', () => {
|
||||
const fileLibrariesPage = new BrowsingPage(APP_ROUTES.FILE_LIBRARIES);
|
||||
const fileLibrariesPage = new BrowsingPage();
|
||||
|
||||
fileLibrariesPage.sidenav.navigateToLinkByLabel('File Libraries')
|
||||
fileLibrariesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES)
|
||||
.then(() => fileLibrariesPage.dataTable.doubleClickOnItemName(siteName))
|
||||
.then(() => fileLibrariesPage.dataTable.doubleClickOnItemName(folderName1))
|
||||
.then(() => fileLibrariesPage.sidenav.openNewMenu())
|
||||
.then(menu => {
|
||||
const isEnabled = menu.getItemByLabel('Create folder').getWebElement().isEnabled();
|
||||
const isEnabled = menu.getItemByLabel('Create folder').isEnabled();
|
||||
expect(isEnabled).toBe(false, 'Create folder is not disabled');
|
||||
});
|
||||
});
|
||||
|
||||
it('disabled option tooltip', () => {
|
||||
const fileLibrariesPage = new BrowsingPage(APP_ROUTES.FILE_LIBRARIES);
|
||||
const fileLibrariesPage = new BrowsingPage();
|
||||
|
||||
fileLibrariesPage.sidenav.navigateToLinkByLabel('File Libraries')
|
||||
fileLibrariesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES)
|
||||
.then(() => fileLibrariesPage.dataTable.doubleClickOnItemName(siteName))
|
||||
.then(() => fileLibrariesPage.dataTable.doubleClickOnItemName(folderName1))
|
||||
.then(() => fileLibrariesPage.sidenav.openNewMenu())
|
||||
.then(menu => browser.actions().mouseMove(menu.getItemByLabel('Create folder')).perform()
|
||||
.then(() => menu))
|
||||
.then(menu => {
|
||||
const action = browser.actions().mouseMove(menu.getItemByLabel('Create folder'));
|
||||
action.perform()
|
||||
.then(() => {
|
||||
const tooltip = menu.getItemTooltip('Create folder');
|
||||
expect(tooltip).toContain(`You can't create a folder here`);
|
||||
});
|
||||
const tooltip = menu.getItemTooltip('Create folder');
|
||||
expect(tooltip).toContain(`You can't create a folder here`);
|
||||
});
|
||||
});
|
||||
|
||||
it('dialog UI elements', () => {
|
||||
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||
.then(() => openCreateDialog().then(() => {
|
||||
.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();
|
||||
const isFolderNameDisplayed = createDialog.nameInput.isDisplayed();
|
||||
const isDescriptionDisplayed = createDialog.descriptionTextArea.isDisplayed();
|
||||
const isCreateEnabled = createDialog.createButton.isEnabled();
|
||||
const isCancelEnabled = createDialog.cancelButton.isEnabled();
|
||||
|
||||
expect(dialogTitle).toBe('Create new folder');
|
||||
expect(dialogTitle).toMatch('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', () => {
|
||||
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||
.then(() => openCreateDialog()
|
||||
.then(() => {
|
||||
createDialog.deleteNameWithBackspace();
|
||||
})
|
||||
.then(() => {
|
||||
const isCreateEnabled = createDialog.createButton.getWebElement().isEnabled();
|
||||
const validationMessage = createDialog.getValidationMessage();
|
||||
.then(() => openCreateDialog())
|
||||
.then(() => createDialog.deleteNameWithBackspace())
|
||||
.then(() => {
|
||||
const isCreateEnabled = createDialog.createButton.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 "."', () => {
|
||||
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||
.then(() => openCreateDialog()
|
||||
.then(() => createDialog.enterName('folder-name.'))
|
||||
.then((dialog) => {
|
||||
const isCreateEnabled = dialog.createButton.getWebElement().isEnabled();
|
||||
const validationMessage = dialog.getValidationMessage();
|
||||
.then(() => openCreateDialog())
|
||||
.then(() => createDialog.enterName('folder-name.'))
|
||||
.then(dialog => {
|
||||
const isCreateEnabled = dialog.createButton.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', 'a<a', 'a>a', `a\\a`, 'a/a', 'a?a', 'a:a', 'a|a' ];
|
||||
|
||||
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||
.then(() => openCreateDialog()
|
||||
.then(() => {
|
||||
namesWithSpecialChars.forEach(name => {
|
||||
createDialog.enterName(name);
|
||||
.then(() => openCreateDialog())
|
||||
.then(() => namesWithSpecialChars.forEach(name => {
|
||||
createDialog.enterName(name);
|
||||
|
||||
const isCreateEnabled = createDialog.createButton.getWebElement().isEnabled();
|
||||
const validationMessage = createDialog.getValidationMessage();
|
||||
const isCreateEnabled = createDialog.createButton.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', () => {
|
||||
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||
.then(() => openCreateDialog()
|
||||
.then(() => createDialog.enterName(' '))
|
||||
.then((dialog) => {
|
||||
const isCreateEnabled = dialog.createButton.getWebElement().isEnabled();
|
||||
const validationMessage = dialog.getValidationMessage();
|
||||
.then(() => openCreateDialog())
|
||||
.then(() => createDialog.enterName(' '))
|
||||
.then(dialog => {
|
||||
const isCreateEnabled = dialog.createButton.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', () => {
|
||||
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||
.then(() => openCreateDialog()
|
||||
.then(() => {
|
||||
createDialog
|
||||
.enterName('test')
|
||||
.enterDescription('test description')
|
||||
.clickCancel();
|
||||
})
|
||||
.then(() => expect(createDialog.component.isPresent()).not.toBe(true, 'dialog is not closed'))
|
||||
);
|
||||
.then(() => openCreateDialog())
|
||||
.then(() => createDialog.enterName('test'))
|
||||
.then(() => createDialog.enterDescription('test description'))
|
||||
.then(() => createDialog.clickCancel())
|
||||
.then(() => {
|
||||
expect(createDialog.component.isPresent()).not.toBe(true, 'dialog is not closed');
|
||||
});
|
||||
});
|
||||
|
||||
it('duplicate folder name', () => {
|
||||
personalFilesPage.dataTable.doubleClickOnItemName(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');
|
||||
});
|
||||
})
|
||||
);
|
||||
.then(() => openCreateDialog())
|
||||
.then(() => createDialog.enterName(duplicateFolderName))
|
||||
.then(() => createDialog.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', () => {
|
||||
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||
.then(() => openCreateDialog()
|
||||
.then(() => createDialog.enterName(nameWithSpaces).clickCreate())
|
||||
.then(() => createDialog.waitForDialogToClose())
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(() => {
|
||||
const isPresent = dataTable.getRowByName(nameWithSpaces.trim()).isPresent();
|
||||
expect(isPresent).toBe(true, 'Folder not displayed in list view');
|
||||
})
|
||||
);
|
||||
.then(() => openCreateDialog())
|
||||
.then(() => createDialog.enterName(nameWithSpaces))
|
||||
.then(() => createDialog.clickCreate())
|
||||
.then(() => createDialog.waitForDialogToClose())
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(() => {
|
||||
const isPresent = dataTable.getRowByName(nameWithSpaces.trim()).isPresent();
|
||||
expect(isPresent).toBe(true, 'Folder not displayed in list view');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
import { protractor, element, browser, by, ElementFinder, promise } from 'protractor';
|
||||
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
||||
import { APP_ROUTES, SITE_VISIBILITY, SITE_ROLES } from '../../configs';
|
||||
import { SIDEBAR_LABELS, SITE_VISIBILITY, SITE_ROLES } from '../../configs';
|
||||
import { RepoClient } from '../../utilities/repo-client/repo-client';
|
||||
import { CreateOrEditFolderDialog } from '../../components/dialog/create-edit-folder-dialog';
|
||||
import { Utils } from '../../utilities/utils';
|
||||
@ -44,42 +44,40 @@ describe('Edit folder', () => {
|
||||
|
||||
const loginPage = new LoginPage();
|
||||
const logoutPage = new LogoutPage();
|
||||
const personalFilesPage = new BrowsingPage(APP_ROUTES.PERSONAL_FILES);
|
||||
const personalFilesPage = new BrowsingPage();
|
||||
const editDialog = new CreateOrEditFolderDialog();
|
||||
const dataTable = personalFilesPage.dataTable;
|
||||
const { dataTable } = personalFilesPage;
|
||||
const editButton = personalFilesPage.toolbar.actions.getButtonByTitleAttribute('Edit');
|
||||
|
||||
beforeAll(done => {
|
||||
Promise
|
||||
.all([
|
||||
apis.admin.people.createUser(username),
|
||||
apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PRIVATE)
|
||||
.then(() => apis.admin.nodes.createFolders([ folderName ], `Sites/${siteName}/documentLibrary`))
|
||||
])
|
||||
apis.admin.people.createUser(username)
|
||||
.then(() => apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PRIVATE))
|
||||
.then(() => apis.admin.nodes.createFolders([ folderName ], `Sites/${siteName}/documentLibrary`))
|
||||
.then(() => apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_CONSUMER))
|
||||
.then(() => Promise.all([
|
||||
apis.user.nodes.createNodeWithProperties( folderName, '', folderDescription, parent ),
|
||||
apis.user.nodes.createFolders([ folderNameToEdit, duplicateFolderName ], parent)
|
||||
]))
|
||||
.then(() => loginPage.load()
|
||||
.then(() => loginPage.loginWith(username))
|
||||
.then(done));
|
||||
|
||||
.then(() => apis.user.nodes.createNodeWithProperties( folderName, '', folderDescription, parent ))
|
||||
.then(() => apis.user.nodes.createFolders([ folderNameToEdit, duplicateFolderName ], parent))
|
||||
.then(() => loginPage.load())
|
||||
.then(() => loginPage.loginWith(username))
|
||||
.then(done);
|
||||
});
|
||||
|
||||
beforeEach(done => {
|
||||
personalFilesPage.load()
|
||||
personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(() => dataTable.doubleClickOnItemName(parent))
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(done);
|
||||
});
|
||||
|
||||
afterEach(done => {
|
||||
browser.$('body').sendKeys(protractor.Key.ESCAPE).then(done);
|
||||
browser.actions().sendKeys(protractor.Key.ESCAPE).perform().then(done);
|
||||
});
|
||||
|
||||
afterAll(done => {
|
||||
Promise
|
||||
.all([
|
||||
apis.admin.sites.deleteSite(siteName, true),
|
||||
apis.admin.sites.deleteSite(siteName),
|
||||
apis.user.nodes.deleteNodes([ parent ]),
|
||||
logoutPage.load()
|
||||
])
|
||||
@ -87,124 +85,98 @@ describe('Edit folder', () => {
|
||||
});
|
||||
|
||||
it('dialog UI defaults', () => {
|
||||
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||
.then(() => dataTable.clickOnItemName(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');
|
||||
})
|
||||
);
|
||||
dataTable.clickOnItemName(folderName)
|
||||
.then(() => editButton.click())
|
||||
.then(() => {
|
||||
expect(editDialog.getTitle()).toEqual('Edit folder');
|
||||
expect(editDialog.nameInput.getAttribute('value')).toBe(folderName);
|
||||
expect(editDialog.descriptionTextArea.getAttribute('value')).toBe(folderDescription);
|
||||
expect(editDialog.updateButton.isEnabled()).toBe(true, 'upload button is not enabled');
|
||||
expect(editDialog.cancelButton.isEnabled()).toBe(true, 'cancel button is not enabled');
|
||||
});
|
||||
});
|
||||
|
||||
it('properties are modified when pressing OK', () => {
|
||||
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||
.then(() => dataTable.clickOnItemName(folderNameToEdit)
|
||||
.then(() => editButton.click())
|
||||
.then(() => {
|
||||
editDialog
|
||||
.enterName(folderNameEdited)
|
||||
.enterDescription(folderDescriptionEdited)
|
||||
.clickUpdate();
|
||||
})
|
||||
.then(() => editDialog.waitForDialogToClose())
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(() => {
|
||||
const isPresent = dataTable.getRowByName(folderNameEdited).isPresent();
|
||||
expect(isPresent).toBe(true, 'Folder not displayed in list view');
|
||||
})
|
||||
.then(() => {
|
||||
apis.user.nodes.getNodeDescription(folderNameEdited)
|
||||
.then((description) => {
|
||||
expect(description).toEqual(folderDescriptionEdited);
|
||||
});
|
||||
})
|
||||
);
|
||||
dataTable.clickOnItemName(folderNameToEdit)
|
||||
.then(() => editButton.click())
|
||||
.then(() => editDialog.waitForDialogToOpen())
|
||||
.then(() => editDialog.enterName(folderNameEdited))
|
||||
.then(() => editDialog.enterDescription(folderDescriptionEdited))
|
||||
.then(() => editDialog.clickUpdate())
|
||||
.then(() => editDialog.waitForDialogToClose())
|
||||
.then(() => dataTable.waitForHeader())
|
||||
.then(() => {
|
||||
const isPresent = dataTable.getRowByName(folderNameEdited).isPresent();
|
||||
expect(isPresent).toBe(true, 'Folder not displayed in list view');
|
||||
})
|
||||
.then(() => {
|
||||
expect(apis.user.nodes.getNodeDescription(folderNameEdited)).toEqual(folderDescriptionEdited);
|
||||
});
|
||||
});
|
||||
|
||||
it('with empty folder name', () => {
|
||||
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||
.then(() => dataTable.clickOnItemName(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');
|
||||
})
|
||||
);
|
||||
dataTable.clickOnItemName(folderName)
|
||||
.then(() => editButton.click())
|
||||
.then(() => editDialog.deleteNameWithBackspace())
|
||||
.then(() => {
|
||||
expect(editDialog.updateButton.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', 'a<a', 'a>a', `a\\a`, 'a/a', 'a?a', 'a:a', 'a|a' ];
|
||||
|
||||
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||
.then(() => dataTable.clickOnItemName(folderName)
|
||||
.then(() => editButton.click())
|
||||
.then(() => {
|
||||
namesWithSpecialChars.forEach(name => {
|
||||
editDialog.enterName(name);
|
||||
dataTable.clickOnItemName(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.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', () => {
|
||||
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||
.then(() => dataTable.clickOnItemName(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 .`);
|
||||
})
|
||||
);
|
||||
dataTable.clickOnItemName(folderName)
|
||||
.then(() => editButton.click())
|
||||
.then(() => editDialog.nameInput.sendKeys('.'))
|
||||
.then(() => {
|
||||
expect(editDialog.updateButton.isEnabled()).toBe(false, 'upload button is not enabled');
|
||||
expect(editDialog.getValidationMessage()).toMatch(`Folder name can't end with a period .`);
|
||||
});
|
||||
});
|
||||
|
||||
it('Cancel button', () => {
|
||||
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||
.then(() => dataTable.clickOnItemName(folderName)
|
||||
.then(() => editButton.click())
|
||||
.then(() => editDialog.clickCancel())
|
||||
.then(() => {
|
||||
expect(editDialog.component.isPresent()).not.toBe(true, 'dialog is not closed');
|
||||
})
|
||||
);
|
||||
dataTable.clickOnItemName(folderName)
|
||||
.then(() => editButton.click())
|
||||
.then(() => editDialog.clickCancel())
|
||||
.then(() => {
|
||||
expect(editDialog.component.isPresent()).not.toBe(true, 'dialog is not closed');
|
||||
});
|
||||
});
|
||||
|
||||
it('with duplicate folder name', () => {
|
||||
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||
.then(() => dataTable.clickOnItemName(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');
|
||||
});
|
||||
})
|
||||
);
|
||||
dataTable.clickOnItemName(folderName)
|
||||
.then(() => editButton.click())
|
||||
.then(() => editDialog.enterName(duplicateFolderName))
|
||||
.then(() => editDialog.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', () => {
|
||||
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||
.then(() => dataTable.clickOnItemName(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.getRowByName(folderName).isPresent()).toBe(true, 'Folder not displayed in list view');
|
||||
})
|
||||
);
|
||||
dataTable.clickOnItemName(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.getRowByName(folderName).isPresent()).toBe(true, 'Folder not displayed in list view');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -66,7 +66,7 @@ describe('Permanently delete from Trash', () => {
|
||||
|
||||
afterAll(done => {
|
||||
Promise.all([
|
||||
apis.user.trashcan.emptyTrash(),
|
||||
apis.admin.trashcan.emptyTrash(),
|
||||
logoutPage.load()
|
||||
])
|
||||
.then(done);
|
||||
|
@ -70,7 +70,7 @@ describe('Restore from Trash', () => {
|
||||
Promise.all([
|
||||
apis.user.nodes.deleteNodesById(filesIds),
|
||||
apis.user.nodes.deleteNodesById(foldersIds),
|
||||
apis.user.trashcan.emptyTrash(),
|
||||
apis.admin.trashcan.emptyTrash(),
|
||||
logoutPage.load()
|
||||
])
|
||||
.then(done);
|
||||
|
@ -23,7 +23,7 @@ exports.config = {
|
||||
],
|
||||
|
||||
capabilities: {
|
||||
'browserName': 'chrome',
|
||||
browserName: 'chrome',
|
||||
chromeOptions: {
|
||||
prefs: {
|
||||
'credentials_enable_service': false
|
||||
|
Loading…
x
Reference in New Issue
Block a user