[ACA-1760] use async / await in list-views suite ()

This commit is contained in:
Adina Parpalita 2018-09-26 12:09:16 +03:00 committed by Denys Vuika
parent 4ff92c23e5
commit 23df2ad6a2
10 changed files with 1167 additions and 1235 deletions

@ -29,80 +29,69 @@ import { Utils } from '../../utilities/utils';
import { RepoClient } from '../../utilities/repo-client/repo-client';
describe('Empty list views', () => {
const username = `user-${Utils.random()}`;
const password = username;
const username = `user-${Utils.random()}`;
const password = username;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, password)
};
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, password)
};
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const page = new BrowsingPage();
const { dataTable } = page;
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const page = new BrowsingPage();
const { dataTable } = page;
beforeAll(done => {
apis.admin.people.createUser({ username })
.then(() => loginPage.loginWith(username))
.then(done);
});
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
await loginPage.loginWith(username);
done();
});
afterAll(done => {
logoutPage.load().then(done);
});
afterAll(async (done) => {
await logoutPage.load();
done();
});
it('empty Personal Files - [C280131]', () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)
.then(() => {
expect(dataTable.isEmptyList()).toBe(true, 'list is not empty');
expect(dataTable.getEmptyDragAndDropText()).toContain('Drag and drop');
});
});
it('empty Personal Files - [C280131]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
expect(await dataTable.isEmptyList()).toBe(true, 'list is not empty');
expect(await dataTable.getEmptyDragAndDropText()).toContain('Drag and drop');
});
it('empty File Libraries - [C217099]', () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES)
.then(() => {
expect(dataTable.isEmptyList()).toBe(true, 'list is not empty');
expect(dataTable.getEmptyStateTitle()).toContain(`You aren't a member of any File Libraries yet`);
expect(dataTable.getEmptyStateSubtitle()).toContain('Join libraries to upload, view, and share files.');
});
});
it('empty File Libraries - [C217099]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
expect(await dataTable.isEmptyList()).toBe(true, 'list is not empty');
expect(await dataTable.getEmptyStateTitle()).toContain(`You aren't a member of any File Libraries yet`);
expect(await dataTable.getEmptyStateSubtitle()).toContain('Join libraries to upload, view, and share files.');
});
it('empty Shared Files - [C280132]', () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES)
.then(() => {
expect(dataTable.isEmptyList()).toBe(true, 'list is not empty');
expect(dataTable.getEmptyStateTitle()).toContain('No shared files or folders');
expect(dataTable.getEmptyStateSubtitle()).toContain('Items you share using the Share option are shown here.');
});
});
it('empty Shared Files - [C280132]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
expect(await dataTable.isEmptyList()).toBe(true, 'list is not empty');
expect(await dataTable.getEmptyStateTitle()).toContain('No shared files or folders');
expect(await dataTable.getEmptyStateSubtitle()).toContain('Items you share using the Share option are shown here.');
});
it('empty Recent Files - [C213169]', () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES)
.then(() => {
expect(dataTable.isEmptyList()).toBe(true, 'list is not empty');
expect(dataTable.getEmptyStateTitle()).toContain('No recent files');
expect(dataTable.getEmptyStateSubtitle()).toContain('Items you upload or edit in the last 30 days are shown here.');
});
});
it('empty Recent Files - [C213169]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES)
expect(await dataTable.isEmptyList()).toBe(true, 'list is not empty');
expect(await dataTable.getEmptyStateTitle()).toContain('No recent files');
expect(await dataTable.getEmptyStateSubtitle()).toContain('Items you upload or edit in the last 30 days are shown here.');
});
it('empty Favorites - [C280133]', () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES)
.then(() => {
expect(dataTable.isEmptyList()).toBe(true, 'list is not empty');
expect(dataTable.getEmptyStateTitle()).toContain('No favorite files or folders');
expect(dataTable.getEmptyStateSubtitle()).toContain('Favorite items that you want to easily find later.');
});
});
it('empty Favorites - [C280133]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
expect(await dataTable.isEmptyList()).toBe(true, 'list is not empty');
expect(await dataTable.getEmptyStateTitle()).toContain('No favorite files or folders');
expect(await dataTable.getEmptyStateSubtitle()).toContain('Favorite items that you want to easily find later.');
});
it('empty Trash - [C280134]', () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)
.then(() => {
expect(dataTable.isEmptyList()).toBe(true, 'list is not empty');
expect(dataTable.getEmptyStateTitle()).toContain('Trash is empty');
expect(dataTable.getEmptyStateText()).toContain('Items you delete are moved to the Trash.');
expect(dataTable.getEmptyStateText()).toContain('Empty Trash to permanently delete items.');
});
});
it('empty Trash - [C280134]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
expect(await dataTable.isEmptyList()).toBe(true, 'list is not empty');
expect(await dataTable.getEmptyStateTitle()).toContain('Trash is empty');
expect(await dataTable.getEmptyStateText()).toContain('Items you delete are moved to the Trash.');
expect(await dataTable.getEmptyStateText()).toContain('Empty Trash to permanently delete items.');
});
});

@ -29,130 +29,127 @@ import { Utils } from '../../utilities/utils';
import { RepoClient } from '../../utilities/repo-client/repo-client';
describe('Favorites', () => {
const username = `user-${Utils.random()}`;
const password = username;
const username = `user-${Utils.random()}`;
const siteName = `site-${Utils.random()}`;
const favFolderName = `favFolder-${Utils.random()}`;
const parentFolder = `parent-${Utils.random()}`;
const fileName1 = `file1-${Utils.random()}.txt`;
const fileName2 = `file2-${Utils.random()}.txt`;
const fileName3 = `file3-${Utils.random()}.txt`;
const fileName4 = `file4-${Utils.random()}.txt`;
const siteName = `site-${Utils.random()}`;
const favFolderName = `favFolder-${Utils.random()}`;
const parentFolder = `parent-${Utils.random()}`;
const fileName1 = `file1-${Utils.random()}.txt`;
const fileName2 = `file2-${Utils.random()}.txt`;
const fileName3 = `file3-${Utils.random()}.txt`;
const fileName4 = `file4-${Utils.random()}.txt`;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, password)
};
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const favoritesPage = new BrowsingPage();
const { dataTable, breadcrumb } = favoritesPage;
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const favoritesPage = new BrowsingPage();
const { dataTable, breadcrumb } = favoritesPage;
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
await apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC);
const docLibId = await apis.admin.sites.getDocLibId(siteName);
await apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_MANAGER);
await apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC);
const docLibId = await apis.admin.sites.getDocLibId(siteName);
await apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_MANAGER);
const file1Id = (await apis.admin.nodes.createFile(fileName1, docLibId)).entry.id;
await apis.user.favorites.addFavoriteById('file', file1Id);
const file1Id = (await apis.admin.nodes.createFile(fileName1, docLibId)).entry.id;
const folderId = (await apis.user.nodes.createFolder(favFolderName)).entry.id;
const parentId = (await apis.user.nodes.createFolder(parentFolder)).entry.id;
const file2Id = (await apis.user.nodes.createFile(fileName2, parentId)).entry.id;
const file3Id = (await apis.user.nodes.createFile(fileName3, parentId)).entry.id;
const file4Id = (await apis.user.nodes.createFile(fileName4, parentId)).entry.id;
const folderId = (await apis.user.nodes.createFolder(favFolderName)).entry.id;
await apis.user.favorites.addFavoriteById('folder', folderId);
await Promise.all([
apis.user.favorites.addFavoriteById('file', file1Id),
apis.user.favorites.addFavoriteById('folder', folderId),
apis.user.favorites.addFavoriteById('file', file2Id),
apis.user.favorites.addFavoriteById('file', file3Id),
apis.user.favorites.addFavoriteById('file', file4Id)
]);
await apis.user.nodes.deleteNodeById(file3Id, false);
await apis.user.nodes.deleteNodeById(file4Id, false);
await apis.user.trashcan.restore(file4Id);
const parentId = (await apis.user.nodes.createFolder(parentFolder)).entry.id;
await loginPage.loginWith(username);
done();
});
const file2Id = (await apis.user.nodes.createFile(fileName2, parentId)).entry.id;
await apis.user.favorites.addFavoriteById('file', file2Id);
beforeEach(async (done) => {
await favoritesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
await dataTable.waitForHeader();
done();
});
const file3Id = (await apis.user.nodes.createFile(fileName3, parentId)).entry.id;
await apis.user.favorites.addFavoriteById('file', file3Id);
await apis.user.nodes.deleteNodeById(file3Id, false);
afterAll(async (done) => {
await Promise.all([
apis.admin.sites.deleteSite(siteName),
apis.user.nodes.deleteNodes([ favFolderName, parentFolder ]),
apis.admin.trashcan.emptyTrash(),
logoutPage.load()
]);
done();
});
const file4Id = (await apis.user.nodes.createFile(fileName4, parentId)).entry.id;
await apis.user.favorites.addFavoriteById('file', file4Id);
await apis.user.nodes.deleteNodeById(file4Id, false);
await apis.user.trashcan.restore(file4Id);
it('has the correct columns - [C280482]', async () => {
const labels = [ 'Name', 'Location', 'Size', 'Modified', 'Modified by' ];
const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label));
await loginPage.loginWith(username);
done();
expect(await dataTable.getColumnHeaders().count()).toBe(5 + 1, 'Incorrect number of columns');
await elements.forEach(async (element, index) => {
expect(await element.isPresent()).toBe(true, `"${labels[index]}" is missing`);
});
});
beforeEach(async (done) => {
await favoritesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
await dataTable.waitForHeader();
done();
});
it('displays the favorite files and folders - [C213226]', async () => {
expect(await dataTable.countRows()).toEqual(4, 'Incorrect number of items displayed');
expect(await dataTable.getRowByName(fileName1).isPresent()).toBe(true, `${fileName1} not displayed`);
expect(await dataTable.getRowByName(fileName2).isPresent()).toBe(true, `${fileName2} not displayed`);
expect(await dataTable.getRowByName(favFolderName).isPresent()).toBe(true, `${favFolderName} not displayed`);
});
afterAll(async (done) => {
await Promise.all([
apis.admin.sites.deleteSite(siteName),
apis.user.nodes.deleteNodes([ favFolderName, parentFolder ]),
apis.admin.trashcan.emptyTrash(),
logoutPage.load()
]);
done();
});
it(`deleted favorite file does not appear - [C213228]`, async () => {
expect(await dataTable.getRowByName(fileName3).isPresent()).not.toBe(true, `${fileName3} is displayed`);
});
it('has the correct columns - [C280482]', async () => {
const labels = [ 'Name', 'Location', 'Size', 'Modified', 'Modified by' ];
const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label));
it(`file is displayed after it is restored from Trashcan - [C213229]`, async () => {
expect(await dataTable.getRowByName(fileName4).isPresent()).toBe(true, `${fileName4} not displayed`);
});
expect(await dataTable.getColumnHeaders().count()).toBe(5 + 1, 'Incorrect number of columns');
it('Location column displays the parent folder of the files - [C213231]', async () => {
expect(await dataTable.getItemLocation(fileName1).getText()).toEqual(siteName);
expect(await dataTable.getItemLocation(fileName2).getText()).toEqual(parentFolder);
expect(await dataTable.getItemLocation(favFolderName).getText()).toEqual('Personal Files');
});
await elements.forEach(async (element, index) => {
expect(await element.isPresent()).toBe(true, `"${labels[index]}" is missing`);
});
});
it('Location column displays a tooltip with the entire path of the file - [C213671]', async () => {
expect(await dataTable.getItemLocationTileAttr(fileName1)).toEqual(`File Libraries/${siteName}`);
expect(await dataTable.getItemLocationTileAttr(fileName2)).toEqual(`Personal Files/${parentFolder}`);
expect(await dataTable.getItemLocationTileAttr(favFolderName)).toEqual('Personal Files');
});
it('displays the favorite files and folders - [C213226]', async () => {
expect(await dataTable.countRows()).toEqual(4, 'Incorrect number of items displayed');
expect(await dataTable.getRowByName(fileName1).isPresent()).toBe(true, `${fileName1} not displayed`);
expect(await dataTable.getRowByName(fileName2).isPresent()).toBe(true, `${fileName2} not displayed`);
expect(await dataTable.getRowByName(favFolderName).isPresent()).toBe(true, `${favFolderName} not displayed`);
});
it('Location column redirect - item in user Home - [C213650]', async () => {
await dataTable.clickItemLocation(favFolderName);
expect(await breadcrumb.getAllItems()).toEqual([ 'Personal Files' ]);
});
it(`deleted favorite file does not appear - [C213228]`, async () => {
expect(await dataTable.getRowByName(fileName3).isPresent()).not.toBe(true, `${fileName3} is displayed`);
});
it('Location column redirect - file in folder - [C280484]', async () => {
await dataTable.clickItemLocation(fileName2);
expect(await breadcrumb.getAllItems()).toEqual([ 'Personal Files', parentFolder ]);
});
it(`file is displayed after it is restored from Trashcan - [C213229]`, async () => {
expect(await dataTable.getRowByName(fileName4).isPresent()).toBe(true, `${fileName4} not displayed`);
});
it('Location column redirect - file in site - [C280485]', async () => {
await dataTable.clickItemLocation(fileName1);
expect(await breadcrumb.getAllItems()).toEqual([ 'File Libraries', siteName ]);
});
it('Location column displays the parent folder of the files - [C213231]', async () => {
expect(await dataTable.getItemLocation(fileName1).getText()).toEqual(siteName);
expect(await dataTable.getItemLocation(fileName2).getText()).toEqual(parentFolder);
expect(await dataTable.getItemLocation(favFolderName).getText()).toEqual('Personal Files');
});
it('Location column displays a tooltip with the entire path of the file - [C213671]', async () => {
expect(dataTable.getItemLocationTileAttr(fileName1)).toEqual(`File Libraries/${siteName}`);
expect(dataTable.getItemLocationTileAttr(fileName2)).toEqual(`Personal Files/${parentFolder}`);
expect(dataTable.getItemLocationTileAttr(favFolderName)).toEqual('Personal Files');
});
it('Location column redirect - item in user Home - [C213650]', async () => {
await dataTable.clickItemLocation(favFolderName);
expect(await breadcrumb.getAllItems()).toEqual([ 'Personal Files' ]);
});
it('Location column redirect - file in folder - [C280484]', async () => {
await dataTable.clickItemLocation(fileName2);
expect(await breadcrumb.getAllItems()).toEqual([ 'Personal Files', parentFolder ]);
});
it('Location column redirect - file in site - [C280485]', async () => {
await dataTable.clickItemLocation(fileName1);
expect(await breadcrumb.getAllItems()).toEqual([ 'File Libraries', siteName ]);
});
it('Navigate into folder from Favorites - [C213230]', async () => {
await dataTable.doubleClickOnRowByName(favFolderName);
await dataTable.waitForEmptyState();
expect(await breadcrumb.getCurrentItemName()).toBe(favFolderName);
});
it('Navigate into folder from Favorites - [C213230]', async () => {
await dataTable.doubleClickOnRowByName(favFolderName);
await dataTable.waitForEmptyState();
expect(await breadcrumb.getCurrentItemName()).toBe(favFolderName);
});
});

@ -29,131 +29,119 @@ import { Utils } from '../../utilities/utils';
import { RepoClient } from '../../utilities/repo-client/repo-client';
describe('File Libraries', () => {
const username = `user-${Utils.random()}`;
const password = username;
const username = `user-${Utils.random()}`;
const password = username;
const sitePrivate = `private-${Utils.random()}`;
const siteModerated = `moderated-${Utils.random()}`;
const sitePublic = `public-${Utils.random()}`;
const siteName = `siteName-${Utils.random()}`;
const siteId1 = Utils.random();
const siteId2 = Utils.random();
const adminSite = `admin-${Utils.random()}`;
const sitePrivate = `private-${Utils.random()}`;
const siteModerated = `moderated-${Utils.random()}`;
const sitePublic = `public-${Utils.random()}`;
const siteName = `siteName-${Utils.random()}`;
const siteId1 = Utils.random();
const siteId2 = Utils.random();
const adminSite = `admin-${Utils.random()}`;
const siteDescription = 'my site description';
const siteDescription = 'my site description';
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, password)
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, password)
};
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const fileLibrariesPage = new BrowsingPage();
const { dataTable } = fileLibrariesPage;
beforeAll(async (done) => {
await Promise.all([
apis.admin.people.createUser({ username }),
apis.admin.sites.createSite(sitePublic, SITE_VISIBILITY.PUBLIC),
apis.admin.sites.createSite(siteModerated, SITE_VISIBILITY.MODERATED, siteDescription),
apis.admin.sites.createSite(sitePrivate, SITE_VISIBILITY.PRIVATE, null),
apis.admin.sites.createSite(adminSite, SITE_VISIBILITY.PUBLIC),
apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC, null, siteId1),
apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC, null, siteId2)
]);
await Promise.all([
apis.admin.sites.addSiteMember(sitePublic, username, SITE_ROLES.SITE_CONSUMER),
apis.admin.sites.addSiteMember(siteModerated, username, SITE_ROLES.SITE_MANAGER),
apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_CONTRIBUTOR),
apis.admin.sites.addSiteMember(siteId1, username, SITE_ROLES.SITE_CONTRIBUTOR),
apis.admin.sites.addSiteMember(siteId2, username, SITE_ROLES.SITE_CONTRIBUTOR)
]);
await loginPage.loginWith(username);
done();
});
beforeEach(async (done) => {
await fileLibrariesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
await dataTable.waitForHeader();
done();
});
afterAll(async (done) => {
await Promise.all([
apis.admin.sites.deleteSites([ sitePublic, siteModerated, sitePrivate, adminSite, siteId1, siteId2 ]),
logoutPage.load()
]);
done();
});
it('has the correct columns - [C217095]', async () => {
const labels = [ 'Title', 'Status' ];
const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label));
expect(await dataTable.getColumnHeaders().count()).toBe(2 + 1, 'Incorrect number of columns');
await elements.forEach(async (element, index) => {
expect(await element.isPresent()).toBe(true, `"${labels[index]}" is missing`);
});
});
it('User can see only the sites he is a member of - [C280501]', async () => {
const sitesCount = await dataTable.countRows();
const expectedSites = {
[sitePrivate]: SITE_VISIBILITY.PRIVATE,
[siteModerated]: SITE_VISIBILITY.MODERATED,
[sitePublic]: SITE_VISIBILITY.PUBLIC
};
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const fileLibrariesPage = new BrowsingPage();
const { dataTable } = fileLibrariesPage;
expect(sitesCount).toEqual(5, 'Incorrect number of sites displayed');
expect(await dataTable.getRowByName(adminSite).isPresent()).toBe(false, 'Incorrect site appears in list');
beforeAll(done => {
Promise
.all([
apis.admin.people.createUser({ username }),
apis.admin.sites.createSite(sitePublic, SITE_VISIBILITY.PUBLIC),
apis.admin.sites.createSite(siteModerated, SITE_VISIBILITY.MODERATED, siteDescription),
apis.admin.sites.createSite(sitePrivate, SITE_VISIBILITY.PRIVATE, null),
apis.admin.sites.createSite(adminSite, SITE_VISIBILITY.PUBLIC),
apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC, null, siteId1),
apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC, null, siteId2)
])
.then(() => apis.admin.sites.addSiteMember(sitePublic, username, SITE_ROLES.SITE_CONSUMER))
.then(() => apis.admin.sites.addSiteMember(siteModerated, username, SITE_ROLES.SITE_MANAGER))
.then(() => apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_CONTRIBUTOR))
.then(() => apis.admin.sites.addSiteMember(siteId1, username, SITE_ROLES.SITE_CONTRIBUTOR))
.then(() => apis.admin.sites.addSiteMember(siteId2, username, SITE_ROLES.SITE_CONTRIBUTOR))
.then(() => loginPage.loginWith(username))
.then(done);
const rowCells = await dataTable.getRows().map((row) => {
return row.all(dataTable.cell).map(async cell => await cell.getText());
});
const sitesList = rowCells.reduce((acc, cell) => {
acc[cell[1]] = cell[2].toUpperCase();
return acc;
}, {});
beforeEach(done => {
fileLibrariesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES)
.then(() => dataTable.waitForHeader())
.then(done);
Object.keys(expectedSites).forEach((site) => {
expect(sitesList[site]).toEqual(expectedSites[site]);
});
});
afterAll(done => {
Promise.all([
apis.admin.sites.deleteSites([
sitePublic,
siteModerated,
sitePrivate,
adminSite,
siteId1,
siteId2
]),
logoutPage.load()
])
.then(done);
});
it('Site ID is displayed when two sites have the same name - [C217098]', async () => {
const expectedSites = [
`${siteName} (${siteId1})`,
`${siteName} (${siteId2})`
];
const cells = await dataTable.getCellsContainingName(siteName);
const expectedJSON = JSON.stringify(expectedSites.sort());
const actualJSON = JSON.stringify(cells.sort());
expect(actualJSON).toEqual(expectedJSON);
});
it('has the correct columns - [C217095]', () => {
const labels = [ 'Title', 'Status' ];
const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label));
it('Tooltip for sites without description - [C217096]', async () => {
const tooltip = await dataTable.getItemNameTooltip(sitePrivate);
expect(tooltip).toBe(`${sitePrivate}`);
});
expect(dataTable.getColumnHeaders().count()).toBe(2 + 1, 'Incorrect number of columns');
elements.forEach((element, index) => {
expect(element.isPresent()).toBe(true, `"${labels[index]}" is missing`);
});
});
it('User can see only the sites he is a member of - [C280501]', () => {
const sitesCount = dataTable.countRows();
const expectedSites = {
[sitePrivate]: SITE_VISIBILITY.PRIVATE,
[siteModerated]: SITE_VISIBILITY.MODERATED,
[sitePublic]: SITE_VISIBILITY.PUBLIC
};
expect(sitesCount).toEqual(5, 'Incorrect number of sites displayed');
expect(dataTable.getRowByName(adminSite).isPresent()).toBe(false, 'Incorrect site appears in list');
dataTable.getRows()
.map((row) => {
return row.all(dataTable.cell).map(cell => cell.getText());
})
.then((rowCells) => {
return rowCells.reduce((acc, cell) => {
acc[cell[1]] = cell[2].toUpperCase();
return acc;
}, {});
})
.then((sitesList) => {
Object.keys(expectedSites).forEach((site) => {
expect(sitesList[site]).toEqual(expectedSites[site]);
});
});
});
it('Site ID is displayed when two sites have the same name - [C217098]', () => {
const expectedSites = [
`${siteName} (${siteId1})`,
`${siteName} (${siteId2})`
];
dataTable.getCellsContainingName(siteName)
.then(resp => {
const expectedJSON = JSON.stringify(expectedSites.sort());
const actualJSON = JSON.stringify(resp.sort());
expect(actualJSON).toEqual(expectedJSON);
});
});
it('Tooltip for sites without description - [C217096]', () => {
const tooltip = dataTable.getItemNameTooltip(sitePrivate);
expect(tooltip).toBe(`${sitePrivate}`);
});
it('Tooltip for sites with description - [C217097]', () => {
const tooltip = dataTable.getItemNameTooltip(siteModerated);
expect(tooltip).toBe(`${siteDescription}`);
});
it('Tooltip for sites with description - [C217097]', async () => {
const tooltip = await dataTable.getItemNameTooltip(siteModerated);
expect(tooltip).toBe(`${siteDescription}`);
});
});

@ -30,79 +30,79 @@ import { Utils } from '../../utilities/utils';
import { RepoClient } from '../../utilities/repo-client/repo-client';
describe('Generic errors', () => {
const username = `user-${Utils.random()}`;
const username = `user-${Utils.random()}`;
const username2 = `user2-${Utils.random()}`;
const username2 = `user2-${Utils.random()}`;
const parent = `folder-${Utils.random()}`; let parentId;
const file1 = `file1-${Utils.random()}.txt`; let file1Id;
const file2 = `file2-${Utils.random()}.txt`;
const parent = `folder-${Utils.random()}`; let parentId;
const file1 = `file1-${Utils.random()}.txt`; let file1Id;
const file2 = `file2-${Utils.random()}.txt`;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const page = new BrowsingPage();
const { dataTable } = page;
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const page = new BrowsingPage();
const { dataTable } = page;
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
await apis.admin.people.createUser({ username: username2 });
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id;
await apis.user.nodes.createFile(file2, parentId);
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
await apis.admin.people.createUser({ username: username2 });
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id;
await apis.user.nodes.createFile(file2, parentId);
await loginPage.loginWith(username);
done();
});
await loginPage.loginWith(username);
done();
});
afterAll(async (done) => {
await Promise.all([
apis.user.nodes.deleteNodeById(parentId),
apis.user.trashcan.emptyTrash(),
logoutPage.load()
]);
done();
});
afterAll(async (done) => {
await Promise.all([
apis.user.nodes.deleteNodeById(parentId),
apis.user.trashcan.emptyTrash(),
logoutPage.load()
]);
done();
});
it('File / folder not found - [C217313]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(parent);
await dataTable.doubleClickOnRowByName(file1);
const URL = await browser.getCurrentUrl();
await apis.user.nodes.deleteNodeById(file1Id, false);
await browser.get(URL);
it('File / folder not found - [C217313]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(parent);
await dataTable.doubleClickOnRowByName(file1);
const URL = await browser.getCurrentUrl();
await apis.user.nodes.deleteNodeById(file1Id, false);
await browser.get(URL);
expect(page.isGenericErrorDisplayed()).toBe(true, 'Generic error page not displayed');
expect(page.getGenericErrorTitle()).toContain(`This file or folder no longer exists or you don't have permission to view it.`);
});
expect(await page.isGenericErrorDisplayed()).toBe(true, 'Generic error page not displayed');
expect(await page.getGenericErrorTitle()).toContain(`This file or folder no longer exists or you don't have permission to view it.`);
});
it('Invalid URL - [C217315]', async () => {
await page.load('invalid page');
it('Invalid URL - [C217315]', async () => {
await page.load('invalid page');
expect(page.isGenericErrorDisplayed()).toBe(true, 'Generic error page not displayed');
expect(page.getGenericErrorTitle()).toContain(`This file or folder no longer exists or you don't have permission to view it.`);
expect(await page.isGenericErrorDisplayed()).toBe(true, 'Generic error page not displayed');
expect(await page.getGenericErrorTitle()).toContain(`This file or folder no longer exists or you don't have permission to view it.`);
});
});
it('Permission denied - [C217314]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(parent);
await dataTable.doubleClickOnRowByName(file2);
const URL = await browser.getCurrentUrl();
await logoutPage.load();
await loginPage.loginWith(username2);
await browser.get(URL);
it('Permission denied - [C217314]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(parent);
await dataTable.doubleClickOnRowByName(file2);
const URL = await browser.getCurrentUrl();
await logoutPage.load();
await loginPage.loginWith(username2);
await browser.get(URL);
expect(page.isGenericErrorDisplayed()).toBe(true, 'Generic error page not displayed');
expect(page.getGenericErrorTitle()).toContain(`This file or folder no longer exists or you don't have permission to view it.`);
expect(await page.isGenericErrorDisplayed()).toBe(true, 'Generic error page not displayed');
expect(await page.getGenericErrorTitle()).toContain(`This file or folder no longer exists or you don't have permission to view it.`);
await logoutPage.load();
await loginPage.loginWith(username);
});
await logoutPage.load();
await loginPage.loginWith(username);
});
});

@ -29,153 +29,136 @@ import { Utils } from '../../utilities/utils';
import { RepoClient } from '../../utilities/repo-client/repo-client';
describe('Special permissions', () => {
const username = `user-${Utils.random()}`;
const password = username;
const username = `user-${Utils.random()}`;
const password = username;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, password)
};
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, password)
};
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const recentFilesPage = new BrowsingPage();
const favoritesPage = new BrowsingPage();
const sharedPage = new BrowsingPage();
const { dataTable } = recentFilesPage;
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const recentFilesPage = new BrowsingPage();
const favoritesPage = new BrowsingPage();
const sharedPage = new BrowsingPage();
const { dataTable } = recentFilesPage;
xit('');
xit('');
beforeAll(done => {
apis.admin.people.createUser({ username }).then(done);
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
done();
});
describe('file not displayed if user no longer has permissions on it', () => {
const sitePrivate = `private-${Utils.random()}`;
const fileName = `file-${Utils.random()}.txt`;
let fileId;
beforeAll(async (done) => {
await apis.admin.sites.createSite(sitePrivate, SITE_VISIBILITY.PRIVATE);
await apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_COLLABORATOR);
const docLibId = await apis.admin.sites.getDocLibId(sitePrivate);
fileId = (await apis.admin.nodes.createFile(fileName, docLibId)).entry.id;
await apis.user.favorites.addFavoriteById('file', fileId);
await apis.admin.shared.shareFileById(fileId);
await apis.user.nodes.editNodeContent(fileId, 'edited by user');
await apis.user.search.waitForApi(username, { expect: 1 });
await apis.user.shared.waitForApi({ expect: 1 });
await loginPage.loginWith(username);
done();
});
describe('file not displayed if user no longer has permissions on it', () => {
const sitePrivate = `private-${Utils.random()}`;
const fileName = `file-${Utils.random()}.txt`;
let fileId;
beforeAll(done => {
apis.admin.sites.createSite(sitePrivate, SITE_VISIBILITY.PRIVATE)
.then(() => apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_COLLABORATOR))
.then(() => apis.admin.nodes.createFiles([ fileName ], `Sites/${sitePrivate}/documentLibrary`)
.then(resp => fileId = resp.entry.id))
.then(() => apis.user.favorites.addFavoriteById('file', fileId))
.then(() => apis.admin.shared.shareFileById(fileId))
.then(() => apis.user.nodes.editNodeContent(fileId, 'edited by user'))
.then(() => apis.user.search.waitForApi(username, { expect: 1 }))
.then(() => apis.user.shared.waitForApi({ expect: 1 }))
.then(() => loginPage.loginWith(username))
.then(done);
});
afterEach(done => {
apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_COLLABORATOR).then(done);
});
afterAll(done => {
Promise.all([
apis.admin.sites.deleteSite(sitePrivate),
logoutPage.load()
])
.then(done);
});
it('on Recent Files - [C213173]', () => {
recentFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES)
.then(() => dataTable.waitForHeader())
.then(() => {
expect(dataTable.countRows()).toBe(1, 'Incorrect number of items');
})
.then(() => apis.admin.sites.deleteSiteMember(sitePrivate, username))
.then(() => recentFilesPage.refresh())
.then(() => {
expect(dataTable.countRows()).toBe(0, 'Incorrect number of items');
});
});
it('on Favorites - [C213227]', () => {
favoritesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES)
.then(() => dataTable.waitForHeader())
.then(() => {
expect(dataTable.countRows()).toBe(1, 'Incorrect number of items');
})
.then(() => apis.admin.sites.deleteSiteMember(sitePrivate, username))
.then(() => favoritesPage.refresh())
.then(() => {
expect(dataTable.countRows()).toBe(0, 'Incorrect number of items');
});
});
it('on Shared Files - [C213116]', () => {
sharedPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES)
.then(() => dataTable.waitForHeader())
.then(() => {
expect(dataTable.countRows()).toBe(1, 'Incorrect number of items');
})
.then(() => apis.admin.sites.deleteSiteMember(sitePrivate, username))
.then(() => sharedPage.refresh())
.then(() => {
expect(dataTable.countRows()).toBe(0, 'Incorrect number of items');
});
});
afterEach(async (done) => {
await apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_COLLABORATOR);
done();
});
describe(`Location column is empty if user doesn't have permissions on the file's parent folder`, () => {
const sitePrivate = `private-${Utils.random()}`;
const fileName = `file-${Utils.random()}.txt`;
let fileId;
beforeAll(done => {
apis.admin.sites.createSite(sitePrivate, SITE_VISIBILITY.PRIVATE)
.then(() => apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_COLLABORATOR))
.then(() => apis.admin.sites.getDocLibId(sitePrivate))
.then(resp => apis.user.nodes.createFile(fileName, resp))
.then(resp => fileId = resp.entry.id)
.then(() => apis.user.favorites.addFavoriteById('file', fileId))
.then(() => apis.user.shared.shareFileById(fileId))
.then(() => apis.user.shared.waitForApi({ expect: 1 }))
.then(() => apis.user.search.waitForApi(username, { expect: 1 }))
.then(() => apis.admin.sites.deleteSiteMember(sitePrivate, username))
.then(() => loginPage.loginWith(username))
.then(done);
});
afterAll(done => {
Promise.all([
apis.admin.sites.deleteSite(sitePrivate),
logoutPage.load()
])
.then(done);
});
it(`on Recent Files - [C213178]`, () => {
recentFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES)
.then(() => dataTable.waitForHeader())
.then(() => {
expect(dataTable.countRows()).toBe(1, 'Incorrect number of items');
expect(dataTable.getItemLocation(fileName).getText()).toEqual('');
});
});
it(`on Favorites - [C213672]`, () => {
favoritesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES)
.then(() => dataTable.waitForHeader())
.then(() => {
expect(dataTable.countRows()).toBe(1, 'Incorrect number of items');
expect(dataTable.getItemLocation(fileName).getText()).toEqual('');
});
});
it(`on Shared Files - [C213668]`, () => {
sharedPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES)
.then(() => dataTable.waitForHeader())
.then(() => {
expect(dataTable.countRows()).toBe(1, 'Incorrect number of items');
expect(dataTable.getItemLocation(fileName).getText()).toEqual('');
});
});
afterAll(async (done) => {
await Promise.all([
apis.admin.sites.deleteSite(sitePrivate),
logoutPage.load()
]);
done();
});
it('on Recent Files - [C213173]', async () => {
await recentFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES);
await dataTable.waitForHeader();
expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items');
await apis.admin.sites.deleteSiteMember(sitePrivate, username);
await recentFilesPage.refresh();
expect(await dataTable.countRows()).toBe(0, 'Incorrect number of items');
});
it('on Favorites - [C213227]', async () => {
await favoritesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
await dataTable.waitForHeader();
expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items');
await apis.admin.sites.deleteSiteMember(sitePrivate, username);
await favoritesPage.refresh();
expect(await dataTable.countRows()).toBe(0, 'Incorrect number of items');
});
it('on Shared Files - [C213116]', async () => {
await sharedPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
await dataTable.waitForHeader();
expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items');
await apis.admin.sites.deleteSiteMember(sitePrivate, username);
await sharedPage.refresh();
expect(await dataTable.countRows()).toBe(0, 'Incorrect number of items');
});
});
describe(`Location column is empty if user doesn't have permissions on the file's parent folder`, () => {
const sitePrivate = `private-${Utils.random()}`;
const fileName = `file-${Utils.random()}.txt`;
let fileId;
beforeAll(async (done) => {
await apis.admin.sites.createSite(sitePrivate, SITE_VISIBILITY.PRIVATE);
await apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_COLLABORATOR);
const docLibId = await apis.admin.sites.getDocLibId(sitePrivate);
fileId = (await apis.user.nodes.createFile(fileName, docLibId)).entry.id;
await apis.user.favorites.addFavoriteById('file', fileId);
await apis.user.shared.shareFileById(fileId);
await apis.user.shared.waitForApi({ expect: 1 });
await apis.user.search.waitForApi(username, { expect: 1 });
await apis.admin.sites.deleteSiteMember(sitePrivate, username);
await loginPage.loginWith(username);
done();
});
afterAll(async (done) => {
await Promise.all([
apis.admin.sites.deleteSite(sitePrivate),
logoutPage.load()
]);
done();
});
it(`on Recent Files - [C213178]`, async () => {
await recentFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES);
await dataTable.waitForHeader();
expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items');
expect(await dataTable.getItemLocation(fileName).getText()).toEqual('');
});
it(`on Favorites - [C213672]`, async () => {
await favoritesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
await dataTable.waitForHeader();
expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items');
expect(await dataTable.getItemLocation(fileName).getText()).toEqual('');
});
it(`on Shared Files - [C213668]`, async () => {
await sharedPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
await dataTable.waitForHeader();
expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items');
expect(await dataTable.getItemLocation(fileName).getText()).toEqual('');
});
});
});

@ -31,143 +31,129 @@ import { Utils } from '../../utilities/utils';
import { RepoClient } from '../../utilities/repo-client/repo-client';
describe('Personal Files', () => {
const username = `user-${Utils.random()}`;
const username = `user-${Utils.random()}`;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const personalFilesPage = new BrowsingPage();
const { dataTable } = personalFilesPage;
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const personalFilesPage = new BrowsingPage();
const { dataTable } = personalFilesPage;
const adminFolder = `admin-folder-${Utils.random()}`;
const adminFolder = `admin-folder-${Utils.random()}`;
const userFolder = `user-folder-${Utils.random()}`;
const userFile = `file-${Utils.random()}.txt`;
const userFolder = `user-folder-${Utils.random()}`;
const userFile = `file-${Utils.random()}.txt`;
beforeAll(done => {
Promise
.all([
apis.admin.people.createUser({ username }),
apis.admin.nodes.createFolders([ adminFolder ])
])
.then(() => apis.user.nodes.createFolders([ userFolder ]))
.then(() => apis.user.nodes.createFiles([ userFile ], userFolder))
.then(done);
beforeAll(async (done) => {
await Promise.all([
apis.admin.people.createUser({ username }),
apis.admin.nodes.createFolders([ adminFolder ])
]);
await apis.user.nodes.createFolders([ userFolder ]);
await apis.user.nodes.createFiles([ userFile ], userFolder);
done();
});
afterAll(async (done) => {
await Promise.all([
apis.admin.nodes.deleteNodes([ adminFolder ]),
apis.user.nodes.deleteNodes([ userFolder ])
]);
done();
});
xit('');
describe(`Admin user's personal files`, () => {
beforeAll(async (done) => {
await loginPage.loginWithAdmin();
done();
});
afterAll(done => {
Promise
.all([
apis.admin.nodes.deleteNodes([ adminFolder ]),
apis.user.nodes.deleteNodes([ userFolder ])
])
.then(done);
beforeEach(async (done) => {
await personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
await dataTable.waitForHeader();
done();
});
xit('');
describe(`Admin user's personal files`, () => {
beforeAll(done => {
loginPage.loginWithAdmin().then(done);
});
beforeEach(done => {
personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)
.then(() => dataTable.waitForHeader())
.then(done);
});
afterAll(done => {
logoutPage.load().then(done);
});
it('has Data Dictionary and created content - [C213241]', () => {
expect(dataTable.getRowByName('Data Dictionary').isPresent()).toBe(true);
expect(dataTable.getRowByName(adminFolder).isPresent()).toBe(true);
});
afterAll(async (done) => {
await logoutPage.load();
done();
});
describe(`Regular user's personal files`, () => {
beforeAll(done => {
loginPage.loginWith(username).then(done);
});
beforeEach(done => {
personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)
.then(() => dataTable.waitForHeader())
.then(done);
});
afterAll(done => {
logoutPage.load().then(done);
});
it('has the correct columns - [C217142]', () => {
const labels = [ 'Name', 'Size', 'Modified', 'Modified by' ];
const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label));
expect(dataTable.getColumnHeaders().count()).toBe(4 + 1, 'Incorrect number of columns');
elements.forEach((element, index) => {
expect(element.isPresent()).toBe(true, `"${labels[index]}" is missing`);
});
});
it('has default sorted column - [C217143]', () => {
expect(dataTable.getSortedColumnHeader().getText()).toBe('Modified');
});
it('has user created content - [C213242]', () => {
expect(dataTable.getRowByName(userFolder).isPresent())
.toBe(true);
});
it('navigates to folder - [C213244]', () => {
const getNodeIdPromise = apis.user.nodes
.getNodeByPath(`/${userFolder}`)
.then(response => response.entry.id);
const navigatePromise = dataTable
.doubleClickOnRowByName(userFolder)
.then(() => dataTable.waitForHeader());
Promise
.all([
getNodeIdPromise,
navigatePromise
])
.then(([ nodeId ]) => {
expect(browser.getCurrentUrl())
.toContain(nodeId, 'Node ID is not in the URL');
expect(dataTable.getRowByName(userFile).isPresent())
.toBe(true, 'user file is missing');
});
});
it('redirects to Personal Files on clicking the link from sidebar - [C213245]', () => {
personalFilesPage.dataTable.doubleClickOnRowByName(userFolder)
.then(() => personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES))
.then(() => browser.getCurrentUrl())
.then(url => expect(url.endsWith(APP_ROUTES.PERSONAL_FILES)).toBe(true, 'incorrect url'));
});
it('page loads correctly after browser refresh - [C213246]', () => {
personalFilesPage.refresh()
.then(() => expect(browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES));
});
it('page load by URL - [C213247]', () => {
let url;
browser.getCurrentUrl()
.then(resp => url = resp)
.then(() => personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH))
.then(() => browser.get(url))
.then(() => expect(browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES));
});
it('has Data Dictionary and created content - [C213241]', async () => {
expect(await dataTable.getRowByName('Data Dictionary').isPresent()).toBe(true);
expect(await dataTable.getRowByName(adminFolder).isPresent()).toBe(true);
});
});
describe(`Regular user's personal files`, () => {
beforeAll(async (done) => {
await loginPage.loginWith(username);
done();
});
beforeEach(async (done) => {
await personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
await dataTable.waitForHeader();
done();
});
afterAll(async (done) => {
await logoutPage.load();
done();
});
it('has the correct columns - [C217142]', async () => {
const labels = [ 'Name', 'Size', 'Modified', 'Modified by' ];
const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label));
expect(await dataTable.getColumnHeaders().count()).toBe(4 + 1, 'Incorrect number of columns');
await elements.forEach(async (element, index) => {
expect(await element.isPresent()).toBe(true, `"${labels[index]}" is missing`);
});
});
it('has default sorted column - [C217143]', async () => {
expect(await dataTable.getSortedColumnHeader().getText()).toBe('Modified');
});
it('has user created content - [C213242]', async () => {
expect(await dataTable.getRowByName(userFolder).isPresent()).toBe(true);
});
it('navigates to folder - [C213244]', async () => {
const nodeId = (await apis.user.nodes.getNodeByPath(`/${userFolder}`)).entry.id;
await dataTable.doubleClickOnRowByName(userFolder)
await dataTable.waitForHeader();
expect(await browser.getCurrentUrl()).toContain(nodeId, 'Node ID is not in the URL');
expect(await dataTable.getRowByName(userFile).isPresent()).toBe(true, 'user file is missing');
});
it('redirects to Personal Files on clicking the link from sidebar - [C213245]', async () => {
await personalFilesPage.dataTable.doubleClickOnRowByName(userFolder);
await personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
const url = await browser.getCurrentUrl();
expect(url.endsWith(APP_ROUTES.PERSONAL_FILES)).toBe(true, 'incorrect url');
});
it('page loads correctly after browser refresh - [C213246]', async () => {
await personalFilesPage.refresh();
expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
});
it('page load by URL - [C213247]', async () => {
const url = await browser.getCurrentUrl();
await personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
await browser.get(url);
expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
});
});
});

@ -29,112 +29,113 @@ import { Utils } from '../../utilities/utils';
import { RepoClient } from '../../utilities/repo-client/repo-client';
describe('Recent Files', () => {
const username = `user-${Utils.random()}`;
const username = `user-${Utils.random()}`;
const folderName = `folder-${Utils.random()}`; let folderId;
const fileName1 = `file-${Utils.random()}.txt`;
const fileName2 = `file-${Utils.random()}.txt`; let file2Id;
const fileName3 = `file-${Utils.random()}.txt`;
const folderName = `folder-${Utils.random()}`; let folderId;
const fileName1 = `file-${Utils.random()}.txt`;
const fileName2 = `file-${Utils.random()}.txt`; let file2Id;
const fileName3 = `file-${Utils.random()}.txt`;
const siteName = `site-${Utils.random()}`;
const folderSite = `folder2-${Utils.random()}`; let folderSiteId;
const fileSite = `file-${Utils.random()}.txt`;
const siteName = `site-${Utils.random()}`;
const folderSite = `folder2-${Utils.random()}`; let folderSiteId;
const fileSite = `file-${Utils.random()}.txt`;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const recentFilesPage = new BrowsingPage();
const { dataTable, breadcrumb } = recentFilesPage;
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const recentFilesPage = new BrowsingPage();
const { dataTable, breadcrumb } = recentFilesPage;
beforeAll(done => {
apis.admin.people.createUser({ username })
.then(() => apis.user.nodes.createFolders([ folderName ])).then(resp => folderId = resp.entry.id)
.then(() => apis.user.nodes.createFiles([ fileName1 ], folderName))
.then(() => apis.user.nodes.createFiles([ fileName2 ])).then(resp => file2Id = resp.entry.id)
.then(() => apis.user.nodes.createFiles([ fileName3 ]).then(resp => apis.user.nodes.deleteNodeById(resp.entry.id, false)))
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
folderId = (await apis.user.nodes.createFolders([ folderName ])).entry.id;
await apis.user.nodes.createFiles([ fileName1 ], folderName);
file2Id = (await apis.user.nodes.createFiles([ fileName2 ])).entry.id;
const id = (await apis.user.nodes.createFiles([ fileName3 ])).entry.id;
await apis.user.nodes.deleteNodeById(id, false);
.then(() => apis.user.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC))
.then(() => apis.user.sites.getDocLibId(siteName))
.then(resp => apis.user.nodes.createFolder(folderSite, resp)).then(resp => folderSiteId = resp.entry.id)
.then(() => apis.user.nodes.createFile(fileSite, folderSiteId))
await apis.user.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC);
const docLibId = await apis.user.sites.getDocLibId(siteName);
folderSiteId = (await apis.user.nodes.createFolder(folderSite, docLibId)).entry.id;
await apis.user.nodes.createFile(fileSite, folderSiteId);
.then(() => apis.user.search.waitForApi(username, { expect: 3 }))
await apis.user.search.waitForApi(username, { expect: 3 });
.then(() => loginPage.loginWith(username))
.then(done);
await loginPage.loginWith(username);
done();
});
beforeEach(async (done) => {
await recentFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES);
await dataTable.waitForHeader();
done();
});
afterAll(async (done) => {
await Promise.all([
apis.user.nodes.deleteNodesById([ folderId, file2Id ]),
apis.user.sites.deleteSite(siteName),
apis.admin.trashcan.emptyTrash(),
logoutPage.load()
]);
done();
});
it('has the correct columns - [C213168]', async () => {
const labels = [ 'Name', 'Location', 'Size', 'Modified' ];
const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label));
expect(await dataTable.getColumnHeaders().count()).toBe(4 + 1, 'Incorrect number of columns');
await elements.forEach(async (element, index) => {
expect(await element.isPresent()).toBe(true, `"${labels[index]}" is missing`);
});
});
beforeEach(done => {
recentFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES)
.then(() => dataTable.waitForHeader())
.then(done);
});
it('default sorting column - [C213171]', async () => {
expect(await dataTable.getSortedColumnHeader().getText()).toBe('Modified');
expect(await dataTable.getSortingOrder()).toBe('desc');
});
afterAll(done => {
Promise.all([
apis.user.nodes.deleteNodesById([ folderId, file2Id ]),
apis.user.sites.deleteSite(siteName),
apis.admin.trashcan.emptyTrash(),
logoutPage.load()
])
.then(done);
});
it('displays the files added by the current user in the last 30 days - [C213170]', async () => {
expect(await dataTable.countRows()).toEqual(3, 'Incorrect number of files displayed');
expect(await dataTable.getRowByName(fileName1).isPresent()).toBe(true, `${fileName1} not displayed`);
expect(await dataTable.getRowByName(fileName2).isPresent()).toBe(true, `${fileName2} not displayed`);
expect(await dataTable.getRowByName(fileSite).isPresent()).toBe(true, `${fileSite} not displayed`);
});
it('has the correct columns - [C213168]', () => {
const labels = [ 'Name', 'Location', 'Size', 'Modified' ];
const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label));
it(`file not displayed if it's been deleted - [C213174]`, async () => {
expect(await dataTable.getRowByName(fileName3).isPresent()).not.toBe(true, `${fileName3} is displayed`);
});
expect(dataTable.getColumnHeaders().count()).toBe(4 + 1, 'Incorrect number of columns');
it('Location column displays the parent folder of the file - [C213175]', async () => {
expect(await dataTable.getItemLocation(fileName1).getText()).toEqual(folderName);
expect(await dataTable.getItemLocation(fileName2).getText()).toEqual('Personal Files');
expect(await dataTable.getItemLocation(fileSite).getText()).toEqual(folderSite);
});
elements.forEach((element, index) => {
expect(element.isPresent()).toBe(true, `"${labels[index]}" is missing`);
});
});
it('Location column displays a tooltip with the entire path of the file - [C213177]', async () => {
expect(await dataTable.getItemLocationTileAttr(fileName1)).toEqual(`Personal Files/${folderName}`);
expect(await dataTable.getItemLocationTileAttr(fileName2)).toEqual('Personal Files');
expect(await dataTable.getItemLocationTileAttr(fileSite)).toEqual(`File Libraries/${siteName}/${folderSite}`);
});
it('default sorting column - [C213171]', () => {
expect(dataTable.getSortedColumnHeader().getText()).toBe('Modified');
expect(dataTable.getSortingOrder()).toBe('desc');
});
it('Location column redirect - file in user Home - [C213176]', async () => {
await dataTable.clickItemLocation(fileName2);
expect(await breadcrumb.getAllItems()).toEqual([ 'Personal Files' ]);
});
it('displays the files added by the current user in the last 30 days - [C213170]', () => {
expect(dataTable.countRows()).toEqual(3, 'Incorrect number of files displayed');
expect(dataTable.getRowByName(fileName1).isPresent()).toBe(true, `${fileName1} not displayed`);
expect(dataTable.getRowByName(fileName2).isPresent()).toBe(true, `${fileName2} not displayed`);
expect(dataTable.getRowByName(fileSite).isPresent()).toBe(true, `${fileSite} not displayed`);
});
it('Location column redirect - file in folder - [C280486]', async () => {
await dataTable.clickItemLocation(fileName1);
expect(await breadcrumb.getAllItems()).toEqual([ 'Personal Files', folderName ]);
});
it(`file not displayed if it's been deleted - [C213174]`, () => {
expect(dataTable.getRowByName(fileName3).isPresent()).not.toBe(true, `${fileName3} is displayed`);
});
it('Location column displays the parent folder of the file - [C213175]', () => {
expect(dataTable.getItemLocation(fileName1).getText()).toEqual(folderName);
expect(dataTable.getItemLocation(fileName2).getText()).toEqual('Personal Files');
expect(dataTable.getItemLocation(fileSite).getText()).toEqual(folderSite);
});
it('Location column displays a tooltip with the entire path of the file - [C213177]', () => {
expect(dataTable.getItemLocationTileAttr(fileName1)).toEqual(`Personal Files/${folderName}`);
expect(dataTable.getItemLocationTileAttr(fileName2)).toEqual('Personal Files');
expect(dataTable.getItemLocationTileAttr(fileSite)).toEqual(`File Libraries/${siteName}/${folderSite}`);
});
it('Location column redirect - file in user Home - [C213176]', () => {
dataTable.clickItemLocation(fileName2)
.then(() => expect(breadcrumb.getAllItems()).toEqual([ 'Personal Files' ]));
});
it('Location column redirect - file in folder - [C280486]', () => {
dataTable.clickItemLocation(fileName1)
.then(() => expect(breadcrumb.getAllItems()).toEqual([ 'Personal Files', folderName ]));
});
it('Location column redirect - file in site - [C280487]', () => {
dataTable.clickItemLocation(fileSite)
.then(() => expect(breadcrumb.getAllItems()).toEqual([ 'File Libraries', siteName, folderSite ]));
});
it('Location column redirect - file in site - [C280487]', async () => {
await dataTable.clickItemLocation(fileSite);
expect(await breadcrumb.getAllItems()).toEqual([ 'File Libraries', siteName, folderSite ]);
});
});

@ -29,125 +29,126 @@ import { Utils } from '../../utilities/utils';
import { RepoClient } from '../../utilities/repo-client/repo-client';
describe('Shared Files', () => {
const username = `user-${Utils.random()}`;
const password = username;
const username = `user-${Utils.random()}`;
const password = username;
const siteName = `site-${Utils.random()}`;
const fileAdmin = `file-${Utils.random()}.txt`;
const siteName = `site-${Utils.random()}`;
const fileAdmin = `file-${Utils.random()}.txt`;
const folderUser = `folder-${Utils.random()}`;
const file1User = `file1-${Utils.random()}.txt`; let file1Id;
const file2User = `file2-${Utils.random()}.txt`; let file2Id;
const file3User = `file3-${Utils.random()}.txt`; let file3Id;
const file4User = `file4-${Utils.random()}.txt`; let file4Id;
const folderUser = `folder-${Utils.random()}`;
const file1User = `file1-${Utils.random()}.txt`; let file1Id;
const file2User = `file2-${Utils.random()}.txt`; let file2Id;
const file3User = `file3-${Utils.random()}.txt`; let file3Id;
const file4User = `file4-${Utils.random()}.txt`; let file4Id;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, password)
};
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, password)
};
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const sharedFilesPage = new BrowsingPage();
const { dataTable, breadcrumb } = sharedFilesPage;
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const sharedFilesPage = new BrowsingPage();
const { dataTable, breadcrumb } = sharedFilesPage;
beforeAll(done => {
apis.admin.people.createUser({ username })
.then(() => apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC))
.then(() => apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_CONSUMER))
.then(() => apis.admin.nodes.createFiles([ fileAdmin ], `Sites/${siteName}/documentLibrary`))
.then(resp => apis.admin.shared.shareFileById(resp.entry.id))
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
await apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC);
await apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_CONSUMER);
const docLibId = await apis.admin.sites.getDocLibId(siteName);
const nodeId = (await apis.admin.nodes.createFile(fileAdmin, docLibId)).entry.id;
await apis.admin.shared.shareFileById(nodeId);
.then(() => apis.user.nodes.createFolders([ folderUser ]))
.then(() => apis.user.nodes.createFiles([ file1User ], folderUser)).then(resp => file1Id = resp.entry.id)
.then(() => apis.user.nodes.createFile(file2User)).then(resp => file2Id = resp.entry.id)
.then(() => apis.user.nodes.createFile(file3User)).then(resp => file3Id = resp.entry.id)
.then(() => apis.user.nodes.createFile(file4User)).then(resp => file4Id = resp.entry.id)
.then(() => apis.user.shared.shareFilesByIds([file1Id, file2Id, file3Id, file4Id]))
const folderId = (await apis.user.nodes.createFolder(folderUser)).entry.id;
file1Id = (await apis.user.nodes.createFile(file1User, folderId)).entry.id;
file2Id = (await apis.user.nodes.createFile(file2User)).entry.id;
file3Id = (await apis.user.nodes.createFile(file3User)).entry.id;
file4Id = (await apis.user.nodes.createFile(file4User)).entry.id;
await apis.user.shared.shareFilesByIds([file1Id, file2Id, file3Id, file4Id]);
.then(() => apis.user.shared.waitForApi({ expect: 5 }))
.then(() => apis.user.nodes.deleteNodeById(file2Id))
.then(() => apis.user.shared.unshareFile(file3User))
await apis.user.shared.waitForApi({ expect: 5 });
await apis.user.nodes.deleteNodeById(file2Id);
await apis.user.shared.unshareFile(file3User);
.then(() => loginPage.loginWith(username))
.then(done);
await loginPage.loginWith(username);
done();
});
beforeEach(async (done) => {
await sharedFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
await dataTable.waitForHeader();
done();
});
afterEach(async (done) => {
await sharedFilesPage.refresh();
done();
});
afterAll(async (done) => {
await Promise.all([
apis.admin.sites.deleteSite(siteName),
apis.user.nodes.deleteNodes([ folderUser ]),
logoutPage.load()
]);
done();
});
it('has the correct columns - [C213113]', async () => {
const labels = [ 'Name', 'Location', 'Size', 'Modified', 'Modified by', 'Shared by' ];
const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label));
expect(await dataTable.getColumnHeaders().count()).toBe(6 + 1, 'Incorrect number of columns');
await elements.forEach(async (element, index) => {
expect(await element.isPresent()).toBe(true, `"${labels[index]}" is missing`);
});
});
beforeEach(done => {
sharedFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES)
.then(() => dataTable.waitForHeader())
.then(done);
});
it('default sorting column - [C213115]', async () => {
expect(await dataTable.getSortedColumnHeader().getText()).toBe('Modified');
expect(await dataTable.getSortingOrder()).toBe('desc');
});
afterEach(done => {
sharedFilesPage.refresh().then(done);
});
it('displays the files shared by everyone - [C213114]', async () => {
expect(await dataTable.getRowByName(fileAdmin).isPresent()).toBe(true, `${fileAdmin} not displayed`);
expect(await dataTable.getRowByName(file1User).isPresent()).toBe(true, `${file1User} not displayed`);
});
afterAll(done => {
Promise.all([
apis.admin.sites.deleteSite(siteName),
apis.user.nodes.deleteNodes([ folderUser ]),
logoutPage.load()
])
.then(done);
});
it(`file not displayed if it's been deleted - [C213117]`, async () => {
expect(await dataTable.getRowByName(file2User).isPresent()).toBe(false, `${file2User} is displayed`);
});
it('has the correct columns - [C213113]', () => {
const labels = [ 'Name', 'Location', 'Size', 'Modified', 'Modified by', 'Shared by' ];
const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label));
// TODO: disabled cause the api is slow to update. Find a way to wait until the file is unshared
xit('unshared file is not displayed - [C213118]', async (done) => {
await apis.user.shared.waitForApi({ expect: 4 });
expect(await dataTable.getRowByName(file3User).isPresent()).toBe(false, `${file3User} is displayed`);
done();
});
expect(dataTable.getColumnHeaders().count()).toBe(6 + 1, 'Incorrect number of columns');
it('Location column displays the parent folder of the file - [C213665]', async () => {
expect(await dataTable.getItemLocationTileAttr(file4User)).toEqual('Personal Files');
expect(await dataTable.getItemLocation(fileAdmin).getText()).toEqual(siteName);
expect(await dataTable.getItemLocation(file1User).getText()).toEqual(folderUser);
});
elements.forEach((element, index) => {
expect(element.isPresent()).toBe(true, `"${labels[index]}" is missing`);
});
});
it('Location column redirect - file in user Home - [C213666]', async () => {
await dataTable.clickItemLocation(file4User);
expect(await breadcrumb.getAllItems()).toEqual([ 'Personal Files' ]);
});
it('default sorting column - [C213115]', () => {
expect(dataTable.getSortedColumnHeader().getText()).toBe('Modified');
expect(dataTable.getSortingOrder()).toBe('desc');
});
it('Location column redirect - file in folder - [C280490]', async () => {
await dataTable.clickItemLocation(file1User);
expect(await breadcrumb.getAllItems()).toEqual([ 'Personal Files', folderUser ]);
});
it('displays the files shared by everyone - [C213114]', () => {
expect(dataTable.getRowByName(fileAdmin).isPresent()).toBe(true, `${fileAdmin} not displayed`);
expect(dataTable.getRowByName(file1User).isPresent()).toBe(true, `${file1User} not displayed`);
});
it('Location column redirect - file in site - [C280491]', async () => {
await dataTable.clickItemLocation(fileAdmin);
expect(await breadcrumb.getAllItems()).toEqual([ 'File Libraries', siteName ]);
});
it(`file not displayed if it's been deleted - [C213117]`, () => {
expect(dataTable.getRowByName(file2User).isPresent()).toBe(false, `${file2User} is displayed`);
});
// TODO: disabled cause the api is slow to update. Find a way to wait until the file is unshared
xit('unshared file is not displayed - [C213118]', async () => {
apis.user.shared.waitForApi({ expect: 4 })
.then(() => {
expect(dataTable.getRowByName(file3User).isPresent()).toBe(false, `${file3User} is displayed`);
});
});
it('Location column displays the parent folder of the file - [C213665]', () => {
expect(dataTable.getItemLocationTileAttr(file4User)).toEqual('Personal Files');
expect(dataTable.getItemLocation(fileAdmin).getText()).toEqual(siteName);
expect(dataTable.getItemLocation(file1User).getText()).toEqual(folderUser);
});
it('Location column redirect - file in user Home - [C213666]', () => {
dataTable.clickItemLocation(file4User)
.then(() => expect(breadcrumb.getAllItems()).toEqual([ 'Personal Files' ]));
});
it('Location column redirect - file in folder - [C280490]', () => {
dataTable.clickItemLocation(file1User)
.then(() => expect(breadcrumb.getAllItems()).toEqual([ 'Personal Files', folderUser ]));
});
it('Location column redirect - file in site - [C280491]', () => {
dataTable.clickItemLocation(fileAdmin)
.then(() => expect(breadcrumb.getAllItems()).toEqual([ 'File Libraries', siteName ]));
});
it('Location column displays a tooltip with the entire path of the file - [C213667]', () => {
expect(dataTable.getItemLocationTileAttr(fileAdmin)).toEqual(`File Libraries/${siteName}`);
expect(dataTable.getItemLocationTileAttr(file1User)).toEqual(`Personal Files/${folderUser}`);
});
it('Location column displays a tooltip with the entire path of the file - [C213667]', async () => {
expect(await dataTable.getItemLocationTileAttr(fileAdmin)).toEqual(`File Libraries/${siteName}`);
expect(await dataTable.getItemLocationTileAttr(file1User)).toEqual(`Personal Files/${folderUser}`);
});
});

@ -29,305 +29,289 @@ import { Utils } from '../../utilities/utils';
import { RepoClient } from '../../utilities/repo-client/repo-client';
describe('File / folder tooltips', () => {
const username = `user-${Utils.random()}`;
const username = `user-${Utils.random()}`;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const parent = `parent-${Utils.random()}`;
const parent = `parent-${Utils.random()}`;
const file = `file1-${Utils.random()}`;
const fileWithDesc = `file2-${Utils.random()}`;
const fileWithTitle = `file3-${Utils.random()}`;
const fileWithTitleAndDesc = `file4-${Utils.random()}`;
const fileNameEqTitleEqDesc = `file5-${Utils.random()}`;
const fileNameEqTitleDiffDesc = `file6-${Utils.random()}`;
const fileNameEqDescDiffTitle = `file7-${Utils.random()}`;
const fileTitleEqDesc = `file8-${Utils.random()}`;
let parentId, file1Id, file2Id, file3Id, file4Id, file5Id, file6Id, file7Id, file8Id;
const file = `file1-${Utils.random()}`;
const fileWithDesc = `file2-${Utils.random()}`;
const fileWithTitle = `file3-${Utils.random()}`;
const fileWithTitleAndDesc = `file4-${Utils.random()}`;
const fileNameEqTitleEqDesc = `file5-${Utils.random()}`;
const fileNameEqTitleDiffDesc = `file6-${Utils.random()}`;
const fileNameEqDescDiffTitle = `file7-${Utils.random()}`;
const fileTitleEqDesc = `file8-${Utils.random()}`;
let parentId, file1Id, file2Id, file3Id, file4Id, file5Id, file6Id, file7Id, file8Id;
const fileTitle = 'file title';
const fileDescription = 'file description';
const fileTitle = 'file title';
const fileDescription = 'file description';
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const page = new BrowsingPage();
const { dataTable } = page;
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const page = new BrowsingPage();
const { dataTable } = page;
beforeAll(done => {
apis.admin.people.createUser({ username })
.then(() => apis.user.nodes.createFolder( parent ))
.then(resp => parentId = resp.entry.id)
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
parentId = (await apis.user.nodes.createFolder( parent )).entry.id;
.then(() => Promise.all([
apis.user.nodes.createFile(file, parentId).then(resp => file1Id = resp.entry.id),
apis.user.nodes.createFile(fileWithDesc, parentId, '', fileDescription).then(resp => file2Id = resp.entry.id),
apis.user.nodes.createFile(fileWithTitle, parentId, fileTitle).then(resp => file3Id = resp.entry.id),
apis.user.nodes.createFile(fileWithTitleAndDesc, parentId, fileTitle, fileDescription)
.then(resp => file4Id = resp.entry.id),
apis.user.nodes.createFile(fileNameEqTitleEqDesc, parentId, fileNameEqTitleEqDesc, fileNameEqTitleEqDesc)
.then(resp => file5Id = resp.entry.id),
apis.user.nodes.createFile(fileNameEqTitleDiffDesc, parentId, fileNameEqTitleDiffDesc, fileDescription)
.then(resp => file6Id = resp.entry.id),
apis.user.nodes.createFile(fileNameEqDescDiffTitle, parentId, fileTitle, fileNameEqDescDiffTitle)
.then(resp => file7Id = resp.entry.id),
apis.user.nodes.createFile(fileTitleEqDesc, parentId, fileTitle, fileTitle).then(resp => file8Id = resp.entry.id)
]))
file1Id = (await apis.user.nodes.createFile(file, parentId)).entry.id;
file2Id = (await apis.user.nodes.createFile(fileWithDesc, parentId, '', fileDescription)).entry.id;
file3Id = (await apis.user.nodes.createFile(fileWithTitle, parentId, fileTitle)).entry.id;
file4Id = (await apis.user.nodes.createFile(fileWithTitleAndDesc, parentId, fileTitle, fileDescription)).entry.id;
file5Id = (await apis.user.nodes.createFile(fileNameEqTitleEqDesc, parentId, fileNameEqTitleEqDesc, fileNameEqTitleEqDesc)).entry.id;
file6Id = (await apis.user.nodes.createFile(fileNameEqTitleDiffDesc, parentId, fileNameEqTitleDiffDesc, fileDescription)).entry.id;
file7Id = (await apis.user.nodes.createFile(fileNameEqDescDiffTitle, parentId, fileTitle, fileNameEqDescDiffTitle)).entry.id;
file8Id = (await apis.user.nodes.createFile(fileTitleEqDesc, parentId, fileTitle, fileTitle)).entry.id;
.then(() => apis.user.shared.shareFilesByIds([ file1Id, file2Id, file3Id, file4Id, file5Id, file6Id, file7Id, file8Id ]))
await apis.user.shared.shareFilesByIds([ file1Id, file2Id, file3Id, file4Id, file5Id, file6Id, file7Id, file8Id ]);
.then(() => apis.user.favorites.addFavoritesByIds('file', [
file1Id, file2Id, file3Id, file4Id, file5Id, file6Id, file7Id, file8Id
]))
await apis.user.favorites.addFavoritesByIds('file', [
file1Id, file2Id, file3Id, file4Id, file5Id, file6Id, file7Id, file8Id
]);
.then(() => loginPage.loginWith(username))
.then(done);
await loginPage.loginWith(username);
done();
});
afterAll(async (done) => {
await Promise.all([
apis.user.nodes.deleteNodes([ parent ]),
apis.user.trashcan.emptyTrash(),
logoutPage.load()
]);
done();
});
xit('');
describe('on Personal Files', () => {
beforeAll(async (done) => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
await dataTable.doubleClickOnRowByName(parent);
done();
});
afterAll(done => {
Promise.all([
apis.user.nodes.deleteNodes([ parent ]),
apis.admin.trashcan.emptyTrash(),
logoutPage.load()
])
.then(done);
it('File with name, no title, no description - [C255871]', async () => {
expect(await dataTable.getItemNameTooltip(file)).toEqual(`${file}`);
});
xit('');
describe('on Personal Files', () => {
beforeAll(done => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)
.then(() => dataTable.doubleClickOnRowByName(parent))
.then(done);
});
it('File with name, no title, no description - [C255871]', () => {
expect(dataTable.getItemNameTooltip(file)).toEqual(`${file}`);
});
it('File with name and description, no title - [C255872]', () => {
expect(dataTable.getItemNameTooltip(fileWithDesc)).toEqual(`${fileWithDesc}\n${fileDescription}`);
});
it('File with name and title, no description - [C255873]', () => {
expect(dataTable.getItemNameTooltip(fileWithTitle)).toEqual(`${fileWithTitle}\n${fileTitle}`);
});
it('File with name and title and description, all different - [C255874]', () => {
expect(dataTable.getItemNameTooltip(fileWithTitleAndDesc)).toEqual(`${fileTitle}\n${fileDescription}`);
});
it('File with name and title and description, all equal - [C255875]', () => {
expect(dataTable.getItemNameTooltip(fileNameEqTitleEqDesc)).toEqual(`${fileNameEqTitleEqDesc}`);
});
it('File with name = title, different description - [C255876]', () => {
expect(dataTable.getItemNameTooltip(fileNameEqTitleDiffDesc)).toEqual(`${fileNameEqTitleDiffDesc}\n${fileDescription}`);
});
it('File with name = description, different title - [C255877]', () => {
expect(dataTable.getItemNameTooltip(fileNameEqDescDiffTitle)).toEqual(`${fileTitle}\n${fileNameEqDescDiffTitle}`);
});
it('File with title = description, different name - [C255878]', () => {
expect(dataTable.getItemNameTooltip(fileTitleEqDesc)).toEqual(`${fileTitle}`);
});
it('File with name and description, no title - [C255872]', async () => {
expect(await dataTable.getItemNameTooltip(fileWithDesc)).toEqual(`${fileWithDesc}\n${fileDescription}`);
});
describe('on Recent Files', () => {
beforeAll(done => {
apis.user.search.waitForApi(username, { expect: 8 })
.then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES))
.then(done);
});
it('File with name, no title, no description - [C280135]', () => {
expect(dataTable.getItemNameTooltip(file)).toEqual(`${file}`);
});
it('File with name and description, no title - [C280136]', () => {
expect(dataTable.getItemNameTooltip(fileWithDesc)).toEqual(`${fileWithDesc}\n${fileDescription}`);
});
it('File with name and title, no description - [C280137]', () => {
expect(dataTable.getItemNameTooltip(fileWithTitle)).toEqual(`${fileWithTitle}\n${fileTitle}`);
});
it('File with name and title and description, all different - [C280138]', () => {
expect(dataTable.getItemNameTooltip(fileWithTitleAndDesc)).toEqual(`${fileTitle}\n${fileDescription}`);
});
it('File with name and title and description, all equal - [C280139]', () => {
expect(dataTable.getItemNameTooltip(fileNameEqTitleEqDesc)).toEqual(`${fileNameEqTitleEqDesc}`);
});
it('File with name = title, different description - [C280140]', () => {
expect(dataTable.getItemNameTooltip(fileNameEqTitleDiffDesc)).toEqual(`${fileNameEqTitleDiffDesc}\n${fileDescription}`);
});
it('File with name = description, different title - [C280141]', () => {
expect(dataTable.getItemNameTooltip(fileNameEqDescDiffTitle)).toEqual(`${fileTitle}\n${fileNameEqDescDiffTitle}`);
});
it('File with title = description, different name - [C280142]', () => {
expect(dataTable.getItemNameTooltip(fileTitleEqDesc)).toEqual(`${fileTitle}`);
});
it('File with name and title, no description - [C255873]', async () => {
expect(await dataTable.getItemNameTooltip(fileWithTitle)).toEqual(`${fileWithTitle}\n${fileTitle}`);
});
// disabled until ACA-518 is done
xdescribe('on Shared Files', () => {
beforeAll(done => {
apis.user.shared.waitForApi({ expect: 8 })
.then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES))
.then(done);
});
xit('File with name, no title, no description - [C280143]', () => {
expect(dataTable.getItemNameTooltip(file)).toEqual(`${file}`);
});
xit('File with name and description, no title - [C280144]', () => {
expect(dataTable.getItemNameTooltip(fileWithDesc)).toEqual(`${fileWithDesc}\n${fileDescription}`);
});
xit('File with name and title, no description - [C280145]', () => {
expect(dataTable.getItemNameTooltip(fileWithTitle)).toEqual(`${fileWithTitle}\n${fileTitle}`);
});
xit('File with name and title and description, all different - [C280146]', () => {
expect(dataTable.getItemNameTooltip(fileWithTitleAndDesc)).toEqual(`${fileTitle}\n${fileDescription}`);
});
xit('File with name and title and description, all equal - [C280147]', () => {
expect(dataTable.getItemNameTooltip(fileNameEqTitleEqDesc)).toEqual(`${fileNameEqTitleEqDesc}`);
});
xit('File with name = title, different description - [C280148]', () => {
expect(dataTable.getItemNameTooltip(fileNameEqTitleDiffDesc)).toEqual(`${fileNameEqTitleDiffDesc}\n${fileDescription}`);
});
xit('File with name = description, different title - [C280149]', () => {
expect(dataTable.getItemNameTooltip(fileNameEqDescDiffTitle)).toEqual(`${fileTitle}\n${fileNameEqDescDiffTitle}`);
});
xit('File with title = description, different name - [C280150]', () => {
expect(dataTable.getItemNameTooltip(fileTitleEqDesc)).toEqual(`${fileTitle}`);
});
it('File with name and title and description, all different - [C255874]', async () => {
expect(await dataTable.getItemNameTooltip(fileWithTitleAndDesc)).toEqual(`${fileTitle}\n${fileDescription}`);
});
describe('on Favorites', () => {
beforeAll(done => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES)
.then(() => dataTable.waitForHeader())
.then(done);
});
it('File with name, no title, no description - [C280151]', () => {
expect(dataTable.getItemNameTooltip(file)).toEqual(`${file}`);
});
it('File with name and description, no title - [C280152]', () => {
expect(dataTable.getItemNameTooltip(fileWithDesc)).toEqual(`${fileWithDesc}\n${fileDescription}`);
});
it('File with name and title, no description - [C280153]', () => {
expect(dataTable.getItemNameTooltip(fileWithTitle)).toEqual(`${fileWithTitle}\n${fileTitle}`);
});
it('File with name and title and description, all different - [C280154]', () => {
expect(dataTable.getItemNameTooltip(fileWithTitleAndDesc)).toEqual(`${fileTitle}\n${fileDescription}`);
});
it('File with name and title and description, all equal - [C280155]', () => {
expect(dataTable.getItemNameTooltip(fileNameEqTitleEqDesc)).toEqual(`${fileNameEqTitleEqDesc}`);
});
it('File with name = title, different description - [C280156]', () => {
expect(dataTable.getItemNameTooltip(fileNameEqTitleDiffDesc)).toEqual(`${fileNameEqTitleDiffDesc}\n${fileDescription}`);
});
it('File with name = description, different title - [C280157]', () => {
expect(dataTable.getItemNameTooltip(fileNameEqDescDiffTitle)).toEqual(`${fileTitle}\n${fileNameEqDescDiffTitle}`);
});
it('File with title = description, different name - [C280158]', () => {
expect(dataTable.getItemNameTooltip(fileTitleEqDesc)).toEqual(`${fileTitle}`);
});
it('File with name and title and description, all equal - [C255875]', async () => {
expect(await dataTable.getItemNameTooltip(fileNameEqTitleEqDesc)).toEqual(`${fileNameEqTitleEqDesc}`);
});
describe('on Trash', () => {
const parentForTrash = `parent-${Utils.random()}`;
let parentForTrashId, file1TrashId, file2TrashId, file3TrashId, file4TrashId;
let file5TrashId, file6TrashId, file7TrashId, file8TrashId;
beforeAll(done => {
apis.user.nodes.createFolder( parentForTrash )
.then(resp => parentForTrashId = resp.entry.id)
.then(() => Promise.all([
apis.user.nodes.createFile(file, parentForTrashId)
.then(resp => file1TrashId = resp.entry.id),
apis.user.nodes.createFile(fileWithDesc, parentForTrashId, '', fileDescription)
.then(resp => file2TrashId = resp.entry.id),
apis.user.nodes.createFile(fileWithTitle, parentForTrashId, fileTitle)
.then(resp => file3TrashId = resp.entry.id),
apis.user.nodes.createFile(fileWithTitleAndDesc, parentForTrashId, fileTitle, fileDescription)
.then(resp => file4TrashId = resp.entry.id),
apis.user.nodes.createFile(fileNameEqTitleEqDesc, parentForTrashId, fileNameEqTitleEqDesc, fileNameEqTitleEqDesc)
.then(resp => file5TrashId = resp.entry.id),
apis.user.nodes.createFile(fileNameEqTitleDiffDesc, parentForTrashId, fileNameEqTitleDiffDesc, fileDescription)
.then(resp => file6TrashId = resp.entry.id),
apis.user.nodes.createFile(fileNameEqDescDiffTitle, parentForTrashId, fileTitle, fileNameEqDescDiffTitle)
.then(resp => file7TrashId = resp.entry.id),
apis.user.nodes.createFile(fileTitleEqDesc, parentForTrashId, fileTitle, fileTitle)
.then(resp => file8TrashId = resp.entry.id)
]))
.then(() => apis.user.nodes.deleteNodesById([
file1TrashId, file2TrashId, file3TrashId, file4TrashId, file5TrashId, file6TrashId, file7TrashId, file8TrashId
], false))
.then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH))
.then(() => dataTable.waitForHeader())
.then(done);
});
afterAll(done => {
apis.user.nodes.deleteNodes([ parentForTrash ]).then(done);
});
it('File with name, no title, no description - [C280159]', () => {
expect(dataTable.getItemNameTooltip(file)).toEqual(`${file}`);
});
it('File with name and description, no title - [C280160]', () => {
expect(dataTable.getItemNameTooltip(fileWithDesc)).toEqual(`${fileWithDesc}\n${fileDescription}`);
});
it('File with name and title, no description - [C280161]', () => {
expect(dataTable.getItemNameTooltip(fileWithTitle)).toEqual(`${fileWithTitle}\n${fileTitle}`);
});
it('File with name and title and description, all different - [C280162]', () => {
expect(dataTable.getItemNameTooltip(fileWithTitleAndDesc)).toEqual(`${fileTitle}\n${fileDescription}`);
});
it('File with name and title and description, all equal - [C280163]', () => {
expect(dataTable.getItemNameTooltip(fileNameEqTitleEqDesc)).toEqual(`${fileNameEqTitleEqDesc}`);
});
it('File with name = title, different description - [C280164]', () => {
expect(dataTable.getItemNameTooltip(fileNameEqTitleDiffDesc)).toEqual(`${fileNameEqTitleDiffDesc}\n${fileDescription}`);
});
it('File with name = description, different title - [C280165]', () => {
expect(dataTable.getItemNameTooltip(fileNameEqDescDiffTitle)).toEqual(`${fileTitle}\n${fileNameEqDescDiffTitle}`);
});
it('File with title = description, different name - [C280166]', () => {
expect(dataTable.getItemNameTooltip(fileTitleEqDesc)).toEqual(`${fileTitle}`);
});
it('File with name = title, different description - [C255876]', async () => {
expect(await dataTable.getItemNameTooltip(fileNameEqTitleDiffDesc)).toEqual(`${fileNameEqTitleDiffDesc}\n${fileDescription}`);
});
it('File with name = description, different title - [C255877]', async () => {
expect(await dataTable.getItemNameTooltip(fileNameEqDescDiffTitle)).toEqual(`${fileTitle}\n${fileNameEqDescDiffTitle}`);
});
it('File with title = description, different name - [C255878]', async () => {
expect(await dataTable.getItemNameTooltip(fileTitleEqDesc)).toEqual(`${fileTitle}`);
});
});
describe('on Recent Files', () => {
beforeAll(async (done) => {
await apis.user.search.waitForApi(username, { expect: 8 });
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES);
done();
});
it('File with name, no title, no description - [C280135]', async () => {
expect(await dataTable.getItemNameTooltip(file)).toEqual(`${file}`);
});
it('File with name and description, no title - [C280136]', async () => {
expect(await dataTable.getItemNameTooltip(fileWithDesc)).toEqual(`${fileWithDesc}\n${fileDescription}`);
});
it('File with name and title, no description - [C280137]', async () => {
expect(await dataTable.getItemNameTooltip(fileWithTitle)).toEqual(`${fileWithTitle}\n${fileTitle}`);
});
it('File with name and title and description, all different - [C280138]', async () => {
expect(await dataTable.getItemNameTooltip(fileWithTitleAndDesc)).toEqual(`${fileTitle}\n${fileDescription}`);
});
it('File with name and title and description, all equal - [C280139]', async () => {
expect(await dataTable.getItemNameTooltip(fileNameEqTitleEqDesc)).toEqual(`${fileNameEqTitleEqDesc}`);
});
it('File with name = title, different description - [C280140]', async () => {
expect(await dataTable.getItemNameTooltip(fileNameEqTitleDiffDesc)).toEqual(`${fileNameEqTitleDiffDesc}\n${fileDescription}`);
});
it('File with name = description, different title - [C280141]', async () => {
expect(await dataTable.getItemNameTooltip(fileNameEqDescDiffTitle)).toEqual(`${fileTitle}\n${fileNameEqDescDiffTitle}`);
});
it('File with title = description, different name - [C280142]', async () => {
expect(await dataTable.getItemNameTooltip(fileTitleEqDesc)).toEqual(`${fileTitle}`);
});
});
// disabled until ACA-518 is done
xdescribe('on Shared Files', () => {
beforeAll(async (done) => {
await apis.user.shared.waitForApi({ expect: 8 });
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
done();
});
xit('File with name, no title, no description - [C280143]', async () => {
expect(await dataTable.getItemNameTooltip(file)).toEqual(`${file}`);
});
xit('File with name and description, no title - [C280144]', async () => {
expect(await dataTable.getItemNameTooltip(fileWithDesc)).toEqual(`${fileWithDesc}\n${fileDescription}`);
});
xit('File with name and title, no description - [C280145]', async () => {
expect(await dataTable.getItemNameTooltip(fileWithTitle)).toEqual(`${fileWithTitle}\n${fileTitle}`);
});
xit('File with name and title and description, all different - [C280146]', async () => {
expect(await dataTable.getItemNameTooltip(fileWithTitleAndDesc)).toEqual(`${fileTitle}\n${fileDescription}`);
});
xit('File with name and title and description, all equal - [C280147]', async () => {
expect(await dataTable.getItemNameTooltip(fileNameEqTitleEqDesc)).toEqual(`${fileNameEqTitleEqDesc}`);
});
xit('File with name = title, different description - [C280148]', async () => {
expect(await dataTable.getItemNameTooltip(fileNameEqTitleDiffDesc)).toEqual(`${fileNameEqTitleDiffDesc}\n${fileDescription}`);
});
xit('File with name = description, different title - [C280149]', async () => {
expect(await dataTable.getItemNameTooltip(fileNameEqDescDiffTitle)).toEqual(`${fileTitle}\n${fileNameEqDescDiffTitle}`);
});
xit('File with title = description, different name - [C280150]', async () => {
expect(await dataTable.getItemNameTooltip(fileTitleEqDesc)).toEqual(`${fileTitle}`);
});
});
describe('on Favorites', () => {
beforeAll(async (done) => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
await dataTable.waitForHeader();
done();
});
it('File with name, no title, no description - [C280151]', async () => {
expect(await dataTable.getItemNameTooltip(file)).toEqual(`${file}`);
});
it('File with name and description, no title - [C280152]', async () => {
expect(await dataTable.getItemNameTooltip(fileWithDesc)).toEqual(`${fileWithDesc}\n${fileDescription}`);
});
it('File with name and title, no description - [C280153]', async () => {
expect(await dataTable.getItemNameTooltip(fileWithTitle)).toEqual(`${fileWithTitle}\n${fileTitle}`);
});
it('File with name and title and description, all different - [C280154]', async () => {
expect(await dataTable.getItemNameTooltip(fileWithTitleAndDesc)).toEqual(`${fileTitle}\n${fileDescription}`);
});
it('File with name and title and description, all equal - [C280155]', async () => {
expect(await dataTable.getItemNameTooltip(fileNameEqTitleEqDesc)).toEqual(`${fileNameEqTitleEqDesc}`);
});
it('File with name = title, different description - [C280156]', async () => {
expect(await dataTable.getItemNameTooltip(fileNameEqTitleDiffDesc)).toEqual(`${fileNameEqTitleDiffDesc}\n${fileDescription}`);
});
it('File with name = description, different title - [C280157]', async () => {
expect(await dataTable.getItemNameTooltip(fileNameEqDescDiffTitle)).toEqual(`${fileTitle}\n${fileNameEqDescDiffTitle}`);
});
it('File with title = description, different name - [C280158]', async () => {
expect(await dataTable.getItemNameTooltip(fileTitleEqDesc)).toEqual(`${fileTitle}`);
});
});
describe('on Trash', () => {
const parentForTrash = `parent-${Utils.random()}`;
let parentForTrashId, file1TrashId, file2TrashId, file3TrashId, file4TrashId;
let file5TrashId, file6TrashId, file7TrashId, file8TrashId;
beforeAll(async (done) => {
parentForTrashId = (await apis.user.nodes.createFolder( parentForTrash )).entry.id;
file1TrashId = (await apis.user.nodes.createFile(file, parentForTrashId)).entry.id;
file2TrashId = (await apis.user.nodes.createFile(fileWithDesc, parentForTrashId, '', fileDescription)).entry.id;
file3TrashId = (await apis.user.nodes.createFile(fileWithTitle, parentForTrashId, fileTitle)).entry.id;
file4TrashId = (await apis.user.nodes.createFile(fileWithTitleAndDesc, parentForTrashId, fileTitle, fileDescription)).entry.id;
file5TrashId = (await apis.user.nodes.createFile(fileNameEqTitleEqDesc, parentForTrashId, fileNameEqTitleEqDesc, fileNameEqTitleEqDesc)).entry.id;
file6TrashId = (await apis.user.nodes.createFile(fileNameEqTitleDiffDesc, parentForTrashId, fileNameEqTitleDiffDesc, fileDescription)).entry.id;
file7TrashId = (await apis.user.nodes.createFile(fileNameEqDescDiffTitle, parentForTrashId, fileTitle, fileNameEqDescDiffTitle)).entry.id;
file8TrashId = (await apis.user.nodes.createFile(fileTitleEqDesc, parentForTrashId, fileTitle, fileTitle)).entry.id;
await apis.user.nodes.deleteNodesById([
file1TrashId, file2TrashId, file3TrashId, file4TrashId, file5TrashId, file6TrashId, file7TrashId, file8TrashId
], false);
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
await dataTable.waitForHeader();
done();
});
afterAll(async (done) => {
await apis.user.nodes.deleteNodes([ parentForTrash ]);
await apis.user.trashcan.emptyTrash();
done();
});
it('File with name, no title, no description - [C280159]', async () => {
expect(await dataTable.getItemNameTooltip(file)).toEqual(`${file}`);
});
it('File with name and description, no title - [C280160]', async () => {
expect(await dataTable.getItemNameTooltip(fileWithDesc)).toEqual(`${fileWithDesc}\n${fileDescription}`);
});
it('File with name and title, no description - [C280161]', async () => {
expect(await dataTable.getItemNameTooltip(fileWithTitle)).toEqual(`${fileWithTitle}\n${fileTitle}`);
});
it('File with name and title and description, all different - [C280162]', async () => {
expect(await dataTable.getItemNameTooltip(fileWithTitleAndDesc)).toEqual(`${fileTitle}\n${fileDescription}`);
});
it('File with name and title and description, all equal - [C280163]', async () => {
expect(await dataTable.getItemNameTooltip(fileNameEqTitleEqDesc)).toEqual(`${fileNameEqTitleEqDesc}`);
});
it('File with name = title, different description - [C280164]', async () => {
expect(await dataTable.getItemNameTooltip(fileNameEqTitleDiffDesc)).toEqual(`${fileNameEqTitleDiffDesc}\n${fileDescription}`);
});
it('File with name = description, different title - [C280165]', async () => {
expect(await dataTable.getItemNameTooltip(fileNameEqDescDiffTitle)).toEqual(`${fileTitle}\n${fileNameEqDescDiffTitle}`);
});
it('File with title = description, different name - [C280166]', async () => {
expect(await dataTable.getItemNameTooltip(fileTitleEqDesc)).toEqual(`${fileTitle}`);
});
});
});

@ -23,180 +23,183 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { SITE_VISIBILITY, SITE_ROLES, SIDEBAR_LABELS } from '../../configs';
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
import { Utils } from '../../utilities/utils';
import { RepoClient } from '../../utilities/repo-client/repo-client';
describe('Trash', () => {
const username = `user-${Utils.random()}`;
const username = `user-${Utils.random()}`;
const siteName = `site-${Utils.random()}`;
const fileSite = `file-${Utils.random()}.txt`; let fileSiteId;
const siteName = `site-${Utils.random()}`;
const fileSite = `file-${Utils.random()}.txt`; let fileSiteId;
const folderAdmin = `folder-${Utils.random()}`; let folderAdminId;
const fileAdmin = `file-${Utils.random()}.txt`; let fileAdminId;
const folderAdmin = `folder-${Utils.random()}`; let folderAdminId;
const fileAdmin = `file-${Utils.random()}.txt`; let fileAdminId;
const folderUser = `folder-${Utils.random()}`; let folderUserId;
const fileUser = `file-${Utils.random()}.txt`; let fileUserId;
const folderUser = `folder-${Utils.random()}`; let folderUserId;
const fileUser = `file-${Utils.random()}.txt`; let fileUserId;
const folderDeleted = `folder-${Utils.random()}`; let folderDeletedId;
const fileDeleted = `file-${Utils.random()}.txt`; let fileDeletedId;
const folderDeleted = `folder-${Utils.random()}`; let folderDeletedId;
const fileDeleted = `file-${Utils.random()}.txt`; let fileDeletedId;
const folderNotDeleted = `folder-${Utils.random()}`; let folderNotDeletedId;
const fileInFolder = `file-${Utils.random()}.txt`; let fileInFolderId;
const folderNotDeleted = `folder-${Utils.random()}`; let folderNotDeletedId;
const fileInFolder = `file-${Utils.random()}.txt`; let fileInFolderId;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const trashPage = new BrowsingPage();
const { dataTable, breadcrumb } = trashPage;
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const trashPage = new BrowsingPage();
const { dataTable, breadcrumb } = trashPage;
beforeAll(done => {
apis.admin.people.createUser({ username })
.then(() => apis.admin.nodes.createFiles([ fileAdmin ]).then(resp => fileAdminId = resp.entry.id))
.then(() => apis.admin.nodes.createFolders([ folderAdmin ]).then(resp => folderAdminId = resp.entry.id))
.then(() => apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC))
.then(() => apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_MANAGER))
.then(() => apis.admin.nodes.createFiles([ fileSite ], `Sites/${siteName}/documentLibrary`)
.then(resp => fileSiteId = resp.entry.id))
.then(() => apis.user.nodes.createFiles([ fileUser ]).then(resp => fileUserId = resp.entry.id))
.then(() => apis.user.nodes.createFolders([ folderUser ]).then(resp => folderUserId = resp.entry.id))
.then(() => apis.user.nodes.createFolder(folderDeleted).then(resp => folderDeletedId = resp.entry.id))
.then(() => apis.user.nodes.createFiles([ fileDeleted ], folderDeleted).then(resp => fileDeletedId = resp.entry.id))
.then(() => apis.user.nodes.createFolder(folderNotDeleted).then(resp => folderNotDeletedId = resp.entry.id))
.then(() => apis.user.nodes.createFiles([ fileInFolder ], folderNotDeleted).then(resp => fileInFolderId = resp.entry.id))
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
fileAdminId = (await apis.admin.nodes.createFiles([ fileAdmin ])).entry.id;
folderAdminId = (await apis.admin.nodes.createFolders([ folderAdmin ])).entry.id;
await apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC);
await apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_MANAGER);
const docLibId = await apis.admin.sites.getDocLibId(siteName);
fileSiteId = (await apis.admin.nodes.createFile(fileSite, docLibId)).entry.id;
fileUserId = (await apis.user.nodes.createFiles([ fileUser ])).entry.id;
folderUserId = (await apis.user.nodes.createFolders([ folderUser ])).entry.id;
folderDeletedId = (await apis.user.nodes.createFolder(folderDeleted)).entry.id;
fileDeletedId = (await apis.user.nodes.createFiles([ fileDeleted ], folderDeleted)).entry.id;
folderNotDeletedId = (await apis.user.nodes.createFolder(folderNotDeleted)).entry.id;
fileInFolderId = (await apis.user.nodes.createFiles([ fileInFolder ], folderNotDeleted)).entry.id;
.then(() => apis.admin.nodes.deleteNodesById([ fileAdminId, folderAdminId ], false))
.then(() => apis.user.nodes.deleteNodesById([ fileSiteId, fileUserId, folderUserId, fileInFolderId ], false))
.then(() => apis.user.nodes.deleteNodeById(fileDeletedId, false))
.then(() => apis.user.nodes.deleteNodeById(folderDeletedId, false))
await apis.admin.nodes.deleteNodesById([ fileAdminId, folderAdminId ], false);
await apis.user.nodes.deleteNodesById([ fileSiteId, fileUserId, folderUserId, fileInFolderId ], false);
await apis.user.nodes.deleteNodeById(fileDeletedId, false);
await apis.user.nodes.deleteNodeById(folderDeletedId, false);
.then(done);
done();
});
afterAll(async (done) => {
await Promise.all([
apis.admin.sites.deleteSite(siteName),
apis.user.nodes.deleteNodeById(folderNotDeletedId),
apis.admin.trashcan.emptyTrash()
]);
done();
});
xit('');
describe('as admin', () => {
beforeAll(async (done) => {
await loginPage.loginWithAdmin();
done();
});
afterAll(done => {
Promise.all([
apis.admin.sites.deleteSite(siteName),
apis.user.nodes.deleteNodeById(folderNotDeletedId),
apis.admin.trashcan.emptyTrash()
])
.then(done);
beforeEach(async (done) => {
await trashPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
await dataTable.waitForHeader();
done();
});
xit('');
describe('as admin', () => {
beforeAll(done => {
loginPage.loginWithAdmin().then(done);
});
beforeEach(done => {
trashPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)
.then(() => dataTable.waitForHeader())
.then(done);
});
afterAll(done => {
logoutPage.load().then(done);
});
it('has the correct columns - [C213217]', () => {
const labels = [ 'Name', 'Location', 'Size', 'Deleted', 'Deleted by' ];
const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label));
expect(dataTable.getColumnHeaders().count()).toBe(5 + 1, 'Incorrect number of columns');
elements.forEach((element, index) => {
expect(element.isPresent()).toBe(true, `"${labels[index]}" is missing`);
});
});
it('displays the files and folders deleted by everyone - [C280493]', () => {
expect(dataTable.countRows()).toEqual(8, 'Incorrect number of deleted items displayed');
expect(dataTable.getRowByName(fileAdmin).isPresent()).toBe(true, `${fileAdmin} not displayed`);
expect(dataTable.getRowByName(folderAdmin).isPresent()).toBe(true, `${folderAdmin} not displayed`);
expect(dataTable.getRowByName(fileUser).isPresent()).toBe(true, `${fileUser} not displayed`);
expect(dataTable.getRowByName(folderUser).isPresent()).toBe(true, `${folderUser} not displayed`);
expect(dataTable.getRowByName(fileSite).isPresent()).toBe(true, `${fileSite} not displayed`);
});
afterAll(async (done) => {
await logoutPage.load();
done();
});
describe('as user', () => {
beforeAll(done => {
loginPage.loginWith(username).then(done);
});
it('has the correct columns - [C213217]', async () => {
const labels = [ 'Name', 'Location', 'Size', 'Deleted', 'Deleted by' ];
const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label));
beforeEach(done => {
trashPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)
.then(() => dataTable.waitForHeader())
.then(done);
});
expect(await dataTable.getColumnHeaders().count()).toBe(5 + 1, 'Incorrect number of columns');
afterAll(done => {
logoutPage.load().then(done);
});
it('has the correct columns - [C280494]', () => {
const labels = [ 'Name', 'Location', 'Size', 'Deleted'];
const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label));
expect(dataTable.getColumnHeaders().count()).toBe(4 + 1, 'Incorrect number of columns');
elements.forEach((element, index) => {
expect(element.isPresent()).toBe(true, `"${labels[index]}" is missing`);
});
});
it('displays the files and folders deleted by the user - [C213218]', () => {
expect(dataTable.countRows()).toEqual(6, 'Incorrect number of deleted items displayed');
expect(dataTable.getRowByName(fileSite).isPresent()).toBe(true, `${fileSite} not displayed`);
expect(dataTable.getRowByName(fileUser).isPresent()).toBe(true, `${fileUser} not displayed`);
expect(dataTable.getRowByName(folderUser).isPresent()).toBe(true, `${folderUser} not displayed`);
expect(dataTable.getRowByName(fileAdmin).isPresent()).toBe(false, `${fileAdmin} is displayed`);
});
it('default sorting column - [C213219]', () => {
expect(dataTable.getSortedColumnHeader().getText()).toBe('Deleted');
expect(dataTable.getSortingOrder()).toBe('desc');
});
it('Location column displays the parent folder of the file - [C280498]', () => {
expect(dataTable.getItemLocation(fileInFolder).getText()).toEqual(folderNotDeleted);
expect(dataTable.getItemLocation(fileUser).getText()).toEqual('Personal Files');
expect(dataTable.getItemLocation(fileSite).getText()).toEqual(siteName);
});
it('Location column displays a tooltip with the entire path of the file - [C280499]', () => {
expect(dataTable.getItemLocationTileAttr(fileInFolder)).toEqual(`Personal Files/${folderNotDeleted}`);
expect(dataTable.getItemLocationTileAttr(fileUser)).toEqual('Personal Files');
expect(dataTable.getItemLocationTileAttr(fileSite)).toEqual(`File Libraries/${siteName}`);
});
it('Location column is empty if parent folder no longer exists - [C280500]', () => {
expect(dataTable.getItemLocation(fileDeleted).getText()).toEqual('');
});
it('Location column redirect - file in user Home - [C217144]', () => {
dataTable.clickItemLocation(fileUser)
.then(() => expect(breadcrumb.getAllItems()).toEqual([ 'Personal Files' ]));
});
it('Location column redirect - file in folder - [C280496]', () => {
dataTable.clickItemLocation(fileInFolder)
.then(() => expect(breadcrumb.getAllItems()).toEqual([ 'Personal Files', folderNotDeleted ]));
});
it('Location column redirect - file in site - [C280497]', () => {
dataTable.clickItemLocation(fileSite)
.then(() => expect(breadcrumb.getAllItems()).toEqual([ 'File Libraries', siteName ]));
});
await elements.forEach(async (element, index) => {
expect(await element.isPresent()).toBe(true, `"${labels[index]}" is missing`);
});
});
it('displays the files and folders deleted by everyone - [C280493]', async () => {
expect(await dataTable.countRows()).toEqual(8, 'Incorrect number of deleted items displayed');
expect(await dataTable.getRowByName(fileAdmin).isPresent()).toBe(true, `${fileAdmin} not displayed`);
expect(await dataTable.getRowByName(folderAdmin).isPresent()).toBe(true, `${folderAdmin} not displayed`);
expect(await dataTable.getRowByName(fileUser).isPresent()).toBe(true, `${fileUser} not displayed`);
expect(await dataTable.getRowByName(folderUser).isPresent()).toBe(true, `${folderUser} not displayed`);
expect(await dataTable.getRowByName(fileSite).isPresent()).toBe(true, `${fileSite} not displayed`);
});
});
describe('as user', () => {
beforeAll(async (done) => {
await loginPage.loginWith(username);
done();
});
beforeEach(async (done) => {
await trashPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
await dataTable.waitForHeader();
done();
});
afterAll(async (done) => {
await logoutPage.load();
done();
});
it('has the correct columns - [C280494]', async () => {
const labels = [ 'Name', 'Location', 'Size', 'Deleted'];
const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label));
expect(await dataTable.getColumnHeaders().count()).toBe(4 + 1, 'Incorrect number of columns');
await elements.forEach(async (element, index) => {
expect(await element.isPresent()).toBe(true, `"${labels[index]}" is missing`);
});
});
it('displays the files and folders deleted by the user - [C213218]', async () => {
expect(await dataTable.countRows()).toEqual(6, 'Incorrect number of deleted items displayed');
expect(await dataTable.getRowByName(fileSite).isPresent()).toBe(true, `${fileSite} not displayed`);
expect(await dataTable.getRowByName(fileUser).isPresent()).toBe(true, `${fileUser} not displayed`);
expect(await dataTable.getRowByName(folderUser).isPresent()).toBe(true, `${folderUser} not displayed`);
expect(await dataTable.getRowByName(fileAdmin).isPresent()).toBe(false, `${fileAdmin} is displayed`);
});
it('default sorting column - [C213219]', async () => {
expect(await dataTable.getSortedColumnHeader().getText()).toBe('Deleted');
expect(await dataTable.getSortingOrder()).toBe('desc');
});
it('Location column displays the parent folder of the file - [C280498]', async () => {
expect(await dataTable.getItemLocation(fileInFolder).getText()).toEqual(folderNotDeleted);
expect(await dataTable.getItemLocation(fileUser).getText()).toEqual('Personal Files');
expect(await dataTable.getItemLocation(fileSite).getText()).toEqual(siteName);
});
it('Location column displays a tooltip with the entire path of the file - [C280499]', async () => {
expect(await dataTable.getItemLocationTileAttr(fileInFolder)).toEqual(`Personal Files/${folderNotDeleted}`);
expect(await dataTable.getItemLocationTileAttr(fileUser)).toEqual('Personal Files');
expect(await dataTable.getItemLocationTileAttr(fileSite)).toEqual(`File Libraries/${siteName}`);
});
it('Location column is empty if parent folder no longer exists - [C280500]', async () => {
expect(await dataTable.getItemLocation(fileDeleted).getText()).toEqual('');
});
it('Location column redirect - file in user Home - [C217144]', async () => {
await dataTable.clickItemLocation(fileUser);
expect(await breadcrumb.getAllItems()).toEqual([ 'Personal Files' ]);
});
it('Location column redirect - file in folder - [C280496]', async () => {
await dataTable.clickItemLocation(fileInFolder);
expect(await breadcrumb.getAllItems()).toEqual([ 'Personal Files', folderNotDeleted ]);
});
it('Location column redirect - file in site - [C280497]', async () => {
await dataTable.clickItemLocation(fileSite);
expect(await breadcrumb.getAllItems()).toEqual([ 'File Libraries', siteName ]);
});
});
});