[ACA-1628] async await (#693)

* async / await on login component and utils

* more async / awaits

* remove fdescribe

* expect for exact totalItems in waitForApi methods
other async / awaits

* pagination tests

* more tries

* disable selenium promise manager

* try to fix shared-links tests

* re-enable selenium_promise_manager and some more fixes

* add target es2017 to e2e

* set target to es2017 on tsconfig.spec.json

* other tries

* forgotten console.log

* disable pagination tests

* some fixes for pagination

* temporary fix viewer actions tests

* fix some actions tests

* fix some tests for actions

* fix some tests for undo action

* try to fix some more tests

* fixes for toolbar actions

* fix NoSuchElementError for openMoreMenu

* fix NoSuchElementError for rightClickOnMultipleSelection

* fixes for mark as favourite

* more fixes

* more fixes

* change order of some expects

* forgot describe
This commit is contained in:
Adina Parpalita
2018-10-08 11:21:02 +03:00
committed by Denys Vuika
parent 0d4795bfa8
commit 7d73ae309c
53 changed files with 1553 additions and 1662 deletions

View File

@@ -33,9 +33,9 @@ describe('Shared Files', () => {
const password = username;
const siteName = `site-${Utils.random()}`;
const fileAdmin = `file-${Utils.random()}.txt`;
const fileAdmin = `fileSite-${Utils.random()}.txt`;
const folderUser = `folder-${Utils.random()}`;
const folderUser = `folder-${Utils.random()}`; let folderId;
const file1User = `file1-${Utils.random()}.txt`; let file1Id;
const file2User = `file2-${Utils.random()}.txt`; let file2Id;
const file3User = `file3-${Utils.random()}.txt`; let file3Id;
@@ -59,16 +59,17 @@ describe('Shared Files', () => {
const nodeId = (await apis.admin.nodes.createFile(fileAdmin, docLibId)).entry.id;
await apis.admin.shared.shareFileById(nodeId);
const folderId = (await apis.user.nodes.createFolder(folderUser)).entry.id;
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]);
await apis.user.shared.waitForApi({ expect: 5 });
await apis.admin.shared.waitForApi({ expect: 5 });
await apis.user.nodes.deleteNodeById(file2Id);
await apis.user.shared.unshareFile(file3User);
await apis.admin.shared.waitForApi({ expect: 3 });
await loginPage.loginWith(username);
done();
@@ -80,33 +81,25 @@ describe('Shared Files', () => {
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()
]);
await apis.admin.sites.deleteSite(siteName);
await apis.user.nodes.deleteNodeById(folderId);
await apis.user.nodes.deleteNodeById(file4Id);
await 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));
const expectedHeader = [ 'Thumbnail', 'Name', 'Location', 'Size', 'Modified', 'Modified by', 'Shared by' ];
const headers = dataTable.getColumnHeaders();
const count = await headers.count();
expect(count).toBe(6 + 1, 'Incorrect number of columns');
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`);
});
expect(await dataTable.getHeaderText()).toEqual(expectedHeader);
});
it('default sorting column - [C213115]', async () => {
expect(await dataTable.getSortedColumnHeader().getText()).toBe('Modified');
expect(await dataTable.getSortedColumnHeaderText()).toBe('Modified');
expect(await dataTable.getSortingOrder()).toBe('desc');
});
@@ -119,17 +112,14 @@ describe('Shared Files', () => {
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
xit('unshared file is not displayed - [C213118]', async (done) => {
await apis.user.shared.waitForApi({ expect: 4 });
it('unshared file is not displayed - [C213118]', async () => {
expect(await dataTable.getRowByName(file3User).isPresent()).toBe(false, `${file3User} is displayed`);
done();
});
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);
expect(await dataTable.getItemLocation(fileAdmin)).toEqual(siteName);
expect(await dataTable.getItemLocation(file1User)).toEqual(folderUser);
});
it('Location column redirect - file in user Home - [C213666]', async () => {