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

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

View File

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

View File

@ -30,7 +30,6 @@ import { RepoClient } from '../../utilities/repo-client/repo-client';
describe('Favorites', () => { describe('Favorites', () => {
const username = `user-${Utils.random()}`; const username = `user-${Utils.random()}`;
const password = username;
const siteName = `site-${Utils.random()}`; const siteName = `site-${Utils.random()}`;
const favFolderName = `favFolder-${Utils.random()}`; const favFolderName = `favFolder-${Utils.random()}`;
@ -42,7 +41,7 @@ describe('Favorites', () => {
const apis = { const apis = {
admin: new RepoClient(), admin: new RepoClient(),
user: new RepoClient(username, password) user: new RepoClient(username, username)
}; };
const loginPage = new LoginPage(); const loginPage = new LoginPage();
@ -58,22 +57,20 @@ describe('Favorites', () => {
await apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_MANAGER); await apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_MANAGER);
const file1Id = (await apis.admin.nodes.createFile(fileName1, docLibId)).entry.id; const file1Id = (await apis.admin.nodes.createFile(fileName1, docLibId)).entry.id;
await apis.user.favorites.addFavoriteById('file', file1Id);
const folderId = (await apis.user.nodes.createFolder(favFolderName)).entry.id; const folderId = (await apis.user.nodes.createFolder(favFolderName)).entry.id;
await apis.user.favorites.addFavoriteById('folder', folderId);
const parentId = (await apis.user.nodes.createFolder(parentFolder)).entry.id; const parentId = (await apis.user.nodes.createFolder(parentFolder)).entry.id;
const file2Id = (await apis.user.nodes.createFile(fileName2, parentId)).entry.id; const file2Id = (await apis.user.nodes.createFile(fileName2, parentId)).entry.id;
await apis.user.favorites.addFavoriteById('file', file2Id);
const file3Id = (await apis.user.nodes.createFile(fileName3, parentId)).entry.id; 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);
const file4Id = (await apis.user.nodes.createFile(fileName4, parentId)).entry.id; const file4Id = (await apis.user.nodes.createFile(fileName4, parentId)).entry.id;
await apis.user.favorites.addFavoriteById('file', file4Id);
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.nodes.deleteNodeById(file4Id, false);
await apis.user.trashcan.restore(file4Id); await apis.user.trashcan.restore(file4Id);
@ -130,9 +127,9 @@ describe('Favorites', () => {
}); });
it('Location column displays a tooltip with the entire path of the file - [C213671]', async () => { it('Location column displays a tooltip with the entire path of the file - [C213671]', async () => {
expect(dataTable.getItemLocationTileAttr(fileName1)).toEqual(`File Libraries/${siteName}`); expect(await dataTable.getItemLocationTileAttr(fileName1)).toEqual(`File Libraries/${siteName}`);
expect(dataTable.getItemLocationTileAttr(fileName2)).toEqual(`Personal Files/${parentFolder}`); expect(await dataTable.getItemLocationTileAttr(fileName2)).toEqual(`Personal Files/${parentFolder}`);
expect(dataTable.getItemLocationTileAttr(favFolderName)).toEqual('Personal Files'); expect(await dataTable.getItemLocationTileAttr(favFolderName)).toEqual('Personal Files');
}); });
it('Location column redirect - item in user Home - [C213650]', async () => { it('Location column redirect - item in user Home - [C213650]', async () => {

View File

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

View File

@ -77,15 +77,15 @@ describe('Generic errors', () => {
await apis.user.nodes.deleteNodeById(file1Id, false); await apis.user.nodes.deleteNodeById(file1Id, false);
await browser.get(URL); await browser.get(URL);
expect(page.isGenericErrorDisplayed()).toBe(true, 'Generic error page not displayed'); expect(await 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.getGenericErrorTitle()).toContain(`This file or folder no longer exists or you don't have permission to view it.`);
}); });
it('Invalid URL - [C217315]', async () => { it('Invalid URL - [C217315]', async () => {
await page.load('invalid page'); await page.load('invalid page');
expect(page.isGenericErrorDisplayed()).toBe(true, 'Generic error page not displayed'); expect(await 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.getGenericErrorTitle()).toContain(`This file or folder no longer exists or you don't have permission to view it.`);
}); });
@ -99,8 +99,8 @@ describe('Generic errors', () => {
await loginPage.loginWith(username2); await loginPage.loginWith(username2);
await browser.get(URL); await browser.get(URL);
expect(page.isGenericErrorDisplayed()).toBe(true, 'Generic error page not displayed'); expect(await 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.getGenericErrorTitle()).toContain(`This file or folder no longer exists or you don't have permission to view it.`);
await logoutPage.load(); await logoutPage.load();
await loginPage.loginWith(username); await loginPage.loginWith(username);

View File

@ -46,8 +46,9 @@ describe('Special permissions', () => {
xit(''); xit('');
beforeAll(done => { beforeAll(async (done) => {
apis.admin.people.createUser({ username }).then(done); await apis.admin.people.createUser({ username });
done();
}); });
describe('file not displayed if user no longer has permissions on it', () => { describe('file not displayed if user no longer has permissions on it', () => {
@ -55,71 +56,60 @@ describe('Special permissions', () => {
const fileName = `file-${Utils.random()}.txt`; const fileName = `file-${Utils.random()}.txt`;
let fileId; let fileId;
beforeAll(done => { beforeAll(async (done) => {
apis.admin.sites.createSite(sitePrivate, SITE_VISIBILITY.PRIVATE) await apis.admin.sites.createSite(sitePrivate, SITE_VISIBILITY.PRIVATE);
.then(() => apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_COLLABORATOR)) await apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_COLLABORATOR);
.then(() => apis.admin.nodes.createFiles([ fileName ], `Sites/${sitePrivate}/documentLibrary`) const docLibId = await apis.admin.sites.getDocLibId(sitePrivate);
.then(resp => fileId = resp.entry.id)) fileId = (await apis.admin.nodes.createFile(fileName, docLibId)).entry.id;
.then(() => apis.user.favorites.addFavoriteById('file', fileId)) await apis.user.favorites.addFavoriteById('file', fileId);
.then(() => apis.admin.shared.shareFileById(fileId)) await apis.admin.shared.shareFileById(fileId);
.then(() => apis.user.nodes.editNodeContent(fileId, 'edited by user')) await apis.user.nodes.editNodeContent(fileId, 'edited by user');
.then(() => apis.user.search.waitForApi(username, { expect: 1 })) await apis.user.search.waitForApi(username, { expect: 1 });
.then(() => apis.user.shared.waitForApi({ expect: 1 })) await apis.user.shared.waitForApi({ expect: 1 });
.then(() => loginPage.loginWith(username)) await loginPage.loginWith(username);
.then(done); done();
}); });
afterEach(done => { afterEach(async (done) => {
apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_COLLABORATOR).then(done); await apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_COLLABORATOR);
done();
}); });
afterAll(done => { afterAll(async (done) => {
Promise.all([ await Promise.all([
apis.admin.sites.deleteSite(sitePrivate), apis.admin.sites.deleteSite(sitePrivate),
logoutPage.load() logoutPage.load()
]) ]);
.then(done); done();
}); });
it('on Recent Files - [C213173]', () => { it('on Recent Files - [C213173]', async () => {
recentFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES) await recentFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES);
.then(() => dataTable.waitForHeader()) await dataTable.waitForHeader();
.then(() => { expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items');
expect(dataTable.countRows()).toBe(1, 'Incorrect number of items'); await apis.admin.sites.deleteSiteMember(sitePrivate, username);
}) await recentFilesPage.refresh();
.then(() => apis.admin.sites.deleteSiteMember(sitePrivate, username)) expect(await dataTable.countRows()).toBe(0, 'Incorrect number of items');
.then(() => recentFilesPage.refresh())
.then(() => {
expect(dataTable.countRows()).toBe(0, 'Incorrect number of items');
});
}); });
it('on Favorites - [C213227]', () => { it('on Favorites - [C213227]', async () => {
favoritesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES) await favoritesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
.then(() => dataTable.waitForHeader()) await dataTable.waitForHeader();
.then(() => { expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items');
expect(dataTable.countRows()).toBe(1, 'Incorrect number of items'); await apis.admin.sites.deleteSiteMember(sitePrivate, username);
}) await favoritesPage.refresh();
.then(() => apis.admin.sites.deleteSiteMember(sitePrivate, username)) expect(await dataTable.countRows()).toBe(0, 'Incorrect number of items');
.then(() => favoritesPage.refresh())
.then(() => {
expect(dataTable.countRows()).toBe(0, 'Incorrect number of items');
});
}); });
it('on Shared Files - [C213116]', () => { it('on Shared Files - [C213116]', async () => {
sharedPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES) await sharedPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
.then(() => dataTable.waitForHeader()) await dataTable.waitForHeader();
.then(() => { expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items');
expect(dataTable.countRows()).toBe(1, 'Incorrect number of items'); await apis.admin.sites.deleteSiteMember(sitePrivate, username);
}) await sharedPage.refresh();
.then(() => apis.admin.sites.deleteSiteMember(sitePrivate, username)) expect(await dataTable.countRows()).toBe(0, 'Incorrect number of items');
.then(() => sharedPage.refresh())
.then(() => {
expect(dataTable.countRows()).toBe(0, 'Incorrect number of items');
});
}); });
}); });
@ -128,54 +118,47 @@ describe('Special permissions', () => {
const fileName = `file-${Utils.random()}.txt`; const fileName = `file-${Utils.random()}.txt`;
let fileId; let fileId;
beforeAll(done => { beforeAll(async (done) => {
apis.admin.sites.createSite(sitePrivate, SITE_VISIBILITY.PRIVATE) await apis.admin.sites.createSite(sitePrivate, SITE_VISIBILITY.PRIVATE);
.then(() => apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_COLLABORATOR)) await apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_COLLABORATOR);
.then(() => apis.admin.sites.getDocLibId(sitePrivate)) const docLibId = await apis.admin.sites.getDocLibId(sitePrivate);
.then(resp => apis.user.nodes.createFile(fileName, resp)) fileId = (await apis.user.nodes.createFile(fileName, docLibId)).entry.id;
.then(resp => fileId = resp.entry.id) await apis.user.favorites.addFavoriteById('file', fileId);
.then(() => apis.user.favorites.addFavoriteById('file', fileId)) await apis.user.shared.shareFileById(fileId);
.then(() => apis.user.shared.shareFileById(fileId)) await apis.user.shared.waitForApi({ expect: 1 });
.then(() => apis.user.shared.waitForApi({ expect: 1 })) await apis.user.search.waitForApi(username, { expect: 1 });
.then(() => apis.user.search.waitForApi(username, { expect: 1 })) await apis.admin.sites.deleteSiteMember(sitePrivate, username);
.then(() => apis.admin.sites.deleteSiteMember(sitePrivate, username)) await loginPage.loginWith(username);
.then(() => loginPage.loginWith(username)) done();
.then(done);
}); });
afterAll(done => { afterAll(async (done) => {
Promise.all([ await Promise.all([
apis.admin.sites.deleteSite(sitePrivate), apis.admin.sites.deleteSite(sitePrivate),
logoutPage.load() logoutPage.load()
]) ]);
.then(done); done();
}); });
it(`on Recent Files - [C213178]`, () => { it(`on Recent Files - [C213178]`, async () => {
recentFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES) await recentFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES);
.then(() => dataTable.waitForHeader()) await dataTable.waitForHeader();
.then(() => { expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items');
expect(dataTable.countRows()).toBe(1, 'Incorrect number of items'); expect(await dataTable.getItemLocation(fileName).getText()).toEqual('');
expect(dataTable.getItemLocation(fileName).getText()).toEqual('');
});
}); });
it(`on Favorites - [C213672]`, () => { it(`on Favorites - [C213672]`, async () => {
favoritesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES) await favoritesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
.then(() => dataTable.waitForHeader()) await dataTable.waitForHeader();
.then(() => { expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items');
expect(dataTable.countRows()).toBe(1, 'Incorrect number of items'); expect(await dataTable.getItemLocation(fileName).getText()).toEqual('');
expect(dataTable.getItemLocation(fileName).getText()).toEqual('');
});
}); });
it(`on Shared Files - [C213668]`, () => { it(`on Shared Files - [C213668]`, async () => {
sharedPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES) await sharedPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
.then(() => dataTable.waitForHeader()) await dataTable.waitForHeader();
.then(() => { expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items');
expect(dataTable.countRows()).toBe(1, 'Incorrect number of items'); expect(await dataTable.getItemLocation(fileName).getText()).toEqual('');
expect(dataTable.getItemLocation(fileName).getText()).toEqual('');
});
}); });
}); });
}); });

View File

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

View File

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

View File

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

View File

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

View File

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