[ACA-4288] Fix API errors from logs (#2006)

* Add API login in afterAll - part 1

* viewer,infoDrawer,extensions - afterAll API login

* deleteActions - afterAll API login

* Improve before and after methods

* add Promise type to methods - part1

* remove unneeded done() method and add try-catch

* delete wrong import

* Login through API

* small change over log errors

* small improvement over the logs
This commit is contained in:
Iulia Burcă
2021-04-16 17:57:50 +03:00
committed by GitHub
parent 9427c0fc7d
commit d17744bfd9
49 changed files with 844 additions and 719 deletions

View File

@@ -49,9 +49,7 @@ describe('Folders - available actions : ', () => {
const searchResultsPage = new SearchResultsPage();
beforeAll(async () => {
await adminApiActions.login();
await adminApiActions.createUser({ username });
await userActions.login(username, username);
parentId = (await userApi.nodes.createFolder(parentName)).entry.id;
@@ -71,6 +69,7 @@ describe('Folders - available actions : ', () => {
});
afterAll(async () => {
await userActions.login(username, username);
await userActions.deleteNodes([parentId]);
await userActions.emptyTrashcan();
});

View File

@@ -50,9 +50,7 @@ describe('Locked Files - available actions : ', () => {
const searchResultsPage = new SearchResultsPage();
beforeAll(async () => {
await adminApiActions.login();
await adminApiActions.createUser({ username });
await userActions.login(username, username);
parentId = (await userApi.nodes.createFolder(parentName)).entry.id;
@@ -78,6 +76,7 @@ describe('Locked Files - available actions : ', () => {
});
afterAll(async () => {
await userActions.login(username, username);
await userActions.deleteNodes([parentId]);
await userActions.emptyTrashcan();
});

View File

@@ -57,9 +57,7 @@ describe('Multiple Files - available actions : ', () => {
const searchResultsPage = new SearchResultsPage();
beforeAll(async () => {
await adminApiActions.login();
await adminApiActions.createUser({ username });
await userActions.login(username, username);
parentId = (await userApi.nodes.createFolder(parentName)).entry.id;
@@ -84,6 +82,7 @@ describe('Multiple Files - available actions : ', () => {
});
afterAll(async () => {
await userActions.login(username, username);
await userActions.unlockNodes([file1LockedFavId, file2LockedFavId, file3LockedId]);
await userActions.deleteNodes([parentId]);
});

View File

@@ -49,9 +49,7 @@ describe('Office Files - available actions : ', () => {
const searchResultsPage = new SearchResultsPage();
beforeAll(async () => {
await adminApiActions.login();
await adminApiActions.createUser({ username });
await userActions.login(username, username);
parentId = (await userApi.nodes.createFolder(parentName)).entry.id;
@@ -71,6 +69,7 @@ describe('Office Files - available actions : ', () => {
});
afterAll(async () => {
await userActions.login(username, username);
await userActions.deleteNodes([parentId]);
await userActions.emptyTrashcan();
});

View File

@@ -26,6 +26,7 @@
import { RepoClient, Utils, AdminActions, UserActions, LoginPage, BrowsingPage, SearchResultsPage } from '@alfresco/aca-testing-shared';
import * as testData from './test-data';
import * as testUtil from '../test-util';
import { Logger } from '@alfresco/adf-testing';
describe('Files - available actions : ', () => {
const random = Utils.random();
@@ -48,29 +49,33 @@ describe('Files - available actions : ', () => {
const { searchInput } = page.header;
const searchResultsPage = new SearchResultsPage();
beforeAll(async () => {
await adminApiActions.login();
await adminApiActions.createUser({ username });
await userActions.login(username, username);
beforeAll(async (done) => {
try {
await adminApiActions.createUser({ username });
parentId = (await userApi.nodes.createFolder(parentName)).entry.id;
parentId = (await userApi.nodes.createFolder(parentName)).entry.id;
await userApi.nodes.createFile(testData.file.name, parentId);
fileFavId = (await userApi.nodes.createFile(testData.fileFav.name, parentId)).entry.id;
fileSharedId = (await userApi.nodes.createFile(testData.fileShared.name, parentId)).entry.id;
fileSharedFavId = (await userApi.nodes.createFile(testData.fileSharedFav.name, parentId)).entry.id;
await userApi.nodes.createFile(testData.file.name, parentId);
fileFavId = (await userApi.nodes.createFile(testData.fileFav.name, parentId)).entry.id;
fileSharedId = (await userApi.nodes.createFile(testData.fileShared.name, parentId)).entry.id;
fileSharedFavId = (await userApi.nodes.createFile(testData.fileSharedFav.name, parentId)).entry.id;
const initialFavoritesTotalItems = (await userApi.favorites.getFavoritesTotalItems()) || 0;
await userApi.favorites.addFavoritesByIds('file', [fileFavId, fileSharedFavId]);
await userApi.favorites.waitForApi({ expect: initialFavoritesTotalItems + 2 });
const initialFavoritesTotalItems = (await userApi.favorites.getFavoritesTotalItems()) || 0;
await userApi.favorites.addFavoritesByIds('file', [fileFavId, fileSharedFavId]);
await userApi.favorites.waitForApi({ expect: initialFavoritesTotalItems + 2 });
await userApi.shared.shareFilesByIds([fileSharedId, fileSharedFavId]);
await userApi.shared.waitForFilesToBeShared([fileSharedId, fileSharedFavId]);
await userApi.shared.shareFilesByIds([fileSharedId, fileSharedFavId]);
await userApi.shared.waitForFilesToBeShared([fileSharedId, fileSharedFavId]);
await loginPage.loginWith(username);
await loginPage.loginWith(username);
} catch (error) {
Logger.error(`----- beforeEach failed : ${error}`);
}
done();
});
afterAll(async () => {
await userActions.login(username, username);
await userActions.deleteNodes([parentId]);
await userActions.emptyTrashcan();
});

View File

@@ -46,15 +46,14 @@ describe('Trash - available actions : ', () => {
const loginPage = new LoginPage();
beforeAll(async () => {
await adminApiActions.login();
await adminApiActions.createUser({ username });
await userActions.login(username, username);
fileInTrashId = (await userApi.nodes.createFile(testData.fileInTrash.name)).entry.id;
file2InTrashId = (await userApi.nodes.createFile(testData.file2InTrash.name)).entry.id;
folderInTrashId = (await userApi.nodes.createFolder(testData.folderInTrash.name)).entry.id;
folder2InTrashId = (await userApi.nodes.createFolder(testData.folder2InTrash.name)).entry.id;
await userActions.login(username, username);
const initialDeletedTotalItems = await userActions.getTrashcanSize();
await userActions.deleteNodes([fileInTrashId, file2InTrashId, folderInTrashId, folder2InTrashId], false);
await userActions.waitForTrashcanSize(initialDeletedTotalItems + 4);
@@ -64,6 +63,7 @@ describe('Trash - available actions : ', () => {
});
afterAll(async () => {
await userActions.login(username, username);
await userActions.emptyTrashcan();
});

View File

@@ -38,19 +38,19 @@ describe('Library actions : ', () => {
const page = new BrowsingPage();
beforeAll(async () => {
await adminApiActions.login();
await adminApiActions.createUser({ username });
await userActions.login(username, username);
await userApi.sites.createSite(testData.siteInTrash.name);
await userApi.sites.createSite(testData.site2InTrash.name);
await userActions.login(username, username);
await userActions.deleteSites([testData.siteInTrash.name, testData.site2InTrash.name], false);
await loginPage.loginWith(username);
});
afterAll(async () => {
await userActions.login(username, username);
await userActions.emptyTrashcan();
});

View File

@@ -26,6 +26,7 @@
import { LoginPage, BrowsingPage, SearchResultsPage, RepoClient, Utils, AdminActions, UserActions } from '@alfresco/aca-testing-shared';
import * as testData from './test-data-libraries';
import * as testUtil from '../test-util';
import { Logger } from '@alfresco/adf-testing';
describe('Library actions : ', () => {
const username = `user-${Utils.random()}`;
@@ -39,36 +40,39 @@ describe('Library actions : ', () => {
const searchResultsPage = new SearchResultsPage();
const { searchInput } = searchResultsPage.header;
beforeAll(async () => {
await adminApiActions.login();
await adminApiActions.createUser({ username });
await userActions.login(username, username);
beforeAll(async (done) => {
try {
await adminApiActions.createUser({ username });
await userApi.sites.createSite(testData.publicUserMemberFav.name);
await userApi.sites.createSitePrivate(testData.privateUserMemberFav.name);
await userApi.sites.createSiteModerated(testData.moderatedUserMemberFav.name);
const publicUserMemberNotFavId = (await userApi.sites.createSite(testData.publicUserMemberNotFav.name)).entry.guid;
const privateUserMemberNotFavId = (await userApi.sites.createSitePrivate(testData.privateUserMemberNotFav.name)).entry.guid;
const moderatedUserMemberNotFavId = (await userApi.sites.createSiteModerated(testData.moderatedUserMemberNotFav.name)).entry.guid;
await userApi.sites.createSite(testData.publicUserMemberFav.name);
await userApi.sites.createSitePrivate(testData.privateUserMemberFav.name);
await userApi.sites.createSiteModerated(testData.moderatedUserMemberFav.name);
const publicUserMemberNotFavId = (await userApi.sites.createSite(testData.publicUserMemberNotFav.name)).entry.guid;
const privateUserMemberNotFavId = (await userApi.sites.createSitePrivate(testData.privateUserMemberNotFav.name)).entry.guid;
const moderatedUserMemberNotFavId = (await userApi.sites.createSiteModerated(testData.moderatedUserMemberNotFav.name)).entry.guid;
await adminApiActions.sites.createSite(testData.publicNotMemberFav.name);
await adminApiActions.sites.createSiteModerated(testData.moderatedNotMemberFav.name);
await adminApiActions.sites.createSite(testData.publicNotMemberNotFav.name);
await adminApiActions.sites.createSiteModerated(testData.moderatedNotMemberNotFav.name);
await adminApiActions.sites.createSiteModerated(testData.moderatedRequestedJoinFav.name);
await adminApiActions.sites.createSiteModerated(testData.moderatedRequestedJoinNotFav.name);
await adminApiActions.sites.createSite(testData.publicNotMemberFav.name);
await adminApiActions.sites.createSiteModerated(testData.moderatedNotMemberFav.name);
await adminApiActions.sites.createSite(testData.publicNotMemberNotFav.name);
await adminApiActions.sites.createSiteModerated(testData.moderatedNotMemberNotFav.name);
await adminApiActions.sites.createSiteModerated(testData.moderatedRequestedJoinFav.name);
await adminApiActions.sites.createSiteModerated(testData.moderatedRequestedJoinNotFav.name);
await userApi.sites.requestToJoin(testData.moderatedRequestedJoinFav.name);
await userApi.sites.requestToJoin(testData.moderatedRequestedJoinNotFav.name);
await userApi.sites.requestToJoin(testData.moderatedRequestedJoinFav.name);
await userApi.sites.requestToJoin(testData.moderatedRequestedJoinNotFav.name);
await userApi.favorites.removeFavoritesByIds([publicUserMemberNotFavId, privateUserMemberNotFavId, moderatedUserMemberNotFavId]);
await userApi.favorites.addFavoritesByIds('site', [
testData.publicNotMemberFav.name,
testData.moderatedNotMemberFav.name,
testData.moderatedRequestedJoinFav.name
]);
await userApi.favorites.removeFavoritesByIds([publicUserMemberNotFavId, privateUserMemberNotFavId, moderatedUserMemberNotFavId]);
await userApi.favorites.addFavoritesByIds('site', [
testData.publicNotMemberFav.name,
testData.moderatedNotMemberFav.name,
testData.moderatedRequestedJoinFav.name
]);
await loginPage.loginWith(username);
await loginPage.loginWith(username);
} catch (error) {
Logger.error(`----- beforeAll failed : ${error}`);
}
done();
});
afterAll(async () => {
@@ -226,10 +230,14 @@ describe('Library actions : ', () => {
describe('on Search Results', () => {
beforeEach(async () => {
await Utils.pressEscape();
await page.clickPersonalFiles();
await searchInput.clickSearchButton();
await searchInput.checkLibraries();
try {
await Utils.pressEscape();
await page.clickPersonalFiles();
await searchInput.clickSearchButton();
await searchInput.checkLibraries();
} catch (error) {
Logger.error(`----- beforeEach failed : ${error}`);
}
});
it('[C290084] Public library, user is a member, favorite', async () => {

View File

@@ -126,101 +126,105 @@ describe('Copy content', () => {
const userActions = new UserActions();
beforeAll(async (done) => {
await adminApiActions.login();
await adminApiActions.createUser({ username });
await userActions.login(username, username);
try {
await adminApiActions.createUser({ username });
const initialFavoritesTotalItems = await apis.user.favorites.getFavoritesTotalItems();
const initialFavoritesTotalItems = await apis.user.favorites.getFavoritesTotalItems();
sourceId = (await apis.user.nodes.createFolder(source)).entry.id;
destinationIdPF = (await apis.user.nodes.createFolder(destinationPF)).entry.id;
destinationIdRF = (await apis.user.nodes.createFolder(destinationRF)).entry.id;
destinationIdSF = (await apis.user.nodes.createFolder(destinationSF)).entry.id;
destinationIdFav = (await apis.user.nodes.createFolder(destinationFav)).entry.id;
destinationIdSearch = (await apis.user.nodes.createFolder(destinationSearch)).entry.id;
sourceId = (await apis.user.nodes.createFolder(source)).entry.id;
destinationIdPF = (await apis.user.nodes.createFolder(destinationPF)).entry.id;
destinationIdRF = (await apis.user.nodes.createFolder(destinationRF)).entry.id;
destinationIdSF = (await apis.user.nodes.createFolder(destinationSF)).entry.id;
destinationIdFav = (await apis.user.nodes.createFolder(destinationFav)).entry.id;
destinationIdSearch = (await apis.user.nodes.createFolder(destinationSearch)).entry.id;
existingFileToCopyId = (await apis.user.nodes.createFile(existingFile, sourceId)).entry.id;
await userActions.shareNodes([existingFileToCopyId]);
await apis.user.favorites.addFavoriteById('file', existingFileToCopyId);
existingFileToCopyId = (await apis.user.nodes.createFile(existingFile, sourceId)).entry.id;
await apis.user.nodes.createFile(existingFile, destinationIdPF);
await apis.user.nodes.createFile(existingFile, destinationIdRF);
await apis.user.nodes.createFile(existingFile, destinationIdSF);
await apis.user.nodes.createFile(existingFile, destinationIdFav);
await apis.user.nodes.createFile(existingFile, destinationIdSearch);
await userActions.login(username, username);
await userActions.shareNodes([existingFileToCopyId]);
await apis.user.favorites.addFavoriteById('file', existingFileToCopyId);
existingFolderToCopyId = (await apis.user.nodes.createFolder(existingFolder, sourceId)).entry.id;
await apis.user.nodes.createFile(existingFile, destinationIdPF);
await apis.user.nodes.createFile(existingFile, destinationIdRF);
await apis.user.nodes.createFile(existingFile, destinationIdSF);
await apis.user.nodes.createFile(existingFile, destinationIdFav);
await apis.user.nodes.createFile(existingFile, destinationIdSearch);
existingIdPF = (await apis.user.nodes.createFolder(existingFolder, destinationIdPF)).entry.id;
await apis.user.nodes.createFolder(existingFolder, destinationIdRF);
await apis.user.nodes.createFolder(existingFolder, destinationIdSF);
existingIdFav = (await apis.user.nodes.createFolder(existingFolder, destinationIdFav)).entry.id;
existingIdSearch = (await apis.user.nodes.createFolder(existingFolder, destinationIdSearch)).entry.id;
await apis.user.nodes.createFile(file2InFolder, existingFolderToCopyId);
existingFolderToCopyId = (await apis.user.nodes.createFolder(existingFolder, sourceId)).entry.id;
await apis.user.nodes.createFile(file3InFolder, existingIdPF);
await apis.user.nodes.createFile(file3InFolder, existingIdFav);
await apis.user.nodes.createFile(file3InFolder, existingIdSearch);
existingIdPF = (await apis.user.nodes.createFolder(existingFolder, destinationIdPF)).entry.id;
await apis.user.nodes.createFolder(existingFolder, destinationIdRF);
await apis.user.nodes.createFolder(existingFolder, destinationIdSF);
existingIdFav = (await apis.user.nodes.createFolder(existingFolder, destinationIdFav)).entry.id;
existingIdSearch = (await apis.user.nodes.createFolder(existingFolder, destinationIdSearch)).entry.id;
await apis.user.nodes.createFile(file2InFolder, existingFolderToCopyId);
await apis.user.favorites.addFavoriteById('folder', existingFolderToCopyId);
await apis.user.nodes.createFile(file3InFolder, existingIdPF);
await apis.user.nodes.createFile(file3InFolder, existingIdFav);
await apis.user.nodes.createFile(file3InFolder, existingIdSearch);
folder1Id = (await apis.user.nodes.createFolder(folder1, sourceId)).entry.id;
fileInFolderId = (await apis.user.nodes.createFile(fileInFolder, folder1Id)).entry.id;
await apis.user.favorites.addFavoriteById('folder', folder1Id);
await apis.user.favorites.addFavoriteById('file', fileInFolderId);
await userActions.shareNodes([fileInFolderId]);
await apis.user.favorites.addFavoriteById('folder', existingFolderToCopyId);
folderExistingId = (await apis.user.nodes.createFolder(folderExisting, sourceId)).entry.id;
await apis.user.favorites.addFavoriteById('folder', folderExistingId);
await apis.user.nodes.createFile(file1InFolderExisting, folderExistingId);
folder1Id = (await apis.user.nodes.createFolder(folder1, sourceId)).entry.id;
fileInFolderId = (await apis.user.nodes.createFile(fileInFolder, folder1Id)).entry.id;
await apis.user.favorites.addFavoriteById('folder', folder1Id);
await apis.user.favorites.addFavoriteById('file', fileInFolderId);
await userActions.shareNodes([fileInFolderId]);
folderExistingPFId = (await apis.user.nodes.createFolder(folderExisting, destinationIdPF)).entry.id;
await apis.user.nodes.createFile(file2InFolderExisting, folderExistingPFId);
folderExistingId = (await apis.user.nodes.createFolder(folderExisting, sourceId)).entry.id;
await apis.user.favorites.addFavoriteById('folder', folderExistingId);
await apis.user.nodes.createFile(file1InFolderExisting, folderExistingId);
folderExistingFavId = (await apis.user.nodes.createFolder(folderExisting, destinationIdFav)).entry.id;
await apis.user.nodes.createFile(file2InFolderExisting, folderExistingFavId);
folderExistingPFId = (await apis.user.nodes.createFolder(folderExisting, destinationIdPF)).entry.id;
await apis.user.nodes.createFile(file2InFolderExisting, folderExistingPFId);
folderExistingSearchId = (await apis.user.nodes.createFolder(folderExisting, destinationIdSearch)).entry.id;
await apis.user.nodes.createFile(file2InFolderExisting, folderExistingSearchId);
folderExistingFavId = (await apis.user.nodes.createFolder(folderExisting, destinationIdFav)).entry.id;
await apis.user.nodes.createFile(file2InFolderExisting, folderExistingFavId);
folder2Id = (await apis.user.nodes.createFolder(folder2, sourceId)).entry.id;
await apis.user.nodes.createFile(fileInFolder2, folder2Id);
await apis.user.favorites.addFavoriteById('folder', folder2Id);
folderExistingSearchId = (await apis.user.nodes.createFolder(folderExisting, destinationIdSearch)).entry.id;
await apis.user.nodes.createFile(file2InFolderExisting, folderExistingSearchId);
fileLocked1Id = (await apis.user.nodes.createFile(fileLocked1, sourceId)).entry.id;
await apis.user.nodes.lockFile(fileLocked1Id);
folder2Id = (await apis.user.nodes.createFolder(folder2, sourceId)).entry.id;
await apis.user.nodes.createFile(fileInFolder2, folder2Id);
await apis.user.favorites.addFavoriteById('folder', folder2Id);
folderWithLockedFilesId = (await apis.user.nodes.createFolder(folderWithLockedFiles, sourceId)).entry.id;
fileLockedInFolderId = (await apis.user.nodes.createFile(fileLockedInFolder, folderWithLockedFilesId)).entry.id;
await apis.user.nodes.lockFile(fileLockedInFolderId);
await apis.user.favorites.addFavoriteById('folder', folderWithLockedFilesId);
fileLocked1Id = (await apis.user.nodes.createFile(fileLocked1, sourceId)).entry.id;
await apis.user.nodes.lockFile(fileLocked1Id);
file1Id = (await apis.user.nodes.createFile(file1, sourceId)).entry.id;
file2Id = (await apis.user.nodes.createFile(file2, sourceId)).entry.id;
file3Id = (await apis.user.nodes.createFile(file3, sourceId)).entry.id;
file4Id = (await apis.user.nodes.createFile(file4, sourceId)).entry.id;
folderWithLockedFilesId = (await apis.user.nodes.createFolder(folderWithLockedFiles, sourceId)).entry.id;
fileLockedInFolderId = (await apis.user.nodes.createFile(fileLockedInFolder, folderWithLockedFilesId)).entry.id;
await apis.user.nodes.lockFile(fileLockedInFolderId);
await apis.user.favorites.addFavoriteById('folder', folderWithLockedFilesId);
await userActions.shareNodes([file1Id, file2Id, file3Id, file4Id, fileLocked1Id]);
file1Id = (await apis.user.nodes.createFile(file1, sourceId)).entry.id;
file2Id = (await apis.user.nodes.createFile(file2, sourceId)).entry.id;
file3Id = (await apis.user.nodes.createFile(file3, sourceId)).entry.id;
file4Id = (await apis.user.nodes.createFile(file4, sourceId)).entry.id;
await apis.user.favorites.addFavoriteById('file', file1Id);
await apis.user.favorites.addFavoriteById('file', file2Id);
await apis.user.favorites.addFavoriteById('file', file3Id);
await apis.user.favorites.addFavoriteById('file', file4Id);
await userActions.shareNodes([file1Id, file2Id, file3Id, file4Id, fileLocked1Id]);
await apis.user.favorites.addFavoriteById('file', fileLocked1Id);
await apis.user.favorites.addFavoriteById('file', file1Id);
await apis.user.favorites.addFavoriteById('file', file2Id);
await apis.user.favorites.addFavoriteById('file', file3Id);
await apis.user.favorites.addFavoriteById('file', file4Id);
await apis.user.sites.createSite(siteName);
const docLibId = await apis.user.sites.getDocLibId(siteName);
await apis.user.nodes.createFolder(folderSitePF, docLibId);
await apis.user.nodes.createFolder(folderSiteRF, docLibId);
await apis.user.nodes.createFolder(folderSiteSF, docLibId);
await apis.user.nodes.createFolder(folderSiteFav, docLibId);
await apis.user.nodes.createFolder(folderSiteSearch, docLibId);
await apis.user.favorites.addFavoriteById('file', fileLocked1Id);
await apis.user.shared.waitForFilesToBeShared([existingFileToCopyId, fileInFolderId, file1Id, file2Id, file3Id, file4Id, fileLocked1Id]);
await apis.user.favorites.waitForApi({ expect: initialFavoritesTotalItems + 13 });
await apis.user.sites.createSite(siteName);
const docLibId = await apis.user.sites.getDocLibId(siteName);
await apis.user.nodes.createFolder(folderSitePF, docLibId);
await apis.user.nodes.createFolder(folderSiteRF, docLibId);
await apis.user.nodes.createFolder(folderSiteSF, docLibId);
await apis.user.nodes.createFolder(folderSiteFav, docLibId);
await apis.user.nodes.createFolder(folderSiteSearch, docLibId);
await loginPage.loginWith(username);
await apis.user.shared.waitForFilesToBeShared([existingFileToCopyId, fileInFolderId, file1Id, file2Id, file3Id, file4Id, fileLocked1Id]);
await apis.user.favorites.waitForApi({ expect: initialFavoritesTotalItems + 13 });
await loginPage.loginWith(username);
} catch (error) {
Logger.error(`----- beforeAll failed : ${error}`);
}
done();
});
@@ -240,10 +244,9 @@ describe('Copy content', () => {
});
describe('from Recent Files', () => {
beforeEach(async (done) => {
beforeEach(async () => {
await Utils.pressEscape();
await page.clickRecentFilesAndWait();
done();
});
it('[C280194] Copy a file', async () => copyFile(file1, source, destinationRF));
@@ -265,11 +268,10 @@ describe('Copy content', () => {
});
describe('from Personal Files', () => {
beforeEach(async (done) => {
beforeEach(async () => {
await Utils.pressEscape();
await page.clickPersonalFilesAndWait();
await dataTable.doubleClickOnRowByName(source);
done();
});
it('[C217135] Copy a file', async () => copyFile(file1, '', destinationPF));
@@ -337,10 +339,9 @@ describe('Copy content', () => {
});
describe('from Favorites', () => {
beforeEach(async (done) => {
beforeEach(async () => {
await Utils.pressEscape();
await page.clickFavoritesAndWait();
done();
});
it('[C280218] Copy a file', async () => copyFile(file1, source, destinationFav));

View File

@@ -103,6 +103,7 @@ describe('Destination picker dialog : ', () => {
fileIdContributor = (await contributorApi.nodes.createFile(file)).entry.id;
fileIdCollaborator = (await collaboratorApi.nodes.createFile(file)).entry.id;
await adminApiActions.login();
adminFolderId = (await adminApiActions.nodes.createFolder(adminFolder)).entry.id;
await userApi.search.waitForNodes(searchFolder, { expect: 2 });
@@ -117,7 +118,6 @@ describe('Destination picker dialog : ', () => {
await contributorApi.nodes.deleteNodeById(fileIdContributor);
await collaboratorApi.nodes.deleteNodeById(fileIdCollaborator);
await adminApiActions.login();
await adminApiActions.nodes.deleteNodeById(adminFolderId);
});

View File

@@ -68,9 +68,7 @@ describe('Move content', () => {
const userActions = new UserActions();
beforeAll(async (done) => {
await adminApiActions.login();
await adminApiActions.createUser({ username });
await userActions.login(username, username);
await apis.user.sites.createSite(siteName);
const docLibId = await apis.user.sites.getDocLibId(siteName);
@@ -422,6 +420,7 @@ describe('Move content', () => {
beforeAll(async (done) => {
file1Id = (await apis.user.nodes.createFile(file1, sourceIdSF)).entry.id;
await userActions.login(username, username);
await userActions.shareNodes([file1Id]);
file2Id = (await apis.user.nodes.createFile(file2, sourceIdSF)).entry.id;

View File

@@ -34,7 +34,7 @@ import {
RepoClient,
NodeContentTree
} from '@alfresco/aca-testing-shared';
import { BrowserActions } from '@alfresco/adf-testing';
import { BrowserActions, Logger } from '@alfresco/adf-testing';
describe('Create file from template', () => {
const random = Utils.random();
@@ -111,7 +111,7 @@ describe('Create file from template', () => {
};
let link: string;
beforeAll(async () => {
beforeAll(async (done) => {
await adminApiActions.createUser({ username });
parentId = (await userApi.nodes.createFolder(parent)).entry.id;
@@ -122,12 +122,14 @@ describe('Create file from template', () => {
await userApi.nodes.createFile(duplicateFileSite, docLibUserSite);
await loginPage.loginWith(username);
done();
});
afterAll(async () => {
await userApi.nodes.deleteNodeById(parentId);
await userApi.sites.deleteSite(siteName);
await adminApiActions.login();
await adminApiActions.cleanupNodeTemplatesItems([
templatesFolder1,
templatesFolder2,
@@ -143,6 +145,7 @@ describe('Create file from template', () => {
describe('with existing templates', () => {
beforeAll(async () => {
await adminApiActions.login();
await adminApiActions.createNodeTemplatesHierarchy(templates);
await adminApiActions.removeUserAccessOnNodeTemplate(restrictedTemplateFolder);
link = (await adminApiActions.createLinkToFileName(template2InRootFolder, await adminApiActions.getNodeTemplatesFolderId())).entry.name;
@@ -229,11 +232,15 @@ describe('Create file from template', () => {
describe('Create from template dialog', () => {
beforeEach(async () => {
await sidenav.openCreateFileFromTemplateDialog();
await selectTemplateDialog.waitForDialogToOpen();
await selectTemplateDialog.dataTable.selectItem(template1InRootFolder);
await selectTemplateDialog.clickNext();
await createFromTemplateDialog.waitForDialogToOpen();
try {
await sidenav.openCreateFileFromTemplateDialog();
await selectTemplateDialog.waitForDialogToOpen();
await selectTemplateDialog.dataTable.selectItem(template1InRootFolder);
await selectTemplateDialog.clickNext();
await createFromTemplateDialog.waitForDialogToOpen();
} catch (error) {
Logger.error(`----- beforeEach failed : ${error}`);
}
});
it('[C325020] Create file from template - dialog UI', async () => {
@@ -296,13 +303,17 @@ describe('Create file from template', () => {
describe('On Personal Files', () => {
beforeEach(async () => {
await page.clickPersonalFilesAndWait();
await page.dataTable.doubleClickOnRowByName(parent);
await sidenav.openCreateFileFromTemplateDialog();
await selectTemplateDialog.waitForDialogToOpen();
await selectTemplateDialog.dataTable.selectItem(template1InRootFolder);
await selectTemplateDialog.clickNext();
await createFromTemplateDialog.waitForDialogToOpen();
try {
await page.clickPersonalFilesAndWait();
await page.dataTable.doubleClickOnRowByName(parent);
await sidenav.openCreateFileFromTemplateDialog();
await selectTemplateDialog.waitForDialogToOpen();
await selectTemplateDialog.dataTable.selectItem(template1InRootFolder);
await selectTemplateDialog.clickNext();
await createFromTemplateDialog.waitForDialogToOpen();
} catch (error) {
Logger.error(`----- beforeEach failed : ${error}`);
}
});
it('[C325030] Create a file from a template - with a new Name', async () => {
@@ -360,13 +371,17 @@ describe('Create file from template', () => {
const fileLibrariesPage = new BrowsingPage();
beforeEach(async () => {
await fileLibrariesPage.goToMyLibrariesAndWait();
await page.dataTable.doubleClickOnRowByName(siteName);
await sidenav.openCreateFileFromTemplateDialog();
await selectTemplateDialog.waitForDialogToOpen();
await selectTemplateDialog.dataTable.selectItem(template1InRootFolder);
await selectTemplateDialog.clickNext();
await createFromTemplateDialog.waitForDialogToOpen();
try {
await fileLibrariesPage.goToMyLibrariesAndWait();
await page.dataTable.doubleClickOnRowByName(siteName);
await sidenav.openCreateFileFromTemplateDialog();
await selectTemplateDialog.waitForDialogToOpen();
await selectTemplateDialog.dataTable.selectItem(template1InRootFolder);
await selectTemplateDialog.clickNext();
await createFromTemplateDialog.waitForDialogToOpen();
} catch (error) {
Logger.error(`----- beforeEach failed : ${error}`);
}
});
it('[C325023] Create a file from a template - with Name, Title and Description', async () => {

View File

@@ -123,6 +123,7 @@ describe('Create folder from template', () => {
docLibUserSite = await userApi.sites.getDocLibId(siteName);
await userApi.nodes.createFolder(duplicateFolderSite, docLibUserSite);
await adminApiActions.login();
await adminApiActions.createSpaceTemplatesHierarchy(templates);
await adminApiActions.removeUserAccessOnSpaceTemplate(restrictedTemplateFolder);
folderLink = (await adminApiActions.createLinkToFolderName(folderInRootFolder, await adminApiActions.getSpaceTemplatesFolderId())).entry.name;

View File

@@ -41,13 +41,11 @@ describe('Delete and undo delete', () => {
const userActions = new UserActions();
beforeAll(async () => {
await adminApiActions.login();
await adminApiActions.createUser({ username });
await userActions.login(username, username);
});
afterAll(async () => {
await userActions.login(username, username);
await userActions.emptyTrashcan();
});
@@ -64,17 +62,21 @@ describe('Delete and undo delete', () => {
const recentFile6 = `recentFile6-${random}.txt`;
beforeAll(async (done) => {
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
try {
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
await apis.user.nodes.createFile(recentFile1, parentId);
await apis.user.nodes.createFile(recentFile2, parentId);
await apis.user.nodes.createFile(recentFile3, parentId);
await apis.user.nodes.createFile(recentFile4, parentId);
await apis.user.nodes.createFile(recentFile5, parentId);
await apis.user.nodes.createFile(recentFile6, parentId);
await apis.user.search.waitForNodes(random, { expect: 6 });
await apis.user.nodes.createFile(recentFile1, parentId);
await apis.user.nodes.createFile(recentFile2, parentId);
await apis.user.nodes.createFile(recentFile3, parentId);
await apis.user.nodes.createFile(recentFile4, parentId);
await apis.user.nodes.createFile(recentFile5, parentId);
await apis.user.nodes.createFile(recentFile6, parentId);
await apis.user.search.waitForNodes(random, { expect: 6 });
await loginPage.loginWith(username);
await loginPage.loginWith(username);
} catch (error) {
Logger.error(`----- beforeAll failed : ${error}`);
}
done();
});
@@ -84,6 +86,7 @@ describe('Delete and undo delete', () => {
afterAll(async () => {
try {
await userActions.login(username, username);
await userActions.deleteNodes([parentId]);
await userActions.emptyTrashcan();
} catch (error) {
@@ -217,18 +220,20 @@ describe('Delete and undo delete', () => {
await page.dataTable.doubleClickOnRowByName(parent);
});
afterAll(async () => {
afterAll(async (done) => {
try {
await apis.user.nodes.unlockFile(fileLocked1Id);
await apis.user.nodes.unlockFile(fileLocked2Id);
await apis.user.nodes.unlockFile(fileLocked3Id);
await apis.user.nodes.unlockFile(fileLocked4Id);
await userActions.login(username, username);
await userActions.deleteNodes([parentId]);
await userActions.emptyTrashcan();
} catch (error) {
Logger.error(`----- afterAll failed : ${error}`);
}
done();
});
it('[C217125] delete a file and check notification', async () => {
@@ -351,19 +356,23 @@ describe('Delete and undo delete', () => {
let parentId: string;
beforeAll(async (done) => {
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
try {
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
sharedFile1Id = (await apis.user.nodes.createFile(sharedFile1, parentId)).entry.id;
sharedFile2Id = (await apis.user.nodes.createFile(sharedFile2, parentId)).entry.id;
sharedFile3Id = (await apis.user.nodes.createFile(sharedFile3, parentId)).entry.id;
sharedFile4Id = (await apis.user.nodes.createFile(sharedFile4, parentId)).entry.id;
sharedFile5Id = (await apis.user.nodes.createFile(sharedFile5, parentId)).entry.id;
sharedFile6Id = (await apis.user.nodes.createFile(sharedFile6, parentId)).entry.id;
sharedFile1Id = (await apis.user.nodes.createFile(sharedFile1, parentId)).entry.id;
sharedFile2Id = (await apis.user.nodes.createFile(sharedFile2, parentId)).entry.id;
sharedFile3Id = (await apis.user.nodes.createFile(sharedFile3, parentId)).entry.id;
sharedFile4Id = (await apis.user.nodes.createFile(sharedFile4, parentId)).entry.id;
sharedFile5Id = (await apis.user.nodes.createFile(sharedFile5, parentId)).entry.id;
sharedFile6Id = (await apis.user.nodes.createFile(sharedFile6, parentId)).entry.id;
await apis.user.shared.shareFilesByIds([sharedFile1Id, sharedFile2Id, sharedFile3Id, sharedFile4Id, sharedFile5Id, sharedFile6Id]);
await apis.user.shared.waitForFilesToBeShared([sharedFile1Id, sharedFile2Id, sharedFile3Id, sharedFile4Id, sharedFile5Id, sharedFile6Id]);
await apis.user.shared.shareFilesByIds([sharedFile1Id, sharedFile2Id, sharedFile3Id, sharedFile4Id, sharedFile5Id, sharedFile6Id]);
await apis.user.shared.waitForFilesToBeShared([sharedFile1Id, sharedFile2Id, sharedFile3Id, sharedFile4Id, sharedFile5Id, sharedFile6Id]);
await loginPage.loginWith(username);
await loginPage.loginWith(username);
} catch (error) {
Logger.error(`----- beforeAll failed : ${error}`);
}
done();
});
@@ -373,6 +382,7 @@ describe('Delete and undo delete', () => {
afterAll(async () => {
try {
await userActions.login(username, username);
await userActions.deleteNodes([parentId]);
await userActions.emptyTrashcan();
} catch (error) {
@@ -466,47 +476,50 @@ describe('Delete and undo delete', () => {
let fileLocked4Id: string;
beforeAll(async (done) => {
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
try {
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
favFile1Id = (await apis.user.nodes.createFile(favFile1, parentId)).entry.id;
favFile2Id = (await apis.user.nodes.createFile(favFile2, parentId)).entry.id;
favFile3Id = (await apis.user.nodes.createFile(favFile3, parentId)).entry.id;
favFile4Id = (await apis.user.nodes.createFile(favFile4, parentId)).entry.id;
favFile5Id = (await apis.user.nodes.createFile(favFile5, parentId)).entry.id;
favFile6Id = (await apis.user.nodes.createFile(favFile6, parentId)).entry.id;
favFile7Id = (await apis.user.nodes.createFile(favFile7, parentId)).entry.id;
favFile1Id = (await apis.user.nodes.createFile(favFile1, parentId)).entry.id;
favFile2Id = (await apis.user.nodes.createFile(favFile2, parentId)).entry.id;
favFile3Id = (await apis.user.nodes.createFile(favFile3, parentId)).entry.id;
favFile4Id = (await apis.user.nodes.createFile(favFile4, parentId)).entry.id;
favFile5Id = (await apis.user.nodes.createFile(favFile5, parentId)).entry.id;
favFile6Id = (await apis.user.nodes.createFile(favFile6, parentId)).entry.id;
favFile7Id = (await apis.user.nodes.createFile(favFile7, parentId)).entry.id;
favFolder1Id = (await apis.user.nodes.createFolder(favFolder1, parentId)).entry.id;
favFolder2Id = (await apis.user.nodes.createFolder(favFolder2, parentId)).entry.id;
favFolder3Id = (await apis.user.nodes.createFolder(favFolder3, parentId)).entry.id;
favFolder4Id = (await apis.user.nodes.createFolder(favFolder4, parentId)).entry.id;
favFolder5Id = (await apis.user.nodes.createFolder(favFolder5, parentId)).entry.id;
favFolder6Id = (await apis.user.nodes.createFolder(favFolder6, parentId)).entry.id;
favFolder1Id = (await apis.user.nodes.createFolder(favFolder1, parentId)).entry.id;
favFolder2Id = (await apis.user.nodes.createFolder(favFolder2, parentId)).entry.id;
favFolder3Id = (await apis.user.nodes.createFolder(favFolder3, parentId)).entry.id;
favFolder4Id = (await apis.user.nodes.createFolder(favFolder4, parentId)).entry.id;
favFolder5Id = (await apis.user.nodes.createFolder(favFolder5, parentId)).entry.id;
favFolder6Id = (await apis.user.nodes.createFolder(favFolder6, parentId)).entry.id;
await apis.user.nodes.createFile(file1InFolder, favFolder1Id);
fileLocked1Id = (await apis.user.nodes.createFile(fileLocked1, favFolder2Id)).entry.id;
fileLocked2Id = (await apis.user.nodes.createFile(fileLocked2, favFolder3Id)).entry.id;
fileLocked3Id = (await apis.user.nodes.createFile(fileLocked3, favFolder4Id)).entry.id;
fileLocked4Id = (await apis.user.nodes.createFile(fileLocked4, favFolder5Id)).entry.id;
await apis.user.nodes.createFile(file2InFolder, favFolder6Id);
await apis.user.nodes.createFile(file1InFolder, favFolder1Id);
fileLocked1Id = (await apis.user.nodes.createFile(fileLocked1, favFolder2Id)).entry.id;
fileLocked2Id = (await apis.user.nodes.createFile(fileLocked2, favFolder3Id)).entry.id;
fileLocked3Id = (await apis.user.nodes.createFile(fileLocked3, favFolder4Id)).entry.id;
fileLocked4Id = (await apis.user.nodes.createFile(fileLocked4, favFolder5Id)).entry.id;
await apis.user.nodes.createFile(file2InFolder, favFolder6Id);
await apis.user.nodes.lockFile(fileLocked1Id, 'FULL');
await apis.user.nodes.lockFile(fileLocked2Id, 'FULL');
await apis.user.nodes.lockFile(fileLocked3Id, 'FULL');
await apis.user.nodes.lockFile(fileLocked4Id, 'FULL');
await apis.user.nodes.lockFile(fileLocked1Id, 'FULL');
await apis.user.nodes.lockFile(fileLocked2Id, 'FULL');
await apis.user.nodes.lockFile(fileLocked3Id, 'FULL');
await apis.user.nodes.lockFile(fileLocked4Id, 'FULL');
const initialFavoritesTotalItems = await apis.user.favorites.getFavoritesTotalItems();
await apis.user.favorites.addFavoritesByIds('file', [favFile1Id, favFile2Id, favFile3Id, favFile4Id, favFile5Id, favFile6Id, favFile7Id]);
await apis.user.favorites.addFavoritesByIds('folder', [favFolder1Id, favFolder2Id, favFolder3Id, favFolder4Id, favFolder5Id, favFolder6Id]);
await apis.user.favorites.waitForApi({ expect: initialFavoritesTotalItems + 13 });
const initialFavoritesTotalItems = await apis.user.favorites.getFavoritesTotalItems();
await apis.user.favorites.addFavoritesByIds('file', [favFile1Id, favFile2Id, favFile3Id, favFile4Id, favFile5Id, favFile6Id, favFile7Id]);
await apis.user.favorites.addFavoritesByIds('folder', [favFolder1Id, favFolder2Id, favFolder3Id, favFolder4Id, favFolder5Id, favFolder6Id]);
await apis.user.favorites.waitForApi({ expect: initialFavoritesTotalItems + 13 });
await loginPage.loginWith(username);
await loginPage.loginWith(username);
} catch (error) {
Logger.error(`----- beforeAll failed : ${error}`);
}
done();
});
beforeEach(async (done) => {
beforeEach(async () => {
await page.clickFavoritesAndWait();
done();
});
afterAll(async () => {
@@ -516,6 +529,7 @@ describe('Delete and undo delete', () => {
await apis.user.nodes.unlockFile(fileLocked3Id);
await apis.user.nodes.unlockFile(fileLocked4Id);
await userActions.login(username, username);
await userActions.deleteNodes([parentId]);
await userActions.emptyTrashcan();
} catch (error) {

View File

@@ -53,14 +53,13 @@ describe('Permanently delete from Trash', () => {
const userActions = new UserActions();
beforeAll(async (done) => {
await adminApiActions.login();
await adminApiActions.createUser({ username });
await userActions.login(username, username);
filesIds = (await apis.user.nodes.createFiles([file1, file2, file3])).list.entries.map((entries: any) => entries.entry.id);
foldersIds = (await apis.user.nodes.createFolders([folder1, folder2])).list.entries.map((entries: any) => entries.entry.id);
await apis.user.sites.createSite(site);
await userActions.login(username, username);
await userActions.deleteNodes([...filesIds, ...foldersIds], false);
await userActions.deleteSites([site], false);
@@ -68,12 +67,12 @@ describe('Permanently delete from Trash', () => {
done();
});
beforeEach(async (done) => {
beforeEach(async () => {
await page.clickTrashAndWait();
done();
});
afterAll(async (done) => {
await userActions.login(username, username);
await userActions.emptyTrashcan();
done();
});

View File

@@ -25,7 +25,7 @@
import { browser } from 'protractor';
import { AdminActions, UserActions, LoginPage, BrowsingPage, APP_ROUTES, RepoClient, Utils } from '@alfresco/aca-testing-shared';
import { BrowserActions } from '@alfresco/adf-testing';
import { BrowserActions, Logger } from '@alfresco/adf-testing';
describe('Restore from Trash', () => {
const username = `user-${Utils.random()}`;
@@ -41,17 +41,14 @@ describe('Restore from Trash', () => {
const userActions = new UserActions();
beforeAll(async (done) => {
await adminApiActions.login();
await adminApiActions.createUser({ username });
await userActions.login(username, username);
await loginPage.loginWith(username);
done();
});
afterAll(async (done) => {
afterAll(async () => {
await userActions.login(username, username);
await userActions.emptyTrashcan();
done();
});
describe('successful restore', () => {
@@ -61,27 +58,26 @@ describe('Restore from Trash', () => {
let folderId: string;
const site = `site-${Utils.random()}`;
beforeAll(async (done) => {
beforeAll(async () => {
fileId = (await apis.user.nodes.createFile(file)).entry.id;
folderId = (await apis.user.nodes.createFolder(folder)).entry.id;
await apis.user.sites.createSite(site);
await userActions.login(username, username);
await userActions.deleteNodes([fileId, folderId], false);
await userActions.deleteSites([site], false);
done();
});
beforeEach(async (done) => {
beforeEach(async () => {
await page.clickTrashAndWait();
done();
});
afterAll(async (done) => {
afterAll(async () => {
await userActions.login(username, username);
await userActions.emptyTrashcan();
done();
});
it('[C217177] restore file', async () => {
it('[C217177] restore file', async (done) => {
await dataTable.selectItem(file);
await BrowserActions.click(toolbar.restoreButton);
const text = await page.getSnackBarMessage();
@@ -92,9 +88,10 @@ describe('Restore from Trash', () => {
expect(await page.dataTable.isItemPresent(file)).toBe(true, 'Item not displayed in list');
await userActions.deleteNodes([fileId], false);
done();
});
it('[C280438] restore folder', async () => {
it('[C280438] restore folder', async (done) => {
await dataTable.selectItem(folder);
await BrowserActions.click(toolbar.restoreButton);
const text = await page.getSnackBarMessage();
@@ -105,6 +102,7 @@ describe('Restore from Trash', () => {
expect(await page.dataTable.isItemPresent(folder)).toBe(true, 'Item not displayed in list');
await userActions.deleteNodes([folderId], false);
done();
});
it('[C290104] restore library', async () => {
@@ -118,7 +116,7 @@ describe('Restore from Trash', () => {
expect(await page.dataTable.isItemPresent(site)).toBe(true, `${site} not displayed in list`);
});
it('[C217182] restore multiple items', async () => {
it('[C217182] restore multiple items', async (done) => {
await dataTable.selectMultipleItems([file, folder]);
await BrowserActions.click(toolbar.restoreButton);
const text = await page.getSnackBarMessage();
@@ -131,9 +129,10 @@ describe('Restore from Trash', () => {
expect(await page.dataTable.isItemPresent(folder)).toBe(true, 'Item not displayed in list');
await userActions.deleteNodes([fileId, folderId], false);
done();
});
it('[C217181] View from notification', async () => {
it('[C217181] View from notification', async (done) => {
await dataTable.selectItem(file);
await BrowserActions.click(toolbar.restoreButton);
await page.clickSnackBarAction();
@@ -142,6 +141,7 @@ describe('Restore from Trash', () => {
expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
await userActions.deleteNodes([fileId], false);
done();
});
});
@@ -157,9 +157,11 @@ describe('Restore from Trash', () => {
const folder2 = `folder-${Utils.random()}`;
let folder2Id: string;
beforeAll(async (done) => {
beforeAll(async () => {
folder1Id = (await apis.user.nodes.createFolder(folder1)).entry.id;
file1Id1 = (await apis.user.nodes.createFile(file1, folder1Id)).entry.id;
await userActions.login(username, username);
await userActions.deleteNodes([file1Id1], false);
file1Id2 = (await apis.user.nodes.createFile(file1, folder1Id)).entry.id;
@@ -167,29 +169,25 @@ describe('Restore from Trash', () => {
file2Id = (await apis.user.nodes.createFile(file2, folder2Id)).entry.id;
await userActions.deleteNodes([file2Id, folder2Id], false);
done();
});
beforeEach(async (done) => {
beforeEach(async () => {
await page.clickTrashAndWait();
done();
});
afterAll(async (done) => {
afterAll(async () => {
await userActions.login(username, username);
await userActions.deleteNodes([file1Id2]);
await userActions.emptyTrashcan();
done();
});
it('[C217178] Restore a file when another file with same name exists on the restore location', async () => {
await page.clickTrashAndWait();
await dataTable.selectItem(file1);
await BrowserActions.click(toolbar.restoreButton);
expect(await page.getSnackBarMessage()).toEqual(`Can't restore, ${file1} already exists`);
});
it('[C217179] Restore a file when original location no longer exists', async () => {
await page.clickTrashAndWait();
await dataTable.selectItem(file2);
await BrowserActions.click(toolbar.restoreButton);
expect(await page.getSnackBarMessage()).toEqual(`Can't restore ${file2}, the original location no longer exists`);
@@ -218,32 +216,36 @@ describe('Restore from Trash', () => {
let file5Id: string;
beforeAll(async (done) => {
folder1Id = (await apis.user.nodes.createFolder(folder1)).entry.id;
file1Id = (await apis.user.nodes.createFile(file1, folder1Id)).entry.id;
folder2Id = (await apis.user.nodes.createFolder(folder2)).entry.id;
file2Id = (await apis.user.nodes.createFile(file2, folder2Id)).entry.id;
try {
folder1Id = (await apis.user.nodes.createFolder(folder1)).entry.id;
file1Id = (await apis.user.nodes.createFile(file1, folder1Id)).entry.id;
folder2Id = (await apis.user.nodes.createFolder(folder2)).entry.id;
file2Id = (await apis.user.nodes.createFile(file2, folder2Id)).entry.id;
await userActions.deleteNodes([file1Id, folder1Id, file2Id], false);
await userActions.login(username, username);
await userActions.deleteNodes([file1Id, folder1Id, file2Id], false);
folder3Id = (await apis.user.nodes.createFolder(folder3)).entry.id;
file3Id = (await apis.user.nodes.createFile(file3, folder3Id)).entry.id;
file4Id = (await apis.user.nodes.createFile(file4, folder3Id)).entry.id;
folder4Id = (await apis.user.nodes.createFolder(folder4)).entry.id;
file5Id = (await apis.user.nodes.createFile(file5, folder4Id)).entry.id;
folder3Id = (await apis.user.nodes.createFolder(folder3)).entry.id;
file3Id = (await apis.user.nodes.createFile(file3, folder3Id)).entry.id;
file4Id = (await apis.user.nodes.createFile(file4, folder3Id)).entry.id;
folder4Id = (await apis.user.nodes.createFolder(folder4)).entry.id;
file5Id = (await apis.user.nodes.createFile(file5, folder4Id)).entry.id;
await userActions.deleteNodes([file3Id, file4Id, folder3Id, file5Id], false);
await loginPage.loginWith(username);
await userActions.deleteNodes([file3Id, file4Id, folder3Id, file5Id], false);
await loginPage.loginWith(username);
} catch (error) {
Logger.error(`----- beforeAll failed : ${error}`);
}
done();
});
beforeEach(async (done) => {
beforeEach(async () => {
await page.clickTrashAndWait();
done();
});
afterAll(async (done) => {
afterAll(async () => {
await userActions.login(username, username);
await userActions.emptyTrashcan();
done();
});
it('[C217183] one failure', async () => {

View File

@@ -123,7 +123,6 @@ describe('Edit folder', () => {
});
afterAll(async () => {
await adminApiActions.login();
await adminApiActions.sites.deleteSite(sitePrivate);
await apis.user.sites.deleteSite(siteName);
await apis.user.nodes.deleteNodesById([parentId, folderFavoriteToEditId, folderFavoriteDuplicateId, folderSearchToEditId]);

View File

@@ -123,14 +123,12 @@ describe('Mark items as favorites', () => {
done();
});
afterAll(async (done) => {
afterAll(async () => {
await apis.user.nodes.deleteNodeById(parentId);
done();
});
afterEach(async (done) => {
afterEach(async () => {
await Utils.pressEscape();
done();
});
describe('on Personal Files', () => {

View File

@@ -78,9 +78,7 @@ describe('Library actions', () => {
const userActions = new UserActions();
beforeAll(async (done) => {
await adminApiActions.login();
await adminApiActions.createUser({ username });
await userActions.login(username, username);
await adminApiActions.sites.createSite(siteSearchPublic1Admin);
await adminApiActions.sites.createSite(siteSearchPublic2Admin);
@@ -126,6 +124,7 @@ describe('Library actions', () => {
siteSearchModerated2Admin
]);
await userActions.login(username, username);
await userActions.deleteSites([sitePublicUser]);
await userActions.emptyTrashcan();
});

View File

@@ -35,7 +35,7 @@ import {
Viewer,
Utils
} from '@alfresco/aca-testing-shared';
import { BrowserActions } from '@alfresco/adf-testing';
import { BrowserActions, Logger } from '@alfresco/adf-testing';
describe('Share a file', () => {
const username = `user-${Utils.random()}`;
@@ -65,10 +65,8 @@ describe('Share a file', () => {
const userActions = new UserActions();
beforeAll(async () => {
await adminApiActions.login();
await adminApiActions.createUser({ username });
await userActions.login(username, username);
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
});
@@ -137,6 +135,7 @@ describe('Share a file', () => {
file8Id = (await apis.user.nodes.createFile(file8, parentId)).entry.id;
file9Id = (await apis.user.nodes.createFile(file9, parentId)).entry.id;
await userActions.login(username, username);
await userActions.shareNodes([file6Id, file7Id], expiryDate);
await apis.user.shared.waitForFilesToBeShared([file6Id, file7Id]);
});
@@ -337,16 +336,21 @@ describe('Share a file', () => {
file8Id = (await apis.user.nodes.createFile(file8, parentInSiteId)).entry.id;
file9Id = (await apis.user.nodes.createFile(file9, parentInSiteId)).entry.id;
await userActions.login(username, username);
await userActions.shareNodes([file6Id, file7Id], expiryDate);
await apis.user.shared.waitForFilesToBeShared([file6Id, file7Id]);
});
beforeEach(async () => {
await page.goToMyLibrariesAndWait();
await dataTable.doubleClickOnRowByName(siteName);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(parentInSite);
await dataTable.waitForHeader();
try {
await page.goToMyLibrariesAndWait();
await dataTable.doubleClickOnRowByName(siteName);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(parentInSite);
await dataTable.waitForHeader();
} catch (error) {
Logger.error(`----- beforeEach failed : ${error}`);
}
});
afterEach(async () => {
@@ -532,6 +536,7 @@ describe('Share a file', () => {
file8Id = (await apis.user.nodes.createFile(file8, parentId)).entry.id;
file9Id = (await apis.user.nodes.createFile(file9, parentId)).entry.id;
await userActions.login(username, username);
await userActions.shareNodes([file6Id, file7Id], expiryDate);
await apis.user.shared.waitForFilesToBeShared([file6Id, file7Id]);
});
@@ -719,6 +724,7 @@ describe('Share a file', () => {
file6Id = (await apis.user.nodes.createFile(file6, parentId)).entry.id;
file7Id = (await apis.user.nodes.createFile(file7, parentId)).entry.id;
await userActions.login(username, username);
await userActions.shareNodes([file1Id, file2Id, file3Id]);
await userActions.shareNodes([file4Id, file5Id], expiryDate);
await userActions.shareNodes([file6Id, file7Id]);
@@ -866,6 +872,7 @@ describe('Share a file', () => {
file9Id = (await apis.user.nodes.createFile(file9, parentId)).entry.id;
await apis.user.favorites.addFavoritesByIds('file', [file1Id, file2Id, file3Id, file4Id, file5Id, file6Id, file7Id, file8Id, file9Id]);
await userActions.login(username, username);
await userActions.shareNodes([file6Id, file7Id], expiryDate);
await apis.user.favorites.waitForApi({ expect: 9 });
@@ -1060,15 +1067,20 @@ describe('Share a file', () => {
fileSearch9Id = (await apis.user.nodes.createFile(fileSearch9, parentId)).entry.id;
await apis.user.search.waitForNodes(searchRandom, { expect: 5 });
await userActions.login(username, username);
await userActions.shareNodes([fileSearch6Id, fileSearch7Id], expiryDate);
await apis.user.shared.waitForFilesToBeShared([fileSearch6Id, fileSearch7Id]);
});
beforeEach(async () => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor(searchRandom);
await dataTable.waitForBody();
try {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor(searchRandom);
await dataTable.waitForBody();
} catch (error) {
Logger.error(`----- beforeEach failed : ${error}`);
}
});
afterEach(async () => {

View File

@@ -37,7 +37,7 @@ import {
Viewer,
Utils
} from '@alfresco/aca-testing-shared';
import { BrowserActions } from '@alfresco/adf-testing';
import { BrowserActions, Logger } from '@alfresco/adf-testing';
describe('Unshare a file from Search Results', () => {
const username = `user-${Utils.random()}`;
@@ -79,47 +79,49 @@ describe('Unshare a file from Search Results', () => {
const userActions = new UserActions();
beforeAll(async (done) => {
await adminApiActions.login();
await adminApiActions.createUser({ username });
await userActions.login(username, username);
try {
await adminApiActions.createUser({ username });
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id;
file2Id = (await apis.user.nodes.createFile(file2, parentId)).entry.id;
file3Id = (await apis.user.nodes.createFile(file3, parentId)).entry.id;
file4Id = (await apis.user.nodes.createFile(file4, parentId)).entry.id;
file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id;
file2Id = (await apis.user.nodes.createFile(file2, parentId)).entry.id;
file3Id = (await apis.user.nodes.createFile(file3, parentId)).entry.id;
file4Id = (await apis.user.nodes.createFile(file4, parentId)).entry.id;
await userActions.shareNodes([file1Id, file2Id, file3Id, file4Id]);
await adminApiActions.sites.createSite(sitePrivate, SITE_VISIBILITY.PRIVATE);
const docLibId = await adminApiActions.sites.getDocLibId(sitePrivate);
await adminApiActions.login();
await adminApiActions.sites.createSite(sitePrivate, SITE_VISIBILITY.PRIVATE);
const docLibId = await adminApiActions.sites.getDocLibId(sitePrivate);
fileSite1Id = (await adminApiActions.nodes.createFile(fileSite1, docLibId)).entry.id;
fileSite2Id = (await adminApiActions.nodes.createFile(fileSite2, docLibId)).entry.id;
fileSite1Id = (await adminApiActions.nodes.createFile(fileSite1, docLibId)).entry.id;
fileSite2Id = (await adminApiActions.nodes.createFile(fileSite2, docLibId)).entry.id;
await adminApiActions.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_CONSUMER.ROLE);
await adminApiActions.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_CONSUMER.ROLE);
await adminApiActions.shareNodes([fileSite1Id]);
await userActions.shareNodes([fileSite2Id]);
await adminApiActions.shareNodes([fileSite1Id]);
await adminApiActions.shared.waitForFilesToBeShared([fileSite1Id]);
await apis.user.shared.waitForFilesToBeShared([file1Id, file2Id, file3Id, file4Id, fileSite2Id]);
await adminApiActions.shared.waitForFilesToBeShared([fileSite1Id]);
await apis.user.search.waitForNodes(`search-file-${searchRandom}`, { expect: 6 });
await userActions.login(username, username);
await userActions.shareNodes([file1Id, file2Id, file3Id, file4Id, fileSite2Id]);
await apis.user.shared.waitForFilesToBeShared([file1Id, file2Id, file3Id, file4Id, fileSite2Id]);
await loginPage.loginWith(username);
await apis.user.search.waitForNodes(`search-file-${searchRandom}`, { expect: 6 });
await loginPage.loginWith(username);
} catch (error) {
Logger.error(`----- beforeAll failed : ${error}`);
}
done();
});
afterAll(async (done) => {
afterAll(async () => {
await apis.user.nodes.deleteNodeById(parentId);
await adminApiActions.sites.deleteSite(sitePrivate);
done();
});
afterEach(async (done) => {
afterEach(async () => {
await page.closeOpenDialogs();
await page.clickPersonalFilesAndWait();
done();
});
it('[C306995] Unshare dialog UI', async () => {

View File

@@ -37,7 +37,7 @@ import {
Viewer,
Utils
} from '@alfresco/aca-testing-shared';
import { BrowserActions } from '@alfresco/adf-testing';
import { BrowserActions, Logger } from '@alfresco/adf-testing';
describe('Unshare a file', () => {
const username = `user-${Utils.random()}`;
@@ -61,18 +61,19 @@ describe('Unshare a file', () => {
const userActions = new UserActions();
beforeAll(async (done) => {
await adminApiActions.login();
await adminApiActions.createUser({ username });
await userActions.login(username, username);
try {
await adminApiActions.createUser({ username });
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
await loginPage.loginWith(username);
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
await loginPage.loginWith(username);
} catch (error) {
Logger.error(`----- beforeAll failed : ${error}`);
}
done();
});
afterAll(async (done) => {
afterAll(async () => {
await apis.user.nodes.deleteNodeById(parentId);
done();
});
describe('from Personal Files', () => {
@@ -85,33 +86,38 @@ describe('Unshare a file', () => {
const file4 = `file4-${Utils.random()}.txt`;
let file4Id: string;
beforeAll(async (done) => {
file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id;
file2Id = (await apis.user.nodes.createFile(file2, parentId)).entry.id;
file3Id = (await apis.user.nodes.createFile(file3, parentId)).entry.id;
file4Id = (await apis.user.nodes.createFile(file4, parentId)).entry.id;
beforeAll(async () => {
try {
file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id;
file2Id = (await apis.user.nodes.createFile(file2, parentId)).entry.id;
file3Id = (await apis.user.nodes.createFile(file3, parentId)).entry.id;
file4Id = (await apis.user.nodes.createFile(file4, parentId)).entry.id;
await userActions.shareNodes([file1Id, file2Id, file3Id, file4Id]);
await apis.user.shared.waitForFilesToBeShared([file1Id, file2Id, file3Id, file4Id]);
done();
await userActions.login(username, username);
await userActions.shareNodes([file1Id, file2Id, file3Id, file4Id]);
await apis.user.shared.waitForFilesToBeShared([file1Id, file2Id, file3Id, file4Id]);
} catch (error) {
Logger.error(`----- beforeAll failed : ${error}`);
}
});
beforeEach(async (done) => {
beforeEach(async () => {
try {
await page.closeOpenDialogs();
await page.clickPersonalFilesAndWait();
await dataTable.doubleClickOnRowByName(parent);
await dataTable.waitForHeader();
} catch (error) {
Logger.error(`----- beforeEach failed : ${error}`);
}
});
afterEach(async () => {
await page.closeOpenDialogs();
await page.clickPersonalFilesAndWait();
await dataTable.doubleClickOnRowByName(parent);
await dataTable.waitForHeader();
done();
});
afterEach(async (done) => {
await page.closeOpenDialogs();
done();
});
afterAll(async (done) => {
afterAll(async () => {
await apis.user.nodes.deleteNodesById([file1Id, file2Id, file3Id, file4Id]);
done();
});
it('[C286339] Unshare dialog UI', async () => {
@@ -204,39 +210,44 @@ describe('Unshare a file', () => {
const parentInSite = `parent-site-${Utils.random()}`;
let parentInSiteId: string;
beforeAll(async (done) => {
await apis.user.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC);
const docLibId = await apis.user.sites.getDocLibId(siteName);
parentInSiteId = (await apis.user.nodes.createFolder(parentInSite, docLibId)).entry.id;
beforeAll(async () => {
try {
await apis.user.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC);
const docLibId = await apis.user.sites.getDocLibId(siteName);
parentInSiteId = (await apis.user.nodes.createFolder(parentInSite, docLibId)).entry.id;
file1Id = (await apis.user.nodes.createFile(file1, parentInSiteId)).entry.id;
file2Id = (await apis.user.nodes.createFile(file2, parentInSiteId)).entry.id;
file3Id = (await apis.user.nodes.createFile(file3, parentInSiteId)).entry.id;
file4Id = (await apis.user.nodes.createFile(file4, parentInSiteId)).entry.id;
file1Id = (await apis.user.nodes.createFile(file1, parentInSiteId)).entry.id;
file2Id = (await apis.user.nodes.createFile(file2, parentInSiteId)).entry.id;
file3Id = (await apis.user.nodes.createFile(file3, parentInSiteId)).entry.id;
file4Id = (await apis.user.nodes.createFile(file4, parentInSiteId)).entry.id;
await userActions.shareNodes([file1Id, file2Id, file3Id, file4Id]);
await apis.user.shared.waitForFilesToBeShared([file1Id, file2Id, file3Id, file4Id]);
done();
await userActions.login(username, username);
await userActions.shareNodes([file1Id, file2Id, file3Id, file4Id]);
await apis.user.shared.waitForFilesToBeShared([file1Id, file2Id, file3Id, file4Id]);
} catch (error) {
Logger.error(`----- beforeAll failed : ${error}`);
}
});
beforeEach(async (done) => {
beforeEach(async () => {
try {
await page.closeOpenDialogs();
await page.goToMyLibrariesAndWait();
await dataTable.doubleClickOnRowByName(siteName);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(parentInSite);
await dataTable.waitForHeader();
} catch (error) {
Logger.error(`----- beforeEach failed : ${error}`);
}
});
afterEach(async () => {
await page.closeOpenDialogs();
await page.goToMyLibrariesAndWait();
await dataTable.doubleClickOnRowByName(siteName);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(parentInSite);
await dataTable.waitForHeader();
done();
});
afterEach(async (done) => {
await page.closeOpenDialogs();
done();
});
afterAll(async (done) => {
afterAll(async () => {
await adminApiActions.sites.deleteSite(siteName);
done();
});
it('[C286679] Unshare dialog UI', async () => {
@@ -325,31 +336,32 @@ describe('Unshare a file', () => {
const file4 = `file4-${Utils.random()}.txt`;
let file4Id: string;
beforeAll(async (done) => {
file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id;
file2Id = (await apis.user.nodes.createFile(file2, parentId)).entry.id;
file3Id = (await apis.user.nodes.createFile(file3, parentId)).entry.id;
file4Id = (await apis.user.nodes.createFile(file4, parentId)).entry.id;
beforeAll(async () => {
try {
file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id;
file2Id = (await apis.user.nodes.createFile(file2, parentId)).entry.id;
file3Id = (await apis.user.nodes.createFile(file3, parentId)).entry.id;
file4Id = (await apis.user.nodes.createFile(file4, parentId)).entry.id;
await userActions.shareNodes([file1Id, file2Id, file3Id, file4Id]);
await apis.user.shared.waitForFilesToBeShared([file1Id, file2Id, file3Id, file4Id]);
done();
await userActions.login(username, username);
await userActions.shareNodes([file1Id, file2Id, file3Id, file4Id]);
await apis.user.shared.waitForFilesToBeShared([file1Id, file2Id, file3Id, file4Id]);
} catch (error) {
Logger.error(`----- beforeAll failed : ${error}`);
}
});
beforeEach(async (done) => {
beforeEach(async () => {
await page.closeOpenDialogs();
await page.clickRecentFilesAndWait();
done();
});
afterEach(async (done) => {
afterEach(async () => {
await page.closeOpenDialogs();
done();
});
afterAll(async (done) => {
afterAll(async () => {
await apis.user.nodes.deleteNodesById([file1Id, file2Id, file3Id, file4Id]);
done();
});
it('[C286689] Unshare dialog UI', async () => {
@@ -438,31 +450,32 @@ describe('Unshare a file', () => {
const file4 = `file4-${Utils.random()}.txt`;
let file4Id: string;
beforeAll(async (done) => {
file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id;
file2Id = (await apis.user.nodes.createFile(file2, parentId)).entry.id;
file3Id = (await apis.user.nodes.createFile(file3, parentId)).entry.id;
file4Id = (await apis.user.nodes.createFile(file4, parentId)).entry.id;
beforeAll(async () => {
try {
file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id;
file2Id = (await apis.user.nodes.createFile(file2, parentId)).entry.id;
file3Id = (await apis.user.nodes.createFile(file3, parentId)).entry.id;
file4Id = (await apis.user.nodes.createFile(file4, parentId)).entry.id;
await userActions.shareNodes([file1Id, file2Id, file3Id, file4Id]);
await apis.user.shared.waitForFilesToBeShared([file1Id, file2Id, file3Id, file4Id]);
done();
await userActions.login(username, username);
await userActions.shareNodes([file1Id, file2Id, file3Id, file4Id]);
await apis.user.shared.waitForFilesToBeShared([file1Id, file2Id, file3Id, file4Id]);
} catch (error) {
Logger.error(`----- beforeAll failed : ${error}`);
}
});
beforeEach(async (done) => {
beforeEach(async () => {
await page.closeOpenDialogs();
await page.clickSharedFilesAndWait();
done();
});
afterEach(async (done) => {
afterEach(async () => {
await page.closeOpenDialogs();
done();
});
afterAll(async (done) => {
afterAll(async () => {
await apis.user.nodes.deleteNodesById([file1Id, file2Id, file3Id, file4Id]);
done();
});
it('[C286684] Unshare dialog UI', async () => {
@@ -553,38 +566,39 @@ describe('Unshare a file', () => {
const file4 = `file4-${Utils.random()}.txt`;
let file4Id: string;
beforeAll(async (done) => {
file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id;
file2Id = (await apis.user.nodes.createFile(file2, parentId)).entry.id;
file3Id = (await apis.user.nodes.createFile(file3, parentId)).entry.id;
file4Id = (await apis.user.nodes.createFile(file4, parentId)).entry.id;
beforeAll(async () => {
try {
file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id;
file2Id = (await apis.user.nodes.createFile(file2, parentId)).entry.id;
file3Id = (await apis.user.nodes.createFile(file3, parentId)).entry.id;
file4Id = (await apis.user.nodes.createFile(file4, parentId)).entry.id;
await userActions.shareNodes([file1Id, file2Id, file3Id, file4Id]);
await userActions.login(username, username);
await userActions.shareNodes([file1Id, file2Id, file3Id, file4Id]);
await apis.user.favorites.addFavoriteById('file', file1Id);
await apis.user.favorites.addFavoriteById('file', file2Id);
await apis.user.favorites.addFavoriteById('file', file3Id);
await apis.user.favorites.addFavoriteById('file', file4Id);
await apis.user.favorites.addFavoriteById('file', file1Id);
await apis.user.favorites.addFavoriteById('file', file2Id);
await apis.user.favorites.addFavoriteById('file', file3Id);
await apis.user.favorites.addFavoriteById('file', file4Id);
await apis.user.favorites.waitForApi({ expect: 4 });
await apis.user.shared.waitForFilesToBeShared([file1Id, file2Id, file3Id, file4Id]);
done();
await apis.user.favorites.waitForApi({ expect: 4 });
await apis.user.shared.waitForFilesToBeShared([file1Id, file2Id, file3Id, file4Id]);
} catch (error) {
Logger.error(`----- beforeAll failed : ${error}`);
}
});
beforeEach(async (done) => {
beforeEach(async () => {
await page.closeOpenDialogs();
await page.clickFavoritesAndWait();
done();
});
afterEach(async (done) => {
afterEach(async () => {
await page.closeOpenDialogs();
done();
});
afterAll(async (done) => {
afterAll(async () => {
await apis.user.nodes.deleteNodesById([file1Id, file2Id, file3Id, file4Id]);
done();
});
it('[C286694] Unshare dialog UI', async () => {
@@ -679,44 +693,44 @@ describe('Unshare a file', () => {
const file2Fav = `file2-Fav-${Utils.random()}.txt`;
let file2FavId: string;
beforeAll(async (done) => {
await adminApiActions.sites.createSite(sitePrivate, SITE_VISIBILITY.PRIVATE);
const docLibId = await adminApiActions.sites.getDocLibId(sitePrivate);
beforeAll(async () => {
try {
await adminApiActions.login();
await adminApiActions.sites.createSite(sitePrivate, SITE_VISIBILITY.PRIVATE);
const docLibId = await adminApiActions.sites.getDocLibId(sitePrivate);
file1FileLibId = (await adminApiActions.nodes.createFile(file1FileLib, docLibId)).entry.id;
file2FileLibId = (await adminApiActions.nodes.createFile(file2FileLib, docLibId)).entry.id;
file1SharedId = (await adminApiActions.nodes.createFile(file1Shared, docLibId)).entry.id;
file2SharedId = (await adminApiActions.nodes.createFile(file2Shared, docLibId)).entry.id;
file1FavId = (await adminApiActions.nodes.createFile(file1Fav, docLibId)).entry.id;
file2FavId = (await adminApiActions.nodes.createFile(file2Fav, docLibId)).entry.id;
file1FileLibId = (await adminApiActions.nodes.createFile(file1FileLib, docLibId)).entry.id;
file2FileLibId = (await adminApiActions.nodes.createFile(file2FileLib, docLibId)).entry.id;
file1SharedId = (await adminApiActions.nodes.createFile(file1Shared, docLibId)).entry.id;
file2SharedId = (await adminApiActions.nodes.createFile(file2Shared, docLibId)).entry.id;
file1FavId = (await adminApiActions.nodes.createFile(file1Fav, docLibId)).entry.id;
file2FavId = (await adminApiActions.nodes.createFile(file2Fav, docLibId)).entry.id;
await adminApiActions.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_CONSUMER.ROLE);
await adminApiActions.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_CONSUMER.ROLE);
await adminApiActions.login();
await adminApiActions.shareNodes([file1FileLibId, file1SharedId, file1FavId]);
await adminApiActions.shareNodes([file1FileLibId, file1SharedId, file1FavId]);
await userActions.login(username, username);
await userActions.shareNodes([file2FileLibId, file2SharedId, file2FavId]);
await userActions.login(username, username);
await userActions.shareNodes([file2FileLibId, file2SharedId, file2FavId]);
await apis.user.favorites.addFavoriteById('file', file1FavId);
await apis.user.favorites.addFavoriteById('file', file2FavId);
await apis.user.favorites.addFavoriteById('file', file1FavId);
await apis.user.favorites.addFavoriteById('file', file2FavId);
await apis.user.favorites.waitForApi({ expect: 2 });
await adminApiActions.shared.waitForFilesToBeShared([file1FileLibId, file1SharedId, file1FavId]);
await apis.user.shared.waitForFilesToBeShared([file2FileLibId, file2SharedId, file2FavId]);
done();
await apis.user.favorites.waitForApi({ expect: 2 });
await adminApiActions.shared.waitForFilesToBeShared([file1FileLibId, file1SharedId, file1FavId]);
await apis.user.shared.waitForFilesToBeShared([file2FileLibId, file2SharedId, file2FavId]);
} catch (error) {
Logger.error(`----- beforeAll failed : ${error}`);
}
});
afterAll(async (done) => {
afterAll(async () => {
await adminApiActions.sites.deleteSite(sitePrivate);
done();
});
afterEach(async (done) => {
afterEach(async () => {
await page.closeOpenDialogs();
await page.clickPersonalFilesAndWait();
done();
});
it('[C286682] on File Libraries - file shared by other user', async () => {

View File

@@ -81,9 +81,7 @@ describe('Download', () => {
const userActions = new UserActions();
beforeAll(async (done) => {
await adminApiActions.login();
await adminApiActions.createUser({ username });
await userActions.login(username, username);
initialRecentTotalItems = await apis.user.search.getTotalItems(username);
@@ -108,6 +106,7 @@ describe('Download', () => {
await apis.user.search.waitForApi(username, { expect: initialRecentTotalItems + 10 });
await userActions.login(username, username);
await userActions.shareNodes([fileShared1Id, fileShared2Id]);
await apis.user.shared.waitForFilesToBeShared([fileShared1Id, fileShared2Id]);
@@ -121,6 +120,7 @@ describe('Download', () => {
});
afterAll(async (done) => {
await userActions.login(username, username);
await userActions.deleteNodes([parentId]);
await userActions.emptyTrashcan();
done();

View File

@@ -24,7 +24,7 @@
*/
import { browser } from 'protractor';
import { BrowserActions, Logger } from '@alfresco/adf-testing';
import { BrowserActions } from '@alfresco/adf-testing';
import { BrowsingPage, LoginPage, CreateOrEditFolderDialog, RepoClient, Utils } from '@alfresco/aca-testing-shared';
describe('General', () => {
@@ -61,11 +61,7 @@ describe('General', () => {
expect(await browser.getTitle()).toContain('Sign in');
try {
await createDialog.waitForDialogToClose();
} catch (error) {
Logger.error('err: ', error);
}
await createDialog.waitForDialogToClose();
expect(await createDialog.isDialogOpen()).not.toBe(true, 'dialog is present');
});
});

View File

@@ -69,9 +69,7 @@ describe('Comments', () => {
const userActions = new UserActions();
beforeAll(async (done) => {
await adminApiActions.login();
await adminApiActions.createUser({ username });
await userActions.login(username, username);
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
@@ -84,6 +82,7 @@ describe('Comments', () => {
fileWith1CommentId = (await apis.user.nodes.createFile(fileWith1Comment, parentId)).entry.id;
fileWith2CommentsId = (await apis.user.nodes.createFile(fileWith2Comments, parentId)).entry.id;
await userActions.login(username, username);
comment1File2Entry = await userActions.createComment(fileWith2CommentsId, 'first comment');
comment2File2Entry = await userActions.createComment(fileWith2CommentsId, 'second comment');
@@ -101,6 +100,7 @@ describe('Comments', () => {
});
afterAll(async (done) => {
await userActions.login(username, username);
await userActions.deleteNodes([parentId]);
done();
});
@@ -355,6 +355,7 @@ describe('Comments', () => {
describe('Comment info display', () => {
beforeAll(async (done) => {
await userActions.login(username, username);
commentFile1Entry = await userActions.createComment(fileWith1CommentId, 'this is my comment');
await apis.user.favorites.waitForApi({ expect: 4 });

View File

@@ -51,9 +51,7 @@ describe('Favorites', () => {
let folderId: string;
beforeAll(async (done) => {
await adminApiActions.login();
await adminApiActions.createUser({ username });
await userActions.login(username, username);
await adminApiActions.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC);
const docLibId = await adminApiActions.sites.getDocLibId(siteName);
@@ -72,6 +70,7 @@ describe('Favorites', () => {
await apis.user.favorites.addFavoriteById('file', file3Id);
await apis.user.favorites.addFavoriteById('file', file4Id);
await userActions.login(username, username);
await userActions.deleteNodes([file3Id, file4Id], false);
await userActions.trashcanApi.restoreDeletedNode(file4Id);
await loginPage.loginWith(username);
@@ -84,6 +83,7 @@ describe('Favorites', () => {
});
afterAll(async (done) => {
await userActions.login(username, username);
await userActions.deleteNodes([folderId, parentId]);
await userActions.emptyTrashcan();

View File

@@ -24,6 +24,7 @@
*/
import { AdminActions, SITE_VISIBILITY, SITE_ROLES, LoginPage, BrowsingPage, Utils, RepoClient } from '@alfresco/aca-testing-shared';
import { Logger } from '@alfresco/adf-testing';
describe('File Libraries', () => {
const username = `user-${Utils.random()}`;
@@ -57,46 +58,48 @@ describe('File Libraries', () => {
const adminApiActions = new AdminActions();
beforeAll(async (done) => {
await adminApiActions.createUser({ username });
try {
await adminApiActions.createUser({ username });
await apis.user.sites.createSite(userSitePublic, SITE_VISIBILITY.PUBLIC);
await apis.user.sites.createSite(userSiteModerated, SITE_VISIBILITY.MODERATED, siteDescription);
await apis.user.sites.createSite(userSitePrivate, SITE_VISIBILITY.PRIVATE, null);
await apis.user.sites.createSite(userSitePublic, SITE_VISIBILITY.PUBLIC);
await apis.user.sites.createSite(userSiteModerated, SITE_VISIBILITY.MODERATED, siteDescription);
await apis.user.sites.createSite(userSitePrivate, SITE_VISIBILITY.PRIVATE, null);
await adminApiActions.sites.createSite(adminSite1, SITE_VISIBILITY.PUBLIC);
await adminApiActions.sites.createSite(adminSite2, SITE_VISIBILITY.PUBLIC);
await adminApiActions.sites.createSite(adminSite3, SITE_VISIBILITY.PUBLIC);
await adminApiActions.sites.createSite(adminSite4, SITE_VISIBILITY.PUBLIC);
await adminApiActions.sites.createSite(adminSite5, SITE_VISIBILITY.PUBLIC);
await adminApiActions.sites.createSite(adminSite6, SITE_VISIBILITY.PUBLIC);
await adminApiActions.sites.addSiteMember(adminSite1, username, SITE_ROLES.SITE_CONSUMER.ROLE);
await adminApiActions.sites.addSiteMember(adminSite2, username, SITE_ROLES.SITE_CONTRIBUTOR.ROLE);
await adminApiActions.sites.addSiteMember(adminSite3, username, SITE_ROLES.SITE_COLLABORATOR.ROLE);
await adminApiActions.sites.addSiteMember(adminSite4, username, SITE_ROLES.SITE_MANAGER.ROLE);
await adminApiActions.sites.addSiteMember(adminSite6, username, SITE_ROLES.SITE_CONSUMER.ROLE);
await adminApiActions.sites.createSite(adminSite1, SITE_VISIBILITY.PUBLIC);
await adminApiActions.sites.createSite(adminSite2, SITE_VISIBILITY.PUBLIC);
await adminApiActions.sites.createSite(adminSite3, SITE_VISIBILITY.PUBLIC);
await adminApiActions.sites.createSite(adminSite4, SITE_VISIBILITY.PUBLIC);
await adminApiActions.sites.createSite(adminSite5, SITE_VISIBILITY.PUBLIC);
await adminApiActions.sites.createSite(adminSite6, SITE_VISIBILITY.PUBLIC);
await adminApiActions.sites.addSiteMember(adminSite1, username, SITE_ROLES.SITE_CONSUMER.ROLE);
await adminApiActions.sites.addSiteMember(adminSite2, username, SITE_ROLES.SITE_CONTRIBUTOR.ROLE);
await adminApiActions.sites.addSiteMember(adminSite3, username, SITE_ROLES.SITE_COLLABORATOR.ROLE);
await adminApiActions.sites.addSiteMember(adminSite4, username, SITE_ROLES.SITE_MANAGER.ROLE);
await adminApiActions.sites.addSiteMember(adminSite6, username, SITE_ROLES.SITE_CONSUMER.ROLE);
await apis.user.favorites.addFavoriteById('site', adminSite1);
await apis.user.favorites.addFavoriteById('site', adminSite2);
await apis.user.favorites.addFavoriteById('site', adminSite3);
await apis.user.favorites.addFavoriteById('site', adminSite4);
await apis.user.favorites.addFavoriteById('site', adminSite1);
await apis.user.favorites.addFavoriteById('site', adminSite2);
await apis.user.favorites.addFavoriteById('site', adminSite3);
await apis.user.favorites.addFavoriteById('site', adminSite4);
await apis.user.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC, null, siteId1);
await apis.user.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC, null, siteId2);
await apis.user.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC, null, siteId1);
await apis.user.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC, null, siteId2);
await loginPage.loginWith(username);
await loginPage.loginWith(username);
} catch (error) {
Logger.error(`----- beforeAll failed : ${error}`);
}
done();
});
afterAll(async (done) => {
afterAll(async () => {
await apis.user.sites.deleteSites([userSitePublic, userSiteModerated, userSitePrivate, siteId1, siteId2]);
await adminApiActions.sites.deleteSites([adminSite1, adminSite2, adminSite3, adminSite4, adminSite5, adminSite6]);
done();
});
describe('My Libraries', () => {
beforeEach(async (done) => {
beforeEach(async () => {
await page.goToMyLibrariesAndWait();
done();
});
it('[C217095] has the correct columns', async () => {
@@ -160,9 +163,8 @@ describe('File Libraries', () => {
});
describe('Favorite Libraries', () => {
beforeEach(async (done) => {
beforeEach(async () => {
await page.goToFavoriteLibrariesAndWait();
done();
});
it('[C289893] has the correct columns', async () => {

View File

@@ -25,6 +25,7 @@
import { browser } from 'protractor';
import { AdminActions, UserActions, LoginPage, BrowsingPage, Utils, RepoClient } from '@alfresco/aca-testing-shared';
import { Logger } from '@alfresco/adf-testing';
describe('Generic errors', () => {
const username = `user-${Utils.random()}`;
@@ -48,23 +49,25 @@ describe('Generic errors', () => {
const userActions = new UserActions();
beforeAll(async (done) => {
await adminApiActions.login();
await adminApiActions.createUser({ username });
await adminApiActions.createUser({ username: username2 });
await userActions.login(username, username);
try {
await adminApiActions.createUser({ username });
await adminApiActions.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);
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);
await loginPage.loginWith(username);
} catch (error) {
Logger.error(`----- beforeAll failed : ${error}`);
}
done();
});
afterAll(async (done) => {
afterAll(async () => {
await userActions.login(username, username);
await userActions.deleteNodes([parentId]);
await userActions.emptyTrashcan();
done();
});
it('[C217313] File / folder not found', async () => {

View File

@@ -40,11 +40,8 @@ describe('Special permissions', () => {
const adminApiActions = new AdminActions();
const userActions = new UserActions();
beforeAll(async (done) => {
await adminApiActions.login();
beforeAll(async () => {
await adminApiActions.createUser({ username });
await userActions.login(username, username);
done();
});
describe('file not displayed if user no longer has permissions on it', () => {
@@ -53,16 +50,20 @@ describe('Special permissions', () => {
let fileId: string;
beforeAll(async (done) => {
await adminApiActions.login();
await adminApiActions.sites.createSite(sitePrivate, SITE_VISIBILITY.PRIVATE);
await adminApiActions.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_COLLABORATOR.ROLE);
const docLibId = await adminApiActions.sites.getDocLibId(sitePrivate);
fileId = (await adminApiActions.nodes.createFile(fileName, docLibId)).entry.id;
await apis.user.favorites.addFavoriteById('file', fileId);
await adminApiActions.login();
await adminApiActions.shareNodes([fileId]);
await apis.user.nodes.updateNodeContent(fileId, 'edited by user');
await apis.user.search.waitForApi(username, { expect: 1 });
await adminApiActions.login();
await adminApiActions.shared.waitForFilesToBeShared([fileId]);
await loginPage.loginWith(username);
@@ -132,6 +133,7 @@ describe('Special permissions', () => {
fileId = (await apis.user.nodes.createFile(fileName, docLibId)).entry.id;
await apis.user.favorites.addFavoriteById('file', fileId);
await userActions.login(username, username);
await userActions.shareNodes([fileId]);
await apis.user.shared.waitForFilesToBeShared([fileId]);

View File

@@ -52,14 +52,14 @@ describe('Recent Files', () => {
const userActions = new UserActions();
beforeAll(async (done) => {
await adminApiActions.login();
await adminApiActions.createUser({ username });
await userActions.login(username, 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 userActions.login(username, username);
await userActions.deleteNodes([id], false);
await apis.user.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC);
@@ -79,6 +79,7 @@ describe('Recent Files', () => {
});
afterAll(async (done) => {
await userActions.login(username, username);
await userActions.deleteNodes([folderId, file2Id]);
await userActions.deleteSites([siteName]);
await userActions.emptyTrashcan();

View File

@@ -59,6 +59,9 @@ describe('Shared Files', () => {
const docLibId = await adminApiActions.sites.getDocLibId(siteName);
const nodeId = (await adminApiActions.nodes.createFile(fileAdmin, docLibId)).entry.id;
await adminApiActions.shareNodes([nodeId]);
await adminApiActions.shared.waitForFilesToBeShared([nodeId]);
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;
@@ -66,12 +69,7 @@ describe('Shared Files', () => {
file4Id = (await apis.user.nodes.createFile(file4User)).entry.id;
await apis.user.shared.shareFilesByIds([file1Id, file2Id, file3Id, file4Id]);
await adminApiActions.login();
await adminApiActions.shareNodes([nodeId]);
await apis.user.shared.waitForFilesToBeShared([file1Id, file2Id, file3Id, file4Id]);
await adminApiActions.shared.waitForFilesToBeShared([nodeId]);
await apis.user.nodes.deleteNodeById(file2Id);
await apis.user.shared.unshareFileById(file3Id);

View File

@@ -63,9 +63,7 @@ describe('File / folder tooltips', () => {
const userActions = new UserActions();
beforeAll(async (done) => {
await adminApiActions.login();
await adminApiActions.createUser({ username });
await userActions.login(username, username);
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
@@ -88,6 +86,7 @@ describe('File / folder tooltips', () => {
});
afterAll(async (done) => {
await userActions.login(username, username);
await userActions.deleteNodes([parentId]);
await userActions.emptyTrashcan();
done();
@@ -246,6 +245,7 @@ describe('File / folder tooltips', () => {
});
afterAll(async (done) => {
await userActions.login(username, username);
await userActions.deleteNodes([parentForTrashId]);
await userActions.emptyTrashcan();
done();

View File

@@ -66,7 +66,6 @@ describe('Trash', () => {
beforeAll(async () => {
try {
await adminApiActions.login();
await adminApiActions.createUser({ username });
fileAdminId = (await adminApiActions.nodes.createFiles([fileAdmin])).entry.id;
@@ -93,10 +92,13 @@ describe('Trash', () => {
afterAll(async () => {
try {
await adminApiActions.login();
await adminApiActions.sites.deleteSite(siteName);
await adminApiActions.trashcanApi.deleteDeletedNode(fileAdminId);
await adminApiActions.trashcanApi.deleteDeletedNode(folderAdminId);
await apis.user.nodes.deleteNodeById(folderNotDeletedId);
await userActions.login(username, username);
await userActions.emptyTrashcan();
} catch (error) {

View File

@@ -55,9 +55,7 @@ describe('Single click on item name', () => {
const userActions = new UserActions();
beforeAll(async (done) => {
await adminApiActions.login();
await adminApiActions.createUser({ username });
await userActions.login(username, username);
const initialRecentTotalItems = await apis.user.search.getTotalItems(username);
@@ -73,6 +71,7 @@ describe('Single click on item name', () => {
deletedFile1Id = (await apis.user.nodes.createFile(deletedFile1)).entry.id;
deletedFolder1Id = (await apis.user.nodes.createFolder(deletedFolder1)).entry.id;
await userActions.login(username, username);
await userActions.deleteNodes([deletedFile1Id, deletedFolder1Id], false);
await loginPage.loginWith(username);
@@ -80,6 +79,7 @@ describe('Single click on item name', () => {
});
afterAll(async () => {
await userActions.login(username, username);
await userActions.deleteSites([siteName]);
await userActions.deleteNodes([folder1Id, file1Id]);
await userActions.emptyTrashcan();
@@ -135,6 +135,7 @@ describe('Single click on item name', () => {
describe('on Shared Files', () => {
beforeAll(async () => {
await userActions.login(username, username);
await userActions.shareNodes([file1Id]);
await apis.user.shared.waitForFilesToBeShared([file1Id]);
});

View File

@@ -56,11 +56,7 @@ describe('Pagination on multiple pages', () => {
}, 400000);
afterAll(async () => {
try {
await userApi.sites.deleteSites(sites);
} catch (error) {
Logger.error(`----- afterAll failed : ${error}`);
}
await userApi.sites.deleteSites(sites);
});
describe('on My Libraries', () => {

View File

@@ -43,12 +43,11 @@ describe('Pagination on multiple pages on Trash', () => {
const { dataTable, pagination } = page;
beforeAll(async () => {
await adminApiActions.login();
await adminApiActions.createUser({ username });
await userActions.login(username, username);
filesDeletedIds = (await userApi.nodes.createFiles(filesForDelete)).list.entries.map((entries: any) => entries.entry.id);
await userActions.login(username, username);
await userActions.deleteNodes(filesDeletedIds, false);
await userActions.waitForTrashcanSize(51);
@@ -61,6 +60,7 @@ describe('Pagination on multiple pages on Trash', () => {
});
afterAll(async () => {
await userActions.login(username, username);
await userActions.emptyTrashcan();
});

View File

@@ -49,12 +49,12 @@ describe('Pagination on single page', () => {
const searchResultsPage = new SearchResultsPage();
beforeAll(async () => {
await adminApiActions.login();
await adminApiActions.createUser({ username });
await userActions.login(username, username);
const initialFavoriteTotalItems = await userApi.favorites.getFavoritesTotalItems();
const initialRecentFilesTotalItems = await userApi.search.getTotalItems(username);
await userActions.login(username, username);
const initialTrashTotalItems = await userActions.getTrashcanSize();
fileId = (await userApi.nodes.createFile(file)).entry.id;
@@ -74,6 +74,7 @@ describe('Pagination on single page', () => {
});
afterAll(async () => {
await userActions.login(username, username);
await userActions.deleteNodes([fileId]);
await userActions.deleteSites([siteId]);
await userActions.emptyTrashcan();

View File

@@ -24,6 +24,7 @@
*/
import { AdminActions, LoginPage, SearchResultsPage, RepoClient, Utils, SITE_VISIBILITY, SITE_ROLES } from '@alfresco/aca-testing-shared';
import { Logger } from '@alfresco/adf-testing';
describe('Search results - libraries', () => {
const random = Utils.random();
@@ -74,54 +75,61 @@ describe('Search results - libraries', () => {
const adminApiActions = new AdminActions();
beforeAll(async (done) => {
await adminApiActions.createUser({ username });
try {
await adminApiActions.createUser({ username });
await apis.user.sites.createSite(site1.name, SITE_VISIBILITY.PUBLIC, '', site1.id);
await apis.user.sites.createSite(site2.name, SITE_VISIBILITY.PUBLIC, '', site2.id);
await apis.user.sites.createSite(site3.name, SITE_VISIBILITY.PUBLIC, '', site3.id);
await apis.user.sites.createSite(site4.name, SITE_VISIBILITY.PUBLIC, site4.description, site4.id);
await apis.user.sites.createSite(site1.name, SITE_VISIBILITY.PUBLIC, '', site1.id);
await apis.user.sites.createSite(site2.name, SITE_VISIBILITY.PUBLIC, '', site2.id);
await apis.user.sites.createSite(site3.name, SITE_VISIBILITY.PUBLIC, '', site3.id);
await apis.user.sites.createSite(site4.name, SITE_VISIBILITY.PUBLIC, site4.description, site4.id);
await apis.user.sites.createSite(userSitePublic, SITE_VISIBILITY.PUBLIC);
await apis.user.sites.createSite(userSiteModerated, SITE_VISIBILITY.MODERATED);
await apis.user.sites.createSite(userSitePrivate, SITE_VISIBILITY.PRIVATE);
await apis.user.sites.createSite(userSitePublic, SITE_VISIBILITY.PUBLIC);
await apis.user.sites.createSite(userSiteModerated, SITE_VISIBILITY.MODERATED);
await apis.user.sites.createSite(userSitePrivate, SITE_VISIBILITY.PRIVATE);
await apis.user.sites.createSite(siteRussian.name, SITE_VISIBILITY.PUBLIC, '', siteRussian.id);
await apis.user.sites.createSite(siteRussian.name, SITE_VISIBILITY.PUBLIC, '', siteRussian.id);
await adminApiActions.sites.createSite(adminSite1, SITE_VISIBILITY.PUBLIC);
await adminApiActions.sites.createSite(adminSite2, SITE_VISIBILITY.PUBLIC);
await adminApiActions.sites.createSite(adminSite3, SITE_VISIBILITY.PUBLIC);
await adminApiActions.sites.createSite(adminSite4, SITE_VISIBILITY.PUBLIC);
await adminApiActions.sites.addSiteMember(adminSite1, username, SITE_ROLES.SITE_CONSUMER.ROLE);
await adminApiActions.sites.addSiteMember(adminSite2, username, SITE_ROLES.SITE_CONTRIBUTOR.ROLE);
await adminApiActions.sites.addSiteMember(adminSite3, username, SITE_ROLES.SITE_COLLABORATOR.ROLE);
await adminApiActions.sites.addSiteMember(adminSite4, username, SITE_ROLES.SITE_MANAGER.ROLE);
await adminApiActions.sites.createSite(adminSite1, SITE_VISIBILITY.PUBLIC);
await adminApiActions.sites.createSite(adminSite2, SITE_VISIBILITY.PUBLIC);
await adminApiActions.sites.createSite(adminSite3, SITE_VISIBILITY.PUBLIC);
await adminApiActions.sites.createSite(adminSite4, SITE_VISIBILITY.PUBLIC);
await adminApiActions.sites.addSiteMember(adminSite1, username, SITE_ROLES.SITE_CONSUMER.ROLE);
await adminApiActions.sites.addSiteMember(adminSite2, username, SITE_ROLES.SITE_CONTRIBUTOR.ROLE);
await adminApiActions.sites.addSiteMember(adminSite3, username, SITE_ROLES.SITE_COLLABORATOR.ROLE);
await adminApiActions.sites.addSiteMember(adminSite4, username, SITE_ROLES.SITE_MANAGER.ROLE);
await adminApiActions.sites.createSite(adminPrivate, SITE_VISIBILITY.PRIVATE);
await adminApiActions.sites.createSite(adminPrivate, SITE_VISIBILITY.PRIVATE);
await adminApiActions.login();
await adminApiActions.sites.waitForSitesToBeCreated([adminSite1, adminSite2, adminSite3, adminSite4]);
await adminApiActions.login();
await adminApiActions.sites.waitForSitesToBeCreated([adminSite1, adminSite2, adminSite3, adminSite4]);
await apis.user.sites.waitForSitesToBeCreated([
site1.id,
site2.id,
site3.id,
site4.id,
userSitePublic,
userSiteModerated,
userSitePrivate,
siteRussian.id
]);
await apis.user.sites.waitForSitesToBeCreated([
site1.id,
site2.id,
site3.id,
site4.id,
userSitePublic,
userSiteModerated,
userSitePrivate,
siteRussian.id
]);
await apis.user.queries.waitForSites(random, { expect: 12 });
await apis.user.queries.waitForSites(random, { expect: 12 });
await loginPage.loginWith(username);
await loginPage.loginWith(username);
} catch (error) {
Logger.error(`----- beforeAll failed : ${error}`);
}
done();
});
afterAll(async () => {
await adminApiActions.login();
await adminApiActions.sites.deleteSites([adminSite1, adminSite2, adminSite3, adminSite4, adminPrivate]);
await apis.user.sites.deleteSites([site1.id, site2.id, site3.id, site4.id, userSitePublic, userSiteModerated, userSitePrivate, siteRussian.id]);
try {
await adminApiActions.sites.deleteSites([adminSite1, adminSite2, adminSite3, adminSite4, adminPrivate]);
await apis.user.sites.deleteSites([site1.id, site2.id, site3.id, site4.id, userSitePublic, userSiteModerated, userSitePrivate, siteRussian.id]);
} catch (error) {
Logger.error(`----- afterAll failed : ${error}`);
}
});
beforeEach(async () => {

View File

@@ -37,7 +37,7 @@ import {
ManageVersionsDialog,
UploadNewVersionDialog
} from '@alfresco/aca-testing-shared';
import { BrowserActions } from '@alfresco/adf-testing';
import { BrowserActions, Logger } from '@alfresco/adf-testing';
describe('Viewer actions', () => {
const username = `user-${Utils.random()}`;
@@ -63,11 +63,8 @@ describe('Viewer actions', () => {
const adminApiActions = new AdminActions();
const userActions = new UserActions();
beforeAll(async (done) => {
await adminApiActions.login();
beforeAll(async () => {
await adminApiActions.createUser({ username });
await userActions.login(username, username);
done();
});
describe('from Personal Files', () => {
@@ -94,45 +91,55 @@ describe('Viewer actions', () => {
let fileForUploadNewVersionId2: string;
beforeAll(async (done) => {
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
destinationId = (await apis.user.nodes.createFolder(destination)).entry.id;
try {
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
destinationId = (await apis.user.nodes.createFolder(destination)).entry.id;
docxFileId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, docxPersonalFiles)).entry.id;
docxFileId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, docxPersonalFiles)).entry.id;
filePersonalFilesId = (await apis.user.upload.uploadFile(docxFile2, parentId)).entry.id;
await apis.user.upload.uploadFileWithRename(xlsxFileForMove, parentId, xlsxPersonalFiles);
await apis.user.upload.uploadFileWithRename(pdfFileForDelete, parentId, pdfPersonalFiles);
filePersonalFilesId = (await apis.user.upload.uploadFile(docxFile2, parentId)).entry.id;
await apis.user.upload.uploadFileWithRename(xlsxFileForMove, parentId, xlsxPersonalFiles);
await apis.user.upload.uploadFileWithRename(pdfFileForDelete, parentId, pdfPersonalFiles);
fileForEditOfflineId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForEditOffline)).entry.id;
fileForCancelEditingId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForCancelEditing)).entry.id;
fileForUploadNewVersionId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForUploadNewVersion)).entry.id;
fileForUploadNewVersionId2 = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForUploadNewVersion2)).entry.id;
fileForEditOfflineId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForEditOffline)).entry.id;
fileForCancelEditingId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForCancelEditing)).entry.id;
fileForUploadNewVersionId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForUploadNewVersion)).entry.id;
fileForUploadNewVersionId2 = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForUploadNewVersion2)).entry.id;
await apis.user.nodes.lockFile(fileForCancelEditingId);
await apis.user.nodes.lockFile(fileForUploadNewVersionId);
await apis.user.nodes.lockFile(fileForUploadNewVersionId2);
await apis.user.nodes.lockFile(fileForCancelEditingId);
await apis.user.nodes.lockFile(fileForUploadNewVersionId);
await apis.user.nodes.lockFile(fileForUploadNewVersionId2);
await loginPage.loginWith(username);
await loginPage.loginWith(username);
} catch (error) {
Logger.error(`----- beforeAll failed : ${error}`);
}
done();
});
beforeEach(async (done) => {
await page.clickPersonalFilesAndWait();
await dataTable.doubleClickOnRowByName(parent);
await dataTable.waitForHeader();
done();
beforeEach(async () => {
try {
await page.clickPersonalFilesAndWait();
await dataTable.doubleClickOnRowByName(parent);
await dataTable.waitForHeader();
} catch (error) {
Logger.error(`----- beforeEach failed : ${error}`);
}
});
afterEach(async (done) => {
afterEach(async () => {
await Utils.pressEscape();
await page.closeUploadDialog();
done();
});
afterAll(async (done) => {
await userActions.deleteNodes([parentId, destinationId]);
await userActions.emptyTrashcan();
done();
afterAll(async () => {
try {
await userActions.login(username, username);
await userActions.deleteNodes([parentId, destinationId]);
await userActions.emptyTrashcan();
} catch (error) {
Logger.error(`----- afterAll failed : ${error}`);
}
});
it('[C268129] Download action', async () => {
@@ -323,45 +330,55 @@ describe('Viewer actions', () => {
let fileForUploadNewVersionId: string;
beforeAll(async (done) => {
await apis.user.sites.createSite(siteName);
const docLibId = await apis.user.sites.getDocLibId(siteName);
destinationId = (await apis.user.nodes.createFolder(destination)).entry.id;
docxFileId = (await apis.user.upload.uploadFileWithRename(docxFile, docLibId, docxLibraries)).entry.id;
try {
await apis.user.sites.createSite(siteName);
const docLibId = await apis.user.sites.getDocLibId(siteName);
destinationId = (await apis.user.nodes.createFolder(destination)).entry.id;
docxFileId = (await apis.user.upload.uploadFileWithRename(docxFile, docLibId, docxLibraries)).entry.id;
fileLibrariesId = (await apis.user.upload.uploadFile(docxFile2, docLibId)).entry.id;
fileLibrariesId = (await apis.user.upload.uploadFile(docxFile2, docLibId)).entry.id;
await apis.user.upload.uploadFileWithRename(xlsxFileForMove, docLibId, xlsxLibraries);
await apis.user.upload.uploadFileWithRename(pdfFileForDelete, docLibId, pdfLibraries);
await apis.user.upload.uploadFileWithRename(xlsxFileForMove, docLibId, xlsxLibraries);
await apis.user.upload.uploadFileWithRename(pdfFileForDelete, docLibId, pdfLibraries);
fileForEditOfflineId = (await apis.user.upload.uploadFileWithRename(docxFile, docLibId, fileForEditOffline)).entry.id;
fileForCancelEditingId = (await apis.user.upload.uploadFileWithRename(docxFile, docLibId, fileForCancelEditing)).entry.id;
fileForUploadNewVersionId = (await apis.user.upload.uploadFileWithRename(docxFile, docLibId, fileForUploadNewVersion)).entry.id;
fileForEditOfflineId = (await apis.user.upload.uploadFileWithRename(docxFile, docLibId, fileForEditOffline)).entry.id;
fileForCancelEditingId = (await apis.user.upload.uploadFileWithRename(docxFile, docLibId, fileForCancelEditing)).entry.id;
fileForUploadNewVersionId = (await apis.user.upload.uploadFileWithRename(docxFile, docLibId, fileForUploadNewVersion)).entry.id;
await apis.user.nodes.lockFile(fileForCancelEditingId);
await apis.user.nodes.lockFile(fileForUploadNewVersionId);
await apis.user.nodes.lockFile(fileForCancelEditingId);
await apis.user.nodes.lockFile(fileForUploadNewVersionId);
await loginPage.loginWith(username);
await loginPage.loginWith(username);
} catch (error) {
Logger.error(`----- beforeAll failed : ${error}`);
}
done();
});
beforeEach(async (done) => {
await page.goToMyLibrariesAndWait();
await dataTable.doubleClickOnRowByName(siteName);
await dataTable.waitForHeader();
done();
beforeEach(async () => {
try {
await page.goToMyLibrariesAndWait();
await dataTable.doubleClickOnRowByName(siteName);
await dataTable.waitForHeader();
} catch (error) {
Logger.error(`----- beforeEach failed : ${error}`);
}
});
afterEach(async (done) => {
afterEach(async () => {
await Utils.pressEscape();
await page.closeUploadDialog();
done();
});
afterAll(async (done) => {
await userActions.deleteSites([siteName]);
await userActions.deleteNodes([destinationId]);
await userActions.emptyTrashcan();
done();
afterAll(async () => {
try {
await userActions.login(username, username);
await userActions.deleteSites([siteName]);
await userActions.deleteNodes([destinationId]);
await userActions.emptyTrashcan();
} catch (error) {
Logger.error(`----- afterAll failed : ${error}`);
}
});
it('[C286369] Download action', async () => {
@@ -510,45 +527,51 @@ describe('Viewer actions', () => {
let fileForUploadNewVersionId: string;
beforeAll(async (done) => {
await apis.user.search.waitForApi(username, { expect: 0 });
try {
await apis.user.search.waitForApi(username, { expect: 0 });
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
destinationId = (await apis.user.nodes.createFolder(destination)).entry.id;
docxFileId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, docxRecentFiles)).entry.id;
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
destinationId = (await apis.user.nodes.createFolder(destination)).entry.id;
docxFileId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, docxRecentFiles)).entry.id;
fileRecentId = (await apis.user.upload.uploadFile(docxFile2, parentId)).entry.id;
fileRecentId = (await apis.user.upload.uploadFile(docxFile2, parentId)).entry.id;
fileForEditOfflineId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForEditOffline)).entry.id;
fileForCancelEditingId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForCancelEditing)).entry.id;
fileForUploadNewVersionId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForUploadNewVersion)).entry.id;
fileForEditOfflineId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForEditOffline)).entry.id;
fileForCancelEditingId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForCancelEditing)).entry.id;
fileForUploadNewVersionId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForUploadNewVersion)).entry.id;
await apis.user.nodes.lockFile(fileForCancelEditingId);
await apis.user.nodes.lockFile(fileForUploadNewVersionId);
await apis.user.nodes.lockFile(fileForCancelEditingId);
await apis.user.nodes.lockFile(fileForUploadNewVersionId);
await apis.user.upload.uploadFileWithRename(xlsxFileForMove, parentId, xlsxRecentFiles);
await apis.user.upload.uploadFileWithRename(pdfFileForDelete, parentId, pdfRecentFiles);
await apis.user.upload.uploadFileWithRename(xlsxFileForMove, parentId, xlsxRecentFiles);
await apis.user.upload.uploadFileWithRename(pdfFileForDelete, parentId, pdfRecentFiles);
await apis.user.search.waitForApi(username, { expect: 7 });
await apis.user.search.waitForApi(username, { expect: 7 });
await loginPage.loginWith(username);
await loginPage.loginWith(username);
} catch (error) {
Logger.error(`----- beforeAll failed : ${error}`);
}
done();
});
beforeEach(async (done) => {
beforeEach(async () => {
await page.clickRecentFilesAndWait();
done();
});
afterEach(async (done) => {
afterEach(async () => {
await Utils.pressEscape();
await page.closeUploadDialog();
done();
});
afterAll(async (done) => {
await userActions.deleteNodes([parentId, destinationId]);
await userActions.emptyTrashcan();
done();
afterAll(async () => {
try {
await userActions.login(username, username);
await userActions.deleteNodes([parentId, destinationId]);
await userActions.emptyTrashcan();
} catch (error) {
Logger.error(`----- afterAll failed : ${error}`);
}
});
it('[C286383] Download action', async () => {
@@ -700,60 +723,70 @@ describe('Viewer actions', () => {
let fileForUploadNewVersionId;
beforeAll(async (done) => {
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
destinationId = (await apis.user.nodes.createFolder(destination)).entry.id;
docxFileId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, docxSharedFiles)).entry.id;
try {
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
destinationId = (await apis.user.nodes.createFolder(destination)).entry.id;
docxFileId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, docxSharedFiles)).entry.id;
xlsxFileId = (await apis.user.upload.uploadFileWithRename(xlsxFileForMove, parentId, xlsxSharedFiles)).entry.id;
pdfFileId = (await apis.user.upload.uploadFileWithRename(pdfFileForDelete, parentId, pdfSharedFiles)).entry.id;
fileSharedId = (await apis.user.upload.uploadFile(docxFile2, parentId)).entry.id;
xlsxFileId = (await apis.user.upload.uploadFileWithRename(xlsxFileForMove, parentId, xlsxSharedFiles)).entry.id;
pdfFileId = (await apis.user.upload.uploadFileWithRename(pdfFileForDelete, parentId, pdfSharedFiles)).entry.id;
fileSharedId = (await apis.user.upload.uploadFile(docxFile2, parentId)).entry.id;
fileForEditOfflineId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForEditOffline)).entry.id;
fileForCancelEditingId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForCancelEditing)).entry.id;
fileForUploadNewVersionId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForUploadNewVersion)).entry.id;
fileForEditOfflineId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForEditOffline)).entry.id;
fileForCancelEditingId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForCancelEditing)).entry.id;
fileForUploadNewVersionId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForUploadNewVersion)).entry.id;
await apis.user.nodes.lockFile(fileForCancelEditingId);
await apis.user.nodes.lockFile(fileForUploadNewVersionId);
await apis.user.nodes.lockFile(fileForCancelEditingId);
await apis.user.nodes.lockFile(fileForUploadNewVersionId);
await apis.user.shared.shareFilesByIds([
docxFileId,
xlsxFileId,
pdfFileId,
fileForCancelEditingId,
fileForEditOfflineId,
fileForUploadNewVersionId,
fileSharedId
]);
await apis.user.shared.waitForFilesToBeShared([
docxFileId,
xlsxFileId,
pdfFileId,
fileForCancelEditingId,
fileForEditOfflineId,
fileForUploadNewVersionId,
fileSharedId
]);
await apis.user.shared.shareFilesByIds([
docxFileId,
xlsxFileId,
pdfFileId,
fileForCancelEditingId,
fileForEditOfflineId,
fileForUploadNewVersionId,
fileSharedId
]);
await apis.user.shared.waitForFilesToBeShared([
docxFileId,
xlsxFileId,
pdfFileId,
fileForCancelEditingId,
fileForEditOfflineId,
fileForUploadNewVersionId,
fileSharedId
]);
await loginPage.loginWith(username);
await loginPage.loginWith(username);
} catch (error) {
Logger.error(`----- beforeAll failed : ${error}`);
}
done();
});
beforeEach(async (done) => {
beforeEach(async () => {
await page.clickSharedFilesAndWait();
done();
});
afterEach(async (done) => {
await page.closeOpenDialogs();
await Utils.pressEscape();
await page.closeUploadDialog();
done();
afterEach(async () => {
try {
await page.closeOpenDialogs();
await Utils.pressEscape();
await page.closeUploadDialog();
} catch (error) {
Logger.error(`----- afterEach failed : ${error}`);
}
});
afterAll(async (done) => {
await userActions.deleteNodes([parentId, destinationId]);
await userActions.emptyTrashcan();
done();
afterAll(async () => {
try {
await userActions.login(username, username);
await userActions.deleteNodes([parentId, destinationId]);
await userActions.emptyTrashcan();
} catch (error) {
Logger.error(`----- afterAll failed : ${error}`);
}
});
it('[C286376] Download action', async () => {
@@ -904,51 +937,57 @@ describe('Viewer actions', () => {
let fileForUploadNewVersionId: string;
beforeAll(async (done) => {
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
destinationId = (await apis.user.nodes.createFolder(destination)).entry.id;
docxFileId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, docxFavorites)).entry.id;
try {
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
destinationId = (await apis.user.nodes.createFolder(destination)).entry.id;
docxFileId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, docxFavorites)).entry.id;
xlsxFileId = (await apis.user.upload.uploadFileWithRename(xlsxFileForMove, parentId, xlsxFavorites)).entry.id;
pdfFileId = (await apis.user.upload.uploadFileWithRename(pdfFileForDelete, parentId, pdfFavorites)).entry.id;
fileFavId = (await apis.user.upload.uploadFile(docxFile2, parentId)).entry.id;
xlsxFileId = (await apis.user.upload.uploadFileWithRename(xlsxFileForMove, parentId, xlsxFavorites)).entry.id;
pdfFileId = (await apis.user.upload.uploadFileWithRename(pdfFileForDelete, parentId, pdfFavorites)).entry.id;
fileFavId = (await apis.user.upload.uploadFile(docxFile2, parentId)).entry.id;
fileForEditOfflineId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForEditOffline)).entry.id;
fileForCancelEditingId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForCancelEditing)).entry.id;
fileForUploadNewVersionId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForUploadNewVersion)).entry.id;
fileForEditOfflineId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForEditOffline)).entry.id;
fileForCancelEditingId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForCancelEditing)).entry.id;
fileForUploadNewVersionId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForUploadNewVersion)).entry.id;
await apis.user.nodes.lockFile(fileForCancelEditingId);
await apis.user.nodes.lockFile(fileForUploadNewVersionId);
await apis.user.nodes.lockFile(fileForCancelEditingId);
await apis.user.nodes.lockFile(fileForUploadNewVersionId);
await apis.user.favorites.addFavoritesByIds('file', [
docxFileId,
xlsxFileId,
pdfFileId,
fileForEditOfflineId,
fileForCancelEditingId,
fileForUploadNewVersionId,
fileFavId
]);
await apis.user.favorites.waitForApi({ expect: 7 });
await apis.user.favorites.addFavoritesByIds('file', [
docxFileId,
xlsxFileId,
pdfFileId,
fileForEditOfflineId,
fileForCancelEditingId,
fileForUploadNewVersionId,
fileFavId
]);
await apis.user.favorites.waitForApi({ expect: 7 });
await loginPage.loginWith(username);
await loginPage.loginWith(username);
} catch (error) {
Logger.error(`----- beforeAll failed : ${error}`);
}
done();
});
beforeEach(async (done) => {
beforeEach(async () => {
await page.clickFavoritesAndWait();
done();
});
afterEach(async (done) => {
afterEach(async () => {
await Utils.pressEscape();
await page.closeUploadDialog();
done();
});
afterAll(async (done) => {
await userActions.deleteNodes([parentId, destinationId]);
await userActions.emptyTrashcan();
done();
afterAll(async () => {
try {
await userActions.login(username, username);
await userActions.deleteNodes([parentId, destinationId]);
await userActions.emptyTrashcan();
} catch (error) {
Logger.error(`----- afterAll failed : ${error}`);
}
});
it('[C286390] Download action', async () => {

View File

@@ -58,9 +58,7 @@ describe('Viewer general', () => {
const userActions = new UserActions();
beforeAll(async (done) => {
await adminApiActions.login();
await adminApiActions.createUser({ username });
await userActions.login(username, username);
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
xlsxFileId = (await apis.user.upload.uploadFile(xlsxFile, parentId)).entry.id;
@@ -73,6 +71,7 @@ describe('Viewer general', () => {
docLibSiteUserId = await apis.user.sites.getDocLibId(siteUser);
await apis.user.upload.uploadFile(fileInSite, docLibSiteUserId);
await userActions.login(username, username);
await userActions.shareNodes([xlsxFileId]);
await apis.user.favorites.addFavoriteById('file', xlsxFileId);

View File

@@ -228,7 +228,7 @@ export class DataTable extends Component {
await browser.actions().mouseMove(item).perform();
await browser.actions().doubleClick().perform();
} catch (error) {
Logger.error('--- catch: doubleClickOnRowByName : ', error);
Logger.error(`--- doubleClickOnRowByName catch : failed to double click on ${name} from location : ${location} : `, error);
}
}
@@ -252,7 +252,7 @@ export class DataTable extends Component {
const item = this.getRowFirstCell(name, location);
await item.click();
} catch (e) {
Logger.error('--- unselect item catch : ', e);
Logger.error(`--- unselect item catch : failed to unselect ${name} from location : ${location} : `, e);
}
}
}

View File

@@ -25,7 +25,7 @@
import { ElementFinder, by, browser, Locator } from 'protractor';
import { isPresentAndDisplayed, waitForPresence, waitForStaleness } from '../../utilities/utils';
import { BrowserVisibility } from '@alfresco/adf-testing';
import { BrowserVisibility, Logger } from '@alfresco/adf-testing';
export abstract class GenericDialog {
protected constructor(private rootCssSelector?: string) {}
@@ -53,7 +53,11 @@ export abstract class GenericDialog {
}
async waitForDialogToClose(): Promise<void> {
await waitForStaleness(this.content);
try {
await waitForStaleness(this.content);
} catch (error) {
Logger.error(`GenericDialog waitForDialogToClose : catch : ${error}`);
}
}
async isDialogOpen(): Promise<boolean> {

View File

@@ -128,7 +128,7 @@ export class Menu extends Component {
const elem = this.getItemByLabel(menuItem);
await BrowserActions.click(elem);
} catch (e) {
Logger.error('___click menu item catch___', e);
Logger.error(`___click menu item catch : failed to click on ${menuItem}___`, e);
}
}
@@ -139,7 +139,7 @@ export class Menu extends Component {
await browser.actions().mouseMove(elem).perform();
await browser.sleep(500);
} catch (error) {
Logger.error('----- mouse over error: ', error);
Logger.error(`----- mouse over error : failed to mouse over ${menuItem} : `, error);
}
}

View File

@@ -58,7 +58,7 @@ export class Sidenav extends Component {
await element(by.css('.mat-expansion-panel-body')).isPresent();
}
} catch (e) {
Logger.error('---- sidebar navigation catch expandMenu: ', e);
Logger.error(`---- sidebar navigation catch expandMenu: failed to expand ${name} menu : `, e);
}
}
@@ -144,7 +144,7 @@ export class Sidenav extends Component {
const link = this.getLinkLabel(name);
await BrowserActions.click(link);
} catch (error) {
Logger.error('---- sidebar navigation clickLink catch error: ', error);
Logger.error(`---- clickLink catch : sidebar navigation failed to click on - ${name} : `, error);
}
}

View File

@@ -27,7 +27,7 @@ import { LoginComponent } from '../components/components';
import { Page } from './page';
import { APP_ROUTES } from '../configs';
import { waitForPresence } from '../utilities/utils';
import { BrowserActions } from '@alfresco/adf-testing';
import { BrowserActions, Logger } from '@alfresco/adf-testing';
export class LoginPage extends Page {
login = new LoginComponent(this.appRoot);
@@ -47,13 +47,17 @@ export class LoginPage extends Page {
}
async loginWith(username: string, password?: string) {
const pass = password || username;
try {
const pass = password || username;
await this.load();
await this.load();
await this.login.enterCredentials(username, pass);
await BrowserActions.click(this.login.submitButton);
await this.waitForApp();
await this.login.enterCredentials(username, pass);
await BrowserActions.click(this.login.submitButton);
await this.waitForApp();
} catch (error) {
Logger.error(`----- loginWith catch : failed to login with user: ${username} : ${error}`);
}
}
async loginWithAdmin() {

View File

@@ -57,7 +57,7 @@ export abstract class Page {
return browser.get(path);
}
async waitForApp() {
async waitForApp(): Promise<void> {
await waitForPresence(this.layout);
}
@@ -67,15 +67,15 @@ export abstract class Page {
await BrowserVisibility.waitUntilElementIsPresent(browser.element(by.css('[class*="login-content"] input#username')));
}
async waitForDialog() {
async waitForDialog(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.dialogContainer);
}
async isDialogOpen() {
return browser.isElementPresent(this.dialogContainer);
async isDialogOpen(): Promise<boolean> {
return isPresentAndDisplayed(this.dialogContainer);
}
async closeOpenDialogs() {
async closeOpenDialogs(): Promise<void> {
while (await this.isDialogOpen()) {
await Utils.pressEscape();
}

View File

@@ -26,7 +26,7 @@
import { RepoApi } from '../repo-api';
import { Logger } from '@alfresco/adf-testing';
import { Utils } from '../../../../utilities/utils';
import { SharedlinksApi as AdfSharedlinksApi, SharedLinkEntry } from '@alfresco/js-api';
import { SharedlinksApi as AdfSharedlinksApi, SharedLinkEntry, SharedLinkPaging } from '@alfresco/js-api';
export class SharedLinksApi extends RepoApi {
sharedlinksApi = new AdfSharedlinksApi(this.alfrescoJsApi);
@@ -75,7 +75,7 @@ export class SharedLinksApi extends RepoApi {
}
}
async unshareFileById(fileId: string) {
async unshareFileById(fileId: string): Promise<any> {
try {
const sharedId = await this.getSharedIdOfNode(fileId);
return await this.sharedlinksApi.deleteSharedLink(sharedId);
@@ -84,7 +84,7 @@ export class SharedLinksApi extends RepoApi {
}
}
async getSharedLinks(maxItems: number = 250) {
async getSharedLinks(maxItems: number = 250): Promise<SharedLinkPaging | null> {
try {
await this.apiAuth();
const opts = {
@@ -111,7 +111,7 @@ export class SharedLinksApi extends RepoApi {
}
}
async waitForApi(data: { expect: number }) {
async waitForApi(data: { expect: number }): Promise<any> {
try {
const sharedFiles = async () => {
const totalItems = await this.getSharedLinksTotalItems();
@@ -129,7 +129,7 @@ export class SharedLinksApi extends RepoApi {
}
}
async waitForFilesToBeShared(filesIds: string[]) {
async waitForFilesToBeShared(filesIds: string[]): Promise<any> {
try {
const sharedFile = async () => {
const sharedFiles = (await this.getSharedLinks()).list.entries.map((link) => link.entry.nodeId);
@@ -143,12 +143,12 @@ export class SharedLinksApi extends RepoApi {
return await Utils.retryCall(sharedFile);
} catch (error) {
Logger.error(`SharedLinksApi waitForFilesToBeShared : catch : `);
Logger.error(`SharedLinksApi waitForFilesToBeShared : catch : ${error}`);
Logger.error(`\tWait timeout reached waiting for files to be shared`);
}
}
async waitForFilesToNotBeShared(filesIds: string[]) {
async waitForFilesToNotBeShared(filesIds: string[]): Promise<any> {
try {
const sharedFile = async () => {
const sharedFiles = (await this.getSharedLinks()).list.entries.map((link) => link.entry.nodeId);
@@ -166,7 +166,7 @@ export class SharedLinksApi extends RepoApi {
return await Utils.retryCall(sharedFile);
} catch (error) {
Logger.error(`SharedLinksApi waitForFilesToNotBeShared : catch : `);
Logger.error(`SharedLinksApi waitForFilesToNotBeShared : catch : ${error}`);
Logger.error(`\tWait timeout reached waiting for files to no longer be shared`);
}
}

View File

@@ -168,12 +168,16 @@ export class SitesApi extends RepoApi {
}
async deleteSites(siteIds: string[], permanent: boolean = true) {
if (siteIds && siteIds.length > 0) {
await this.apiAuth();
try {
if (siteIds && siteIds.length > 0) {
await this.apiAuth();
for (const siteId of siteIds) {
await this.sitesApi.deleteSite(siteId, { permanent });
for (const siteId of siteIds) {
await this.sitesApi.deleteSite(siteId, { permanent });
}
}
} catch (error) {
this.handleError(`SitesApi deleteSites : catch : `, error);
}
}
@@ -287,7 +291,7 @@ export class SitesApi extends RepoApi {
return await Utils.retryCall(site);
} catch (error) {
Logger.error(`SitesApi waitForSitesToBeCreated : catch : `);
Logger.error(`SitesApi waitForSitesToBeCreated : catch : ${error}`);
Logger.error(`\tWait timeout reached waiting for sites to be created`);
}
}

View File

@@ -142,7 +142,7 @@ export class Utils {
if (fileExists) {
fs.rename(oldFilePath, newFilePath, function (err: any) {
if (err) {
Logger.error('==== rename err: ', err);
Logger.error(`==== rename err : failed to rename file from ${oldName} to ${newName} : `, err);
}
});
}
@@ -159,7 +159,7 @@ export class Utils {
});
await zip.on('error', (err: any) => {
Logger.error('=== unzip err: ', err);
Logger.error(`=== unzip err : failed to unzip ${filename} - ${unzippedName} :`, err);
});
await zip.on('ready', async () => {