mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
e2e cleanup (#2951)
* reduce the code * reduce code * reduce code * reduce code * cleanup tests * more readable code * cleanup code * fix code * even more cleanup * remove some deprecated apis * code fixes * cleanup files * more files switching to user actions
This commit is contained in:
@@ -24,8 +24,9 @@
|
||||
*/
|
||||
|
||||
import { Logger } from '@alfresco/adf-testing';
|
||||
import { AlfrescoApi, Comment, CommentsApi, NodesApi, TrashcanApi, SitesApi, SharedlinksApi } from '@alfresco/js-api';
|
||||
import { AlfrescoApi, Comment, CommentsApi, NodesApi, TrashcanApi, SitesApi, SharedlinksApi, SiteEntry } from '@alfresco/js-api';
|
||||
import { browser } from 'protractor';
|
||||
import { SITE_VISIBILITY } from '../configs';
|
||||
import { Utils } from './utils';
|
||||
|
||||
export class UserActions {
|
||||
@@ -158,6 +159,16 @@ export class UserActions {
|
||||
}
|
||||
}
|
||||
|
||||
async lockNodes(nodeIds: string[], lockType: string = 'ALLOW_OWNER_CHANGES') {
|
||||
try {
|
||||
for (const nodeId of nodeIds) {
|
||||
await this.nodesApi.lockNode(nodeId, { type: lockType });
|
||||
}
|
||||
} catch (error) {
|
||||
this.handleError('User Actions - lockNodes failed : ', error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unlock multiple nodes.
|
||||
* @param nodeIds The list of node IDs to unlock.
|
||||
@@ -172,6 +183,32 @@ export class UserActions {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create multiple sites
|
||||
* @param siteNames The list of the site names
|
||||
* @param visibility Default site visibility
|
||||
* @returns List of site entries
|
||||
*/
|
||||
async createSites(siteNames: string[], visibility?: string): Promise<SiteEntry[]> {
|
||||
const sites: SiteEntry[] = [];
|
||||
|
||||
try {
|
||||
if (siteNames && siteNames.length > 0) {
|
||||
for (const siteName of siteNames) {
|
||||
const site = await this.sitesApi.createSite({
|
||||
title: siteName,
|
||||
visibility: visibility || SITE_VISIBILITY.PUBLIC,
|
||||
id: siteName
|
||||
});
|
||||
sites.push(site);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
this.handleError(`User Actions - createSites failed : `, error);
|
||||
}
|
||||
return sites;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete multiple sites/libraries.
|
||||
* @param siteIds The list of the site/library IDs to delete.
|
||||
|
Reference in New Issue
Block a user