e2e improvements part2 (#1728)

* deprecate comments api wrapper, delete sites perf improve

* introduce user actions

* admin actions inherit user actions

* unlock nodes helper

* api improvements

* api improvements

* update code

* api improvements

* deprecate trashcan api wrapper

* shared api improvements
This commit is contained in:
Denys Vuika
2020-10-07 19:06:21 +01:00
committed by GitHub
parent ffa7ca3aa6
commit e9b837462a
35 changed files with 509 additions and 458 deletions

View File

@@ -23,7 +23,7 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { RepoClient, Utils, AdminActions, LoginPage, FILES } from '@alfresco/aca-testing-shared';
import { RepoClient, Utils, AdminActions, UserActions, LoginPage, FILES } from '@alfresco/aca-testing-shared';
import * as testData from './test-data';
import { personalFilesTests } from './personal-files';
import { recentFilesTests } from './recent-files';
@@ -35,9 +35,7 @@ import { trashTests } from './trash';
describe('Files / folders actions : ', () => {
const random = Utils.random();
const username = `user-${random}`;
const parent = `parent-${random}`;
let parentId: string;
@@ -60,11 +58,14 @@ describe('Files / folders actions : ', () => {
const userApi = new RepoClient(username, username);
const adminApiActions = new AdminActions();
const userActions = new UserActions();
const loginPage = new LoginPage();
beforeAll(async () => {
await adminApiActions.login();
await adminApiActions.createUser({ username });
await userActions.login(username, username);
parentId = (await userApi.nodes.createFolder(parent)).entry.id;
@@ -121,8 +122,8 @@ describe('Files / folders actions : ', () => {
});
afterAll(async () => {
await userApi.nodes.deleteNodeById(parentId);
await userApi.trashcan.emptyTrash();
await userActions.deleteNodes([parentId]);
await userActions.emptyTrashcan();
});
beforeEach(async () => {
@@ -160,12 +161,9 @@ describe('Files / folders actions : ', () => {
folderInTrashId = (await userApi.nodes.createFolder(testData.folderInTrash.name)).entry.id;
folder2InTrashId = (await userApi.nodes.createFolder(testData.folder2InTrash.name)).entry.id;
const initialDeletedTotalItems = await userApi.trashcan.getDeletedNodesTotalItems();
await userApi.nodes.deleteNodeById(fileInTrashId, false);
await userApi.nodes.deleteNodeById(file2InTrashId, false);
await userApi.nodes.deleteNodeById(folderInTrashId, false);
await userApi.nodes.deleteNodeById(folder2InTrashId, false);
await userApi.trashcan.waitForApi({ expect: initialDeletedTotalItems + 4 });
const initialDeletedTotalItems = await userActions.getTrashcanSize();
await userActions.deleteNodes([fileInTrashId, file2InTrashId, folderInTrashId, folder2InTrashId], false);
await userActions.waitForTrashcanSize(initialDeletedTotalItems + 4);
});
trashTests();
});

View File

@@ -23,7 +23,7 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { LoginPage, BrowsingPage, SearchResultsPage, RepoClient, Utils, AdminActions } from '@alfresco/aca-testing-shared';
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';
@@ -31,8 +31,8 @@ describe('Library actions : ', () => {
const username = `user-${Utils.random()}`;
const userApi = new RepoClient(username, username);
const adminApiActions = new AdminActions();
const userActions = new UserActions();
const loginPage = new LoginPage();
const page = new BrowsingPage();
@@ -40,11 +40,13 @@ describe('Library actions : ', () => {
const { searchInput } = searchResultsPage.header;
beforeAll(async () => {
await adminApiActions.login();
await adminApiActions.createUser({ username });
await userActions.login(username, username);
const initialAdminSitesTotalItems = await adminApiActions.sites.getSitesTotalItems();
const initialUserSitesTotalItems = await userApi.sites.getSitesTotalItems();
const initialDeletedTotalItems = await userApi.trashcan.getDeletedNodesTotalItems();
const initialDeletedTotalItems = await userActions.getTrashcanSize();
const initialQuerySitesTotalItems = await userApi.queries.findSitesTotalItems('actionsSite-');
await userApi.sites.createSite(testData.publicUserMemberFav.name);
@@ -78,33 +80,30 @@ describe('Library actions : ', () => {
await userApi.sites.createSite(testData.siteInTrash.name);
await userApi.sites.createSite(testData.site2InTrash.name);
await userApi.sites.deleteSite(testData.siteInTrash.name, false);
await userApi.sites.deleteSite(testData.site2InTrash.name, false);
await userApi.trashcan.waitForApi({ expect: initialDeletedTotalItems + 2 });
await userActions.deleteSites([testData.siteInTrash.name, testData.site2InTrash.name], false);
await userActions.waitForTrashcanSize(initialDeletedTotalItems + 2);
await loginPage.loginWith(username);
});
afterAll(async () => {
await Promise.all([
userApi.sites.deleteSites([
testData.publicUserMemberFav.name,
testData.privateUserMemberFav.name,
testData.moderatedUserMemberFav.name,
testData.publicUserMemberNotFav.name,
testData.privateUserMemberNotFav.name,
testData.moderatedUserMemberNotFav.name
]),
adminApiActions.sites.deleteSites([
testData.publicNotMemberFav.name,
testData.moderatedNotMemberFav.name,
testData.publicNotMemberNotFav.name,
testData.moderatedNotMemberNotFav.name,
testData.moderatedRequestedJoinFav.name,
testData.moderatedRequestedJoinNotFav.name
]),
userApi.trashcan.emptyTrash()
await userActions.deleteSites([
testData.publicUserMemberFav.name,
testData.privateUserMemberFav.name,
testData.moderatedUserMemberFav.name,
testData.publicUserMemberNotFav.name,
testData.privateUserMemberNotFav.name,
testData.moderatedUserMemberNotFav.name
]);
await adminApiActions.deleteSites([
testData.publicNotMemberFav.name,
testData.moderatedNotMemberFav.name,
testData.publicNotMemberNotFav.name,
testData.moderatedNotMemberNotFav.name,
testData.moderatedRequestedJoinFav.name,
testData.moderatedRequestedJoinNotFav.name
]);
await userActions.emptyTrashcan();
});
describe('on My Libraries', () => {

View File

@@ -23,7 +23,7 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { AdminActions, LoginPage, BrowsingPage, ContentNodeSelectorDialog, RepoClient, Utils } from '@alfresco/aca-testing-shared';
import { AdminActions, UserActions, LoginPage, BrowsingPage, ContentNodeSelectorDialog, RepoClient, Utils } from '@alfresco/aca-testing-shared';
describe('Copy content', () => {
const username = `user-${Utils.random()}`;
@@ -108,10 +108,14 @@ describe('Copy content', () => {
const { dataTable, toolbar } = page;
const copyDialog = new ContentNodeSelectorDialog();
const { searchInput } = page.header;
const adminApiActions = new AdminActions();
const userActions = new UserActions();
beforeAll(async (done) => {
await adminApiActions.login();
await adminApiActions.createUser({ username });
await userActions.login(username, username);
const initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems();
const initialFavoritesTotalItems = await apis.user.favorites.getFavoritesTotalItems();
@@ -124,7 +128,7 @@ describe('Copy content', () => {
destinationIdSearch = (await apis.user.nodes.createFolder(destinationSearch)).entry.id;
existingFileToCopyId = (await apis.user.nodes.createFile(existingFile, sourceId)).entry.id;
await apis.user.shared.shareFileById(existingFileToCopyId);
await userActions.shareNodes([existingFileToCopyId]);
await apis.user.favorites.addFavoriteById('file', existingFileToCopyId);
await apis.user.nodes.createFile(existingFile, destinationIdPF);
@@ -152,7 +156,7 @@ describe('Copy content', () => {
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 apis.user.shared.shareFileById(fileInFolderId);
await userActions.shareNodes([fileInFolderId]);
folderExistingId = (await apis.user.nodes.createFolder(folderExisting, sourceId)).entry.id;
await apis.user.favorites.addFavoriteById('folder', folderExistingId);
@@ -184,11 +188,7 @@ describe('Copy content', () => {
file3Id = (await apis.user.nodes.createFile(file3, sourceId)).entry.id;
file4Id = (await apis.user.nodes.createFile(file4, sourceId)).entry.id;
await apis.user.shared.shareFileById(file1Id);
await apis.user.shared.shareFileById(file2Id);
await apis.user.shared.shareFileById(file3Id);
await apis.user.shared.shareFileById(file4Id);
await apis.user.shared.shareFileById(fileLocked1Id);
await userActions.shareNodes([file1Id, file2Id, file3Id, file4Id, fileLocked1Id]);
await apis.user.favorites.addFavoriteById('file', file1Id);
await apis.user.favorites.addFavoriteById('file', file2Id);

View File

@@ -23,7 +23,7 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { AdminActions, LoginPage, BrowsingPage, ContentNodeSelectorDialog, RepoClient, Utils } from '@alfresco/aca-testing-shared';
import { AdminActions, UserActions, LoginPage, BrowsingPage, ContentNodeSelectorDialog, RepoClient, Utils } from '@alfresco/aca-testing-shared';
describe('Move content', () => {
const username = `user-${Utils.random()}`;
@@ -62,10 +62,14 @@ describe('Move content', () => {
const page = new BrowsingPage();
const { dataTable, toolbar } = page;
const moveDialog = new ContentNodeSelectorDialog();
const adminApiActions = new AdminActions();
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);
@@ -420,20 +424,18 @@ describe('Move content', () => {
file1Id = (await apis.user.nodes.createFile(file1, sourceIdSF)).entry.id;
const initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems();
await apis.user.shared.shareFileById(file1Id);
await userActions.shareNodes([file1Id]);
file2Id = (await apis.user.nodes.createFile(file2, sourceIdSF)).entry.id;
file3Id = (await apis.user.nodes.createFile(file3, sourceIdSF)).entry.id;
await apis.user.shared.shareFileById(file2Id);
await apis.user.shared.shareFileById(file3Id);
await userActions.shareNodes([file2Id, file3Id]);
existingFileId = (await apis.user.nodes.createFile(`${existingFile}.txt`, sourceIdSF)).entry.id;
await apis.user.shared.shareFileById(existingFileId);
await userActions.shareNodes([existingFileId]);
await apis.user.nodes.createFile(`${existingFile}.txt`, destinationIdSF);
file4Id = (await apis.user.nodes.createFile(file4, sourceIdSF)).entry.id;
await apis.user.shared.shareFileById(file4Id);
await userActions.shareNodes([file4Id]);
await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 5 });
done();

View File

@@ -23,7 +23,7 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { AdminActions, LoginPage, BrowsingPage, RepoClient, Utils } from '@alfresco/aca-testing-shared';
import { AdminActions, UserActions, LoginPage, BrowsingPage, RepoClient, Utils } from '@alfresco/aca-testing-shared';
describe('Delete and undo delete', () => {
const username = `user-${Utils.random()}`;
@@ -35,14 +35,19 @@ describe('Delete and undo delete', () => {
const loginPage = new LoginPage();
const page = new BrowsingPage();
const { dataTable, toolbar } = page;
const adminApiActions = new AdminActions();
const userActions = new UserActions();
beforeAll(async () => {
await adminApiActions.login();
await adminApiActions.createUser({ username });
await userActions.login(username, username);
});
afterAll(async () => {
await apis.user.trashcan.emptyTrash();
await userActions.emptyTrashcan();
});
describe('on Recent Files', () => {
@@ -78,8 +83,8 @@ describe('Delete and undo delete', () => {
});
afterAll(async () => {
await apis.user.nodes.deleteNodeById(parentId);
await apis.user.trashcan.emptyTrash();
await userActions.deleteNodes([parentId]);
await userActions.emptyTrashcan();
});
it('[C280528] delete a file and check notification', async () => {
@@ -209,12 +214,9 @@ describe('Delete and undo delete', () => {
});
afterAll(async () => {
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 apis.user.nodes.deleteNodeById(parentId);
await apis.user.trashcan.emptyTrash();
await userActions.unlockNodes([fileLocked1Id, fileLocked2Id, fileLocked3Id, fileLocked4Id]);
await userActions.deleteNodes([parentId]);
await userActions.emptyTrashcan();
});
it('[C217125] delete a file and check notification', async () => {
@@ -362,8 +364,8 @@ describe('Delete and undo delete', () => {
});
afterAll(async (done) => {
await apis.user.nodes.deleteNodeById(parentId);
await apis.user.trashcan.emptyTrash();
await userActions.deleteNodes([parentId]);
await userActions.emptyTrashcan();
done();
});
@@ -498,12 +500,9 @@ describe('Delete and undo delete', () => {
});
afterAll(async (done) => {
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 apis.user.nodes.deleteNodeById(parentId);
await apis.user.trashcan.emptyTrash();
await userActions.unlockNodes([fileLocked1Id, fileLocked2Id, fileLocked3Id, fileLocked4Id]);
await userActions.deleteNodes([parentId]);
await userActions.emptyTrashcan();
done();
});

View File

@@ -23,7 +23,7 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { AdminActions, LoginPage, BrowsingPage, SearchResultsPage, RepoClient, Utils } from '@alfresco/aca-testing-shared';
import { AdminActions, UserActions, LoginPage, BrowsingPage, SearchResultsPage, RepoClient, Utils } from '@alfresco/aca-testing-shared';
describe('Download', () => {
const username = `user-${Utils.random()}`;
@@ -77,9 +77,12 @@ describe('Download', () => {
let initialRecentTotalItems: number;
const adminApiActions = new AdminActions();
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);
@@ -105,8 +108,7 @@ describe('Download', () => {
await apis.user.search.waitForApi(username, { expect: initialRecentTotalItems + 10 });
initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems();
await apis.user.shared.shareFileById(fileShared1Id);
await apis.user.shared.shareFileById(fileShared2Id);
await userActions.shareNodes([fileShared1Id, fileShared2Id]);
await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 2 });
initialFavoritesTotalItems = await apis.user.favorites.getFavoritesTotalItems();
@@ -119,8 +121,8 @@ describe('Download', () => {
});
afterAll(async (done) => {
await apis.user.nodes.deleteNodeById(parentId);
await apis.user.trashcan.emptyTrash();
await userActions.deleteNodes([parentId]);
await userActions.emptyTrashcan();
done();
});

View File

@@ -23,7 +23,17 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { AdminActions, SITE_VISIBILITY, SITE_ROLES, LoginPage, BrowsingPage, Utils, ConfirmDialog, RepoClient } from '@alfresco/aca-testing-shared';
import {
AdminActions,
UserActions,
SITE_VISIBILITY,
SITE_ROLES,
LoginPage,
BrowsingPage,
Utils,
ConfirmDialog,
RepoClient
} from '@alfresco/aca-testing-shared';
describe('Library actions', () => {
const username = `user-${Utils.random()}`;
@@ -64,9 +74,12 @@ describe('Library actions', () => {
const confirmDialog = new ConfirmDialog();
const adminApiActions = new AdminActions();
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);
@@ -95,7 +108,7 @@ describe('Library actions', () => {
});
afterAll(async () => {
await adminApiActions.sites.deleteSites([
await adminApiActions.deleteSites([
sitePublic1Admin,
siteSearchPublic1Admin,
sitePublic2Admin,
@@ -104,9 +117,7 @@ describe('Library actions', () => {
sitePublic5Admin,
sitePublic6Admin,
sitePublic7Admin,
sitePublic8Admin
]);
await adminApiActions.sites.deleteSites([
sitePublic8Admin,
siteSearchPublic2Admin,
siteSearchPublic3Admin,
siteSearchPublic4Admin,
@@ -115,8 +126,9 @@ describe('Library actions', () => {
siteSearchModerated1Admin,
siteSearchModerated2Admin
]);
await apis.user.sites.deleteSite(sitePublicUser);
await apis.user.trashcan.emptyTrash();
await userActions.deleteSites([sitePublicUser]);
await userActions.emptyTrashcan();
});
describe('Join a public library', () => {

View File

@@ -23,7 +23,7 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { AdminActions, LoginPage, BrowsingPage, ConfirmDialog, RepoClient, Utils } from '@alfresco/aca-testing-shared';
import { AdminActions, UserActions, LoginPage, BrowsingPage, ConfirmDialog, RepoClient, Utils } from '@alfresco/aca-testing-shared';
describe('Permanently delete from Trash', () => {
const username = `user-${Utils.random()}`;
@@ -49,16 +49,19 @@ describe('Permanently delete from Trash', () => {
const confirmDialog = new ConfirmDialog();
const adminApiActions = new AdminActions();
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 apis.user.nodes.deleteNodesById(filesIds, false);
await apis.user.nodes.deleteNodesById(foldersIds, false);
await apis.user.sites.deleteSite(site, false);
await userActions.deleteNodes([...filesIds, ...foldersIds], false);
await userActions.deleteSites([site], false);
await loginPage.loginWith(username);
done();
@@ -70,7 +73,7 @@ describe('Permanently delete from Trash', () => {
});
afterAll(async (done) => {
await apis.user.trashcan.emptyTrash();
await userActions.emptyTrashcan();
done();
});

View File

@@ -24,7 +24,7 @@
*/
import { browser } from 'protractor';
import { AdminActions, LoginPage, BrowsingPage, APP_ROUTES, RepoClient, Utils } from '@alfresco/aca-testing-shared';
import { AdminActions, UserActions, LoginPage, BrowsingPage, APP_ROUTES, RepoClient, Utils } from '@alfresco/aca-testing-shared';
describe('Restore from Trash', () => {
const username = `user-${Utils.random()}`;
@@ -37,15 +37,19 @@ describe('Restore from Trash', () => {
const page = new BrowsingPage();
const { dataTable, toolbar } = page;
const adminApiActions = new AdminActions();
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) => {
await apis.user.trashcan.emptyTrash();
await userActions.emptyTrashcan();
done();
});
@@ -61,8 +65,8 @@ describe('Restore from Trash', () => {
folderId = (await apis.user.nodes.createFolder(folder)).entry.id;
await apis.user.sites.createSite(site);
await apis.user.nodes.deleteNodesById([fileId, folderId], false);
await apis.user.sites.deleteSite(site, false);
await userActions.deleteNodes([fileId, folderId], false);
await userActions.deleteSites([site], false);
done();
});
@@ -72,7 +76,7 @@ describe('Restore from Trash', () => {
});
afterAll(async (done) => {
await apis.user.trashcan.emptyTrash();
await userActions.emptyTrashcan();
done();
});
@@ -86,7 +90,7 @@ describe('Restore from Trash', () => {
await page.clickPersonalFilesAndWait();
expect(await page.dataTable.isItemPresent(file)).toBe(true, 'Item not displayed in list');
await apis.user.nodes.deleteNodeById(fileId, false);
await userActions.deleteNodes([fileId], false);
});
it('[C280438] restore folder', async () => {
@@ -99,7 +103,7 @@ describe('Restore from Trash', () => {
await page.clickPersonalFilesAndWait();
expect(await page.dataTable.isItemPresent(folder)).toBe(true, 'Item not displayed in list');
await apis.user.nodes.deleteNodeById(folderId, false);
await userActions.deleteNodes([folderId], false);
});
it('[C290104] restore library', async () => {
@@ -125,7 +129,7 @@ describe('Restore from Trash', () => {
expect(await page.dataTable.isItemPresent(file)).toBe(true, 'Item not displayed in list');
expect(await page.dataTable.isItemPresent(folder)).toBe(true, 'Item not displayed in list');
await apis.user.nodes.deleteNodesById([fileId, folderId], false);
await userActions.deleteNodes([fileId, folderId], false);
});
it('[C217181] View from notification', async () => {
@@ -136,7 +140,7 @@ describe('Restore from Trash', () => {
expect(await page.sidenav.isActive('Personal Files')).toBe(true, 'Personal Files sidebar link not active');
expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
await apis.user.nodes.deleteNodeById(fileId, false);
await userActions.deleteNodes([fileId], false);
});
});
@@ -155,14 +159,13 @@ describe('Restore from Trash', () => {
beforeAll(async (done) => {
folder1Id = (await apis.user.nodes.createFolder(folder1)).entry.id;
file1Id1 = (await apis.user.nodes.createFile(file1, folder1Id)).entry.id;
await apis.user.nodes.deleteNodeById(file1Id1, false);
await userActions.deleteNodes([file1Id1], false);
file1Id2 = (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 apis.user.nodes.deleteNodeById(file2Id, false);
await apis.user.nodes.deleteNodeById(folder2Id, false);
await userActions.deleteNodes([file2Id, folder2Id], false);
done();
});
@@ -172,7 +175,8 @@ describe('Restore from Trash', () => {
});
afterAll(async (done) => {
await Promise.all([apis.user.nodes.deleteNodeById(file1Id2), apis.user.trashcan.emptyTrash()]);
await userActions.deleteNodes([file1Id2]);
await userActions.emptyTrashcan();
done();
});
@@ -217,20 +221,16 @@ describe('Restore from Trash', () => {
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 apis.user.nodes.deleteNodeById(file1Id, false);
await apis.user.nodes.deleteNodeById(folder1Id, false);
await apis.user.nodes.deleteNodeById(file2Id, false);
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;
await apis.user.nodes.deleteNodeById(file3Id, false);
await apis.user.nodes.deleteNodeById(file4Id, false);
await apis.user.nodes.deleteNodeById(folder3Id, false);
await apis.user.nodes.deleteNodeById(file5Id, false);
await userActions.deleteNodes([file3Id, file4Id, folder3Id, file5Id], false);
await loginPage.loginWith(username);
done();
});
@@ -241,7 +241,7 @@ describe('Restore from Trash', () => {
});
afterAll(async (done) => {
await apis.user.trashcan.emptyTrash();
await userActions.emptyTrashcan();
done();
});

View File

@@ -24,7 +24,17 @@
*/
import { browser } from 'protractor';
import { AdminActions, LoginPage, BrowsingPage, SITE_VISIBILITY, RepoClient, ShareDialog, Viewer, Utils } from '@alfresco/aca-testing-shared';
import {
AdminActions,
UserActions,
LoginPage,
BrowsingPage,
SITE_VISIBILITY,
RepoClient,
ShareDialog,
Viewer,
Utils
} from '@alfresco/aca-testing-shared';
describe('Share a file', () => {
const username = `user-${Utils.random()}`;
@@ -60,9 +70,13 @@ describe('Share a file', () => {
};
const adminApiActions = new AdminActions();
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;
done();
});
@@ -127,8 +141,7 @@ describe('Share a file', () => {
file9Id = (await apis.user.nodes.createFile(file9, parentId)).entry.id;
initialTotalItems = await apis.user.shared.getSharedLinksTotalItems();
await apis.user.shared.shareFileById(file6Id, expiryDate);
await apis.user.shared.shareFileById(file7Id, expiryDate);
await userActions.shareNodes([file6Id, file7Id], expiryDate);
await apis.user.shared.waitForApi({ expect: initialTotalItems + 2 });
});
@@ -312,8 +325,7 @@ describe('Share a file', () => {
file9Id = (await apis.user.nodes.createFile(file9, parentInSiteId)).entry.id;
initialTotalItems = await apis.user.shared.getSharedLinksTotalItems();
await apis.user.shared.shareFileById(file6Id, expiryDate);
await apis.user.shared.shareFileById(file7Id, expiryDate);
await userActions.shareNodes([file6Id, file7Id], expiryDate);
await apis.user.shared.waitForApi({ expect: initialTotalItems + 2 });
});
@@ -485,8 +497,7 @@ describe('Share a file', () => {
file9Id = (await apis.user.nodes.createFile(file9, parentId)).entry.id;
initialTotalItems = await apis.user.shared.getSharedLinksTotalItems();
await apis.user.shared.shareFileById(file6Id, expiryDate);
await apis.user.shared.shareFileById(file7Id, expiryDate);
await userActions.shareNodes([file6Id, file7Id], expiryDate);
await apis.user.shared.waitForApi({ expect: initialTotalItems + 2 });
});
@@ -660,13 +671,9 @@ describe('Share a file', () => {
file7Id = (await apis.user.nodes.createFile(file7, parentId)).entry.id;
initialTotalItems = await apis.user.shared.getSharedLinksTotalItems();
await apis.user.shared.shareFileById(file1Id);
await apis.user.shared.shareFileById(file2Id);
await apis.user.shared.shareFileById(file3Id);
await apis.user.shared.shareFileById(file4Id, expiryDate);
await apis.user.shared.shareFileById(file5Id, expiryDate);
await apis.user.shared.shareFileById(file6Id);
await apis.user.shared.shareFileById(file7Id);
await userActions.shareNodes([file1Id, file2Id, file3Id]);
await userActions.shareNodes([file4Id, file5Id], expiryDate);
await userActions.shareNodes([file6Id, file7Id]);
await apis.user.shared.waitForApi({ expect: initialTotalItems + 7 });
});
@@ -820,8 +827,7 @@ describe('Share a file', () => {
await apis.user.favorites.addFavoriteById('file', file8Id);
await apis.user.favorites.addFavoriteById('file', file9Id);
await apis.user.shared.shareFileById(file6Id, expiryDate);
await apis.user.shared.shareFileById(file7Id, expiryDate);
await userActions.shareNodes([file6Id, file7Id], expiryDate);
await apis.user.favorites.waitForApi({ expect: 9 });
await apis.user.shared.waitForApi({ expect: initialTotalItems + 2 });
});
@@ -1002,8 +1008,7 @@ describe('Share a file', () => {
await apis.user.search.waitForNodes('search-f', { expect: initialSearchByTermTotalItems + 5 });
initialTotalItems = await apis.user.shared.getSharedLinksTotalItems();
await apis.user.shared.shareFileById(file6Id, expiryDate);
await apis.user.shared.shareFileById(file7Id, expiryDate);
await userActions.shareNodes([file6Id, file7Id], expiryDate);
await apis.user.shared.waitForApi({ expect: initialTotalItems + 2 });
});

View File

@@ -26,6 +26,7 @@
import { browser } from 'protractor';
import {
AdminActions,
UserActions,
LoginPage,
BrowsingPage,
SITE_VISIBILITY,
@@ -71,10 +72,15 @@ describe('Unshare a file from Search Results', () => {
const contextMenu = dataTable.menu;
const viewer = new Viewer();
const { searchInput } = page.header;
const adminApiActions = new AdminActions();
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;
const initialSearchByTermTotalItems = await apis.user.search.getSearchByTermTotalItems('search-file');
@@ -84,11 +90,7 @@ describe('Unshare a file from Search Results', () => {
file4Id = (await apis.user.nodes.createFile(file4, parentId)).entry.id;
const initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems();
await apis.user.shared.shareFileById(file1Id);
await apis.user.shared.shareFileById(file2Id);
await apis.user.shared.shareFileById(file3Id);
await apis.user.shared.shareFileById(file4Id);
await userActions.shareNodes([file1Id, file2Id, file3Id, file4Id]);
await adminApiActions.sites.createSite(sitePrivate, SITE_VISIBILITY.PRIVATE);
const docLibId = await adminApiActions.sites.getDocLibId(sitePrivate);
@@ -97,8 +99,8 @@ describe('Unshare a file from Search Results', () => {
await adminApiActions.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_CONSUMER.ROLE);
await adminApiActions.shared.shareFileById(fileSite1Id);
await apis.user.shared.shareFileById(fileSite2Id);
await adminApiActions.shareNodes([fileSite1Id]);
await userActions.shareNodes([fileSite2Id]);
await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 6 });
await apis.user.search.waitForNodes('search-file', { expect: initialSearchByTermTotalItems + 6 });

View File

@@ -26,6 +26,7 @@
import { browser } from 'protractor';
import {
AdminActions,
UserActions,
LoginPage,
BrowsingPage,
SITE_VISIBILITY,
@@ -54,10 +55,15 @@ describe('Unshare a file', () => {
const confirmDialog = new ConfirmDialog();
const contextMenu = dataTable.menu;
const viewer = new Viewer();
const adminApiActions = new AdminActions();
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;
await loginPage.loginWith(username);
done();
@@ -85,10 +91,8 @@ describe('Unshare a file', () => {
file3Id = (await apis.user.nodes.createFile(file3, parentId)).entry.id;
file4Id = (await apis.user.nodes.createFile(file4, parentId)).entry.id;
initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems();
await apis.user.shared.shareFileById(file1Id);
await apis.user.shared.shareFileById(file2Id);
await apis.user.shared.shareFileById(file3Id);
await apis.user.shared.shareFileById(file4Id);
await userActions.shareNodes([file1Id, file2Id, file3Id, file4Id]);
await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 4 });
done();
});
@@ -213,10 +217,8 @@ describe('Unshare a file', () => {
file3Id = (await apis.user.nodes.createFile(file3, parentInSiteId)).entry.id;
file4Id = (await apis.user.nodes.createFile(file4, parentInSiteId)).entry.id;
initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems();
await apis.user.shared.shareFileById(file1Id);
await apis.user.shared.shareFileById(file2Id);
await apis.user.shared.shareFileById(file3Id);
await apis.user.shared.shareFileById(file4Id);
await userActions.shareNodes([file1Id, file2Id, file3Id, file4Id]);
await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 4 });
done();
});
@@ -333,10 +335,8 @@ describe('Unshare a file', () => {
file4Id = (await apis.user.nodes.createFile(file4, parentId)).entry.id;
initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems();
await apis.user.shared.shareFileById(file1Id);
await apis.user.shared.shareFileById(file2Id);
await apis.user.shared.shareFileById(file3Id);
await apis.user.shared.shareFileById(file4Id);
await userActions.shareNodes([file1Id, file2Id, file3Id, file4Id]);
await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 4 });
done();
});
@@ -452,10 +452,8 @@ describe('Unshare a file', () => {
file4Id = (await apis.user.nodes.createFile(file4, parentId)).entry.id;
initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems();
await apis.user.shared.shareFileById(file1Id);
await apis.user.shared.shareFileById(file2Id);
await apis.user.shared.shareFileById(file3Id);
await apis.user.shared.shareFileById(file4Id);
await userActions.shareNodes([file1Id, file2Id, file3Id, file4Id]);
await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 4 });
done();
});
@@ -571,10 +569,8 @@ describe('Unshare a file', () => {
file4Id = (await apis.user.nodes.createFile(file4, parentId)).entry.id;
initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems();
await apis.user.shared.shareFileById(file1Id);
await apis.user.shared.shareFileById(file2Id);
await apis.user.shared.shareFileById(file3Id);
await apis.user.shared.shareFileById(file4Id);
await userActions.shareNodes([file1Id, file2Id, file3Id, file4Id]);
await apis.user.favorites.addFavoriteById('file', file1Id);
await apis.user.favorites.addFavoriteById('file', file2Id);
@@ -709,12 +705,8 @@ describe('Unshare a file', () => {
await adminApiActions.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_CONSUMER.ROLE);
const initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems();
await adminApiActions.shared.shareFileById(file1FileLibId);
await apis.user.shared.shareFileById(file2FileLibId);
await adminApiActions.shared.shareFileById(file1SharedId);
await apis.user.shared.shareFileById(file2SharedId);
await adminApiActions.shared.shareFileById(file1FavId);
await apis.user.shared.shareFileById(file2FavId);
await adminApiActions.shareNodes([file1FileLibId, file1SharedId, file1FavId]);
await userActions.shareNodes([file2FileLibId, file2SharedId, file2FavId]);
await apis.user.favorites.addFavoriteById('file', file1FavId);
await apis.user.favorites.addFavoriteById('file', file2FavId);

View File

@@ -23,7 +23,7 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { AdminActions, LoginPage, BrowsingPage, RepoClient, InfoDrawer, Utils } from '@alfresco/aca-testing-shared';
import { AdminActions, UserActions, LoginPage, BrowsingPage, RepoClient, InfoDrawer, Utils } from '@alfresco/aca-testing-shared';
const moment = require('moment');
describe('Comments', () => {
@@ -63,10 +63,14 @@ describe('Comments', () => {
const loginPage = new LoginPage();
const page = new BrowsingPage();
const { dataTable } = page;
const adminApiActions = new AdminActions();
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;
@@ -79,8 +83,8 @@ describe('Comments', () => {
fileWith1CommentId = (await apis.user.nodes.createFile(fileWith1Comment, parentId)).entry.id;
fileWith2CommentsId = (await apis.user.nodes.createFile(fileWith2Comments, parentId)).entry.id;
comment1File2Entry = (await apis.user.comments.addComment(fileWith2CommentsId, 'first comment')).entry;
comment2File2Entry = (await apis.user.comments.addComment(fileWith2CommentsId, 'second comment')).entry;
comment1File2Entry = await userActions.createComment(fileWith2CommentsId, 'first comment');
comment2File2Entry = await userActions.createComment(fileWith2CommentsId, 'second comment');
const initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems();
await apis.user.shared.shareFilesByIds([file2SharedId, fileWith1CommentId, fileWith2CommentsId]);
@@ -97,7 +101,7 @@ describe('Comments', () => {
});
afterAll(async (done) => {
await apis.user.nodes.deleteNodeById(parentId);
await userActions.deleteNodes([parentId]);
done();
});
@@ -351,7 +355,7 @@ describe('Comments', () => {
describe('Comment info display', () => {
beforeAll(async (done) => {
commentFile1Entry = (await apis.user.comments.addComment(fileWith1CommentId, 'this is my comment')).entry;
commentFile1Entry = await userActions.createComment(fileWith1CommentId, 'this is my comment');
await apis.user.favorites.waitForApi({ expect: 4 });
await apis.user.search.waitForApi(username, { expect: 7 });

View File

@@ -23,7 +23,7 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { AdminActions, SITE_VISIBILITY, SITE_ROLES, LoginPage, BrowsingPage, Utils, RepoClient } from '@alfresco/aca-testing-shared';
import { AdminActions, UserActions, SITE_VISIBILITY, SITE_ROLES, LoginPage, BrowsingPage, Utils, RepoClient } from '@alfresco/aca-testing-shared';
describe('Favorites', () => {
const username = `user-${Utils.random()}`;
@@ -43,10 +43,14 @@ describe('Favorites', () => {
const loginPage = new LoginPage();
const page = new BrowsingPage();
const { dataTable, breadcrumb } = page;
const adminApiActions = new AdminActions();
const userActions = new UserActions();
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);
@@ -64,10 +68,9 @@ describe('Favorites', () => {
await apis.user.favorites.addFavoriteById('file', file2Id);
await apis.user.favorites.addFavoriteById('file', file3Id);
await apis.user.favorites.addFavoriteById('file', file4Id);
await apis.user.nodes.deleteNodeById(file3Id, false);
await apis.user.nodes.deleteNodeById(file4Id, false);
await apis.user.trashcan.restore(file4Id);
await userActions.deleteNodes([file3Id, file4Id], false);
await userActions.trashcanApi.restoreDeletedNode(file4Id);
await loginPage.loginWith(username);
done();
});
@@ -78,9 +81,9 @@ describe('Favorites', () => {
});
afterAll(async (done) => {
await adminApiActions.sites.deleteSite(siteName);
await apis.user.nodes.deleteNodes([favFolderName, parentFolder]);
await apis.user.trashcan.emptyTrash();
await adminApiActions.deleteSites([siteName]);
await userActions.deleteNodes([favFolderName, parentFolder]);
await userActions.emptyTrashcan();
done();
});

View File

@@ -24,7 +24,7 @@
*/
import { browser } from 'protractor';
import { AdminActions, LoginPage, BrowsingPage, Utils, RepoClient } from '@alfresco/aca-testing-shared';
import { AdminActions, UserActions, LoginPage, BrowsingPage, Utils, RepoClient } from '@alfresco/aca-testing-shared';
describe('Generic errors', () => {
const username = `user-${Utils.random()}`;
@@ -43,11 +43,16 @@ describe('Generic errors', () => {
const loginPage = new LoginPage();
const page = new BrowsingPage();
const { dataTable } = page;
const adminApiActions = new AdminActions();
const userActions = new UserActions();
beforeAll(async (done) => {
await adminApiActions.login();
await adminApiActions.createUser({ username });
await adminApiActions.createUser({ username: username2 });
await userActions.login(username, username);
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);
@@ -57,8 +62,8 @@ describe('Generic errors', () => {
});
afterAll(async (done) => {
await apis.user.nodes.deleteNodeById(parentId);
await apis.user.trashcan.emptyTrash();
await userActions.deleteNodes([parentId]);
await userActions.emptyTrashcan();
done();
});

View File

@@ -23,26 +23,29 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { AdminActions, SITE_VISIBILITY, SITE_ROLES, LoginPage, BrowsingPage, Utils, RepoClient } from '@alfresco/aca-testing-shared';
import { AdminActions, UserActions, SITE_VISIBILITY, SITE_ROLES, LoginPage, BrowsingPage, Utils, RepoClient } from '@alfresco/aca-testing-shared';
describe('Special permissions', () => {
const username = `user-${Utils.random()}`;
const password = username;
const apis = {
user: new RepoClient(username, password)
user: new RepoClient(username, username)
};
const loginPage = new LoginPage();
const page = new BrowsingPage();
const { dataTable } = page;
const { searchInput } = page.header;
const adminApiActions = new AdminActions();
const userActions = new UserActions();
let initialSharedTotalItems: number;
beforeAll(async (done) => {
await adminApiActions.login();
await adminApiActions.createUser({ username });
await userActions.login(username, username);
done();
});
@@ -60,7 +63,7 @@ describe('Special permissions', () => {
initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems();
await adminApiActions.shared.shareFileById(fileId);
await adminApiActions.shareNodes([fileId]);
await apis.user.nodes.editNodeContent(fileId, 'edited by user');
await apis.user.search.waitForApi(username, { expect: 1 });
@@ -134,7 +137,7 @@ describe('Special permissions', () => {
await apis.user.favorites.addFavoriteById('file', fileId);
initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems();
await apis.user.shared.shareFileById(fileId);
await userActions.shareNodes([fileId]);
await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 1 });
await apis.user.search.waitForApi(username, { expect: 1 });

View File

@@ -23,7 +23,7 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { AdminActions, SITE_VISIBILITY, LoginPage, BrowsingPage, Utils, RepoClient } from '@alfresco/aca-testing-shared';
import { AdminActions, UserActions, SITE_VISIBILITY, LoginPage, BrowsingPage, Utils, RepoClient } from '@alfresco/aca-testing-shared';
describe('Recent Files', () => {
const username = `user-${Utils.random()}`;
@@ -47,15 +47,20 @@ describe('Recent Files', () => {
const loginPage = new LoginPage();
const page = new BrowsingPage();
const { dataTable, breadcrumb } = page;
const adminApiActions = new AdminActions();
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 apis.user.nodes.deleteNodeById(id, false);
await userActions.deleteNodes([id], false);
await apis.user.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC);
const docLibId = await apis.user.sites.getDocLibId(siteName);
@@ -74,9 +79,9 @@ describe('Recent Files', () => {
});
afterAll(async (done) => {
await apis.user.nodes.deleteNodesById([folderId, file2Id]);
await apis.user.sites.deleteSite(siteName);
await apis.user.trashcan.emptyTrash();
await userActions.deleteNodes([folderId, file2Id]);
await userActions.deleteSites([siteName]);
await userActions.emptyTrashcan();
done();
});

View File

@@ -70,7 +70,7 @@ describe('Shared Files', () => {
initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems();
await apis.user.shared.shareFilesByIds([file1Id, file2Id, file3Id, file4Id]);
await adminApiActions.shared.shareFileById(nodeId);
await adminApiActions.shareNodes([nodeId]);
await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 5 });
await apis.user.nodes.deleteNodeById(file2Id);

View File

@@ -23,7 +23,7 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { AdminActions, LoginPage, BrowsingPage, Utils, RepoClient } from '@alfresco/aca-testing-shared';
import { AdminActions, UserActions, LoginPage, BrowsingPage, Utils, RepoClient } from '@alfresco/aca-testing-shared';
describe('File / folder tooltips', () => {
const username = `user-${Utils.random()}`;
@@ -50,10 +50,15 @@ describe('File / folder tooltips', () => {
const loginPage = new LoginPage();
const page = new BrowsingPage();
const { dataTable } = page;
const adminApiActions = new AdminActions();
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;
file1Id = (await apis.user.nodes.createFile(file, parentId)).entry.id;
@@ -77,7 +82,8 @@ describe('File / folder tooltips', () => {
});
afterAll(async (done) => {
await Promise.all([apis.user.nodes.deleteNodes([parent]), apis.user.trashcan.emptyTrash()]);
await userActions.deleteNodes([parent]);
await userActions.emptyTrashcan();
done();
});
@@ -267,8 +273,8 @@ describe('File / folder tooltips', () => {
});
afterAll(async (done) => {
await apis.user.nodes.deleteNodes([parentForTrash]);
await apis.user.trashcan.emptyTrash();
await userActions.deleteNodes([parentForTrash]);
await userActions.emptyTrashcan();
done();
});

View File

@@ -23,7 +23,7 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { AdminActions, SITE_VISIBILITY, SITE_ROLES, LoginPage, BrowsingPage, Utils, RepoClient } from '@alfresco/aca-testing-shared';
import { AdminActions, UserActions, SITE_VISIBILITY, SITE_ROLES, LoginPage, BrowsingPage, Utils, RepoClient } from '@alfresco/aca-testing-shared';
describe('Trash', () => {
const username = `user-${Utils.random()}`;
@@ -59,10 +59,15 @@ describe('Trash', () => {
const loginPage = new LoginPage();
const page = new BrowsingPage();
const { dataTable, breadcrumb } = page;
const adminApiActions = new AdminActions();
const userActions = new UserActions();
beforeAll(async () => {
await adminApiActions.login();
await adminApiActions.createUser({ username });
await userActions.login(username, username);
fileAdminId = (await adminApiActions.nodes.createFiles([fileAdmin])).entry.id;
folderAdminId = (await adminApiActions.nodes.createFolders([folderAdmin])).entry.id;
await adminApiActions.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC);
@@ -83,13 +88,11 @@ describe('Trash', () => {
});
afterAll(async (done) => {
await Promise.all([
adminApiActions.sites.deleteSite(siteName),
adminApiActions.trashcan.permanentlyDelete(fileAdminId),
adminApiActions.trashcan.permanentlyDelete(folderAdminId),
apis.user.nodes.deleteNodeById(folderNotDeletedId),
apis.user.trashcan.emptyTrash()
]);
await adminApiActions.sites.deleteSite(siteName);
await adminApiActions.trashcanApi.deleteDeletedNode(fileAdminId);
await adminApiActions.trashcanApi.deleteDeletedNode(folderAdminId);
await apis.user.nodes.deleteNodeById(folderNotDeletedId);
await userActions.emptyTrashcan();
done();
});

View File

@@ -23,7 +23,7 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { AdminActions, LoginPage, BrowsingPage, Viewer, RepoClient, Utils } from '@alfresco/aca-testing-shared';
import { AdminActions, UserActions, LoginPage, BrowsingPage, Viewer, RepoClient, Utils } from '@alfresco/aca-testing-shared';
describe('Single click on item name', () => {
const username = `user-${Utils.random()}`;
@@ -50,17 +50,22 @@ describe('Single click on item name', () => {
const { dataTable, breadcrumb } = page;
const viewer = new Viewer();
const { searchInput } = page.header;
const adminApiActions = new AdminActions();
const userActions = new UserActions();
beforeAll(async (done) => {
await adminApiActions.login();
await adminApiActions.createUser({ username });
await userActions.login(username, username);
file1Id = (await apis.user.nodes.createFile(file1)).entry.id;
folder1Id = (await apis.user.nodes.createFolder(folder1)).entry.id;
deletedFile1Id = (await apis.user.nodes.createFile(deletedFile1)).entry.id;
deletedFolder1Id = (await apis.user.nodes.createFolder(deletedFolder1)).entry.id;
await apis.user.nodes.deleteNodeById(deletedFile1Id, false);
await apis.user.nodes.deleteNodeById(deletedFolder1Id, false);
await userActions.deleteNodes([deletedFile1Id, deletedFolder1Id], false);
await apis.user.sites.createSite(siteName);
const docLibId = await apis.user.sites.getDocLibId(siteName);
@@ -71,10 +76,9 @@ describe('Single click on item name', () => {
});
afterAll(async () => {
await apis.user.sites.deleteSite(siteName);
await apis.user.nodes.deleteNodeById(folder1Id);
await apis.user.nodes.deleteNodeById(file1Id);
await apis.user.trashcan.emptyTrash();
await userActions.deleteSites([siteName]);
await userActions.deleteNodes([folder1Id, file1Id]);
await userActions.emptyTrashcan();
});
it('[C284899] Hyperlink does not appear for items in the Trash', async () => {
@@ -128,7 +132,7 @@ describe('Single click on item name', () => {
describe('on Shared Files', () => {
beforeAll(async () => {
const initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems();
await apis.user.shared.shareFileById(file1Id);
await userActions.shareNodes([file1Id]);
await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 1 });
});

View File

@@ -23,7 +23,7 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { LoginPage, BrowsingPage, Utils, AdminActions, RepoClient } from '@alfresco/aca-testing-shared';
import { LoginPage, BrowsingPage, Utils, AdminActions, UserActions, RepoClient } from '@alfresco/aca-testing-shared';
describe('Pagination on multiple pages on Trash', () => {
const random = Utils.random();
@@ -36,17 +36,21 @@ describe('Pagination on multiple pages on Trash', () => {
const userApi = new RepoClient(username, username);
const adminApiActions = new AdminActions();
const userActions = new UserActions();
const loginPage = new LoginPage();
const page = new BrowsingPage();
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 userApi.nodes.deleteNodesById(filesDeletedIds, false);
await userApi.trashcan.waitForApi({ expect: 101 });
await userActions.deleteNodes(filesDeletedIds, false);
await userActions.waitForTrashcanSize(101);
await loginPage.loginWith(username);
await page.clickTrashAndWait();
@@ -57,7 +61,7 @@ describe('Pagination on multiple pages on Trash', () => {
});
afterAll(async () => {
await userApi.trashcan.emptyTrash();
await userActions.emptyTrashcan();
});
it('[C280122] Pagination control default values', async () => {

View File

@@ -23,7 +23,7 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { LoginPage, BrowsingPage, SearchResultsPage, Utils, AdminActions, RepoClient } from '@alfresco/aca-testing-shared';
import { LoginPage, BrowsingPage, SearchResultsPage, Utils, AdminActions, UserActions, RepoClient } from '@alfresco/aca-testing-shared';
describe('Pagination on single page', () => {
const random = Utils.random();
@@ -40,6 +40,7 @@ describe('Pagination on single page', () => {
const userApi = new RepoClient(username, username);
const adminApiActions = new AdminActions();
const userActions = new UserActions();
const loginPage = new LoginPage();
const page = new BrowsingPage();
@@ -48,12 +49,14 @@ 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);
const initialSharedTotalItems = await userApi.shared.getSharedLinksTotalItems();
const initialTrashTotalItems = await userApi.trashcan.getDeletedNodesTotalItems();
const initialTrashTotalItems = await userActions.getTrashcanSize();
fileId = (await userApi.nodes.createFile(file)).entry.id;
fileInTrashId = (await userApi.nodes.createFile(fileInTrash)).entry.id;
@@ -61,20 +64,20 @@ describe('Pagination on single page', () => {
await userApi.nodes.deleteNodeById(fileInTrashId, false);
await userApi.favorites.addFavoriteById('file', fileId);
await userApi.shared.shareFileById(fileId);
await userActions.shareNodes([fileId]);
await Promise.all([
userApi.favorites.waitForApi({ expect: initialFavoriteTotalItems + 2 }),
userApi.search.waitForApi(username, { expect: initialRecentFilesTotalItems + 1 }),
userApi.shared.waitForApi({ expect: initialSharedTotalItems + 1 }),
userApi.trashcan.waitForApi({ expect: initialTrashTotalItems + 1 })
]);
await userApi.favorites.waitForApi({ expect: initialFavoriteTotalItems + 2 });
await userApi.search.waitForApi(username, { expect: initialRecentFilesTotalItems + 1 });
await userApi.shared.waitForApi({ expect: initialSharedTotalItems + 1 });
await userActions.waitForTrashcanSize(initialTrashTotalItems + 1);
await loginPage.loginWith(username);
});
afterAll(async () => {
await Promise.all([userApi.nodes.deleteNodeById(fileId), userApi.sites.deleteSite(siteId), userApi.trashcan.emptyTrash()]);
await userActions.deleteNodes([fileId]);
await userActions.deleteSites([siteId]);
await userActions.emptyTrashcan();
});
it('[C280112] page selector not displayed on Favorites', async () => {

View File

@@ -25,6 +25,7 @@
import {
AdminActions,
UserActions,
LoginPage,
BrowsingPage,
FILES,
@@ -59,9 +60,12 @@ describe('Viewer actions', () => {
const manageVersionsDialog = new ManageVersionsDialog();
const uploadNewVersionDialog = new UploadNewVersionDialog();
const adminApiActions = new AdminActions();
const userActions = new UserActions();
beforeAll(async (done) => {
await adminApiActions.login();
await adminApiActions.createUser({ username });
await userActions.login(username, username);
done();
});
@@ -125,9 +129,8 @@ describe('Viewer actions', () => {
});
afterAll(async (done) => {
await apis.user.nodes.deleteNodeById(parentId);
await apis.user.nodes.deleteNodeById(destinationId);
await apis.user.trashcan.emptyTrash();
await userActions.deleteNodes([parentId, destinationId]);
await userActions.emptyTrashcan();
done();
});
@@ -354,9 +357,9 @@ describe('Viewer actions', () => {
});
afterAll(async (done) => {
await apis.user.sites.deleteSite(siteName);
await apis.user.nodes.deleteNodeById(destinationId);
await apis.user.trashcan.emptyTrash();
await userActions.deleteSites([siteName]);
await userActions.deleteNodes([destinationId]);
await userActions.emptyTrashcan();
done();
});
@@ -542,9 +545,8 @@ describe('Viewer actions', () => {
});
afterAll(async (done) => {
await apis.user.nodes.deleteNodeById(parentId);
await apis.user.nodes.deleteNodeById(destinationId);
await apis.user.trashcan.emptyTrash();
await userActions.deleteNodes([parentId, destinationId]);
await userActions.emptyTrashcan();
done();
});
@@ -741,9 +743,8 @@ describe('Viewer actions', () => {
});
afterAll(async (done) => {
await apis.user.nodes.deleteNodeById(parentId);
await apis.user.nodes.deleteNodeById(destinationId);
await apis.user.trashcan.emptyTrash();
await userActions.deleteNodes([parentId, destinationId]);
await userActions.emptyTrashcan();
done();
});
@@ -937,9 +938,8 @@ describe('Viewer actions', () => {
});
afterAll(async (done) => {
await apis.user.nodes.deleteNodeById(parentId);
await apis.user.nodes.deleteNodeById(destinationId);
await apis.user.trashcan.emptyTrash();
await userActions.deleteNodes([parentId, destinationId]);
await userActions.emptyTrashcan();
done();
});

View File

@@ -23,7 +23,7 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { AdminActions, LoginPage, BrowsingPage, FILES, SITE_VISIBILITY, RepoClient, Utils, Viewer } from '@alfresco/aca-testing-shared';
import { AdminActions, UserActions, LoginPage, BrowsingPage, FILES, SITE_VISIBILITY, RepoClient, Utils, Viewer } from '@alfresco/aca-testing-shared';
describe('Viewer general', () => {
const username = `user-${Utils.random()}`;
@@ -52,10 +52,15 @@ describe('Viewer general', () => {
const { dataTable } = page;
const viewer = new Viewer();
const { searchInput } = page.header;
const adminApiActions = new AdminActions();
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;
@@ -68,7 +73,7 @@ describe('Viewer general', () => {
await apis.user.upload.uploadFile(fileInSite, docLibSiteUserId);
const initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems();
await apis.user.shared.shareFileById(xlsxFileId);
await userActions.shareNodes([xlsxFileId]);
await apis.user.favorites.addFavoriteById('file', xlsxFileId);
await apis.user.favorites.waitForApi({ expect: 2 });