[ACA-1759] use async / await in test suites (#667)

* use async / await in authentication suites

* use async / await on application suites

* use async / await in navigation suites

* use async / await in actions suites
This commit is contained in:
Adina Parpalita
2018-09-25 15:43:23 +03:00
committed by Denys Vuika
parent b2b0da4c86
commit 341b93c2fa
18 changed files with 3049 additions and 3566 deletions

View File

@@ -34,7 +34,7 @@ import { RepoClient } from '../../utilities/repo-client/repo-client';
describe('Create folder', () => { describe('Create folder', () => {
const username = `user-${Utils.random()}`; const username = `user-${Utils.random()}`;
const parent = `parent-${Utils.random()}`; const parent = `parent-${Utils.random()}`; let parentId;
const folderName1 = `folder-${Utils.random()}`; const folderName1 = `folder-${Utils.random()}`;
const folderName2 = `folder-${Utils.random()}`; const folderName2 = `folder-${Utils.random()}`;
const folderDescription = 'description of my folder'; const folderDescription = 'description of my folder';
@@ -54,94 +54,89 @@ describe('Create folder', () => {
const createDialog = new CreateOrEditFolderDialog(); const createDialog = new CreateOrEditFolderDialog();
const { dataTable } = personalFilesPage; const { dataTable } = personalFilesPage;
beforeAll(done => { beforeAll(async (done) => {
apis.admin.people.createUser({ username }) await apis.admin.people.createUser({ username });
.then(() => apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PRIVATE)) await apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PRIVATE);
.then(() => apis.admin.nodes.createFolders([ folderName1 ], `Sites/${siteName}/documentLibrary`)) const docLibId = (await apis.admin.sites.getDocLibId(siteName));
.then(() => apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_CONSUMER)) await apis.admin.nodes.createFolder(folderName1, docLibId);
.then(() => apis.user.nodes.createFolders([ duplicateFolderName ], parent)) await apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_CONSUMER);
.then(() => loginPage.loginWith(username)) parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
.then(done); await apis.user.nodes.createFolder(duplicateFolderName, parentId);
await loginPage.loginWith(username);
done();
}); });
afterAll(done => { afterAll(async (done) => {
Promise await Promise.all([
.all([
apis.admin.sites.deleteSite(siteName), apis.admin.sites.deleteSite(siteName),
apis.user.nodes.deleteNodes([ parent ]), apis.user.nodes.deleteNodeById(parentId),
logoutPage.load() logoutPage.load()
]) ]);
.then(done); done();
}); });
describe('on Personal Files', () => { describe('on Personal Files', () => {
beforeEach(done => { beforeEach(async (done) => {
personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES) await personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
.then(() => dataTable.waitForHeader()) await dataTable.waitForHeader();
.then(done); done();
}); });
afterEach(done => { afterEach(async (done) => {
browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform().then(done); await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
done();
}); });
it('option is enabled when having enough permissions - [C216339]', () => { it('option is enabled when having enough permissions - [C216339]', async () => {
personalFilesPage.dataTable.doubleClickOnRowByName(parent) await personalFilesPage.dataTable.doubleClickOnRowByName(parent);
.then(() => personalFilesPage.sidenav.openNewMenu()) const menu = await personalFilesPage.sidenav.openNewMenu();
.then(menu => { const isEnabled = await menu.getItemByLabel('Create folder').isEnabled();
const isEnabled = menu.getItemByLabel('Create folder').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 - [C216341]', () => { it('creates new folder with name - [C216341]', async () => {
personalFilesPage.dataTable.doubleClickOnRowByName(parent) await personalFilesPage.dataTable.doubleClickOnRowByName(parent);
.then(() => personalFilesPage.sidenav.openCreateDialog()) await personalFilesPage.sidenav.openCreateDialog();
.then(() => createDialog.waitForDialogToOpen()) await createDialog.waitForDialogToOpen();
.then(() => createDialog.enterName(folderName1)) await createDialog.enterName(folderName1);
.then(() => createDialog.clickCreate()) await createDialog.clickCreate();
.then(() => createDialog.waitForDialogToClose()) await createDialog.waitForDialogToClose();
.then(() => dataTable.waitForHeader()) await dataTable.waitForHeader();
.then(() => { const isPresent = await dataTable.getRowByName(folderName1).isPresent();
const isPresent = dataTable.getRowByName(folderName1).isPresent();
expect(isPresent).toBe(true, 'Folder not displayed in list view'); expect(isPresent).toBe(true, 'Folder not displayed in list view');
}); });
it('creates new folder with name and description - [C216340]', async (done) => {
await personalFilesPage.dataTable.doubleClickOnRowByName(parent);
await personalFilesPage.sidenav.openCreateDialog();
await createDialog.waitForDialogToOpen();
await createDialog.enterName(folderName2);
await createDialog.enterDescription(folderDescription);
await createDialog.clickCreate();
await createDialog.waitForDialogToClose();
await dataTable.waitForHeader();
expect(await dataTable.getRowByName(folderName2).isPresent()).toBe(true, 'Folder not displayed');
const desc = await apis.user.nodes.getNodeDescription(folderName2, parent);
expect(desc).toEqual(folderDescription);
done();
}); });
it('creates new folder with name and description - [C216340]', () => { it('enabled option tooltip - [C216342]', async () => {
personalFilesPage.dataTable.doubleClickOnRowByName(parent) await personalFilesPage.dataTable.doubleClickOnRowByName(parent);
.then(() => personalFilesPage.sidenav.openCreateDialog()) const menu = await personalFilesPage.sidenav.openNewMenu();
.then(() => createDialog.waitForDialogToOpen()) await browser.actions().mouseMove(menu.getItemByLabel('Create folder')).perform();
.then(() => createDialog.enterName(folderName2)) expect(await menu.getItemTooltip('Create folder')).toContain('Create new folder');
.then(() => createDialog.enterDescription(folderDescription))
.then(() => createDialog.clickCreate())
.then(() => createDialog.waitForDialogToClose())
.then(() => dataTable.waitForHeader())
.then(() => expect(dataTable.getRowByName(folderName2).isPresent()).toBe(true, 'Folder not displayed'))
.then(() => apis.user.nodes.getNodeDescription(folderName2, parent))
.then(desc => expect(desc).toEqual(folderDescription));
}); });
it('enabled option tooltip - [C216342]', () => { it('dialog UI elements - [C216345]', async () => {
personalFilesPage.dataTable.doubleClickOnRowByName(parent) await personalFilesPage.dataTable.doubleClickOnRowByName(parent);
.then(() => personalFilesPage.sidenav.openNewMenu()) await personalFilesPage.sidenav.openCreateDialog();
.then(menu => browser.actions().mouseMove(menu.getItemByLabel('Create folder')).perform() await createDialog.waitForDialogToOpen();
.then(() => menu)) const dialogTitle = await createDialog.getTitle();
.then(menu => { const isFolderNameDisplayed = await createDialog.nameInput.isDisplayed();
expect(menu.getItemTooltip('Create folder')).toContain('Create new folder'); const isDescriptionDisplayed = await createDialog.descriptionTextArea.isDisplayed();
}); const isCreateEnabled = await createDialog.createButton.isEnabled();
}); const isCancelEnabled = await createDialog.cancelButton.isEnabled();
it('dialog UI elements - [C216345]', () => {
personalFilesPage.dataTable.doubleClickOnRowByName(parent)
.then(() => personalFilesPage.sidenav.openCreateDialog())
.then(() => createDialog.waitForDialogToOpen())
.then(() => {
const dialogTitle = createDialog.getTitle();
const isFolderNameDisplayed = createDialog.nameInput.isDisplayed();
const isDescriptionDisplayed = createDialog.descriptionTextArea.isDisplayed();
const isCreateEnabled = createDialog.createButton.isEnabled();
const isCancelEnabled = createDialog.cancelButton.isEnabled();
expect(dialogTitle).toMatch('Create new folder'); expect(dialogTitle).toMatch('Create new folder');
expect(isFolderNameDisplayed).toBe(true, 'Name input is not displayed'); expect(isFolderNameDisplayed).toBe(true, 'Name input is not displayed');
@@ -149,142 +144,122 @@ describe('Create folder', () => {
expect(isCreateEnabled).toBe(false, 'Create button is not disabled'); expect(isCreateEnabled).toBe(false, 'Create button is not disabled');
expect(isCancelEnabled).toBe(true, 'Cancel button is not enabled'); expect(isCancelEnabled).toBe(true, 'Cancel button is not enabled');
}); });
});
it('with empty folder name - [C216346]', () => { it('with empty folder name - [C216346]', async () => {
personalFilesPage.dataTable.doubleClickOnRowByName(parent) await personalFilesPage.dataTable.doubleClickOnRowByName(parent);
.then(() => personalFilesPage.sidenav.openCreateDialog()) await personalFilesPage.sidenav.openCreateDialog();
.then(() => createDialog.waitForDialogToOpen()) await createDialog.waitForDialogToOpen();
.then(() => createDialog.deleteNameWithBackspace()) await createDialog.deleteNameWithBackspace();
.then(() => { const isCreateEnabled = await createDialog.createButton.isEnabled();
const isCreateEnabled = createDialog.createButton.isEnabled(); const validationMessage = await createDialog.getValidationMessage();
const validationMessage = createDialog.getValidationMessage();
expect(isCreateEnabled).toBe(false, 'Create button is enabled'); expect(isCreateEnabled).toBe(false, 'Create button is enabled');
expect(validationMessage).toMatch('Folder name is required'); expect(validationMessage).toMatch('Folder name is required');
}); });
});
it('with folder name ending with a dot "." - [C216348]', () => { it('with folder name ending with a dot "." - [C216348]', async () => {
personalFilesPage.dataTable.doubleClickOnRowByName(parent) await personalFilesPage.dataTable.doubleClickOnRowByName(parent);
.then(() => personalFilesPage.sidenav.openCreateDialog()) await personalFilesPage.sidenav.openCreateDialog();
.then(() => createDialog.waitForDialogToOpen()) await createDialog.waitForDialogToOpen();
.then(() => createDialog.enterName('folder-name.')) await createDialog.enterName('folder-name.');
.then(() => { const isCreateEnabled = await createDialog.createButton.isEnabled();
const isCreateEnabled = createDialog.createButton.isEnabled(); const validationMessage = await createDialog.getValidationMessage();
const validationMessage = createDialog.getValidationMessage();
expect(isCreateEnabled).toBe(false, 'Create button is not disabled'); expect(isCreateEnabled).toBe(false, 'Create button is not disabled');
expect(validationMessage).toMatch(`Folder name can't end with a period .`); expect(validationMessage).toMatch(`Folder name can't end with a period .`);
}); });
});
it('with folder name containing special characters - [C216347]', () => { it('with folder name containing special characters - [C216347]', async () => {
const namesWithSpecialChars = [ 'a*a', 'a"a', 'a<a', 'a>a', `a\\a`, 'a/a', 'a?a', 'a:a', 'a|a' ]; const namesWithSpecialChars = [ 'a*a', 'a"a', 'a<a', 'a>a', `a\\a`, 'a/a', 'a?a', 'a:a', 'a|a' ];
personalFilesPage.dataTable.doubleClickOnRowByName(parent) await personalFilesPage.dataTable.doubleClickOnRowByName(parent);
.then(() => personalFilesPage.sidenav.openCreateDialog()) await personalFilesPage.sidenav.openCreateDialog();
.then(() => createDialog.waitForDialogToOpen()) await createDialog.waitForDialogToOpen();
.then(() => namesWithSpecialChars.forEach(name => {
createDialog.enterName(name);
const isCreateEnabled = createDialog.createButton.isEnabled(); for (const name of namesWithSpecialChars) {
const validationMessage = createDialog.getValidationMessage(); await createDialog.enterName(name);
expect(await createDialog.createButton.isEnabled()).toBe(false, 'Create button is not disabled');
expect(isCreateEnabled).toBe(false, 'Create button is not disabled'); expect(await createDialog.getValidationMessage()).toContain(`Folder name can't contain these characters`);
expect(validationMessage).toContain(`Folder name can't contain these characters`); }
}));
}); });
it('with folder name containing only spaces - [C280406]', () => { it('with folder name containing only spaces - [C280406]', async () => {
personalFilesPage.dataTable.doubleClickOnRowByName(parent) await personalFilesPage.dataTable.doubleClickOnRowByName(parent);
.then(() => personalFilesPage.sidenav.openCreateDialog()) await personalFilesPage.sidenav.openCreateDialog();
.then(() => createDialog.waitForDialogToOpen()) await createDialog.waitForDialogToOpen();
.then(() => createDialog.enterName(' ')) await createDialog.enterName(' ');
.then(() => { const isCreateEnabled = await createDialog.createButton.isEnabled();
const isCreateEnabled = createDialog.createButton.isEnabled(); const validationMessage = await createDialog.getValidationMessage();
const validationMessage = createDialog.getValidationMessage();
expect(isCreateEnabled).toBe(false, 'Create button is not disabled'); expect(isCreateEnabled).toBe(false, 'Create button is not disabled');
expect(validationMessage).toMatch(`Folder name can't contain only spaces`); expect(validationMessage).toMatch(`Folder name can't contain only spaces`);
}); });
it('cancel folder creation - [C216349]', async () => {
await personalFilesPage.dataTable.doubleClickOnRowByName(parent);
await personalFilesPage.sidenav.openCreateDialog();
await createDialog.waitForDialogToOpen();
await createDialog.enterName('test');
await createDialog.enterDescription('test description');
await createDialog.clickCancel();
expect(await createDialog.component.isPresent()).not.toBe(true, 'dialog is not closed');
}); });
it('cancel folder creation - [C216349]', () => { it('duplicate folder name - [C216350]', async () => {
personalFilesPage.dataTable.doubleClickOnRowByName(parent) await personalFilesPage.dataTable.doubleClickOnRowByName(parent);
.then(() => personalFilesPage.sidenav.openCreateDialog()) await personalFilesPage.sidenav.openCreateDialog();
.then(() => createDialog.waitForDialogToOpen()) await createDialog.waitForDialogToOpen();
.then(() => createDialog.enterName('test')) await createDialog.enterName(duplicateFolderName);
.then(() => createDialog.enterDescription('test description')) await createDialog.clickCreate();
.then(() => createDialog.clickCancel()) const message = await personalFilesPage.getSnackBarMessage();
.then(() => {
expect(createDialog.component.isPresent()).not.toBe(true, 'dialog is not closed');
});
});
it('duplicate folder name - [C216350]', () => {
personalFilesPage.dataTable.doubleClickOnRowByName(parent)
.then(() => personalFilesPage.sidenav.openCreateDialog())
.then(() => createDialog.waitForDialogToOpen())
.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(message).toEqual(`There's already a folder with this name. Try a different name.`);
expect(createDialog.component.isPresent()).toBe(true, 'dialog is not present'); expect(await createDialog.component.isPresent()).toBe(true, 'dialog is not present');
});
}); });
it('trim ending spaces from folder name - [C216351]', () => { it('trim ending spaces from folder name - [C216351]', async () => {
personalFilesPage.dataTable.doubleClickOnRowByName(parent) await personalFilesPage.dataTable.doubleClickOnRowByName(parent);
.then(() => personalFilesPage.sidenav.openCreateDialog()) await personalFilesPage.sidenav.openCreateDialog();
.then(() => createDialog.waitForDialogToOpen()) await createDialog.waitForDialogToOpen();
.then(() => createDialog.enterName(nameWithSpaces)) await createDialog.enterName(nameWithSpaces);
.then(() => createDialog.clickCreate()) await createDialog.clickCreate();
.then(() => createDialog.waitForDialogToClose()) await createDialog.waitForDialogToClose();
.then(() => dataTable.waitForHeader()) await dataTable.waitForHeader();
.then(() => { const isPresent = await dataTable.getRowByName(nameWithSpaces.trim()).isPresent();
const isPresent = dataTable.getRowByName(nameWithSpaces.trim()).isPresent();
expect(isPresent).toBe(true, 'Folder not displayed in list view'); expect(isPresent).toBe(true, 'Folder not displayed in list view');
}); });
}); });
});
describe('on File Libraries', () => { describe('on File Libraries', () => {
const fileLibrariesPage = new BrowsingPage(); const fileLibrariesPage = new BrowsingPage();
beforeEach(done => { beforeEach(async (done) => {
fileLibrariesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES) await fileLibrariesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
.then(() => dataTable.waitForHeader()) await dataTable.waitForHeader();
.then(done); done();
}); });
afterEach(done => { afterEach(async (done) => {
browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform().then(done); await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
done();
}); });
it('option is disabled when not enough permissions - [C280397]', () => { it('option is disabled when not enough permissions - [C280397]', async () => {
fileLibrariesPage.dataTable.doubleClickOnRowByName(siteName) await fileLibrariesPage.dataTable.doubleClickOnRowByName(siteName);
.then(() => fileLibrariesPage.dataTable.doubleClickOnRowByName(folderName1)) await fileLibrariesPage.dataTable.doubleClickOnRowByName(folderName1);
.then(() => fileLibrariesPage.sidenav.openNewMenu()) const menu = await fileLibrariesPage.sidenav.openNewMenu();
.then(menu => { const isEnabled = await menu.getItemByLabel('Create folder').isEnabled();
const isEnabled = menu.getItemByLabel('Create folder').isEnabled();
expect(isEnabled).toBe(false, 'Create folder is not disabled'); expect(isEnabled).toBe(false, 'Create folder is not disabled');
}); });
});
it('disabled option tooltip - [C280398]', () => { it('disabled option tooltip - [C280398]', async () => {
fileLibrariesPage.dataTable.doubleClickOnRowByName(siteName) await fileLibrariesPage.dataTable.doubleClickOnRowByName(siteName);
.then(() => fileLibrariesPage.dataTable.doubleClickOnRowByName(folderName1)) await fileLibrariesPage.dataTable.doubleClickOnRowByName(folderName1);
.then(() => fileLibrariesPage.sidenav.openNewMenu()) const menu = await fileLibrariesPage.sidenav.openNewMenu();
.then(menu => browser.actions().mouseMove(menu.getItemByLabel('Create folder')).perform() await browser.actions().mouseMove(menu.getItemByLabel('Create folder')).perform();
.then(() => menu)) const tooltip = await menu.getItemTooltip('Create folder');
.then(menu => {
const tooltip = menu.getItemTooltip('Create folder');
expect(tooltip).toContain(`Folders cannot be created whilst viewing the current items`); expect(tooltip).toContain(`Folders cannot be created whilst viewing the current items`);
}); });
}); });
});
xit(''); xit('');
}); });

View File

@@ -111,11 +111,11 @@ describe('Delete and undo delete', () => {
await toolbar.menu.clickMenuItem('Delete'); await toolbar.menu.clickMenuItem('Delete');
const message = await page.getSnackBarMessage(); const message = await page.getSnackBarMessage();
expect(message).toContain(`${file1} deleted`); expect(message).toContain(`${file1} deleted`);
expect(dataTable.getRowByName(file1).isPresent()).toBe(false, 'Item was not removed from list'); expect(await dataTable.getRowByName(file1).isPresent()).toBe(false, 'Item was not removed from list');
items--; items--;
expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`); expect(await page.pagination.range.getText()).toContain(`1-${items} of ${items}`);
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH); await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
expect(dataTable.getRowByName(file1).isPresent()).toBe(true, 'Item is not in trash'); expect(await dataTable.getRowByName(file1).isPresent()).toBe(true, 'Item is not in trash');
await apis.user.trashcan.restore(file1Id); await apis.user.trashcan.restore(file1Id);
}); });
@@ -128,13 +128,13 @@ describe('Delete and undo delete', () => {
await toolbar.menu.clickMenuItem('Delete'); await toolbar.menu.clickMenuItem('Delete');
const message = await page.getSnackBarMessage(); const message = await page.getSnackBarMessage();
expect(message).toContain(`Deleted 2 items`); expect(message).toContain(`Deleted 2 items`);
expect(dataTable.getRowByName(file1).isPresent()).toBe(false, `${file1} was not removed from list`); expect(await dataTable.getRowByName(file1).isPresent()).toBe(false, `${file1} was not removed from list`);
expect(dataTable.getRowByName(file2).isPresent()).toBe(false, `${file2} was not removed from list`); expect(await dataTable.getRowByName(file2).isPresent()).toBe(false, `${file2} was not removed from list`);
items = items - 2; items = items - 2;
expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`); expect(await page.pagination.range.getText()).toContain(`1-${items} of ${items}`);
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH); await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
expect(dataTable.getRowByName(file1).isPresent()).toBe(true, `${file1} is not in trash`); expect(await dataTable.getRowByName(file1).isPresent()).toBe(true, `${file1} is not in trash`);
expect(dataTable.getRowByName(file2).isPresent()).toBe(true, `${file2} is not in trash`); expect(await dataTable.getRowByName(file2).isPresent()).toBe(true, `${file2} is not in trash`);
await apis.user.trashcan.restore(file1Id); await apis.user.trashcan.restore(file1Id);
await apis.user.trashcan.restore(file2Id); await apis.user.trashcan.restore(file2Id);
@@ -146,12 +146,12 @@ describe('Delete and undo delete', () => {
await dataTable.selectItem(folder1); await dataTable.selectItem(folder1);
await toolbar.openMoreMenu(); await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Delete'); await toolbar.menu.clickMenuItem('Delete');
expect(dataTable.getRowByName(folder1).isPresent()).toBe(false, 'Item was not removed from list'); expect(await dataTable.getRowByName(folder1).isPresent()).toBe(false, 'Item was not removed from list');
items--; items--;
expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`); expect(await page.pagination.range.getText()).toContain(`1-${items} of ${items}`);
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH); await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
expect(dataTable.getRowByName(folder1).isPresent()).toBe(true, 'Item is not in trash'); expect(await dataTable.getRowByName(folder1).isPresent()).toBe(true, 'Item is not in trash');
expect(dataTable.getRowByName(file3).isPresent()).toBe(false, 'Item is in trash'); expect(await dataTable.getRowByName(file3).isPresent()).toBe(false, 'Item is in trash');
await apis.user.trashcan.restore(folder1Id); await apis.user.trashcan.restore(folder1Id);
}); });
@@ -162,10 +162,10 @@ describe('Delete and undo delete', () => {
await toolbar.menu.clickMenuItem('Delete'); await toolbar.menu.clickMenuItem('Delete');
const message = await page.getSnackBarMessage(); const message = await page.getSnackBarMessage();
expect(message).toContain(`${folder2} couldn't be deleted`); expect(message).toContain(`${folder2} couldn't be deleted`);
expect(dataTable.getRowByName(folder2).isPresent()).toBe(true, 'Item was removed from list'); expect(await dataTable.getRowByName(folder2).isPresent()).toBe(true, 'Item was removed from list');
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH); await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
expect(dataTable.getRowByName(folder2).isPresent()).toBe(false, 'Item is in trash'); expect(await dataTable.getRowByName(folder2).isPresent()).toBe(false, 'Item is in trash');
expect(dataTable.getRowByName(file4).isPresent()).toBe(false, 'Item is in trash'); expect(await dataTable.getRowByName(file4).isPresent()).toBe(false, 'Item is in trash');
}); });
it('notification on multiple items deletion - some items fail to delete - [C217129]', async () => { it('notification on multiple items deletion - some items fail to delete - [C217129]', async () => {
@@ -211,8 +211,8 @@ describe('Delete and undo delete', () => {
await toolbar.openMoreMenu(); await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Delete'); await toolbar.menu.clickMenuItem('Delete');
await page.clickSnackBarAction(); await page.clickSnackBarAction();
expect(dataTable.getRowByName(file1).isPresent()).toBe(true, 'Item was not restored'); expect(await dataTable.getRowByName(file1).isPresent()).toBe(true, 'Item was not restored');
expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`); expect(await page.pagination.range.getText()).toContain(`1-${items} of ${items}`);
}); });
it('undo delete of folder with content - [C280503]', async () => { it('undo delete of folder with content - [C280503]', async () => {
@@ -222,10 +222,10 @@ describe('Delete and undo delete', () => {
await toolbar.openMoreMenu(); await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Delete'); await toolbar.menu.clickMenuItem('Delete');
await page.clickSnackBarAction(); await page.clickSnackBarAction();
expect(dataTable.getRowByName(folder1).isPresent()).toBe(true, 'Item was not restored'); expect(await dataTable.getRowByName(folder1).isPresent()).toBe(true, 'Item was not restored');
expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`); expect(await page.pagination.range.getText()).toContain(`1-${items} of ${items}`);
await dataTable.doubleClickOnRowByName(folder1); await dataTable.doubleClickOnRowByName(folder1);
expect(dataTable.getRowByName(file3).isPresent()).toBe(true, 'file from folder not restored'); expect(await dataTable.getRowByName(file3).isPresent()).toBe(true, 'file from folder not restored');
}); });
xit('undo delete of multiple files - [C280504]', async () => { xit('undo delete of multiple files - [C280504]', async () => {
@@ -235,9 +235,9 @@ describe('Delete and undo delete', () => {
await toolbar.openMoreMenu(); await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Delete'); await toolbar.menu.clickMenuItem('Delete');
await page.clickSnackBarAction(); await page.clickSnackBarAction();
expect(dataTable.getRowByName(file1).isPresent()).toBe(true, `${file1} was not removed from list`); expect(await dataTable.getRowByName(file1).isPresent()).toBe(true, `${file1} was not removed from list`);
expect(dataTable.getRowByName(file2).isPresent()).toBe(true, `${file2} was not removed from list`); expect(await dataTable.getRowByName(file2).isPresent()).toBe(true, `${file2} was not removed from list`);
expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`); expect(await page.pagination.range.getText()).toContain(`1-${items} of ${items}`);
}); });
}); });
@@ -285,9 +285,9 @@ describe('Delete and undo delete', () => {
await toolbar.menu.clickMenuItem('Delete'); await toolbar.menu.clickMenuItem('Delete');
const message = await page.getSnackBarMessage(); const message = await page.getSnackBarMessage();
expect(message).toContain(`${sharedFile1} deleted`); expect(message).toContain(`${sharedFile1} deleted`);
expect(dataTable.getRowByName(sharedFile1).isPresent()).toBe(false, 'Item was not removed from list'); expect(await dataTable.getRowByName(sharedFile1).isPresent()).toBe(false, 'Item was not removed from list');
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH); await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
expect(dataTable.getRowByName(sharedFile1).isPresent()).toBe(true, 'Item is not in trash'); expect(await dataTable.getRowByName(sharedFile1).isPresent()).toBe(true, 'Item is not in trash');
await apis.user.trashcan.restore(sharedFile1Id); await apis.user.trashcan.restore(sharedFile1Id);
await apis.user.shared.shareFilesByIds([ sharedFile1Id ]); await apis.user.shared.shareFilesByIds([ sharedFile1Id ]);
@@ -300,11 +300,11 @@ describe('Delete and undo delete', () => {
await toolbar.menu.clickMenuItem('Delete'); await toolbar.menu.clickMenuItem('Delete');
const message = await page.getSnackBarMessage(); const message = await page.getSnackBarMessage();
expect(message).toContain(`Deleted 2 items`); expect(message).toContain(`Deleted 2 items`);
expect(dataTable.getRowByName(sharedFile2).isPresent()).toBe(false, `${sharedFile2} was not removed from list`); expect(await dataTable.getRowByName(sharedFile2).isPresent()).toBe(false, `${sharedFile2} was not removed from list`);
expect(dataTable.getRowByName(sharedFile3).isPresent()).toBe(false, `${sharedFile3} was not removed from list`); expect(await dataTable.getRowByName(sharedFile3).isPresent()).toBe(false, `${sharedFile3} was not removed from list`);
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH); await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
expect(dataTable.getRowByName(sharedFile2).isPresent()).toBe(true, `${sharedFile2} is not in trash`); expect(await dataTable.getRowByName(sharedFile2).isPresent()).toBe(true, `${sharedFile2} is not in trash`);
expect(dataTable.getRowByName(sharedFile3).isPresent()).toBe(true, `${sharedFile3} is not in trash`); expect(await dataTable.getRowByName(sharedFile3).isPresent()).toBe(true, `${sharedFile3} is not in trash`);
await apis.user.trashcan.restore(sharedFile2Id); await apis.user.trashcan.restore(sharedFile2Id);
await apis.user.trashcan.restore(sharedFile3Id); await apis.user.trashcan.restore(sharedFile3Id);
@@ -328,7 +328,7 @@ describe('Delete and undo delete', () => {
await toolbar.menu.clickMenuItem('Delete'); await toolbar.menu.clickMenuItem('Delete');
await page.clickSnackBarAction(); await page.clickSnackBarAction();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH); await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
expect(dataTable.getRowByName(sharedFile2).isPresent()).toBe(false, 'Item was not restored'); expect(await dataTable.getRowByName(sharedFile2).isPresent()).toBe(false, 'Item was not restored');
}); });
xit('undo delete of multiple files - [C280514]', async () => { xit('undo delete of multiple files - [C280514]', async () => {
@@ -337,8 +337,8 @@ describe('Delete and undo delete', () => {
await toolbar.menu.clickMenuItem('Delete'); await toolbar.menu.clickMenuItem('Delete');
await page.clickSnackBarAction(); await page.clickSnackBarAction();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH); await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
expect(dataTable.getRowByName(sharedFile3).isPresent()).toBe(false, `${sharedFile3} was not restored`); expect(await dataTable.getRowByName(sharedFile3).isPresent()).toBe(false, `${sharedFile3} was not restored`);
expect(dataTable.getRowByName(sharedFile4).isPresent()).toBe(false, `${sharedFile4} was not restored`); expect(await dataTable.getRowByName(sharedFile4).isPresent()).toBe(false, `${sharedFile4} was not restored`);
}); });
}); });
@@ -405,11 +405,11 @@ describe('Delete and undo delete', () => {
await toolbar.menu.clickMenuItem('Delete'); await toolbar.menu.clickMenuItem('Delete');
const message = await page.getSnackBarMessage(); const message = await page.getSnackBarMessage();
expect(message).toContain(`${favoriteFile1} deleted`); expect(message).toContain(`${favoriteFile1} deleted`);
expect(dataTable.getRowByName(favoriteFile1).isPresent()).toBe(false, 'Item was not removed from list'); expect(await dataTable.getRowByName(favoriteFile1).isPresent()).toBe(false, 'Item was not removed from list');
items--; items--;
expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`); expect(await page.pagination.range.getText()).toContain(`1-${items} of ${items}`);
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH); await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
expect(dataTable.getRowByName(favoriteFile1).isPresent()).toBe(true, 'Item is not in trash'); expect(await dataTable.getRowByName(favoriteFile1).isPresent()).toBe(true, 'Item is not in trash');
await apis.user.trashcan.restore(favoriteFile1Id); await apis.user.trashcan.restore(favoriteFile1Id);
}); });
@@ -422,13 +422,13 @@ describe('Delete and undo delete', () => {
await toolbar.menu.clickMenuItem('Delete'); await toolbar.menu.clickMenuItem('Delete');
const message = await page.getSnackBarMessage(); const message = await page.getSnackBarMessage();
expect(message).toContain(`Deleted 2 items`); expect(message).toContain(`Deleted 2 items`);
expect(dataTable.getRowByName(favoriteFile1).isPresent()).toBe(false, `${favoriteFile1} was not removed from list`); expect(await dataTable.getRowByName(favoriteFile1).isPresent()).toBe(false, `${favoriteFile1} was not removed from list`);
expect(dataTable.getRowByName(favoriteFile2).isPresent()).toBe(false, `${favoriteFile2} was not removed from list`); expect(await dataTable.getRowByName(favoriteFile2).isPresent()).toBe(false, `${favoriteFile2} was not removed from list`);
items = items - 2; items = items - 2;
expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`); expect(await page.pagination.range.getText()).toContain(`1-${items} of ${items}`);
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH); await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
expect(dataTable.getRowByName(favoriteFile1).isPresent()).toBe(true, `${favoriteFile1} is not in trash`); expect(await dataTable.getRowByName(favoriteFile1).isPresent()).toBe(true, `${favoriteFile1} is not in trash`);
expect(dataTable.getRowByName(favoriteFile2).isPresent()).toBe(true, `${favoriteFile2} is not in trash`); expect(await dataTable.getRowByName(favoriteFile2).isPresent()).toBe(true, `${favoriteFile2} is not in trash`);
await apis.user.trashcan.restore(favoriteFile1Id); await apis.user.trashcan.restore(favoriteFile1Id);
await apis.user.trashcan.restore(favoriteFile2Id); await apis.user.trashcan.restore(favoriteFile2Id);
@@ -439,12 +439,12 @@ describe('Delete and undo delete', () => {
await dataTable.selectItem(favoriteFolder1); await dataTable.selectItem(favoriteFolder1);
await toolbar.openMoreMenu(); await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Delete'); await toolbar.menu.clickMenuItem('Delete');
expect(dataTable.getRowByName(favoriteFolder1).isPresent()).toBe(false, 'Item was not removed from list'); expect(await dataTable.getRowByName(favoriteFolder1).isPresent()).toBe(false, 'Item was not removed from list');
items--; items--;
expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`); expect(await page.pagination.range.getText()).toContain(`1-${items} of ${items}`);
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH); await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
expect(dataTable.getRowByName(favoriteFolder1).isPresent()).toBe(true, 'Item is not in trash'); expect(await dataTable.getRowByName(favoriteFolder1).isPresent()).toBe(true, 'Item is not in trash');
expect(dataTable.getRowByName(favoriteFile3).isPresent()).toBe(false, 'Item is in trash'); expect(await dataTable.getRowByName(favoriteFile3).isPresent()).toBe(false, 'Item is in trash');
await apis.user.trashcan.restore(favoriteFolder1Id); await apis.user.trashcan.restore(favoriteFolder1Id);
}); });
@@ -455,10 +455,10 @@ describe('Delete and undo delete', () => {
await toolbar.menu.clickMenuItem('Delete'); await toolbar.menu.clickMenuItem('Delete');
const message = await page.getSnackBarMessage(); const message = await page.getSnackBarMessage();
expect(message).toContain(`${favoriteFolder2} couldn't be deleted`); expect(message).toContain(`${favoriteFolder2} couldn't be deleted`);
expect(dataTable.getRowByName(favoriteFolder2).isPresent()).toBe(true, 'Item was removed from list'); expect(await dataTable.getRowByName(favoriteFolder2).isPresent()).toBe(true, 'Item was removed from list');
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH); await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
expect(dataTable.getRowByName(favoriteFolder2).isPresent()).toBe(false, 'Item is in trash'); expect(await dataTable.getRowByName(favoriteFolder2).isPresent()).toBe(false, 'Item is in trash');
expect(dataTable.getRowByName(favoriteFile4).isPresent()).toBe(false, 'Item is in trash'); expect(await dataTable.getRowByName(favoriteFile4).isPresent()).toBe(false, 'Item is in trash');
}); });
it('notification on multiple items deletion - some items fail to delete - [C280520]', async () => { it('notification on multiple items deletion - some items fail to delete - [C280520]', async () => {
@@ -504,8 +504,8 @@ describe('Delete and undo delete', () => {
await toolbar.openMoreMenu(); await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Delete'); await toolbar.menu.clickMenuItem('Delete');
await page.clickSnackBarAction(); await page.clickSnackBarAction();
expect(dataTable.getRowByName(favoriteFile1).isPresent()).toBe(true, 'Item was not restored'); expect(await dataTable.getRowByName(favoriteFile1).isPresent()).toBe(true, 'Item was not restored');
expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`); expect(await page.pagination.range.getText()).toContain(`1-${items} of ${items}`);
}); });
it('undo delete of folder with content - [C280526]', async () => { it('undo delete of folder with content - [C280526]', async () => {
@@ -515,10 +515,10 @@ describe('Delete and undo delete', () => {
await toolbar.openMoreMenu(); await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Delete'); await toolbar.menu.clickMenuItem('Delete');
await page.clickSnackBarAction(); await page.clickSnackBarAction();
expect(dataTable.getRowByName(favoriteFolder1).isPresent()).toBe(true, 'Item was not restored'); expect(await dataTable.getRowByName(favoriteFolder1).isPresent()).toBe(true, 'Item was not restored');
expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`); expect(await page.pagination.range.getText()).toContain(`1-${items} of ${items}`);
await dataTable.doubleClickOnRowByName(favoriteFolder1); await dataTable.doubleClickOnRowByName(favoriteFolder1);
expect(dataTable.getRowByName(favoriteFile3).isPresent()).toBe(true, 'file from folder not restored'); expect(await dataTable.getRowByName(favoriteFile3).isPresent()).toBe(true, 'file from folder not restored');
}); });
it('undo delete of multiple files - [C280525]', async () => { it('undo delete of multiple files - [C280525]', async () => {
@@ -528,9 +528,9 @@ describe('Delete and undo delete', () => {
await toolbar.openMoreMenu(); await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Delete'); await toolbar.menu.clickMenuItem('Delete');
await page.clickSnackBarAction(); await page.clickSnackBarAction();
expect(dataTable.getRowByName(favoriteFile1).isPresent()).toBe(true, `${favoriteFile1} was not removed from list`); expect(await dataTable.getRowByName(favoriteFile1).isPresent()).toBe(true, `${favoriteFile1} was not removed from list`);
expect(dataTable.getRowByName(favoriteFile2).isPresent()).toBe(true, `${favoriteFile2} was not removed from list`); expect(await dataTable.getRowByName(favoriteFile2).isPresent()).toBe(true, `${favoriteFile2} was not removed from list`);
expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`); expect(await page.pagination.range.getText()).toContain(`1-${items} of ${items}`);
}); });
}); });
@@ -584,9 +584,9 @@ describe('Delete and undo delete', () => {
await toolbar.menu.clickMenuItem('Delete'); await toolbar.menu.clickMenuItem('Delete');
const message = await page.getSnackBarMessage(); const message = await page.getSnackBarMessage();
expect(message).toContain(`${recentFile1} deleted`); expect(message).toContain(`${recentFile1} deleted`);
expect(dataTable.getRowByName(recentFile1).isPresent()).toBe(false, 'Item was not removed from list'); expect(await dataTable.getRowByName(recentFile1).isPresent()).toBe(false, 'Item was not removed from list');
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH); await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
expect(dataTable.getRowByName(recentFile1).isPresent()).toBe(true, 'Item is not in trash'); expect(await dataTable.getRowByName(recentFile1).isPresent()).toBe(true, 'Item is not in trash');
await apis.user.trashcan.restore(recentFile1Id); await apis.user.trashcan.restore(recentFile1Id);
await apis.user.search.waitForApi(username, { expect: 4 }); await apis.user.search.waitForApi(username, { expect: 4 });
@@ -598,11 +598,11 @@ describe('Delete and undo delete', () => {
await toolbar.menu.clickMenuItem('Delete'); await toolbar.menu.clickMenuItem('Delete');
const message = await page.getSnackBarMessage(); const message = await page.getSnackBarMessage();
expect(message).toContain(`Deleted 2 items`); expect(message).toContain(`Deleted 2 items`);
expect(dataTable.getRowByName(recentFile2).isPresent()).toBe(false, `${recentFile2} was not removed from list`); expect(await dataTable.getRowByName(recentFile2).isPresent()).toBe(false, `${recentFile2} was not removed from list`);
expect(dataTable.getRowByName(recentFile3).isPresent()).toBe(false, `${recentFile3} was not removed from list`); expect(await dataTable.getRowByName(recentFile3).isPresent()).toBe(false, `${recentFile3} was not removed from list`);
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH); await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
expect(dataTable.getRowByName(recentFile2).isPresent()).toBe(true, `${recentFile2} is not in trash`); expect(await dataTable.getRowByName(recentFile2).isPresent()).toBe(true, `${recentFile2} is not in trash`);
expect(dataTable.getRowByName(recentFile3).isPresent()).toBe(true, `${recentFile3} is not in trash`); expect(await dataTable.getRowByName(recentFile3).isPresent()).toBe(true, `${recentFile3} is not in trash`);
await apis.user.trashcan.restore(recentFile2Id); await apis.user.trashcan.restore(recentFile2Id);
await apis.user.trashcan.restore(recentFile3Id); await apis.user.trashcan.restore(recentFile3Id);
@@ -630,7 +630,7 @@ describe('Delete and undo delete', () => {
await toolbar.menu.clickMenuItem('Delete'); await toolbar.menu.clickMenuItem('Delete');
await page.clickSnackBarAction(); await page.clickSnackBarAction();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH); await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
expect(dataTable.getRowByName(recentFile2).isPresent()).toBe(false, 'Item is in Trash'); expect(await dataTable.getRowByName(recentFile2).isPresent()).toBe(false, 'Item is in Trash');
}); });
// due to the fact that the search api is slow to update, // due to the fact that the search api is slow to update,
@@ -643,8 +643,8 @@ describe('Delete and undo delete', () => {
await toolbar.menu.clickMenuItem('Delete'); await toolbar.menu.clickMenuItem('Delete');
await page.clickSnackBarAction(); await page.clickSnackBarAction();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH); await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
expect(dataTable.getRowByName(recentFile3).isPresent()).toBe(false, `${recentFile3} is in Trash`); expect(await dataTable.getRowByName(recentFile3).isPresent()).toBe(false, `${recentFile3} is in Trash`);
expect(dataTable.getRowByName(recentFile4).isPresent()).toBe(false, `${recentFile4} is in Trash`); expect(await dataTable.getRowByName(recentFile4).isPresent()).toBe(false, `${recentFile4} is in Trash`);
}); });
}); });
}); });

View File

@@ -33,7 +33,7 @@ import { Utils } from '../../utilities/utils';
describe('Edit folder', () => { describe('Edit folder', () => {
const username = `user-${Utils.random()}`; const username = `user-${Utils.random()}`;
const parent = `parent-${Utils.random()}`; const parent = `parent-${Utils.random()}`; let parentId;
const folderName = `folder-${Utils.random()}`; const folderName = `folder-${Utils.random()}`;
const folderDescription = 'my folder description'; const folderDescription = 'my folder description';
@@ -57,131 +57,125 @@ describe('Edit folder', () => {
const { dataTable } = personalFilesPage; const { dataTable } = personalFilesPage;
const editButton = personalFilesPage.toolbar.getButtonByTitleAttribute('Edit'); const editButton = personalFilesPage.toolbar.getButtonByTitleAttribute('Edit');
beforeAll(done => { beforeAll(async (done) => {
apis.admin.people.createUser({ username }) await apis.admin.people.createUser({ username });
.then(() => apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PRIVATE)) await apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PRIVATE);
.then(() => apis.admin.nodes.createFolders([ folderName ], `Sites/${siteName}/documentLibrary`)) const docLibId = await apis.admin.sites.getDocLibId(siteName);
.then(() => apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_CONSUMER)) await apis.admin.nodes.createFolder(folderName, docLibId);
await apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_CONSUMER);
.then(() => apis.user.nodes.createFolder( parent )) parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
.then(resp => apis.user.nodes.createFolder( folderName, resp.entry.id, '', folderDescription )) await apis.user.nodes.createFolder(folderName, parentId, '', folderDescription);
.then(() => apis.user.nodes.createFolders([ folderNameToEdit, duplicateFolderName ], parent)) await apis.user.nodes.createFolder(folderNameToEdit, parentId);
await apis.user.nodes.createFolder(duplicateFolderName, parentId);
.then(() => loginPage.loginWith(username)) await loginPage.loginWith(username);
.then(done); done();
}); });
beforeEach(done => { beforeEach(async (done) => {
personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES) await personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
.then(() => dataTable.waitForHeader()) await dataTable.waitForHeader();
.then(() => dataTable.doubleClickOnRowByName(parent)) await dataTable.doubleClickOnRowByName(parent);
.then(() => dataTable.waitForHeader()) await dataTable.waitForHeader();
.then(done); done();
}); });
afterEach(done => { afterEach(async (done) => {
browser.actions().sendKeys(protractor.Key.ESCAPE).perform().then(done); await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
done();
}); });
afterAll(done => { afterAll(async (done) => {
Promise await Promise.all([
.all([
apis.admin.sites.deleteSite(siteName), apis.admin.sites.deleteSite(siteName),
apis.user.nodes.deleteNodes([ parent ]), apis.user.nodes.deleteNodeById(parentId),
logoutPage.load() logoutPage.load()
]) ]);
.then(done); done();
}); });
it('dialog UI defaults - [C216331]', () => { it('dialog UI defaults - [C216331]', async () => {
dataTable.selectItem(folderName) await dataTable.selectItem(folderName);
.then(() => editButton.click()) await editButton.click();
.then(() => { expect(await editDialog.getTitle()).toEqual('Edit folder');
expect(editDialog.getTitle()).toEqual('Edit folder'); expect(await editDialog.nameInput.getAttribute('value')).toBe(folderName);
expect(editDialog.nameInput.getAttribute('value')).toBe(folderName); expect(await editDialog.descriptionTextArea.getAttribute('value')).toBe(folderDescription);
expect(editDialog.descriptionTextArea.getAttribute('value')).toBe(folderDescription); expect(await editDialog.updateButton.isEnabled()).toBe(true, 'upload button is not enabled');
expect(editDialog.updateButton.isEnabled()).toBe(true, 'upload button is not enabled'); expect(await editDialog.cancelButton.isEnabled()).toBe(true, 'cancel button is not enabled');
expect(editDialog.cancelButton.isEnabled()).toBe(true, 'cancel button is not enabled');
});
}); });
it('properties are modified when pressing OK - [C216335]', () => { it('properties are modified when pressing OK - [C216335]', async (done) => {
dataTable.selectItem(folderNameToEdit) await dataTable.selectItem(folderNameToEdit);
.then(() => editButton.click()) await editButton.click();
.then(() => editDialog.waitForDialogToOpen()) await editDialog.waitForDialogToOpen();
.then(() => editDialog.enterDescription(folderDescriptionEdited)) await editDialog.enterDescription(folderDescriptionEdited);
.then(() => editDialog.enterName(folderNameEdited)) await editDialog.enterName(folderNameEdited);
.then(() => editDialog.clickUpdate()) await editDialog.clickUpdate();
.then(() => editDialog.waitForDialogToClose()) await editDialog.waitForDialogToClose();
.then(() => dataTable.waitForHeader()) await dataTable.waitForHeader();
.then(() => expect(dataTable.getRowByName(folderNameEdited).isPresent()).toBe(true, 'Folder not displayed')) expect(await dataTable.getRowByName(folderNameEdited).isPresent()).toBe(true, 'Folder not displayed');
.then(() => apis.user.nodes.getNodeDescription(folderNameEdited, parent)) const desc = await apis.user.nodes.getNodeDescription(folderNameEdited, parent);
.then(desc => expect(desc).toEqual(folderDescriptionEdited)); expect(desc).toEqual(folderDescriptionEdited);
done();
}); });
it('with empty folder name - [C216332]', () => { it('with empty folder name - [C216332]', async () => {
dataTable.selectItem(folderName) await dataTable.selectItem(folderName);
.then(() => editButton.click()) await editButton.click();
.then(() => editDialog.deleteNameWithBackspace()) await editDialog.deleteNameWithBackspace();
.then(() => { expect(await editDialog.updateButton.isEnabled()).toBe(false, 'upload button is not enabled');
expect(editDialog.updateButton.isEnabled()).toBe(false, 'upload button is not enabled'); expect(await editDialog.getValidationMessage()).toMatch('Folder name is required');
expect(editDialog.getValidationMessage()).toMatch('Folder name is required');
});
}); });
it('with name with special characters - [C216333]', () => { it('with name with special characters - [C216333]', async () => {
const namesWithSpecialChars = [ 'a*a', 'a"a', 'a<a', 'a>a', `a\\a`, 'a/a', 'a?a', 'a:a', 'a|a' ]; const namesWithSpecialChars = [ 'a*a', 'a"a', 'a<a', 'a>a', `a\\a`, 'a/a', 'a?a', 'a:a', 'a|a' ];
dataTable.selectItem(folderName) await dataTable.selectItem(folderName);
.then(() => editButton.click()) await editButton.click();
.then(() => namesWithSpecialChars.forEach(name => {
editDialog.enterName(name);
expect(editDialog.updateButton.isEnabled()).toBe(false, 'upload button is not disabled'); for (const name of namesWithSpecialChars) {
expect(editDialog.getValidationMessage()).toContain(`Folder name can't contain these characters`); await editDialog.enterName(name);
})); expect(await editDialog.updateButton.isEnabled()).toBe(false, 'upload button is not disabled');
expect(await editDialog.getValidationMessage()).toContain(`Folder name can't contain these characters`);
}
}); });
it('with name ending with a dot - [C216334]', () => { it('with name ending with a dot - [C216334]', async () => {
dataTable.selectItem(folderName) await dataTable.selectItem(folderName);
.then(() => editButton.click()) await editButton.click();
.then(() => editDialog.nameInput.sendKeys('.')) await editDialog.waitForDialogToOpen();
.then(() => { await editDialog.nameInput.sendKeys('.');
expect(editDialog.updateButton.isEnabled()).toBe(false, 'upload button is not enabled'); expect(await editDialog.updateButton.isEnabled()).toBe(false, 'upload button is not enabled');
expect(editDialog.getValidationMessage()).toMatch(`Folder name can't end with a period .`); expect(await editDialog.getValidationMessage()).toMatch(`Folder name can't end with a period .`);
});
}); });
it('Cancel button - [C216336]', () => { it('Cancel button - [C216336]', async () => {
dataTable.selectItem(folderName) await dataTable.selectItem(folderName);
.then(() => editButton.click()) await editButton.click();
.then(() => editDialog.clickCancel()) await editDialog.waitForDialogToOpen();
.then(() => { await editDialog.clickCancel();
expect(editDialog.component.isPresent()).not.toBe(true, 'dialog is not closed'); expect(await editDialog.component.isPresent()).not.toBe(true, 'dialog is not closed');
});
}); });
it('with duplicate folder name - [C216337]', () => { it('with duplicate folder name - [C216337]', async () => {
dataTable.selectItem(folderName) await dataTable.selectItem(folderName);
.then(() => editButton.click()) await editButton.click();
.then(() => editDialog.enterName(duplicateFolderName)) await editDialog.waitForDialogToOpen();
.then(() => editDialog.clickUpdate()) await editDialog.enterName(duplicateFolderName);
.then(() => personalFilesPage.getSnackBarMessage()) await editDialog.clickUpdate();
.then(message => { const message = await personalFilesPage.getSnackBarMessage();
expect(message).toEqual(`There's already a folder with this name. Try a different name.`); 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'); expect(await editDialog.component.isPresent()).toBe(true, 'dialog is not present');
});
}); });
it('trim ending spaces - [C216338]', () => { it('trim ending spaces - [C216338]', async () => {
dataTable.selectItem(folderName) await dataTable.selectItem(folderName);
.then(() => editButton.click()) await editButton.click();
.then(() => editDialog.nameInput.sendKeys(' ')) await editDialog.nameInput.sendKeys(' ');
.then(() => editDialog.clickUpdate()) await editDialog.clickUpdate();
.then(() => editDialog.waitForDialogToClose()) await editDialog.waitForDialogToClose();
.then(() => { expect(await personalFilesPage.snackBar.isPresent()).not.toBe(true, 'notification appears');
expect(personalFilesPage.snackBar.isPresent()).not.toBe(true, 'notification appears'); expect(await dataTable.getRowByName(folderName).isPresent()).toBe(true, 'Folder not displayed in list view');
expect(dataTable.getRowByName(folderName).isPresent()).toBe(true, 'Folder not displayed in list view');
});
}); });
}); });

View File

@@ -56,377 +56,357 @@ describe('Mark items as favorites', () => {
const page = new BrowsingPage(); const page = new BrowsingPage();
const { dataTable, toolbar } = page; const { dataTable, toolbar } = page;
beforeAll(done => { beforeAll(async (done) => {
apis.admin.people.createUser({ username }) await apis.admin.people.createUser({ username });
.then(() => apis.user.nodes.createFile( file1NotFav ).then(resp => file1Id = resp.entry.id)) file1Id = (await apis.user.nodes.createFile(file1NotFav)).entry.id;
.then(() => apis.user.nodes.createFile( file2NotFav ).then(resp => file2Id = resp.entry.id)) file2Id = (await apis.user.nodes.createFile(file2NotFav)).entry.id;
.then(() => apis.user.nodes.createFile( file3Fav ).then(resp => file3Id = resp.entry.id)) file3Id = (await apis.user.nodes.createFile(file3Fav)).entry.id;
.then(() => apis.user.nodes.createFile( file4Fav ).then(resp => file4Id = resp.entry.id)) file4Id = (await apis.user.nodes.createFile(file4Fav)).entry.id;
.then(() => apis.user.nodes.createFolder( folder1 ).then(resp => folder1Id = resp.entry.id)) folder1Id = (await apis.user.nodes.createFolder(folder1)).entry.id;
.then(() => apis.user.favorites.addFavoriteById('file', file3Id)) await apis.user.favorites.addFavoriteById('file', file3Id);
.then(() => apis.user.favorites.addFavoriteById('file', file4Id)) await apis.user.favorites.addFavoriteById('file', file4Id);
.then(() => apis.user.search.waitForApi(username, { expect: 4 })) await apis.user.search.waitForApi(username, { expect: 4 });
.then(() => apis.user.favorites.waitForApi({ expect: 2 })) await apis.user.favorites.waitForApi({ expect: 2 });
.then(() => loginPage.loginWith(username)) await loginPage.loginWith(username);
.then(done); done();
}); });
afterAll(done => { afterAll(async (done) => {
Promise.all([ await Promise.all([
apis.user.nodes.deleteNodesById([ file1Id, file2Id, file3Id, file4Id, folder1Id]), apis.user.nodes.deleteNodesById([ file1Id, file2Id, file3Id, file4Id, folder1Id]),
apis.user.sites.deleteSite(siteName), apis.user.sites.deleteSite(siteName),
logoutPage.load() logoutPage.load()
]) ]);
.then(done); done();
}); });
xit(''); xit('');
describe('on Personal Files', () => { describe('on Personal Files', () => {
beforeAll(done => { beforeAll(async (done) => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES) await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
.then(() => dataTable.waitForHeader()) await dataTable.waitForHeader();
.then(done); done();
}); });
beforeEach(done => { beforeEach(async (done) => {
toolbar.closeMoreMenu().then(done); await toolbar.closeMoreMenu();
done();
}); });
it('Favorite action has empty star icon for an item not marked as favorite - [C217186]', () => { it('Favorite action has empty star icon for an item not marked as favorite - [C217186]', async () => {
dataTable.selectItem(file1NotFav) await dataTable.selectItem(file1NotFav);
.then(() => toolbar.openMoreMenu()) await toolbar.openMoreMenu();
.then(() => expect(toolbar.menu.getItemIconText('Favorite')).toEqual('star_border')); expect(await toolbar.menu.getItemIconText('Favorite')).toEqual('star_border');
}); });
it('Favorite action has empty star icon for multiple selection of items when some are not favorite - [C217187]', () => { it('Favorite action has empty star icon for multiple selection of items when some are not favorite - [C217187]', async () => {
dataTable.selectMultipleItems([ file1NotFav, file3Fav ]) await dataTable.selectMultipleItems([ file1NotFav, file3Fav ]);
.then(() => toolbar.openMoreMenu()) await toolbar.openMoreMenu();
.then(() => expect(toolbar.menu.getItemIconText('Favorite')).toEqual('star_border')); expect(await toolbar.menu.getItemIconText('Favorite')).toEqual('star_border');
}); });
it('Favorite action has full star icon for items marked as favorite - [C217188]', () => { it('Favorite action has full star icon for items marked as favorite - [C217188]', async () => {
dataTable.selectItem(file3Fav) await dataTable.selectItem(file3Fav);
.then(() => toolbar.openMoreMenu()) await toolbar.openMoreMenu();
.then(() => expect(toolbar.menu.getItemIconText('Favorite')).toEqual('star')); expect(await toolbar.menu.getItemIconText('Favorite')).toEqual('star');
}); });
it('favorite a file - [C217189]', () => { it('favorite a file - [C217189]', async () => {
dataTable.selectItem(file1NotFav) await dataTable.selectItem(file1NotFav);
.then(() => toolbar.openMoreMenu()) await toolbar.openMoreMenu();
.then(() => toolbar.menu.clickMenuItem('Favorite')) await toolbar.menu.clickMenuItem('Favorite');
.then(() => apis.user.favorites.waitForApi({ expect: 3 })) await apis.user.favorites.waitForApi({ expect: 3 });
.then(() => apis.user.favorites.isFavorite(file1Id)) const isFavorite = await apis.user.favorites.isFavorite(file1Id);
.then(isFavorite => expect(isFavorite).toBe(true, `${file1NotFav} not marked as favorite`)) expect(isFavorite).toBe(true, `${file1NotFav} not marked as favorite`);
.then(() => apis.user.favorites.removeFavoriteById(file1Id)); await apis.user.favorites.removeFavoriteById(file1Id);
}); });
it('favorite a folder - [C280390]', () => { it('favorite a folder - [C280390]', async () => {
dataTable.selectItem(folder1) await dataTable.selectItem(folder1);
.then(() => toolbar.openMoreMenu()) await toolbar.openMoreMenu();
.then(() => toolbar.menu.clickMenuItem('Favorite')) await toolbar.menu.clickMenuItem('Favorite');
.then(() => apis.user.favorites.waitForApi({ expect: 3 })) await apis.user.favorites.waitForApi({ expect: 3 });
.then(() => apis.user.favorites.isFavorite(folder1Id)) const isFavorite = await apis.user.favorites.isFavorite(folder1Id);
.then(isFavorite => expect(isFavorite).toBe(true, `${folder1} not marked as favorite`)) expect(isFavorite).toBe(true, `${folder1} not marked as favorite`);
.then(() => apis.user.favorites.removeFavoriteById(folder1Id)); await apis.user.favorites.removeFavoriteById(folder1Id);
}); });
it('unfavorite an item - [C217190]', () => { it('unfavorite an item - [C217190]', async () => {
dataTable.selectItem(file3Fav) await dataTable.selectItem(file3Fav);
.then(() => toolbar.openMoreMenu()) await toolbar.openMoreMenu();
.then(() => toolbar.menu.clickMenuItem('Favorite')) await toolbar.menu.clickMenuItem('Favorite');
.then(() => apis.user.favorites.waitForApi({ expect: 1 })) await apis.user.favorites.waitForApi({ expect: 1 });
.then(() => apis.user.favorites.isFavorite(file3Id)) const isFavorite = await apis.user.favorites.isFavorite(file3Id);
.then(isFavorite => expect(isFavorite).toBe(false, `${file3Fav} is marked as favorite`)) expect(isFavorite).toBe(false, `${file3Fav} is marked as favorite`);
.then(() => apis.user.favorites.addFavoriteById('file', file3Id)); await apis.user.favorites.addFavoriteById('file', file3Id);
}); });
it('favorite multiple items - all unfavorite - [C217192]', () => { it('favorite multiple items - all unfavorite - [C217192]', async () => {
dataTable.selectMultipleItems([ file1NotFav, file2NotFav ]) await dataTable.selectMultipleItems([ file1NotFav, file2NotFav ]);
.then(() => toolbar.openMoreMenu()) await toolbar.openMoreMenu();
.then(() => toolbar.menu.clickMenuItem('Favorite')) await toolbar.menu.clickMenuItem('Favorite');
.then(() => apis.user.favorites.waitForApi({ expect: 4 })) await apis.user.favorites.waitForApi({ expect: 4 });
.then(() => Promise.all([ const resp = await Promise.all([
apis.user.favorites.isFavorite(file1Id), apis.user.favorites.isFavorite(file1Id),
apis.user.favorites.isFavorite(file2Id) apis.user.favorites.isFavorite(file2Id)
])) ]);
.then(resp => {
expect(resp[0]).toBe(true, 'item not marked as favorite'); expect(resp[0]).toBe(true, 'item not marked as favorite');
expect(resp[1]).toBe(true, 'item not marked as favorite'); expect(resp[1]).toBe(true, 'item not marked as favorite');
})
.then(() => apis.user.favorites.removeFavoriteById(file1Id)) await apis.user.favorites.removeFavoriteById(file1Id);
.then(() => apis.user.favorites.removeFavoriteById(file2Id)); await apis.user.favorites.removeFavoriteById(file2Id);
}); });
it('favorite multiple items - some favorite and some unfavorite - [C217194]', () => { it('favorite multiple items - some favorite and some unfavorite - [C217194]', async () => {
dataTable.selectMultipleItems([ file1NotFav, file3Fav ]) await dataTable.selectMultipleItems([ file1NotFav, file3Fav ]);
.then(() => toolbar.openMoreMenu()) await toolbar.openMoreMenu();
.then(() => toolbar.menu.clickMenuItem('Favorite')) await toolbar.menu.clickMenuItem('Favorite');
.then(() => apis.user.favorites.waitForApi({ expect: 3 })) await apis.user.favorites.waitForApi({ expect: 3 });
.then(() => Promise.all([ const resp = await Promise.all([
apis.user.favorites.isFavorite(file1Id), apis.user.favorites.isFavorite(file1Id),
apis.user.favorites.isFavorite(file3Id) apis.user.favorites.isFavorite(file3Id)
])) ]);
.then(resp => {
expect(resp[0]).toBe(true, 'item not marked as favorite'); expect(resp[0]).toBe(true, 'item not marked as favorite');
expect(resp[1]).toBe(true, 'item not marked as favorite'); expect(resp[1]).toBe(true, 'item not marked as favorite');
})
.then(() => apis.user.favorites.removeFavoriteById(file1Id)); await apis.user.favorites.removeFavoriteById(file1Id);
}); });
it('unfavorite multiple items - [C217193]', () => { it('unfavorite multiple items - [C217193]', async () => {
dataTable.selectMultipleItems([ file3Fav, file4Fav ]) await dataTable.selectMultipleItems([ file3Fav, file4Fav ])
.then(() => toolbar.openMoreMenu()) await toolbar.openMoreMenu();
.then(() => toolbar.menu.clickMenuItem('Favorite')) await toolbar.menu.clickMenuItem('Favorite');
.then(() => browser.sleep(2000)) await browser.sleep(2000);
.then(() => Promise.all([ const resp = await Promise.all([
apis.user.favorites.isFavorite(file3Id), apis.user.favorites.isFavorite(file3Id),
apis.user.favorites.isFavorite(file4Id) apis.user.favorites.isFavorite(file4Id)
])) ]);
.then(resp => {
expect(resp[0]).toBe(false, 'item marked as favorite'); expect(resp[0]).toBe(false, 'item marked as favorite');
expect(resp[1]).toBe(false, 'item marked as favorite'); expect(resp[1]).toBe(false, 'item marked as favorite');
})
.then(() => apis.user.favorites.addFavoriteById('file', file3Id)) await apis.user.favorites.addFavoriteById('file', file3Id);
.then(() => apis.user.favorites.addFavoriteById('file', file4Id)); await apis.user.favorites.addFavoriteById('file', file4Id);
}); });
}); });
describe('on Recent Files', () => { describe('on Recent Files', () => {
beforeAll(done => { beforeAll(async (done) => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES) await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES);
.then(() => dataTable.waitForHeader()) await dataTable.waitForHeader();
.then(done); done();
}); });
beforeEach(done => { beforeEach(async (done) => {
toolbar.closeMoreMenu().then(done); await toolbar.closeMoreMenu();
done();
}); });
it('favorite a file - [C280352]', () => { it('favorite a file - [C280352]', async () => {
dataTable.selectItem(file1NotFav) await dataTable.selectItem(file1NotFav);
.then(() => toolbar.openMoreMenu()) await toolbar.openMoreMenu();
.then(() => toolbar.menu.clickMenuItem('Favorite')) await toolbar.menu.clickMenuItem('Favorite');
.then(() => apis.user.favorites.waitForApi({ expect: 3 })) await apis.user.favorites.waitForApi({ expect: 3 });
.then(() => apis.user.favorites.isFavorite(file1Id)) const isFavorite = await apis.user.favorites.isFavorite(file1Id);
.then(isFavorite => expect(isFavorite).toBe(true, `${file1NotFav} not marked as favorite`)) expect(isFavorite).toBe(true, `${file1NotFav} not marked as favorite`);
.then(() => apis.user.favorites.removeFavoriteById(file1Id)); await apis.user.favorites.removeFavoriteById(file1Id);
}); });
it('unfavorite an item - [C280353]', () => { it('unfavorite an item - [C280353]', async () => {
dataTable.selectItem(file3Fav) await dataTable.selectItem(file3Fav);
.then(() => toolbar.openMoreMenu()) await toolbar.openMoreMenu();
.then(() => toolbar.menu.clickMenuItem('Favorite')) await toolbar.menu.clickMenuItem('Favorite');
.then(() => apis.user.favorites.waitForApi({ expect: 1 })) await apis.user.favorites.waitForApi({ expect: 1 });
.then(() => apis.user.favorites.isFavorite(file3Id)) const isFavorite = await apis.user.favorites.isFavorite(file3Id);
.then(isFavorite => expect(isFavorite).toBe(false, `${file3Fav} is marked as favorite`)) expect(isFavorite).toBe(false, `${file3Fav} is marked as favorite`);
.then(() => apis.user.favorites.addFavoriteById('file', file3Id)); await apis.user.favorites.addFavoriteById('file', file3Id);
}); });
it('favorite multiple items - all unfavorite - [C280355]', () => { it('favorite multiple items - all unfavorite - [C280355]', async () => {
dataTable.selectMultipleItems([ file1NotFav, file2NotFav ]) await dataTable.selectMultipleItems([ file1NotFav, file2NotFav ]);
.then(() => toolbar.openMoreMenu()) await toolbar.openMoreMenu();
.then(() => toolbar.menu.clickMenuItem('Favorite')) await toolbar.menu.clickMenuItem('Favorite');
.then(() => apis.user.favorites.waitForApi({ expect: 4 })) await apis.user.favorites.waitForApi({ expect: 4 });
.then(() => Promise.all([ const resp = await Promise.all([
apis.user.favorites.isFavorite(file1Id), apis.user.favorites.isFavorite(file1Id),
apis.user.favorites.isFavorite(file2Id) apis.user.favorites.isFavorite(file2Id)
])) ]);
.then(resp => {
expect(resp[0]).toBe(true, 'item not marked as favorite'); expect(resp[0]).toBe(true, 'item not marked as favorite');
expect(resp[1]).toBe(true, 'item not marked as favorite'); expect(resp[1]).toBe(true, 'item not marked as favorite');
})
.then(() => apis.user.favorites.removeFavoriteById(file1Id)) await apis.user.favorites.removeFavoriteById(file1Id);
.then(() => apis.user.favorites.removeFavoriteById(file2Id)); await apis.user.favorites.removeFavoriteById(file2Id);
}); });
it('favorite multiple items - some favorite and some unfavorite - [C280357]', () => { it('favorite multiple items - some favorite and some unfavorite - [C280357]', async () => {
dataTable.selectMultipleItems([ file1NotFav, file3Fav ]) await dataTable.selectMultipleItems([ file1NotFav, file3Fav ]);
.then(() => toolbar.openMoreMenu()) await toolbar.openMoreMenu();
.then(() => toolbar.menu.clickMenuItem('Favorite')) await toolbar.menu.clickMenuItem('Favorite');
.then(() => apis.user.favorites.waitForApi({ expect: 3 })) await apis.user.favorites.waitForApi({ expect: 3 });
.then(() => Promise.all([ const resp = await Promise.all([
apis.user.favorites.isFavorite(file1Id), apis.user.favorites.isFavorite(file1Id),
apis.user.favorites.isFavorite(file3Id) apis.user.favorites.isFavorite(file3Id)
])) ]);
.then(resp => {
expect(resp[0]).toBe(true, 'item not marked as favorite'); expect(resp[0]).toBe(true, 'item not marked as favorite');
expect(resp[1]).toBe(true, 'item not marked as favorite'); expect(resp[1]).toBe(true, 'item not marked as favorite');
})
.then(() => apis.user.favorites.removeFavoriteById(file1Id)); await apis.user.favorites.removeFavoriteById(file1Id);
}); });
it('unfavorite multiple items - [C280356]', () => { it('unfavorite multiple items - [C280356]', async () => {
dataTable.selectMultipleItems([ file3Fav, file4Fav ]) await dataTable.selectMultipleItems([ file3Fav, file4Fav ]);
.then(() => toolbar.openMoreMenu()) await toolbar.openMoreMenu();
.then(() => toolbar.menu.clickMenuItem('Favorite')) await toolbar.menu.clickMenuItem('Favorite');
.then(() => browser.sleep(2000)) await browser.sleep(2000);
.then(() => Promise.all([ const resp = await Promise.all([
apis.user.favorites.isFavorite(file3Id), apis.user.favorites.isFavorite(file3Id),
apis.user.favorites.isFavorite(file4Id) apis.user.favorites.isFavorite(file4Id)
])) ]);
.then(resp => {
expect(resp[0]).toBe(false, 'item marked as favorite'); expect(resp[0]).toBe(false, 'item marked as favorite');
expect(resp[1]).toBe(false, 'item marked as favorite'); expect(resp[1]).toBe(false, 'item marked as favorite');
})
.then(() => apis.user.favorites.addFavoriteById('file', file3Id)) await apis.user.favorites.addFavoriteById('file', file3Id);
.then(() => apis.user.favorites.addFavoriteById('file', file4Id)); await apis.user.favorites.addFavoriteById('file', file4Id);
}); });
}); });
describe('on Shared Files', () => { describe('on Shared Files', () => {
beforeAll(done => { beforeAll(async (done) => {
apis.user.shared.shareFilesByIds([ file1Id, file2Id, file3Id, file4Id ]) await apis.user.shared.shareFilesByIds([ file1Id, file2Id, file3Id, file4Id ]);
.then(() => apis.user.shared.waitForApi({ expect: 4 })) await apis.user.shared.waitForApi({ expect: 4 });
.then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES)) await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
.then(() => dataTable.waitForHeader()) await dataTable.waitForHeader();
.then(done); done();
}); });
afterEach(done => { afterEach(async (done) => {
// browser.actions().sendKeys(protractor.Key.ESCAPE).perform().then(done); // browser.actions().sendKeys(protractor.Key.ESCAPE).perform().then(done);
browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform().then(done); await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
done();
}); });
it('favorite a file - [C280362]', () => { it('favorite a file - [C280362]', async () => {
dataTable.selectItem(file1NotFav) await dataTable.selectItem(file1NotFav)
.then(() => toolbar.openMoreMenu()) await toolbar.openMoreMenu();
.then(() => toolbar.menu.clickMenuItem('Favorite')) await toolbar.menu.clickMenuItem('Favorite');
.then(() => apis.user.favorites.waitForApi({ expect: 3 })) await apis.user.favorites.waitForApi({ expect: 3 });
.then(() => apis.user.favorites.isFavorite(file1Id)) const isFavorite = await apis.user.favorites.isFavorite(file1Id);
.then(isFavorite => expect(isFavorite).toBe(true, `${file1NotFav} not marked as favorite`)) expect(isFavorite).toBe(true, `${file1NotFav} not marked as favorite`);
.then(() => apis.user.favorites.removeFavoriteById(file1Id)); await apis.user.favorites.removeFavoriteById(file1Id);
}); });
it('unfavorite an item - [C280363]', () => { it('unfavorite an item - [C280363]', async () => {
dataTable.selectItem(file3Fav) await dataTable.selectItem(file3Fav);
.then(() => toolbar.openMoreMenu()) await toolbar.openMoreMenu();
.then(() => toolbar.menu.clickMenuItem('Favorite')) await toolbar.menu.clickMenuItem('Favorite');
.then(() => apis.user.favorites.waitForApi({ expect: 1 })) await apis.user.favorites.waitForApi({ expect: 1 });
.then(() => apis.user.favorites.isFavorite(file3Id)) const isFavorite = await apis.user.favorites.isFavorite(file3Id);
.then(isFavorite => expect(isFavorite).toBe(false, `${file3Fav} is marked as favorite`)) expect(isFavorite).toBe(false, `${file3Fav} is marked as favorite`);
.then(() => apis.user.favorites.addFavoriteById('file', file3Id)); await apis.user.favorites.addFavoriteById('file', file3Id);
}); });
it('favorite multiple items - all unfavorite - [C280365]', () => { it('favorite multiple items - all unfavorite - [C280365]', async () => {
dataTable.selectMultipleItems([ file1NotFav, file2NotFav ]) await dataTable.selectMultipleItems([ file1NotFav, file2NotFav ]);
.then(() => toolbar.openMoreMenu()) await toolbar.openMoreMenu();
.then(() => toolbar.menu.clickMenuItem('Favorite')) await toolbar.menu.clickMenuItem('Favorite');
.then(() => apis.user.favorites.waitForApi({ expect: 4 })) await apis.user.favorites.waitForApi({ expect: 4 });
.then(() => Promise.all([ const resp = await Promise.all([
apis.user.favorites.isFavorite(file1Id), apis.user.favorites.isFavorite(file1Id),
apis.user.favorites.isFavorite(file2Id) apis.user.favorites.isFavorite(file2Id)
])) ]);
.then(resp => {
expect(resp[0]).toBe(true, 'item not marked as favorite'); expect(resp[0]).toBe(true, 'item not marked as favorite');
expect(resp[1]).toBe(true, 'item not marked as favorite'); expect(resp[1]).toBe(true, 'item not marked as favorite');
})
.then(() => apis.user.favorites.removeFavoriteById(file1Id)) await apis.user.favorites.removeFavoriteById(file1Id);
.then(() => apis.user.favorites.removeFavoriteById(file2Id)); await apis.user.favorites.removeFavoriteById(file2Id);
}); });
it('favorite multiple items - some favorite and some unfavorite - [C280367]', () => { it('favorite multiple items - some favorite and some unfavorite - [C280367]', async () => {
dataTable.selectMultipleItems([ file1NotFav, file3Fav ]) await dataTable.selectMultipleItems([ file1NotFav, file3Fav ]);
.then(() => toolbar.openMoreMenu()) await toolbar.openMoreMenu();
.then(() => toolbar.menu.clickMenuItem('Favorite')) await toolbar.menu.clickMenuItem('Favorite');
.then(() => apis.user.favorites.waitForApi({ expect: 3 })) await apis.user.favorites.waitForApi({ expect: 3 });
.then(() => Promise.all([ const resp = await Promise.all([
apis.user.favorites.isFavorite(file1Id), apis.user.favorites.isFavorite(file1Id),
apis.user.favorites.isFavorite(file3Id) apis.user.favorites.isFavorite(file3Id)
])) ]);
.then(resp => {
expect(resp[0]).toBe(true, 'item not marked as favorite'); expect(resp[0]).toBe(true, 'item not marked as favorite');
expect(resp[1]).toBe(true, 'item not marked as favorite'); expect(resp[1]).toBe(true, 'item not marked as favorite');
})
.then(() => apis.user.favorites.removeFavoriteById(file1Id)); await apis.user.favorites.removeFavoriteById(file1Id);
}); });
it('unfavorite multiple items - [C280366]', () => { it('unfavorite multiple items - [C280366]', async () => {
dataTable.selectMultipleItems([ file3Fav, file4Fav ]) await dataTable.selectMultipleItems([ file3Fav, file4Fav ]);
.then(() => toolbar.openMoreMenu()) await toolbar.openMoreMenu();
.then(() => toolbar.menu.clickMenuItem('Favorite')) await toolbar.menu.clickMenuItem('Favorite');
.then(() => browser.sleep(2000)) await browser.sleep(2000);
.then(() => Promise.all([ const resp = await Promise.all([
apis.user.favorites.isFavorite(file3Id), apis.user.favorites.isFavorite(file3Id),
apis.user.favorites.isFavorite(file4Id) apis.user.favorites.isFavorite(file4Id)
])) ]);
.then(resp => {
expect(resp[0]).toBe(false, 'item marked as favorite'); expect(resp[0]).toBe(false, 'item marked as favorite');
expect(resp[1]).toBe(false, 'item marked as favorite'); expect(resp[1]).toBe(false, 'item marked as favorite');
})
.then(() => apis.user.favorites.addFavoriteById('file', file3Id)) await apis.user.favorites.addFavoriteById('file', file3Id);
.then(() => apis.user.favorites.addFavoriteById('file', file4Id)); await apis.user.favorites.addFavoriteById('file', file4Id);
}); });
}); });
describe('on Favorites', () => { describe('on Favorites', () => {
beforeAll(done => { beforeAll(async (done) => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES) await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
.then(() => dataTable.waitForHeader()) await dataTable.waitForHeader();
.then(done); done();
}); });
afterEach(done => { afterEach(async (done) => {
page.refresh().then(done); await page.refresh();
done();
}); });
it('unfavorite an item - [C280368]', () => { it('unfavorite an item - [C280368]', async () => {
dataTable.selectItem(file3Fav) await dataTable.selectItem(file3Fav);
.then(() => toolbar.openMoreMenu()) await toolbar.openMoreMenu();
.then(() => toolbar.menu.clickMenuItem('Favorite')) await toolbar.menu.clickMenuItem('Favorite');
.then(() => apis.user.favorites.waitForApi({ expect: 1 })) await apis.user.favorites.waitForApi({ expect: 1 });
.then(() => apis.user.favorites.isFavorite(file3Id)) const isFavorite = await apis.user.favorites.isFavorite(file3Id);
.then(isFavorite => {
expect(isFavorite).toBe(false, 'item is marked as favorite'); expect(isFavorite).toBe(false, 'item is marked as favorite');
expect(dataTable.getRowByName(file3Fav).isPresent()).toBe(false, 'item still displayed'); expect(await dataTable.getRowByName(file3Fav).isPresent()).toBe(false, 'item still displayed');
})
.then(() => apis.user.favorites.addFavoriteById('file', file3Id)); await apis.user.favorites.addFavoriteById('file', file3Id);
}); });
it('unfavorite multiple items - [C280374]', () => { it('unfavorite multiple items - [C280374]', async () => {
dataTable.selectMultipleItems([ file3Fav, file4Fav ]) await dataTable.selectMultipleItems([ file3Fav, file4Fav ]);
.then(() => toolbar.openMoreMenu()) await toolbar.openMoreMenu();
.then(() => toolbar.menu.clickMenuItem('Favorite')) await toolbar.menu.clickMenuItem('Favorite');
.then(() => browser.sleep(2000)) await browser.sleep(2000);
.then(() => apis.user.favorites.isFavorite(file3Id)) const isFavorite3 = await apis.user.favorites.isFavorite(file3Id);
.then(resp => { expect(isFavorite3).toBe(false, 'file3 marked as favorite');
expect(resp).toBe(false, 'file3 marked as favorite'); expect(await dataTable.getRowByName(file3Fav).isPresent()).toBe(false, 'file3 still displayed');
expect(dataTable.getRowByName(file3Fav).isPresent()).toBe(false, 'file3 still displayed'); const isFavorite4 = await apis.user.favorites.isFavorite(file4Id);
}) expect(isFavorite4).toBe(false, 'file4 marked as favorite');
.then(() => apis.user.favorites.isFavorite(file4Id)) expect(await dataTable.getRowByName(file4Fav).isPresent()).toBe(false, 'file4 still displayed');
.then(resp => {
expect(resp).toBe(false, 'file4 marked as favorite');
expect(dataTable.getRowByName(file4Fav).isPresent()).toBe(false, 'file4 still displayed');
})
.then(() => apis.user.favorites.addFavoriteById('file', file3Id)) await apis.user.favorites.addFavoriteById('file', file3Id);
.then(() => apis.user.favorites.addFavoriteById('file', file4Id)); await apis.user.favorites.addFavoriteById('file', file4Id);
}); });
it('Favorite action has full star icon for items marked as favorite - [C280371]', () => { it('Favorite action has full star icon for items marked as favorite - [C280371]', async () => {
dataTable.selectItem(file3Fav) await dataTable.selectItem(file3Fav);
.then(() => toolbar.openMoreMenu()) await toolbar.openMoreMenu();
.then(() => expect(toolbar.menu.getItemIconText('Favorite')).toEqual('star')); expect(await toolbar.menu.getItemIconText('Favorite')).toEqual('star');
}); });
}); });
@@ -435,7 +415,7 @@ describe('Mark items as favorites', () => {
beforeAll(async (done) => { beforeAll(async (done) => {
await apis.user.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC); await apis.user.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC);
const docLibId = (await apis.user.sites.getDocLibId(siteName)); const docLibId = await apis.user.sites.getDocLibId(siteName);
folderSiteId = (await apis.user.nodes.createFolder(folderSite, docLibId)).entry.id; folderSiteId = (await apis.user.nodes.createFolder(folderSite, docLibId)).entry.id;
fileSiteNotFav1Id = (await apis.user.nodes.createFile(fileSiteNotFav1, folderSiteId)).entry.id; fileSiteNotFav1Id = (await apis.user.nodes.createFile(fileSiteNotFav1, folderSiteId)).entry.id;
fileSiteFav1Id = (await apis.user.nodes.createFile(fileSiteFav1, folderSiteId)).entry.id; fileSiteFav1Id = (await apis.user.nodes.createFile(fileSiteFav1, folderSiteId)).entry.id;

View File

@@ -88,7 +88,7 @@ describe('Permanently delete from Trash', () => {
const text = await trashPage.getSnackBarMessage(); const text = await trashPage.getSnackBarMessage();
expect(text).toEqual(`${file1} deleted`); expect(text).toEqual(`${file1} deleted`);
expect(dataTable.getRowByName(file1).isPresent()).toBe(false, 'Item was not deleted'); expect(await dataTable.getRowByName(file1).isPresent()).toBe(false, 'Item was not deleted');
}); });
it('delete folder - [C280416]', async () => { it('delete folder - [C280416]', async () => {
@@ -100,7 +100,7 @@ describe('Permanently delete from Trash', () => {
const text = await trashPage.getSnackBarMessage(); const text = await trashPage.getSnackBarMessage();
expect(text).toEqual(`${folder1} deleted`); expect(text).toEqual(`${folder1} deleted`);
expect(dataTable.getRowByName(folder1).isPresent()).toBe(false, 'Item was not deleted'); expect(await dataTable.getRowByName(folder1).isPresent()).toBe(false, 'Item was not deleted');
}); });
it('delete multiple items - [C280417]', async () => { it('delete multiple items - [C280417]', async () => {
@@ -112,8 +112,8 @@ describe('Permanently delete from Trash', () => {
const text = await trashPage.getSnackBarMessage(); const text = await trashPage.getSnackBarMessage();
expect(text).toEqual(`2 items deleted`); expect(text).toEqual(`2 items deleted`);
expect(dataTable.getRowByName(file2).isPresent()).toBe(false, 'Item was not deleted'); expect(await dataTable.getRowByName(file2).isPresent()).toBe(false, 'Item was not deleted');
expect(dataTable.getRowByName(folder2).isPresent()).toBe(false, 'Item was not deleted'); expect(await dataTable.getRowByName(folder2).isPresent()).toBe(false, 'Item was not deleted');
}); });
it('Confirmation dialog UI - [C269113]', async () => { it('Confirmation dialog UI - [C269113]', async () => {
@@ -137,6 +137,6 @@ describe('Permanently delete from Trash', () => {
expect(await confirmDialog.keepButton.isEnabled()).toBe(true, 'KEEP button is not enabled'); expect(await confirmDialog.keepButton.isEnabled()).toBe(true, 'KEEP button is not enabled');
await confirmDialog.clickKeep(); await confirmDialog.clickKeep();
expect(dataTable.getRowByName(file3).isPresent()).toBe(true, 'Item was deleted'); expect(await dataTable.getRowByName(file3).isPresent()).toBe(true, 'Item was deleted');
}); });
}); });

View File

@@ -42,15 +42,18 @@ describe('Restore from Trash', () => {
const page = new BrowsingPage(); const page = new BrowsingPage();
const { dataTable, toolbar } = page; const { dataTable, toolbar } = page;
beforeAll(done => { beforeAll(async (done) => {
apis.admin.people await apis.admin.people.createUser({ username });
.createUser({ username }) await loginPage.loginWith(username);
.then(() => loginPage.loginWith(username)) done();
.then(done);
}); });
afterAll(done => { afterAll(async (done) => {
Promise.all([apis.admin.trashcan.emptyTrash(), logoutPage.load()]).then(done); await Promise.all([
apis.admin.trashcan.emptyTrash(),
logoutPage.load()
]);
done();
}); });
xit(''); xit('');
@@ -61,97 +64,77 @@ describe('Restore from Trash', () => {
const folder = `folder-${Utils.random()}`; const folder = `folder-${Utils.random()}`;
let folderId; let folderId;
beforeAll(done => { beforeAll(async (done) => {
apis.user.nodes fileId = (await apis.user.nodes.createFile(file)).entry.id;
.createFile(file) folderId = (await apis.user.nodes.createFolder(folder)).entry.id;
.then(resp => (fileId = resp.entry.id)) await apis.user.nodes.deleteNodesById([fileId, folderId], false);
.then(() => apis.user.nodes.createFolder(folder).then(resp => (folderId = resp.entry.id))) done();
.then(() => apis.user.nodes.deleteNodesById([fileId, folderId], false))
.then(done);
}); });
beforeEach(done => { beforeEach(async (done) => {
page.sidenav await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH) await dataTable.waitForHeader();
.then(() => dataTable.waitForHeader()) done();
.then(done);
}); });
afterAll(done => { afterAll(async (done) => {
apis.user.trashcan.emptyTrash().then(done); await apis.user.trashcan.emptyTrash();
done();
}); });
it('restore file - [C217177]', () => { it('restore file - [C217177]', async () => {
dataTable await dataTable.selectItem(file);
.selectItem(file) await toolbar.getButtonByTitleAttribute('Restore').click();
.then(() => toolbar.getButtonByTitleAttribute('Restore').click()) const text = await page.getSnackBarMessage();
.then(() => page.getSnackBarMessage())
.then(text => {
expect(text).toContain(`${file} restored`); expect(text).toContain(`${file} restored`);
expect(text).toContain(`View`); expect(text).toContain(`View`);
expect(dataTable.getRowByName(file).isPresent()).toBe(false, 'Item was not removed from list'); expect(await dataTable.getRowByName(file).isPresent()).toBe(false, 'Item was not removed from list');
}) await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
.then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)) await page.dataTable.waitForHeader();
.then(() => page.dataTable.waitForHeader()) expect(await page.dataTable.getRowByName(file).isPresent()).toBe(true, 'Item not displayed in list');
.then(() => {
expect(page.dataTable.getRowByName(file).isPresent()).toBe(true, 'Item not displayed in list');
})
.then(() => apis.user.nodes.deleteNodeById(fileId, false)); await apis.user.nodes.deleteNodeById(fileId, false);
}); });
it('restore folder - [C280438]', () => { it('restore folder - [C280438]', async () => {
dataTable await dataTable.selectItem(folder);
.selectItem(folder) await toolbar.getButtonByTitleAttribute('Restore').click();
.then(() => toolbar.getButtonByTitleAttribute('Restore').click()) const text = await page.getSnackBarMessage();
.then(() => page.getSnackBarMessage())
.then(text => {
expect(text).toContain(`${folder} restored`); expect(text).toContain(`${folder} restored`);
expect(text).toContain(`View`); expect(text).toContain(`View`);
expect(dataTable.getRowByName(folder).isPresent()).toBe(false, 'Item was not removed from list'); expect(await dataTable.getRowByName(folder).isPresent()).toBe(false, 'Item was not removed from list');
}) await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
.then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)) await page.dataTable.waitForHeader();
.then(() => page.dataTable.waitForHeader()) expect(await page.dataTable.getRowByName(folder).isPresent()).toBe(true, 'Item not displayed in list');
.then(() => {
expect(page.dataTable.getRowByName(folder).isPresent()).toBe(true, 'Item not displayed in list');
})
.then(() => apis.user.nodes.deleteNodeById(folderId, false)); await apis.user.nodes.deleteNodeById(folderId, false);
}); });
it('restore multiple items - [C217182]', () => { it('restore multiple items - [C217182]', async () => {
dataTable await dataTable.selectMultipleItems([file, folder]);
.selectMultipleItems([file, folder]) await toolbar.getButtonByTitleAttribute('Restore').click();
.then(() => toolbar.getButtonByTitleAttribute('Restore').click()) const text = await page.getSnackBarMessage();
.then(() => page.getSnackBarMessage())
.then(text => {
expect(text).toContain(`Restore successful`); expect(text).toContain(`Restore successful`);
expect(text).not.toContain(`View`); expect(text).not.toContain(`View`);
expect(dataTable.getRowByName(file).isPresent()).toBe(false, 'Item was not removed from list'); expect(await dataTable.getRowByName(file).isPresent()).toBe(false, 'Item was not removed from list');
expect(dataTable.getRowByName(folder).isPresent()).toBe(false, 'Item was not removed from list'); expect(await dataTable.getRowByName(folder).isPresent()).toBe(false, 'Item was not removed from list');
}) await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
.then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)) await page.dataTable.waitForHeader();
.then(() => page.dataTable.waitForHeader()) expect(await page.dataTable.getRowByName(file).isPresent()).toBe(true, 'Item not displayed in list');
.then(() => { expect(await page.dataTable.getRowByName(folder).isPresent()).toBe(true, 'Item not displayed in list');
expect(page.dataTable.getRowByName(file).isPresent()).toBe(true, 'Item not displayed in list');
expect(page.dataTable.getRowByName(folder).isPresent()).toBe(true, 'Item not displayed in list');
})
.then(() => apis.user.nodes.deleteNodesById([fileId, folderId], false)); await apis.user.nodes.deleteNodesById([fileId, folderId], false);
}); });
it('View from notification - [C217181]', () => { it('View from notification - [C217181]', async () => {
dataTable await dataTable.selectItem(file);
.selectItem(file) await toolbar.getButtonByTitleAttribute('Restore').click();
.then(() => toolbar.getButtonByTitleAttribute('Restore').click()) await page.clickSnackBarAction();
.then(() => page.clickSnackBarAction()) await page.dataTable.waitForHeader();
.then(() => page.dataTable.waitForHeader()) expect(await page.sidenav.isActiveByLabel('Personal Files')).toBe(true, 'Personal Files sidebar link not active');
.then(() => { expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
expect(page.sidenav.isActiveByLabel('Personal Files')).toBe(true, 'Personal Files sidebar link not active');
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
})
.then(() => apis.user.nodes.deleteNodeById(fileId, false)); await apis.user.nodes.deleteNodeById(fileId, false);
}); });
}); });
@@ -166,49 +149,48 @@ describe('Restore from Trash', () => {
const folder2 = `folder-${Utils.random()}`; const folder2 = `folder-${Utils.random()}`;
let folder2Id; let folder2Id;
beforeAll(done => { beforeAll(async (done) => {
apis.user.nodes folder1Id = (await apis.user.nodes.createFolder(folder1)).entry.id;
.createFolder(folder1) file1Id1 = (await apis.user.nodes.createFile(file1, folder1Id)).entry.id;
.then(resp => (folder1Id = resp.entry.id)) await apis.user.nodes.deleteNodeById(file1Id1, false);
.then(() => apis.user.nodes.createFile(file1, folder1Id).then(resp => (file1Id1 = resp.entry.id))) file1Id2 = (await apis.user.nodes.createFile(file1, folder1Id)).entry.id;
.then(() => apis.user.nodes.deleteNodeById(file1Id1, false))
.then(() => apis.user.nodes.createFile(file1, folder1Id).then(resp => (file1Id2 = resp.entry.id)))
.then(() => apis.user.nodes.createFolder(folder2).then(resp => (folder2Id = resp.entry.id))) folder2Id = (await apis.user.nodes.createFolder(folder2)).entry.id;
.then(() => apis.user.nodes.createFile(file2, folder2Id).then(resp => (file2Id = resp.entry.id))) file2Id = (await apis.user.nodes.createFile(file2, folder2Id)).entry.id;
.then(() => apis.user.nodes.deleteNodeById(file2Id, false)) await apis.user.nodes.deleteNodeById(file2Id, false);
.then(() => apis.user.nodes.deleteNodeById(folder2Id, false)) await apis.user.nodes.deleteNodeById(folder2Id, false);
.then(done); done();
}); });
beforeEach(done => { beforeEach(async (done) => {
page.sidenav await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH) await dataTable.waitForHeader();
.then(() => dataTable.waitForHeader()) done();
.then(done);
}); });
afterAll(done => { afterAll(async (done) => {
Promise.all([apis.user.nodes.deleteNodeById(file1Id2), apis.user.trashcan.emptyTrash()]).then(done); await Promise.all([
apis.user.nodes.deleteNodeById(file1Id2),
apis.user.trashcan.emptyTrash()
]);
done();
}); });
it('Restore a file when another file with same name exists on the restore location - [C217178]', () => { it('Restore a file when another file with same name exists on the restore location - [C217178]', async () => {
page.sidenav await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH) await dataTable.selectItem(file1);
.then(() => dataTable.selectItem(file1)) await toolbar.getButtonByTitleAttribute('Restore').click();
.then(() => toolbar.getButtonByTitleAttribute('Restore').click()) const text = await page.getSnackBarMessage();
.then(() => page.getSnackBarMessage()) expect(text).toEqual(`Can't restore, ${file1} already exists`);
.then(text => expect(text).toEqual(`Can't restore, ${file1} already exists`));
}); });
it('Restore a file when original location no longer exists - [C217179]', () => { it('Restore a file when original location no longer exists - [C217179]', async () => {
page.sidenav await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH) await dataTable.selectItem(file2);
.then(() => dataTable.selectItem(file2)) await toolbar.getButtonByTitleAttribute('Restore').click();
.then(() => toolbar.getButtonByTitleAttribute('Restore').click()) const text = await page.getSnackBarMessage();
.then(() => page.getSnackBarMessage()) expect(text).toEqual(`Can't restore ${file2}, the original location no longer exists`);
.then(text => expect(text).toEqual(`Can't restore ${file2}, the original location no longer exists`));
}); });
}); });
@@ -233,56 +215,55 @@ describe('Restore from Trash', () => {
const file5 = `file5-${Utils.random()}.txt`; const file5 = `file5-${Utils.random()}.txt`;
let file5Id; let file5Id;
beforeAll(done => { beforeAll(async (done) => {
apis.user.nodes folder1Id = (await apis.user.nodes.createFolder(folder1)).entry.id;
.createFolder(folder1) file1Id = (await apis.user.nodes.createFile(file1, folder1Id)).entry.id;
.then(resp => (folder1Id = resp.entry.id)) folder2Id = (await apis.user.nodes.createFolder(folder2)).entry.id;
.then(() => apis.user.nodes.createFile(file1, folder1Id).then(resp => (file1Id = resp.entry.id))) file2Id = (await apis.user.nodes.createFile(file2, folder2Id)).entry.id;
.then(() => apis.user.nodes.createFolder(folder2).then(resp => (folder2Id = resp.entry.id))) await apis.user.nodes.deleteNodeById(file1Id, false);
.then(() => apis.user.nodes.createFile(file2, folder2Id).then(resp => (file2Id = resp.entry.id))) await apis.user.nodes.deleteNodeById(folder1Id, false);
.then(() => apis.user.nodes.deleteNodeById(file1Id, false)) await apis.user.nodes.deleteNodeById(file2Id, false);
.then(() => apis.user.nodes.deleteNodeById(folder1Id, false))
.then(() => apis.user.nodes.deleteNodeById(file2Id, false))
.then(() => apis.user.nodes.createFolder(folder3).then(resp => (folder3Id = resp.entry.id))) folder3Id = (await apis.user.nodes.createFolder(folder3)).entry.id;
.then(() => apis.user.nodes.createFile(file3, folder3Id).then(resp => (file3Id = resp.entry.id))) file3Id = (await apis.user.nodes.createFile(file3, folder3Id)).entry.id;
.then(() => apis.user.nodes.createFile(file4, folder3Id).then(resp => (file4Id = resp.entry.id))) file4Id = (await apis.user.nodes.createFile(file4, folder3Id)).entry.id;
.then(() => apis.user.nodes.createFolder(folder4).then(resp => (folder4Id = resp.entry.id))) folder4Id = (await apis.user.nodes.createFolder(folder4)).entry.id;
.then(() => apis.user.nodes.createFile(file5, folder4Id).then(resp => (file5Id = resp.entry.id))) file5Id = (await apis.user.nodes.createFile(file5, folder4Id)).entry.id;
.then(() => apis.user.nodes.deleteNodeById(file3Id, false)) await apis.user.nodes.deleteNodeById(file3Id, false);
.then(() => apis.user.nodes.deleteNodeById(file4Id, false)) await apis.user.nodes.deleteNodeById(file4Id, false);
.then(() => apis.user.nodes.deleteNodeById(folder3Id, false)) await apis.user.nodes.deleteNodeById(folder3Id, false);
.then(() => apis.user.nodes.deleteNodeById(file5Id, false)) await apis.user.nodes.deleteNodeById(file5Id, false);
.then(() => loginPage.loginWith(username)) await loginPage.loginWith(username);
.then(done); done();
}); });
beforeEach(done => { beforeEach(async (done) => {
page.sidenav await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH) await dataTable.waitForHeader();
.then(() => dataTable.waitForHeader()) done();
.then(done);
}); });
afterAll(done => { afterAll(async (done) => {
Promise.all([apis.user.trashcan.emptyTrash(), logoutPage.load()]).then(done); await Promise.all([
apis.user.trashcan.emptyTrash(),
logoutPage.load()
]);
done();
}); });
it('one failure - [C217183]', () => { it('one failure - [C217183]', async () => {
dataTable await dataTable.selectMultipleItems([file1, file2]);
.selectMultipleItems([file1, file2]) await toolbar.getButtonByTitleAttribute('Restore').click();
.then(() => toolbar.getButtonByTitleAttribute('Restore').click()) const text = await page.getSnackBarMessage();
.then(() => page.getSnackBarMessage()) expect(text).toEqual(`Can't restore ${file1}, the original location no longer exists`);
.then(text => expect(text).toEqual(`Can't restore ${file1}, the original location no longer exists`));
}); });
it('multiple failures - [C217184]', () => { it('multiple failures - [C217184]', async () => {
dataTable await dataTable.selectMultipleItems([file3, file4, file5]);
.selectMultipleItems([file3, file4, file5]) await toolbar.getButtonByTitleAttribute('Restore').click();
.then(() => toolbar.getButtonByTitleAttribute('Restore').click()) const text = await page.getSnackBarMessage();
.then(() => page.getSnackBarMessage()) expect(text).toEqual('2 items not restored because of issues with the restore location');
.then(text => expect(text).toEqual('2 items not restored because of issues with the restore location'));
}); });
}); });
}); });

View File

@@ -74,44 +74,28 @@ describe('Toolbar actions - multiple selection : ', () => {
file2Id = (await apis.user.nodes.createFiles([file2])).entry.id; file2Id = (await apis.user.nodes.createFiles([file2])).entry.id;
folder1Id = (await apis.user.nodes.createFolders([folder1])).entry.id; folder1Id = (await apis.user.nodes.createFolders([folder1])).entry.id;
folder2Id = (await apis.user.nodes.createFolders([folder2])).entry.id; folder2Id = (await apis.user.nodes.createFolders([folder2])).entry.id;
fileForDelete1Id = (await apis.user.nodes.createFiles([fileForDelete1])) fileForDelete1Id = (await apis.user.nodes.createFiles([fileForDelete1])).entry.id;
.entry.id; fileForDelete2Id = (await apis.user.nodes.createFiles([fileForDelete2])).entry.id;
fileForDelete2Id = (await apis.user.nodes.createFiles([fileForDelete2])) folderForDelete1Id = (await apis.user.nodes.createFolders([folderForDelete1])).entry.id;
.entry.id; folderForDelete2Id = (await apis.user.nodes.createFolders([folderForDelete2])).entry.id;
folderForDelete1Id = (await apis.user.nodes.createFolders([
folderForDelete1
])).entry.id;
folderForDelete2Id = (await apis.user.nodes.createFolders([
folderForDelete2
])).entry.id;
await apis.user.shared.shareFilesByIds([file1Id, file2Id]); await apis.user.shared.shareFilesByIds([file1Id, file2Id]);
await apis.user.shared.waitForApi({ expect: 2 }); await apis.user.shared.waitForApi({ expect: 2 });
await apis.user.favorites.addFavoritesByIds('file', [file1Id, file2Id]); await apis.user.favorites.addFavoritesByIds('file', [file1Id, file2Id]);
await apis.user.favorites.addFavoritesByIds('folder', [ await apis.user.favorites.addFavoritesByIds('folder', [folder1Id, folder2Id]);
folder1Id,
folder2Id
]);
await apis.user.favorites.waitForApi({ expect: 4 }); await apis.user.favorites.waitForApi({ expect: 4 });
await apis.user.nodes.deleteNodesById( await apis.user.nodes.deleteNodesById([fileForDelete1Id, fileForDelete2Id, folderForDelete1Id, folderForDelete2Id], false);
[
fileForDelete1Id,
fileForDelete2Id,
folderForDelete1Id,
folderForDelete2Id
],
false
);
await apis.user.sites.createSite(siteName, SITE_VISIBILITY.PRIVATE); await apis.user.sites.createSite(siteName, SITE_VISIBILITY.PRIVATE);
const docLibId = await apis.user.sites.getDocLibId(siteName); const docLibId = await apis.user.sites.getDocLibId(siteName);
await apis.user.nodes.createFile(file1InSite, docLibId); await Promise.all([
await apis.user.nodes.createFile(file2InSite, docLibId); apis.user.nodes.createFile(file1InSite, docLibId),
await apis.user.nodes.createFolder(folder1InSite, docLibId); apis.user.nodes.createFile(file2InSite, docLibId),
await apis.user.nodes.createFolder(folder2InSite, docLibId); apis.user.nodes.createFolder(folder1InSite, docLibId),
apis.user.nodes.createFolder(folder2InSite, docLibId)
]);
await loginPage.loginWith(username); await loginPage.loginWith(username);
done(); done();
}); });
@@ -138,161 +122,70 @@ describe('Toolbar actions - multiple selection : ', () => {
it('Unselect items with single click - [C280458]', async () => { it('Unselect items with single click - [C280458]', async () => {
await dataTable.selectMultipleItems([file1, file2, folder1, folder2]); await dataTable.selectMultipleItems([file1, file2, folder1, folder2]);
expect(await dataTable.countSelectedRows()).toEqual( expect(await dataTable.countSelectedRows()).toEqual(4, 'incorrect selected rows number');
4,
'incorrect selected rows number'
);
await dataTable.selectItem(file1); await dataTable.selectItem(file1);
expect(await dataTable.countSelectedRows()).toEqual( expect(await dataTable.countSelectedRows()).toEqual(1, 'incorrect selected rows number');
1,
'incorrect selected rows number'
);
}); });
it('Select / unselect selected items by CMD+click - [C217110]', async () => { it('Select / unselect selected items by CMD+click - [C217110]', async () => {
await browser await browser.actions().sendKeys(protractor.Key.COMMAND).perform();
.actions()
.sendKeys(protractor.Key.COMMAND)
.perform();
await dataTable.selectItem(file1); await dataTable.selectItem(file1);
await dataTable.selectItem(file2); await dataTable.selectItem(file2);
await dataTable.selectItem(folder1); await dataTable.selectItem(folder1);
await dataTable.selectItem(folder2); await dataTable.selectItem(folder2);
await browser await browser.actions().sendKeys(protractor.Key.NULL).perform();
.actions() expect(await dataTable.countSelectedRows()).toEqual(4, 'incorrect selected rows number');
.sendKeys(protractor.Key.NULL) await browser.actions().sendKeys(protractor.Key.COMMAND).perform();
.perform();
expect(await dataTable.countSelectedRows()).toEqual(
4,
'incorrect selected rows number'
);
await browser
.actions()
.sendKeys(protractor.Key.COMMAND)
.perform();
await dataTable.selectItem(file1); await dataTable.selectItem(file1);
await dataTable.selectItem(file2); await dataTable.selectItem(file2);
await browser await browser.actions().sendKeys(protractor.Key.NULL).perform();
.actions()
.sendKeys(protractor.Key.NULL)
.perform();
expect(await dataTable.countSelectedRows()).toEqual( expect(await dataTable.countSelectedRows()).toEqual(2, 'incorrect selected rows number');
2,
'incorrect selected rows number'
);
}); });
it('correct actions appear when multiple files are selected - [C217112]', async () => { it('correct actions appear when multiple files are selected - [C217112]', async () => {
await dataTable.selectMultipleItems([file1, file2]); await dataTable.selectMultipleItems([file1, file2]);
expect(await toolbar.isButtonPresent('View')).toBe( expect(await toolbar.isButtonPresent('View')).toBe(false, 'View is displayed');
false, expect(await toolbar.isButtonPresent('Download')).toBe(true, 'Download is not displayed');
'View is displayed' expect(await toolbar.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
);
expect(await toolbar.isButtonPresent('Download')).toBe(
true,
'Download is not displayed'
);
expect(await toolbar.isButtonPresent('Edit')).toBe(
false,
'Edit is displayed'
);
const menu = await toolbar.openMoreMenu(); const menu = await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe( expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
true, expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
`Copy is not displayed for selected files` expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
); expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Delete')).toBe(
true,
`Delete is not displayed for selected files`
);
expect(await menu.isMenuItemPresent('Move')).toBe(
true,
`Move is not displayed for selected files`
);
expect(await menu.isMenuItemPresent('Favorite')).toBe(
true,
`Favorite is not displayed for selected files`
);
await toolbar.closeMoreMenu(); await toolbar.closeMoreMenu();
}); });
it('correct actions appear when multiple folders are selected - [C280459]', async () => { it('correct actions appear when multiple folders are selected - [C280459]', async () => {
await dataTable.selectMultipleItems([folder1, folder2]); await dataTable.selectMultipleItems([folder1, folder2]);
expect(await toolbar.isButtonPresent('View')).toBe( expect(await toolbar.isButtonPresent('View')).toBe(false, 'View is displayed');
false, expect(await toolbar.isButtonPresent('Download')).toBe(true, 'Download is not displayed');
'View is displayed' expect(await toolbar.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
);
expect(await toolbar.isButtonPresent('Download')).toBe(
true,
'Download is not displayed'
);
expect(await toolbar.isButtonPresent('Edit')).toBe(
false,
'Edit is displayed'
);
const menu = await toolbar.openMoreMenu(); const menu = await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe( expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
true, expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
`Copy is not displayed for selected files` expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
); expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Delete')).toBe(
true,
`Delete is not displayed for selected files`
);
expect(await menu.isMenuItemPresent('Move')).toBe(
true,
`Move is not displayed for selected files`
);
expect(await menu.isMenuItemPresent('Favorite')).toBe(
true,
`Favorite is not displayed for selected files`
);
await toolbar.closeMoreMenu(); await toolbar.closeMoreMenu();
}); });
it('correct actions appear when both files and folders are selected - [C280460]', async () => { it('correct actions appear when both files and folders are selected - [C280460]', async () => {
await dataTable.selectMultipleItems([file1, file2, folder1, folder2]); await dataTable.selectMultipleItems([file1, file2, folder1, folder2]);
expect(await toolbar.isButtonPresent('View')).toBe( expect(await toolbar.isButtonPresent('View')).toBe(false, 'View is displayed');
false, expect(await toolbar.isButtonPresent('Download')).toBe(true, 'Download is not displayed');
'View is displayed' expect(await toolbar.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
);
expect(await toolbar.isButtonPresent('Download')).toBe(
true,
'Download is not displayed'
);
expect(await toolbar.isButtonPresent('Edit')).toBe(
false,
'Edit is displayed'
);
const menu = await toolbar.openMoreMenu(); const menu = await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe( expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
true, expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
`Copy is not displayed for selected files` expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
); expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Delete')).toBe(
true,
`Delete is not displayed for selected files`
);
expect(await menu.isMenuItemPresent('Move')).toBe(
true,
`Move is not displayed for selected files`
);
expect(await menu.isMenuItemPresent('Favorite')).toBe(
true,
`Favorite is not displayed for selected files`
);
await toolbar.closeMoreMenu(); await toolbar.closeMoreMenu();
}); });
}); });
describe('File Libraries', () => { describe('File Libraries', () => {
beforeEach(async done => { beforeEach(async done => {
await browser await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
.actions()
.mouseMove(browser.$('body'), { x: 0, y: 0 })
.click()
.perform();
await dataTable.clearSelection(); await dataTable.clearSelection();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES); await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
await dataTable.waitForHeader(); await dataTable.waitForHeader();
@@ -303,116 +196,44 @@ describe('Toolbar actions - multiple selection : ', () => {
it('correct actions appear when multiple files are selected - [C280461]', async () => { it('correct actions appear when multiple files are selected - [C280461]', async () => {
await dataTable.selectMultipleItems([file1InSite, file2InSite]); await dataTable.selectMultipleItems([file1InSite, file2InSite]);
expect(await toolbar.isButtonPresent('View')).toBe( expect(await toolbar.isButtonPresent('View')).toBe(false, 'View is displayed for selected files');
false, expect(await toolbar.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
'View is displayed for selected files' expect(await toolbar.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files');
);
expect(await toolbar.isButtonPresent('Download')).toBe(
true,
'Download is not displayed for selected files'
);
expect(await toolbar.isButtonPresent('Edit')).toBe(
false,
'Edit is displayed for selected files'
);
const menu = await toolbar.openMoreMenu(); const menu = await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe( expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
true, expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
`Copy is not displayed for selected files` expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
); expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Delete')).toBe(
true,
`Delete is not displayed for selected files`
);
expect(await menu.isMenuItemPresent('Move')).toBe(
true,
`Move is not displayed for selected files`
);
expect(await menu.isMenuItemPresent('Favorite')).toBe(
true,
`Favorite is not displayed for selected files`
);
}); });
it('correct actions appear when multiple folders are selected - [C280462]', async () => { it('correct actions appear when multiple folders are selected - [C280462]', async () => {
await dataTable.selectMultipleItems([folder1InSite, folder2InSite]); await dataTable.selectMultipleItems([folder1InSite, folder2InSite]);
expect(await toolbar.isButtonPresent('View')).toBe( expect(await toolbar.isButtonPresent('View')).toBe(false, 'View is displayed');
false, expect(await toolbar.isButtonPresent('Download')).toBe(true, 'Download is not displayed');
'View is displayed' expect(await toolbar.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
);
expect(await toolbar.isButtonPresent('Download')).toBe(
true,
'Download is not displayed'
);
expect(await toolbar.isButtonPresent('Edit')).toBe(
false,
'Edit is displayed'
);
const menu = await toolbar.openMoreMenu(); const menu = await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe( expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
true, expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
`Copy is not displayed for selected files` expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
); expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Delete')).toBe(
true,
`Delete is not displayed for selected files`
);
expect(await menu.isMenuItemPresent('Move')).toBe(
true,
`Move is not displayed for selected files`
);
expect(await menu.isMenuItemPresent('Favorite')).toBe(
true,
`Favorite is not displayed for selected files`
);
}); });
it('correct actions appear when both files and folders are selected - [C280463]', async () => { it('correct actions appear when both files and folders are selected - [C280463]', async () => {
await dataTable.selectMultipleItems([ await dataTable.selectMultipleItems([file1InSite, file2InSite, folder1InSite, folder2InSite]);
file1InSite, expect(await toolbar.isButtonPresent('View')).toBe(false, 'View is displayed');
file2InSite, expect(await toolbar.isButtonPresent('Download')).toBe(true, 'Download is not displayed');
folder1InSite, expect(await toolbar.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
folder2InSite
]);
expect(await toolbar.isButtonPresent('View')).toBe(
false,
'View is displayed'
);
expect(await toolbar.isButtonPresent('Download')).toBe(
true,
'Download is not displayed'
);
expect(await toolbar.isButtonPresent('Edit')).toBe(
false,
'Edit is displayed'
);
const menu = await toolbar.openMoreMenu(); const menu = await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe( expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
true, expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
`Copy is not displayed for selected files` expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
); expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Delete')).toBe(
true,
`Delete is not displayed for selected files`
);
expect(await menu.isMenuItemPresent('Move')).toBe(
true,
`Move is not displayed for selected files`
);
expect(await menu.isMenuItemPresent('Favorite')).toBe(
true,
`Favorite is not displayed for selected files`
);
}); });
}); });
describe('Shared Files', () => { describe('Shared Files', () => {
beforeEach(async done => { beforeEach(async done => {
await browser await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
.actions()
.mouseMove(browser.$('body'), { x: 0, y: 0 })
.click()
.perform();
await dataTable.clearSelection(); await dataTable.clearSelection();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES); await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
await dataTable.waitForHeader(); await dataTable.waitForHeader();
@@ -421,45 +242,20 @@ describe('Toolbar actions - multiple selection : ', () => {
it('correct actions appear when multiple files are selected - [C280467]', async () => { it('correct actions appear when multiple files are selected - [C280467]', async () => {
await dataTable.selectMultipleItems([file1, file2]); await dataTable.selectMultipleItems([file1, file2]);
expect(await toolbar.isButtonPresent('View')).toBe( expect(await toolbar.isButtonPresent('View')).toBe(false, 'View is displayed');
false, expect(await toolbar.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
'View is displayed' expect(await toolbar.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files');
);
expect(await toolbar.isButtonPresent('Download')).toBe(
true,
'Download is not displayed for selected files'
);
expect(await toolbar.isButtonPresent('Edit')).toBe(
false,
'Edit is displayed for selected files'
);
const menu = await toolbar.openMoreMenu(); const menu = await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe( expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
true, expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
`Copy is not displayed for selected files` expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
); expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Delete')).toBe(
true,
`Delete is not displayed for selected files`
);
expect(await menu.isMenuItemPresent('Move')).toBe(
true,
`Move is not displayed for selected files`
);
expect(await menu.isMenuItemPresent('Favorite')).toBe(
true,
`Favorite is not displayed for selected files`
);
}); });
}); });
describe('Recent Files', () => { describe('Recent Files', () => {
beforeEach(async done => { beforeEach(async done => {
await browser await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
.actions()
.mouseMove(browser.$('body'), { x: 0, y: 0 })
.click()
.perform();
await dataTable.clearSelection(); await dataTable.clearSelection();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES); await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES);
await dataTable.waitForHeader(); await dataTable.waitForHeader();
@@ -468,45 +264,20 @@ describe('Toolbar actions - multiple selection : ', () => {
it('correct actions appear when multiple files are selected - [C280468]', async () => { it('correct actions appear when multiple files are selected - [C280468]', async () => {
await dataTable.selectMultipleItems([file1, file2]); await dataTable.selectMultipleItems([file1, file2]);
expect(await toolbar.isButtonPresent('View')).toBe( expect(await toolbar.isButtonPresent('View')).toBe(false, 'View is displayed');
false, expect(await toolbar.isButtonPresent('Download')).toBe(true, 'Download is not displayed');
'View is displayed' expect(await toolbar.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
);
expect(await toolbar.isButtonPresent('Download')).toBe(
true,
'Download is not displayed'
);
expect(await toolbar.isButtonPresent('Edit')).toBe(
false,
'Edit is displayed'
);
const menu = await toolbar.openMoreMenu(); const menu = await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe( expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
true, expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
`Copy is not displayed for selected files` expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
); expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Delete')).toBe(
true,
`Delete is not displayed for selected files`
);
expect(await menu.isMenuItemPresent('Move')).toBe(
true,
`Move is not displayed for selected files`
);
expect(await menu.isMenuItemPresent('Favorite')).toBe(
true,
`Favorite is not displayed for selected files`
);
}); });
}); });
describe('Favorites', () => { describe('Favorites', () => {
beforeEach(async done => { beforeEach(async done => {
await browser await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
.actions()
.mouseMove(browser.$('body'), { x: 0, y: 0 })
.click()
.perform();
await dataTable.clearSelection(); await dataTable.clearSelection();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES); await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
await dataTable.waitForHeader(); await dataTable.waitForHeader();
@@ -515,101 +286,38 @@ describe('Toolbar actions - multiple selection : ', () => {
it('correct actions appear when multiple files are selected - [C280469]', async () => { it('correct actions appear when multiple files are selected - [C280469]', async () => {
await dataTable.selectMultipleItems([file1, file2]); await dataTable.selectMultipleItems([file1, file2]);
expect(await toolbar.isButtonPresent('View')).toBe( expect(await toolbar.isButtonPresent('View')).toBe(false, 'View is displayed');
false, expect(await toolbar.isButtonPresent('Download')).toBe(true, 'Download is not displayed');
'View is displayed' expect(await toolbar.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
);
expect(await toolbar.isButtonPresent('Download')).toBe(
true,
'Download is not displayed'
);
expect(await toolbar.isButtonPresent('Edit')).toBe(
false,
'Edit is displayed'
);
const menu = await toolbar.openMoreMenu(); const menu = await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe( expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
true, expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
`Copy is not displayed for selected files` expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
); expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Delete')).toBe(
true,
`Delete is not displayed for selected files`
);
expect(await menu.isMenuItemPresent('Move')).toBe(
true,
`Move is not displayed for selected files`
);
expect(await menu.isMenuItemPresent('Favorite')).toBe(
true,
`Favorite is not displayed for selected files`
);
}); });
it('correct actions appear when multiple folders are selected - [C280470]', async () => { it('correct actions appear when multiple folders are selected - [C280470]', async () => {
await dataTable.selectMultipleItems([folder1, folder2]); await dataTable.selectMultipleItems([folder1, folder2]);
expect(await toolbar.isButtonPresent('View')).toBe( expect(await toolbar.isButtonPresent('View')).toBe(false, 'View is displayed');
false, expect(await toolbar.isButtonPresent('Download')).toBe(true, 'Download is not displayed');
'View is displayed' expect(await toolbar.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
);
expect(await toolbar.isButtonPresent('Download')).toBe(
true,
'Download is not displayed'
);
expect(await toolbar.isButtonPresent('Edit')).toBe(
false,
'Edit is displayed'
);
const menu = await toolbar.openMoreMenu(); const menu = await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe( expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
true, expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
`Copy is not displayed for selected files` expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
); expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Delete')).toBe(
true,
`Delete is not displayed for selected files`
);
expect(await menu.isMenuItemPresent('Move')).toBe(
true,
`Move is not displayed for selected files`
);
expect(await menu.isMenuItemPresent('Favorite')).toBe(
true,
`Favorite is not displayed for selected files`
);
}); });
it('correct actions appear when both files and folders are selected - [C280471]', async () => { it('correct actions appear when both files and folders are selected - [C280471]', async () => {
await dataTable.selectMultipleItems([file1, file2, folder1, folder2]); await dataTable.selectMultipleItems([file1, file2, folder1, folder2]);
expect(await toolbar.isButtonPresent('View')).toBe( expect(await toolbar.isButtonPresent('View')).toBe(false, 'View is displayed');
false, expect(await toolbar.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
'View is displayed' expect(await toolbar.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
);
expect(await toolbar.isButtonPresent('Download')).toBe(
true,
'Download is not displayed for selected files'
);
expect(await toolbar.isButtonPresent('Edit')).toBe(
false,
'Edit is displayed'
);
const menu = await toolbar.openMoreMenu(); const menu = await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe( expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
true, expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
`Copy is not displayed for selected files` expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
); expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Delete')).toBe(
true,
`Delete is not displayed for selected files`
);
expect(await menu.isMenuItemPresent('Move')).toBe(
true,
`Move is not displayed for selected files`
);
expect(await menu.isMenuItemPresent('Favorite')).toBe(
true,
`Favorite is not displayed for selected files`
);
}); });
}); });
@@ -623,43 +331,20 @@ describe('Toolbar actions - multiple selection : ', () => {
it('correct actions appear when multiple files are selected - [C280472]', async () => { it('correct actions appear when multiple files are selected - [C280472]', async () => {
await dataTable.selectMultipleItems([fileForDelete1, fileForDelete2]); await dataTable.selectMultipleItems([fileForDelete1, fileForDelete2]);
expect(await toolbar.isButtonPresent('Permanently delete')).toBe( expect(await toolbar.isButtonPresent('Permanently delete')).toBe(true, 'Permanently delete is displayed');
true, expect(await toolbar.isButtonPresent('Restore')).toBe(true, 'Restore is not displayed');
'Permanently delete is displayed'
);
expect(await toolbar.isButtonPresent('Restore')).toBe(
true,
'Restore is not displayed'
);
}); });
it('correct actions appear when multiple folders are selected - [C280473]', async () => { it('correct actions appear when multiple folders are selected - [C280473]', async () => {
await dataTable.selectMultipleItems([folderForDelete1, folderForDelete2]); await dataTable.selectMultipleItems([folderForDelete1, folderForDelete2]);
expect(await toolbar.isButtonPresent('Permanently delete')).toBe( expect(await toolbar.isButtonPresent('Permanently delete')).toBe(true, 'Permanently delete is displayed');
true, expect(await toolbar.isButtonPresent('Restore')).toBe(true, 'Restore is not displayed');
'Permanently delete is displayed'
);
expect(await toolbar.isButtonPresent('Restore')).toBe(
true,
'Restore is not displayed'
);
}); });
it('correct actions appear when both files and folders are selected - [C280474]', async () => { it('correct actions appear when both files and folders are selected - [C280474]', async () => {
await dataTable.selectMultipleItems([ await dataTable.selectMultipleItems([fileForDelete1, fileForDelete2, folderForDelete1, folderForDelete2]);
fileForDelete1, expect(await toolbar.isButtonPresent('Permanently delete')).toBe(true, 'Permanently delete is displayed');
fileForDelete2, expect(await toolbar.isButtonPresent('Restore')).toBe(true, 'Restore is not displayed');
folderForDelete1,
folderForDelete2
]);
expect(await toolbar.isButtonPresent('Permanently delete')).toBe(
true,
'Permanently delete is displayed'
);
expect(await toolbar.isButtonPresent('Restore')).toBe(
true,
'Restore is not displayed'
);
}); });
}); });
}); });

View File

@@ -218,7 +218,6 @@ describe('Toolbar actions - single selection : ', () => {
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${fileUser}`); expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${fileUser}`);
await toolbar.closeMoreMenu(); await toolbar.closeMoreMenu();
}); });
}); });
describe('Recent Files', () => { describe('Recent Files', () => {

View File

@@ -44,31 +44,31 @@ describe('Upload files', () => {
const page = new BrowsingPage(); const page = new BrowsingPage();
const { dataTable } = page; const { dataTable } = page;
beforeAll(done => { beforeAll(async (done) => {
apis.admin.people.createUser({ username }) await apis.admin.people.createUser({ username });
.then(() => apis.user.nodes.createFolder(folder1).then(resp => folder1Id = resp.entry.id)) folder1Id = (await apis.user.nodes.createFolder(folder1)).entry.id;
.then(() => loginPage.loginWith(username)) await loginPage.loginWith(username);
.then(done); done();
}); });
beforeEach(done => { beforeEach(async (done) => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES) await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
.then(() => dataTable.waitForHeader()) await dataTable.waitForHeader();
.then(done); done();
}); });
afterAll(done => { afterAll(async (done) => {
Promise.all([ await Promise.all([
// apis.user.nodes.deleteNodeById(folder1Id), apis.user.nodes.deleteNodeById(folder1Id),
logoutPage.load() logoutPage.load()
]) ]);
.then(done); done();
}); });
it('Upload a file', () => { it('Upload a file', async () => {
dataTable.doubleClickOnRowByName(folder1) await dataTable.doubleClickOnRowByName(folder1);
.then(() => page.sidenav.openNewMenu()) await page.sidenav.openNewMenu();
.then(() => page.sidenav.menu.uploadFile().sendKeys(`${__dirname}/create-folder.test.ts`)); await page.sidenav.menu.uploadFile().sendKeys(`${__dirname}/create-folder.test.ts`);
}); });
}); });

View File

@@ -41,16 +41,18 @@ describe('General', () => {
xit(''); xit('');
describe('on session expire', () => { describe('on session expire', () => {
beforeAll(async () => { beforeAll(async (done) => {
folderId = (await nodesApi.createFolder(folder)).entry.id; folderId = (await nodesApi.createFolder(folder)).entry.id;
done();
}); });
afterAll(async () => { afterAll(async (done) => {
await nodesApi.deleteNodeById(folderId); await nodesApi.deleteNodeById(folderId);
await logoutPage.load(); await logoutPage.load();
done();
}); });
it('should redirect user to login page' , async () => { it('should close opened dialogs - [C286473]', async () => {
await loginPage.loginWithAdmin(); await loginPage.loginWithAdmin();
await page.sidenav.openCreateDialog(); await page.sidenav.openCreateDialog();
@@ -61,25 +63,11 @@ describe('General', () => {
await createDialog.clickCreate(); await createDialog.clickCreate();
expect(await browser.getTitle()).toContain('Sign in'); 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(); const message = await page.getSnackBarMessage();
expect(message).toEqual('The action was unsuccessful. Try again or contact your IT Team.'); expect(message).toEqual('The action was unsuccessful. Try again or contact your IT Team.');
await createDialog.waitForDialogToClose(); await createDialog.waitForDialogToClose();
expect(createDialog.component.isPresent()).not.toBe(true, 'dialog is present'); expect(createDialog.component.isPresent()).not.toBe(true, 'dialog is present');
}); });
}); });
}); });

View File

@@ -44,127 +44,88 @@ describe('Page titles', () => {
describe('on Login / Logout pages', () => { describe('on Login / Logout pages', () => {
it('on Login page - [C217155]', () => { it('on Login page - [C217155]', async () => {
loginPage.load() await loginPage.load();
.then(() => { expect(await browser.getTitle()).toContain('Sign in');
expect(browser.getTitle()).toContain('Sign in'); });
it('after logout - [C217156]', async () => {
await loginPage.loginWithAdmin();
await page.signOut();
expect(await browser.getTitle()).toContain('Sign in');
});
it('when pressing Back after Logout - [C280414]', async () => {
await loginPage.loginWithAdmin();
await page.signOut();
await browser.navigate().back();
expect(await browser.getTitle()).toContain('Sign in');
}); });
}); });
it('after logout - [C217156]', () => { describe('on app pages', () => {
loginPage.loginWithAdmin() beforeAll(async (done) => {
.then(() => page.signOut())
.then(() => {
expect(browser.getTitle()).toContain('Sign in');
});
});
it('when pressing Back after Logout - [C280414]', () => {
loginPage.loginWithAdmin()
.then(() => page.signOut())
.then(() => browser.navigate().back())
.then(() => {
expect(browser.getTitle()).toContain('Sign in');
});
});
});
describe('on list views', () => {
beforeAll(done => {
loginPage.loginWithAdmin().then(done);
});
afterAll(done => {
logoutPage.load()
.then(done);
});
it('Personal Files page - [C217157]', () => {
const label = SIDEBAR_LABELS.PERSONAL_FILES;
page.sidenav.navigateToLinkByLabel(label)
.then(() => {
expect(browser.getTitle()).toContain(label);
});
});
it('File Libraries page - [C217158]', () => {
const label = SIDEBAR_LABELS.FILE_LIBRARIES;
page.sidenav.navigateToLinkByLabel(label)
.then(() => {
expect(browser.getTitle()).toContain(label);
});
});
it('Shared Files page - [C217159]', () => {
const label = SIDEBAR_LABELS.SHARED_FILES;
page.sidenav.navigateToLinkByLabel(label)
.then(() => {
expect(browser.getTitle()).toContain(label);
});
});
it('Recent Files page - [C217160]', () => {
const label = SIDEBAR_LABELS.RECENT_FILES;
page.sidenav.navigateToLinkByLabel(label)
.then(() => {
expect(browser.getTitle()).toContain(label);
});
});
it('Favorites page - [C217161]', () => {
const label = SIDEBAR_LABELS.FAVORITES;
page.sidenav.navigateToLinkByLabel(label)
.then(() => {
expect(browser.getTitle()).toContain(label);
});
});
it('Trash page - [C217162]', () => {
const label = SIDEBAR_LABELS.TRASH;
page.sidenav.navigateToLinkByLabel(label)
.then(() => {
expect(browser.getTitle()).toContain(label);
});
});
});
describe('on File Viewer', () => {
beforeAll( async (done) => {
fileId = (await nodesApi.createFile(file)).entry.id; fileId = (await nodesApi.createFile(file)).entry.id;
await loginPage.loginWithAdmin(); await loginPage.loginWithAdmin();
done(); done();
}); });
afterAll( async (done) => { afterAll(async (done) => {
await logoutPage.load(); await Promise.all([
await adminApi.nodes.deleteNodeById(fileId); logoutPage.load(),
adminApi.nodes.deleteNodeById(fileId)
]);
done(); done();
}); });
it('Personal Files page - [C217157]', async () => {
const label = SIDEBAR_LABELS.PERSONAL_FILES;
await page.sidenav.navigateToLinkByLabel(label);
expect(await browser.getTitle()).toContain(label);
});
it('File Libraries page - [C217158]', async () => {
const label = SIDEBAR_LABELS.FILE_LIBRARIES;
await page.sidenav.navigateToLinkByLabel(label);
expect(await browser.getTitle()).toContain(label);
});
it('Shared Files page - [C217159]', async () => {
const label = SIDEBAR_LABELS.SHARED_FILES;
await page.sidenav.navigateToLinkByLabel(label);
expect(await browser.getTitle()).toContain(label);
});
it('Recent Files page - [C217160]', async () => {
const label = SIDEBAR_LABELS.RECENT_FILES;
await page.sidenav.navigateToLinkByLabel(label);
expect(await browser.getTitle()).toContain(label);
});
it('Favorites page - [C217161]', async () => {
const label = SIDEBAR_LABELS.FAVORITES;
await page.sidenav.navigateToLinkByLabel(label);
expect(await browser.getTitle()).toContain(label);
});
it('Trash page - [C217162]', async () => {
const label = SIDEBAR_LABELS.TRASH;
await page.sidenav.navigateToLinkByLabel(label);
expect(await browser.getTitle()).toContain(label);
});
it('File Preview page - [C280415]', async () => { it('File Preview page - [C280415]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES); await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
await page.dataTable.waitForHeader(); await page.dataTable.waitForHeader();
await page.dataTable.doubleClickOnRowByName(file); await page.dataTable.doubleClickOnRowByName(file);
expect(await browser.getTitle()).toContain(PAGE_TITLES.VIEWER); expect(await browser.getTitle()).toContain(PAGE_TITLES.VIEWER);
}); await Utils.pressEscape();
});
describe ('on Search query', () => {
beforeAll( async (done) => {
await loginPage.loginWithAdmin();
done();
});
afterAll( async (done) => {
await logoutPage.load();
done();
}); });
it('Search Results page - [C280413]', async () => { it('Search Results page - [C280413]', async () => {

View File

@@ -58,119 +58,98 @@ describe('Login', () => {
}; };
const newPassword = 'new password'; const newPassword = 'new password';
beforeAll(done => { beforeAll(async (done) => {
Promise await Promise.all([
.all([
peopleApi.createUser({ username: testUser }), peopleApi.createUser({ username: testUser }),
peopleApi.createUser(russianUser), peopleApi.createUser(russianUser),
peopleApi.createUser(johnDoe), peopleApi.createUser(johnDoe),
peopleApi.createUser({ username: disabledUser }) peopleApi.createUser({ username: disabledUser }),
.then(() => peopleApi.disableUser(disabledUser)),
peopleApi.createUser(testUser2) peopleApi.createUser(testUser2)
]) ]);
.then(done); await peopleApi.disableUser(disabledUser);
done();
}); });
afterEach(done => { afterEach(async (done) => {
logoutPage.load() await logoutPage.load();
.then(() => Utils.clearLocalStorage()) await Utils.clearLocalStorage();
.then(done); done();
}); });
xit(''); xit('');
describe('general tests', () => { describe('general tests', () => {
beforeEach(done => { beforeEach(async (done) => {
loginPage.load().then(done); await loginPage.load();
done();
}); });
it('login page layout - [C213089]', () => { it('login page layout - [C213089]', async () => {
expect(loginPage.login.usernameInput.isEnabled()).toBe(true, 'username input is not enabled'); expect(await loginPage.login.usernameInput.isEnabled()).toBe(true, 'username input is not enabled');
expect(loginPage.login.passwordInput.isEnabled()).toBe(true, 'password input is not enabled'); expect(await loginPage.login.passwordInput.isEnabled()).toBe(true, 'password input is not enabled');
expect(loginPage.login.submitButton.isEnabled()).toBe(false, 'SIGN IN button is enabled'); expect(await loginPage.login.submitButton.isEnabled()).toBe(false, 'SIGN IN button is enabled');
expect(loginPage.login.getPasswordVisibility()).toBe(false, 'Password is not hidden by default'); expect(await loginPage.login.getPasswordVisibility()).toBe(false, 'Password is not hidden by default');
}); });
it('change password visibility - [C213091]', () => { it('change password visibility - [C213091]', async () => {
loginPage.login.enterPassword('some password'); await loginPage.login.enterPassword('some password');
expect(loginPage.login.isPasswordShown()).toBe(false, 'password is visible'); expect(await loginPage.login.isPasswordShown()).toBe(false, 'password is visible');
loginPage.login.passwordVisibility.click() await loginPage.login.passwordVisibility.click();
.then(() => { expect(await loginPage.login.getPasswordVisibility()).toBe(true, 'Password visibility not changed');
expect(loginPage.login.getPasswordVisibility()).toBe(true, 'Password visibility not changed'); expect(await loginPage.login.isPasswordShown()).toBe(true, 'password is not visible');
expect(loginPage.login.isPasswordShown()).toBe(true, 'password is not visible');
});
}); });
}); });
describe('with valid credentials', () => { describe('with valid credentials', () => {
it('navigate to "Personal Files" - [C213092]', () => { it('navigate to "Personal Files" - [C213092]', async () => {
const { username } = johnDoe; const { username } = johnDoe;
loginPage.loginWith(username) await loginPage.loginWith(username);
.then(() => { expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
});
}); });
it(`displays user's name in header - [C213108]`, () => { it(`displays user's name in header - [C213108]`, async () => {
const { userInfo } = new BrowsingPage(APP_ROUTES.PERSONAL_FILES).header; const { userInfo } = new BrowsingPage(APP_ROUTES.PERSONAL_FILES).header;
const { username, firstName, lastName } = johnDoe; const { username, firstName, lastName } = johnDoe;
loginPage.loginWith(username) await loginPage.loginWith(username);
.then(() => {
expect(userInfo.name).toEqual(`${firstName} ${lastName}`); expect(userInfo.name).toEqual(`${firstName} ${lastName}`);
}); });
it(`logs in with user having username containing "@" - [C213096]`, async () => {
await loginPage.loginWith(testUser);
expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
}); });
it(`logs in with user having username containing "@" - [C213096]`, () => { it('logs in with user with non-latin characters - [C213097]', async () => {
loginPage
.loginWith(testUser)
.then(() => {
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
});
});
it('logs in with user with non-latin characters - [C213097]', () => {
const { username, password } = russianUser; const { username, password } = russianUser;
loginPage await loginPage.loginWith(username, password);
.loginWith(username, password)
.then(() => {
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES); expect(browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
}); });
});
it('redirects to Home Page when navigating to the Login page while already logged in - [C213107]', () => { it('redirects to Home Page when navigating to the Login page while already logged in - [C213107]', async () => {
const { username } = johnDoe; const { username } = johnDoe;
loginPage await loginPage.loginWith(username);
.loginWith(username) await browser.get(APP_ROUTES.LOGIN);
.then(() => browser.get(APP_ROUTES.LOGIN) expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
.then(() => {
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
})
);
}); });
it('redirects to Personal Files when pressing browser Back while already logged in - [C213109]', () => { it('redirects to Personal Files when pressing browser Back while already logged in - [C213109]', async () => {
const { username } = johnDoe; const { username } = johnDoe;
loginPage await loginPage.loginWith(username);
.loginWith(username) await browser.navigate().back();
.then(() => browser.navigate().back()) expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
.then(() => {
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
});
}); });
it('user is able to login after changing his password - [C213104]', () => { it('user is able to login after changing his password - [C213104]', async () => {
loginPage.loginWith(testUser2.username, testUser2.password) await loginPage.loginWith(testUser2.username, testUser2.password);
.then(() => logoutPage.load()) await logoutPage.load();
.then(() => peopleApi.changePassword(testUser2.username, newPassword)) await peopleApi.changePassword(testUser2.username, newPassword);
.then(() => loginPage.loginWith(testUser2.username, newPassword)) await loginPage.loginWith(testUser2.username, newPassword);
.then(() => { expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
});
}); });
}); });
@@ -178,56 +157,47 @@ describe('Login', () => {
const { login: loginComponent } = loginPage; const { login: loginComponent } = loginPage;
const { submitButton, errorMessage } = loginComponent; const { submitButton, errorMessage } = loginComponent;
beforeEach(done => { beforeEach(async (done) => {
loginPage.load().then(done); await loginPage.load();
done();
}); });
it('disabled submit button when password is empty - [C280072]', () => { it('disabled submit button when password is empty - [C280072]', async () => {
loginComponent.enterUsername('any-username'); await loginComponent.enterUsername('any-username');
expect(submitButton.isEnabled()).toBe(false); expect(await submitButton.isEnabled()).toBe(false, 'submit button is enabled');
}); });
it('disabled submit button when username is empty - [C280070]', () => { it('disabled submit button when username is empty - [C280070]', async () => {
loginPage.login.enterPassword('any-password'); await loginPage.login.enterPassword('any-password');
expect(submitButton.isEnabled()).toBe(false); expect(await submitButton.isEnabled()).toBe(false, 'submit button is enabled');
}); });
it('shows error when entering nonexistent user - [C213093]', () => { it('shows error when entering nonexistent user - [C213093]', async () => {
loginPage await loginPage.tryLoginWith('nonexistent-user', 'any-password');
.tryLoginWith('nonexistent-user', 'any-password') expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.LOGIN);
.then(() => { expect(await errorMessage.isDisplayed()).toBe(true, 'error message is not displayed');
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.LOGIN); expect(await errorMessage.getText()).toBe(`You've entered an unknown username or password`);
expect(errorMessage.isDisplayed()).toBe(true);
expect(errorMessage.getText()).toBe(`You've entered an unknown username or password`);
});
}); });
it('shows error when entering invalid password - [C280071]', () => { it('shows error when entering invalid password - [C280071]', async () => {
const { username } = johnDoe; const { username } = johnDoe;
loginPage await loginPage.tryLoginWith(username, 'incorrect-password');
.tryLoginWith(username, 'incorrect-password') expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.LOGIN);
.then(() => { expect(await errorMessage.isDisplayed()).toBe(true, 'error message is not displayed');
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.LOGIN); expect(await errorMessage.getText()).toBe(`You've entered an unknown username or password`);
expect(errorMessage.isDisplayed()).toBe(true);
expect(errorMessage.getText()).toBe(`You've entered an unknown username or password`);
});
}); });
it('unauthenticated user is redirected to Login page - [C213106]', () => { it('unauthenticated user is redirected to Login page - [C213106]', async () => {
browser.get(APP_ROUTES.PERSONAL_FILES) await browser.get(APP_ROUTES.PERSONAL_FILES);
.then(() => { expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.LOGIN);
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.LOGIN);
});
}); });
it('disabled user is not logged in - [C213100]', () => { it('disabled user is not logged in - [C213100]', async () => {
loginPage.tryLoginWith(disabledUser) await loginPage.tryLoginWith(disabledUser);
.then(() => { expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.LOGIN);
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.LOGIN); expect(await errorMessage.isDisplayed()).toBe(true, 'error message is not displayed');
expect(errorMessage.isDisplayed()).toBe(true); expect(await errorMessage.getText()).toBe(`You've entered an unknown username or password`);
expect(errorMessage.getText()).toBe(`You've entered an unknown username or password`);
});
}); });
}); });
}); });

View File

@@ -38,45 +38,40 @@ describe('Logout', () => {
const johnDoe = `user-${Utils.random()}`; const johnDoe = `user-${Utils.random()}`;
beforeAll((done) => { beforeAll(async (done) => {
peopleApi await peopleApi.createUser({ username: johnDoe });
.createUser({ username: johnDoe }) done();
.then(done);
}); });
beforeEach((done) => { beforeEach(async (done) => {
loginPage.loginWith(johnDoe).then(done); await loginPage.loginWith(johnDoe);
done();
}); });
afterEach((done) => { afterEach(async (done) => {
logoutPage.load().then(done); await logoutPage.load();
done();
}); });
it('Sign out option is available - [C213143]', () => { it('Sign out option is available - [C213143]', async () => {
page.header.userInfo.openMenu() await page.header.userInfo.openMenu();
.then(() => expect(page.header.userInfo.menu.isMenuItemPresent('Sign out')).toBe(true, 'Sign out option not displayed')); expect(await page.header.userInfo.menu.isMenuItemPresent('Sign out')).toBe(true, 'Sign out option not displayed');
}); });
it('redirects to Login page on sign out - [C213144]', () => { it('redirects to Login page on sign out - [C213144]', async () => {
page.signOut() await page.signOut();
.then(() => { expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.LOGIN);
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.LOGIN);
});
}); });
it('redirects to Login page when pressing browser Back after logout - [C213145]', () => { it('redirects to Login page when pressing browser Back after logout - [C213145]', async () => {
page.signOut() await page.signOut();
.then(() => browser.navigate().back()) await browser.navigate().back();
.then(() => { expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.LOGIN);
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.LOGIN);
});
}); });
it('redirects to Login page when trying to access a part of the app after logout - [C213146]', () => { it('redirects to Login page when trying to access a part of the app after logout - [C213146]', async () => {
page.signOut() await page.signOut();
.then(() => page.load('/favorites')) await page.load('/favorites');
.then(() => { expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.LOGIN);
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.LOGIN);
});
}); });
}); });

View File

@@ -54,161 +54,138 @@ describe('Breadcrumb', () => {
user: new RepoClient(username, username) user: new RepoClient(username, username)
}; };
beforeAll(done => { beforeAll(async (done) => {
apis.admin.people.createUser({ username }) await apis.admin.people.createUser({ username });
.then(() => apis.user.nodes.createFolder(parent)).then(resp => parentId = resp.entry.id) parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
.then(() => apis.user.nodes.createFolder(subFolder1, parentId)).then(resp => subFolder1Id = resp.entry.id) subFolder1Id = (await apis.user.nodes.createFolder(subFolder1, parentId)).entry.id;
.then(() => apis.user.nodes.createFolder(subFolder2, subFolder1Id)).then(resp => subFolder2Id = resp.entry.id) subFolder2Id = (await apis.user.nodes.createFolder(subFolder2, subFolder1Id)).entry.id;
.then(() => apis.user.nodes.createFile(fileName1, subFolder2Id)) await apis.user.nodes.createFile(fileName1, subFolder2Id);
.then(() => apis.user.nodes.createFolder(parent2)).then(resp => parent2Id = resp.entry.id) parent2Id = (await apis.user.nodes.createFolder(parent2)).entry.id;
.then(() => apis.user.nodes.createFolder(folder1, parent2Id)).then(resp => folder1Id = resp.entry.id) folder1Id = (await apis.user.nodes.createFolder(folder1, parent2Id)).entry.id;
.then(() => apis.user.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC)) await apis.user.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC);
.then(() => apis.user.sites.getDocLibId(siteName)) const docLibId = await apis.user.sites.getDocLibId(siteName);
.then(resp => apis.user.nodes.createFolder(parent, resp)).then(resp => parentId = resp.entry.id) parentId = (await apis.user.nodes.createFolder(parent, docLibId)).entry.id;
.then(() => apis.user.nodes.createFolder(subFolder1, parentId)).then(resp => subFolder1Id = resp.entry.id) subFolder1Id = (await apis.user.nodes.createFolder(subFolder1, parentId)).entry.id;
.then(() => apis.user.nodes.createFolder(subFolder2, subFolder1Id)).then(resp => subFolder2Id = resp.entry.id) subFolder2Id = (await apis.user.nodes.createFolder(subFolder2, subFolder1Id)).entry.id;
.then(() => apis.user.nodes.createFile(fileName1, subFolder2Id)) await apis.user.nodes.createFile(fileName1, subFolder2Id);
.then(() => loginPage.loginWith(username)) await loginPage.loginWith(username);
.then(done); done();
}); });
afterAll(done => { afterAll(async (done) => {
Promise.all([ await Promise.all([
apis.user.nodes.deleteNodeById(parentId), apis.user.nodes.deleteNodeById(parentId),
apis.user.nodes.deleteNodeById(parent2Id), apis.user.nodes.deleteNodeById(parent2Id),
apis.user.sites.deleteSite(siteName), apis.user.sites.deleteSite(siteName),
logoutPage.load() logoutPage.load()
]) ]);
.then(done); done();
}); });
it('Personal Files breadcrumb main node - [C260964]', () => { it('Personal Files breadcrumb main node - [C260964]', async () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES) await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
.then(() => { expect(await breadcrumb.getItemsCount()).toEqual(1, 'Breadcrumb has incorrect number of items');
expect(breadcrumb.getItemsCount()).toEqual(1, 'Breadcrumb has incorrect number of items'); expect(await breadcrumb.getCurrentItemName()).toBe('Personal Files');
expect(breadcrumb.getCurrentItemName()).toBe('Personal Files');
});
}); });
it('File Libraries breadcrumb main node - [C260966]', () => { it('File Libraries breadcrumb main node - [C260966]', async () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES) await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
.then(() => { expect(await breadcrumb.getItemsCount()).toEqual(1, 'Breadcrumb has incorrect number of items');
expect(breadcrumb.getItemsCount()).toEqual(1, 'Breadcrumb has incorrect number of items'); expect(await breadcrumb.getCurrentItemName()).toBe('File Libraries');
expect(breadcrumb.getCurrentItemName()).toBe('File Libraries');
});
}); });
it('Recent Files breadcrumb main node - [C260971]', () => { it('Recent Files breadcrumb main node - [C260971]', async () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES) await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES);
.then(() => { expect(await breadcrumb.getItemsCount()).toEqual(1, 'Breadcrumb has incorrect number of items');
expect(breadcrumb.getItemsCount()).toEqual(1, 'Breadcrumb has incorrect number of items'); expect(await breadcrumb.getCurrentItemName()).toBe('Recent Files');
expect(breadcrumb.getCurrentItemName()).toBe('Recent Files');
});
}); });
it('Shared Files breadcrumb main node - [C260972]', () => { it('Shared Files breadcrumb main node - [C260972]', async () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES) await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
.then(() => { expect(await breadcrumb.getItemsCount()).toEqual(1, 'Breadcrumb has incorrect number of items');
expect(breadcrumb.getItemsCount()).toEqual(1, 'Breadcrumb has incorrect number of items'); expect(await breadcrumb.getCurrentItemName()).toBe('Shared Files');
expect(breadcrumb.getCurrentItemName()).toBe('Shared Files');
});
}); });
it('Favorites breadcrumb main node - [C260973]', () => { it('Favorites breadcrumb main node - [C260973]', async () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES) await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
.then(() => { expect(await breadcrumb.getItemsCount()).toEqual(1, 'Breadcrumb has incorrect number of items');
expect(breadcrumb.getItemsCount()).toEqual(1, 'Breadcrumb has incorrect number of items'); expect(await breadcrumb.getCurrentItemName()).toBe('Favorites');
expect(breadcrumb.getCurrentItemName()).toBe('Favorites');
});
}); });
it('Trash breadcrumb main node - [C260974]', () => { it('Trash breadcrumb main node - [C260974]', async () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH) await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
.then(() => { expect(await breadcrumb.getItemsCount()).toEqual(1, 'Breadcrumb has incorrect number of items');
expect(breadcrumb.getItemsCount()).toEqual(1, 'Breadcrumb has incorrect number of items'); expect(await breadcrumb.getCurrentItemName()).toBe('Trash');
expect(breadcrumb.getCurrentItemName()).toBe('Trash');
});
}); });
it('Personal Files breadcrumb for a folder hierarchy - [C260965]', () => { it('Personal Files breadcrumb for a folder hierarchy - [C260965]', async () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES) await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
.then(() => page.dataTable.waitForHeader()) await page.dataTable.waitForHeader();
.then(() => page.dataTable.doubleClickOnRowByName(parent)) await page.dataTable.doubleClickOnRowByName(parent);
.then(() => page.dataTable.doubleClickOnRowByName(subFolder1)) await page.dataTable.doubleClickOnRowByName(subFolder1);
.then(() => page.dataTable.doubleClickOnRowByName(subFolder2)) await page.dataTable.doubleClickOnRowByName(subFolder2);
.then(() => {
const expectedBreadcrumb = [ 'Personal Files', parent, subFolder1, subFolder2 ]; const expectedBreadcrumb = [ 'Personal Files', parent, subFolder1, subFolder2 ];
expect(breadcrumb.getAllItems()).toEqual(expectedBreadcrumb); expect(await breadcrumb.getAllItems()).toEqual(expectedBreadcrumb);
});
}); });
it('File Libraries breadcrumb for a folder hierarchy - [C260967]', () => { it('File Libraries breadcrumb for a folder hierarchy - [C260967]', async () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES) await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
.then(() => page.dataTable.waitForHeader()) await page.dataTable.waitForHeader();
.then(() => page.dataTable.doubleClickOnRowByName(siteName)) await page.dataTable.doubleClickOnRowByName(siteName);
.then(() => page.dataTable.doubleClickOnRowByName(parent)) await page.dataTable.doubleClickOnRowByName(parent);
.then(() => page.dataTable.doubleClickOnRowByName(subFolder1)) await page.dataTable.doubleClickOnRowByName(subFolder1);
.then(() => page.dataTable.doubleClickOnRowByName(subFolder2)) await page.dataTable.doubleClickOnRowByName(subFolder2);
.then(() => {
const expectedItems = [ 'File Libraries', siteName, parent, subFolder1, subFolder2 ]; const expectedItems = [ 'File Libraries', siteName, parent, subFolder1, subFolder2 ];
expect(breadcrumb.getAllItems()).toEqual(expectedItems); expect(await breadcrumb.getAllItems()).toEqual(expectedItems);
});
}); });
it('User can navigate to any location by clicking on a step from the breadcrumb - [C213235]', () => { it('User can navigate to any location by clicking on a step from the breadcrumb - [C213235]', async () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES) await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
.then(() => page.dataTable.waitForHeader()) await page.dataTable.waitForHeader();
.then(() => page.dataTable.doubleClickOnRowByName(parent)) await page.dataTable.doubleClickOnRowByName(parent);
.then(() => page.dataTable.doubleClickOnRowByName(subFolder1)) await page.dataTable.doubleClickOnRowByName(subFolder1);
.then(() => page.dataTable.doubleClickOnRowByName(subFolder2)) await page.dataTable.doubleClickOnRowByName(subFolder2);
.then(() => breadcrumb.clickItem(subFolder1)) await breadcrumb.clickItem(subFolder1);
.then(() => {
const expectedBreadcrumb = [ 'Personal Files', parent, subFolder1 ]; const expectedBreadcrumb = [ 'Personal Files', parent, subFolder1 ];
expect(breadcrumb.getAllItems()).toEqual(expectedBreadcrumb); expect(await breadcrumb.getAllItems()).toEqual(expectedBreadcrumb);
});
}); });
it('Tooltip appears on hover on a step in breadcrumb - [C213237]', () => { it('Tooltip appears on hover on a step in breadcrumb - [C213237]', async () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES) await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
.then(() => page.dataTable.waitForHeader()) await page.dataTable.waitForHeader();
.then(() => page.dataTable.doubleClickOnRowByName(parent)) await page.dataTable.doubleClickOnRowByName(parent);
.then(() => page.dataTable.doubleClickOnRowByName(subFolder1)) await page.dataTable.doubleClickOnRowByName(subFolder1);
.then(() => page.dataTable.doubleClickOnRowByName(subFolder2)) await page.dataTable.doubleClickOnRowByName(subFolder2);
.then(() => { expect(await breadcrumb.getNthItemTooltip(3)).toEqual(subFolder1);
expect(breadcrumb.getNthItemTooltip(3)).toEqual(subFolder1);
});
}); });
it('Breadcrumb updates correctly when folder is renamed - [C213238]', () => { it('Breadcrumb updates correctly when folder is renamed - [C213238]', async () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES) await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
.then(() => page.dataTable.waitForHeader()) await page.dataTable.waitForHeader();
.then(() => page.dataTable.doubleClickOnRowByName(parent2)) await page.dataTable.doubleClickOnRowByName(parent2);
.then(() => page.dataTable.doubleClickOnRowByName(folder1)) await page.dataTable.doubleClickOnRowByName(folder1);
.then(() => page.dataTable.wait()) await page.dataTable.wait();
.then(() => apis.user.nodes.renameNode(folder1Id, folder1Renamed).then(done => done)) await apis.user.nodes.renameNode(folder1Id, folder1Renamed)
.then(() => page.refresh()) // .then(done => done)
.then(() => page.dataTable.wait()) await page.refresh();
.then(() => { await page.dataTable.wait();
expect(breadcrumb.getCurrentItemName()).toEqual(folder1Renamed); expect(await breadcrumb.getCurrentItemName()).toEqual(folder1Renamed);
});
}); });
it('Browser back navigates to previous location regardless of breadcrumb steps - [C213240]', () => { it('Browser back navigates to previous location regardless of breadcrumb steps - [C213240]', async () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES) await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
.then(() => page.dataTable.waitForHeader()) await page.dataTable.waitForHeader();
.then(() => page.dataTable.doubleClickOnRowByName(parent)) await page.dataTable.doubleClickOnRowByName(parent);
.then(() => page.dataTable.doubleClickOnRowByName(subFolder1)) await page.dataTable.doubleClickOnRowByName(subFolder1);
.then(() => page.dataTable.doubleClickOnRowByName(subFolder2)) await page.dataTable.doubleClickOnRowByName(subFolder2);
.then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)) await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
.then(() => page.dataTable.waitForEmptyState()) await page.dataTable.waitForEmptyState();
.then(() => browser.navigate().back()) await browser.navigate().back();
.then(() => {
const expectedBreadcrumb = [ 'Personal Files', parent, subFolder1, subFolder2 ]; const expectedBreadcrumb = [ 'Personal Files', parent, subFolder1, subFolder2 ];
expect(breadcrumb.getAllItems()).toEqual(expectedBreadcrumb); expect(await breadcrumb.getAllItems()).toEqual(expectedBreadcrumb);
});
}); });
// disabled cause of ACA-1039 // disabled cause of ACA-1039
@@ -217,28 +194,28 @@ describe('Breadcrumb', () => {
const userFolder = `userFolder-${Utils.random()}`; let userFolderId; const userFolder = `userFolder-${Utils.random()}`; let userFolderId;
const user2Api = new RepoClient(user2, user2); const user2Api = new RepoClient(user2, user2);
beforeAll(done => { beforeAll(async (done) => {
logoutPage.load() await logoutPage.load();
.then(() => apis.admin.people.createUser({ username: user2 })) await apis.admin.people.createUser({ username: user2 });
.then(() => user2Api.nodes.createFolder(userFolder).then(resp => userFolderId = resp.entry.id)) userFolderId = (await user2Api.nodes.createFolder(userFolder)).entry.id;
.then(() => loginPage.loginWithAdmin()) await loginPage.loginWithAdmin();
.then(done); done();
}); });
afterAll(done => { afterAll(async (done) => {
Promise.all([ await Promise.all([
user2Api.nodes.deleteNodeById(userFolderId), user2Api.nodes.deleteNodeById(userFolderId),
logoutPage.load() logoutPage.load()
]) ]);
.then(done); done();
}); });
xit(`Breadcrumb on navigation to a user's home - [C260970]`, () => { xit(`Breadcrumb on navigation to a user's home - [C260970]`, async () => {
page.dataTable.doubleClickOnRowByName('User Homes') await page.dataTable.doubleClickOnRowByName('User Homes');
.then(() => page.dataTable.doubleClickOnRowByName(user2)) await page.dataTable.doubleClickOnRowByName(user2);
.then(() => expect(breadcrumb.getAllItems()).toEqual([ 'Personal Files', 'User Homes', user2 ])) expect(await breadcrumb.getAllItems()).toEqual([ 'Personal Files', 'User Homes', user2 ]);
.then(() => page.dataTable.doubleClickOnRowByName(userFolder)) await page.dataTable.doubleClickOnRowByName(userFolder);
.then(() => expect(breadcrumb.getAllItems()).toEqual([ 'Personal Files', 'User Homes', user2, userFolder ])); expect(await breadcrumb.getAllItems()).toEqual([ 'Personal Files', 'User Homes', user2, userFolder ]);
}); });
}); });
}); });

View File

@@ -34,112 +34,90 @@ describe('Sidebar', () => {
const page = new BrowsingPage(); const page = new BrowsingPage();
const { sidenav } = page; const { sidenav } = page;
beforeAll(done => { beforeAll(async (done) => {
loginPage.loginWithAdmin().then(done); await loginPage.loginWithAdmin();
done();
}); });
afterAll(done => { afterAll(async (done) => {
logoutPage.load().then(done); await logoutPage.load();
done();
}); });
it('has "Personal Files" as default - [C217149]', () => { it('has "Personal Files" as default - [C217149]', async () => {
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES); expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
expect(sidenav.isActiveByLabel('Personal Files')).toBe(true, 'Active link'); expect(await sidenav.isActiveByLabel('Personal Files')).toBe(true, 'Active link');
}); });
it('navigates to "File Libraries" - [C217150]', () => { it('navigates to "File Libraries" - [C217150]', async () => {
sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES) await sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
.then(() => { expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.FILE_LIBRARIES);
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.FILE_LIBRARIES); expect(await sidenav.isActiveByLabel(SIDEBAR_LABELS.FILE_LIBRARIES)).toBe(true);
expect(sidenav.isActiveByLabel(SIDEBAR_LABELS.FILE_LIBRARIES)).toBe(true);
});
}); });
it('navigates to "Personal Files" - [C280409]', () => { it('navigates to "Personal Files" - [C280409]', async () => {
sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES) await sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
.then(() => { expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES); expect(await sidenav.isActiveByLabel(SIDEBAR_LABELS.PERSONAL_FILES)).toBe(true);
expect(sidenav.isActiveByLabel(SIDEBAR_LABELS.PERSONAL_FILES)).toBe(true);
});
}); });
it('navigates to "Shared Files" - [C213110]', () => { it('navigates to "Shared Files" - [C213110]', async () => {
sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES) await sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
.then(() => { expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.SHARED_FILES);
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.SHARED_FILES); expect(await sidenav.isActiveByLabel(SIDEBAR_LABELS.SHARED_FILES)).toBe(true);
expect(sidenav.isActiveByLabel(SIDEBAR_LABELS.SHARED_FILES)).toBe(true);
});
}); });
it('navigates to "Recent Files" - [C213166]', () => { it('navigates to "Recent Files" - [C213166]', async () => {
sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES) await sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES);
.then(() => { expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.RECENT_FILES);
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.RECENT_FILES); expect(await sidenav.isActiveByLabel(SIDEBAR_LABELS.RECENT_FILES)).toBe(true);
expect(sidenav.isActiveByLabel(SIDEBAR_LABELS.RECENT_FILES)).toBe(true);
});
}); });
it('navigates to "Favorites" - [C213225]', () => { it('navigates to "Favorites" - [C213225]', async () => {
sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES) await sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
.then(() => { expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.FAVORITES);
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.FAVORITES); expect(await sidenav.isActiveByLabel(SIDEBAR_LABELS.FAVORITES)).toBe(true);
expect(sidenav.isActiveByLabel(SIDEBAR_LABELS.FAVORITES)).toBe(true);
});
}); });
it('navigates to "Trash" - [C213216]', () => { it('navigates to "Trash" - [C213216]', async () => {
sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH) await sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
.then(() => { expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.TRASHCAN);
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.TRASHCAN); expect(await sidenav.isActiveByLabel(SIDEBAR_LABELS.TRASH)).toBe(true);
expect(sidenav.isActiveByLabel(SIDEBAR_LABELS.TRASH)).toBe(true);
});
}); });
// TODO: incomplete test // TODO: incomplete test
xit('Personal Files tooltip - [C217151]', () => { xit('Personal Files tooltip - [C217151]', async () => {
sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES) await sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
.then(() => { expect(await sidenav.getLinkTooltip(SIDEBAR_LABELS.PERSONAL_FILES)).toContain('View your Personal Files');
expect(sidenav.getLinkTooltip(SIDEBAR_LABELS.PERSONAL_FILES)).toContain('View your Personal Files');
});
}); });
// TODO: incomplete test // TODO: incomplete test
xit('File Libraries tooltip - [C217152]', () => { xit('File Libraries tooltip - [C217152]', async () => {
sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES) await sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
.then(() => { expect(await sidenav.getLinkTooltip(SIDEBAR_LABELS.FILE_LIBRARIES)).toContain('Access File Libraries');
expect(sidenav.getLinkTooltip(SIDEBAR_LABELS.FILE_LIBRARIES)).toContain('Access File Libraries');
});
}); });
// TODO: incomplete test // TODO: incomplete test
xit('Shared Files tooltip - [C213111]', () => { xit('Shared Files tooltip - [C213111]', async () => {
sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES) await sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
.then(() => { expect(await sidenav.getLinkTooltip(SIDEBAR_LABELS.SHARED_FILES)).toContain('View files that have been shared');
expect(sidenav.getLinkTooltip(SIDEBAR_LABELS.SHARED_FILES)).toContain('View files that have been shared');
});
}); });
// TODO: incomplete test // TODO: incomplete test
xit('Recent Files tooltip - [C213167]', () => { xit('Recent Files tooltip - [C213167]', async () => {
sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES) await sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES);
.then(() => { expect(await sidenav.getLinkTooltip(SIDEBAR_LABELS.RECENT_FILES)).toContain('View files you recently edited');
expect(sidenav.getLinkTooltip(SIDEBAR_LABELS.RECENT_FILES)).toContain('View files you recently edited');
});
}); });
// TODO: incomplete test // TODO: incomplete test
xit('Favorites tooltip - [C217153]', () => { xit('Favorites tooltip - [C217153]', async () => {
sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES) await sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
.then(() => { expect(await sidenav.getLinkTooltip(SIDEBAR_LABELS.FAVORITES)).toContain('View your favorite files and folders');
expect(sidenav.getLinkTooltip(SIDEBAR_LABELS.FAVORITES)).toContain('View your favorite files and folders');
});
}); });
// TODO: incomplete test // TODO: incomplete test
xit('Trash tooltip - [C217154]', () => { xit('Trash tooltip - [C217154]', async () => {
sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH) await sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
.then(() => { expect(await sidenav.getLinkTooltip(SIDEBAR_LABELS.TRASH)).toContain('View deleted files in the trash');
expect(sidenav.getLinkTooltip(SIDEBAR_LABELS.TRASH)).toContain('View deleted files in the trash');
});
}); });
}); });