@alfresco/aca-playwright-shared 8.1.0-36865736229 → 8.1.0-36865757793
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AlfrescoApi, SitesApi as SitesApi$1, UploadApi, NodesApi as NodesApi$1, PeopleApi, AdminUsersApi, AdminTenantsApi, GroupsApi, QueriesApi as QueriesApi$1, SearchApi as SearchApi$1, SecurityGroupsApi, SecurityMarksApi, ContentClient, SharedlinksApi, FavoritesApi as FavoritesApi$1, TrashcanApi as TrashcanApi$1, CommentsApi, CategoriesApi as CategoriesApi$1, TagsApi as TagsApi$1,
|
|
1
|
+
import { AlfrescoApi, SitesApi as SitesApi$1, UploadApi as UploadApi$1, NodesApi as NodesApi$1, PeopleApi, AdminUsersApi, AdminTenantsApi, GroupsApi, QueriesApi as QueriesApi$1, SearchApi as SearchApi$1, SecurityGroupsApi, SecurityMarksApi, ContentClient, SharedlinksApi, FavoritesApi as FavoritesApi$1, TrashcanApi as TrashcanApi$1, CommentsApi, CategoriesApi as CategoriesApi$1, TagsApi as TagsApi$1, SharedLinkPaging, FavoritePaging, Site, SiteMemberEntry, ResultSetPaging } from '@alfresco/js-api';
|
|
2
2
|
import { expect, chromium, devices, test as test$1 } from '@playwright/test';
|
|
3
3
|
import * as path from 'path';
|
|
4
4
|
import { resolve } from 'path';
|
|
@@ -4989,7 +4989,7 @@ class ApiClientFactory {
|
|
|
4989
4989
|
constructor() {
|
|
4990
4990
|
this.alfrescoApi = new AlfrescoApi(config);
|
|
4991
4991
|
this.sites = new SitesApi$1(this.alfrescoApi);
|
|
4992
|
-
this.upload = new UploadApi(this.alfrescoApi);
|
|
4992
|
+
this.upload = new UploadApi$1(this.alfrescoApi);
|
|
4993
4993
|
this.nodes = new NodesApi$1(this.alfrescoApi);
|
|
4994
4994
|
this.people = new PeopleApi(this.alfrescoApi);
|
|
4995
4995
|
this.adminUsers = new AdminUsersApi(this.alfrescoApi);
|
|
@@ -5347,12 +5347,12 @@ async function toUploadFile(fileLocation) {
|
|
|
5347
5347
|
}
|
|
5348
5348
|
return new File([new Uint8Array(buffer)], path.basename(fileLocation));
|
|
5349
5349
|
}
|
|
5350
|
-
class
|
|
5350
|
+
class UploadApi {
|
|
5351
5351
|
constructor() {
|
|
5352
5352
|
this.apiService = new ApiClientFactory();
|
|
5353
5353
|
}
|
|
5354
5354
|
static async initialize(userName, password) {
|
|
5355
|
-
const classObj = new
|
|
5355
|
+
const classObj = new UploadApi();
|
|
5356
5356
|
await classObj.apiService.setUpAcaBackend(userName, password);
|
|
5357
5357
|
return classObj;
|
|
5358
5358
|
}
|
|
@@ -5419,83 +5419,6 @@ class FileActionsApi {
|
|
|
5419
5419
|
return Promise.reject(error);
|
|
5420
5420
|
}
|
|
5421
5421
|
}
|
|
5422
|
-
async getNodeById(id) {
|
|
5423
|
-
try {
|
|
5424
|
-
return this.apiService.nodes.getNode(id);
|
|
5425
|
-
}
|
|
5426
|
-
catch {
|
|
5427
|
-
return null;
|
|
5428
|
-
}
|
|
5429
|
-
}
|
|
5430
|
-
async isFileCheckedOutWithRetry(nodeId, expect) {
|
|
5431
|
-
const data = { expect, retry: 5 };
|
|
5432
|
-
let isCheckedOut = false;
|
|
5433
|
-
try {
|
|
5434
|
-
const check = async () => {
|
|
5435
|
-
const node = await this.getNodeById(nodeId);
|
|
5436
|
-
isCheckedOut = (node?.entry?.aspectNames ?? []).includes('cm:checkedOut');
|
|
5437
|
-
if (isCheckedOut !== data.expect) {
|
|
5438
|
-
return Promise.reject(new Error(`Checked-out state mismatch: expected=${data.expect}, actual=${isCheckedOut}`));
|
|
5439
|
-
}
|
|
5440
|
-
return Promise.resolve(isCheckedOut);
|
|
5441
|
-
};
|
|
5442
|
-
return await Utils.retryCall(check, data.retry);
|
|
5443
|
-
}
|
|
5444
|
-
catch { }
|
|
5445
|
-
return isCheckedOut;
|
|
5446
|
-
}
|
|
5447
|
-
async queryNodesNames(searchTerm) {
|
|
5448
|
-
const data = {
|
|
5449
|
-
query: {
|
|
5450
|
-
query: `cm:name:"${searchTerm}*"`,
|
|
5451
|
-
language: 'afts'
|
|
5452
|
-
},
|
|
5453
|
-
filterQueries: [{ query: `+TYPE:'cm:folder' OR +TYPE:'cm:content'` }]
|
|
5454
|
-
};
|
|
5455
|
-
try {
|
|
5456
|
-
return this.apiService.search.search(data);
|
|
5457
|
-
}
|
|
5458
|
-
catch {
|
|
5459
|
-
return new ResultSetPaging();
|
|
5460
|
-
}
|
|
5461
|
-
}
|
|
5462
|
-
async waitForNodes(searchTerm, data) {
|
|
5463
|
-
const predicate = (totalItems) => totalItems === data.expect;
|
|
5464
|
-
const apiCall = async () => {
|
|
5465
|
-
try {
|
|
5466
|
-
return (await this.queryNodesNames(searchTerm)).list?.pagination?.totalItems || 0;
|
|
5467
|
-
}
|
|
5468
|
-
catch {
|
|
5469
|
-
return 0;
|
|
5470
|
-
}
|
|
5471
|
-
};
|
|
5472
|
-
try {
|
|
5473
|
-
await waitForApi(apiCall, predicate, 30, 2500);
|
|
5474
|
-
logger.info(`waitForNodes: Found ${data.expect} node(s) matching "${searchTerm}"`);
|
|
5475
|
-
}
|
|
5476
|
-
catch {
|
|
5477
|
-
const actual = await apiCall();
|
|
5478
|
-
const message = `waitForNodes: Timed out waiting for "${searchTerm}" — expected ${data.expect} nodes, found ${actual}`;
|
|
5479
|
-
logger.error(message);
|
|
5480
|
-
throw new Error(message);
|
|
5481
|
-
}
|
|
5482
|
-
}
|
|
5483
|
-
async updateNodeContent(nodeId, content, majorVersion = true, comment, newName) {
|
|
5484
|
-
try {
|
|
5485
|
-
const opts = { majorVersion };
|
|
5486
|
-
if (comment !== undefined) {
|
|
5487
|
-
opts['comment'] = comment;
|
|
5488
|
-
}
|
|
5489
|
-
if (newName !== undefined) {
|
|
5490
|
-
opts['name'] = newName;
|
|
5491
|
-
}
|
|
5492
|
-
return await this.apiService.nodes.updateNodeContent(nodeId, content, opts); // NOSONAR
|
|
5493
|
-
}
|
|
5494
|
-
catch (error) {
|
|
5495
|
-
logger.error(`${this.constructor.name} ${this.updateNodeContent.name}: ${JSON.stringify(error)}`);
|
|
5496
|
-
return Promise.reject(error);
|
|
5497
|
-
}
|
|
5498
|
-
}
|
|
5499
5422
|
}
|
|
5500
5423
|
|
|
5501
5424
|
/*!
|
|
@@ -5967,6 +5890,22 @@ class NodesApi {
|
|
|
5967
5890
|
return null;
|
|
5968
5891
|
}
|
|
5969
5892
|
}
|
|
5893
|
+
async updateNodeContent(nodeId, content, majorVersion = true, comment, newName) {
|
|
5894
|
+
try {
|
|
5895
|
+
const opts = { majorVersion };
|
|
5896
|
+
if (comment !== undefined) {
|
|
5897
|
+
opts['comment'] = comment;
|
|
5898
|
+
}
|
|
5899
|
+
if (newName !== undefined) {
|
|
5900
|
+
opts['name'] = newName;
|
|
5901
|
+
}
|
|
5902
|
+
return await this.apiService.nodes.updateNodeContent(nodeId, content, opts); // NOSONAR
|
|
5903
|
+
}
|
|
5904
|
+
catch (error) {
|
|
5905
|
+
logger.error(`${this.constructor.name} ${this.updateNodeContent.name}: ${JSON.stringify(error)}`);
|
|
5906
|
+
return Promise.reject(error);
|
|
5907
|
+
}
|
|
5908
|
+
}
|
|
5970
5909
|
/**
|
|
5971
5910
|
* Delete all nodes of the currently logged in user
|
|
5972
5911
|
* @param userNodeId The id of User node, all child nodes of "userNodeId" will be gathered as a list and deleted ( e.g.: "-my-" - User Homes folder)
|
|
@@ -6001,6 +5940,23 @@ class NodesApi {
|
|
|
6001
5940
|
logger.error(`${this.constructor.name} ${this.cancelCheckout.name}: ${error instanceof Error ? error.message : JSON.stringify(error)}`);
|
|
6002
5941
|
}
|
|
6003
5942
|
}
|
|
5943
|
+
async isFileCheckedOutWithRetry(nodeId, expect) {
|
|
5944
|
+
const data = { expect, retry: 5 };
|
|
5945
|
+
let isCheckedOut = false;
|
|
5946
|
+
try {
|
|
5947
|
+
const check = async () => {
|
|
5948
|
+
const node = await this.getNodeById(nodeId);
|
|
5949
|
+
isCheckedOut = (node?.entry?.aspectNames ?? []).includes('cm:checkedOut');
|
|
5950
|
+
if (isCheckedOut !== data.expect) {
|
|
5951
|
+
return Promise.reject(new Error(`Checked-out state mismatch: expected=${data.expect}, actual=${isCheckedOut}`));
|
|
5952
|
+
}
|
|
5953
|
+
return Promise.resolve(isCheckedOut);
|
|
5954
|
+
};
|
|
5955
|
+
return await Utils.retryCall(check, data.retry);
|
|
5956
|
+
}
|
|
5957
|
+
catch { }
|
|
5958
|
+
return isCheckedOut;
|
|
5959
|
+
}
|
|
6004
5960
|
async createContent(content, relativePath = '/') {
|
|
6005
5961
|
try {
|
|
6006
5962
|
return this.apiService.nodes.createNode('-my-', flattenNodeContentTree(content, relativePath));
|
|
@@ -6724,6 +6680,42 @@ class SearchApi {
|
|
|
6724
6680
|
} while (!found);
|
|
6725
6681
|
logger.info(`waitForContentIndexing: content "${contentTerm}" is indexed for "${expectedFileName}".`);
|
|
6726
6682
|
}
|
|
6683
|
+
async queryNodesNames(searchTerm) {
|
|
6684
|
+
const data = {
|
|
6685
|
+
query: {
|
|
6686
|
+
query: `cm:name:"${searchTerm}*"`,
|
|
6687
|
+
language: 'afts'
|
|
6688
|
+
},
|
|
6689
|
+
filterQueries: [{ query: `+TYPE:'cm:folder' OR +TYPE:'cm:content'` }]
|
|
6690
|
+
};
|
|
6691
|
+
try {
|
|
6692
|
+
return this.apiService.search.search(data);
|
|
6693
|
+
}
|
|
6694
|
+
catch {
|
|
6695
|
+
return new ResultSetPaging();
|
|
6696
|
+
}
|
|
6697
|
+
}
|
|
6698
|
+
async waitForNodes(searchTerm, data) {
|
|
6699
|
+
const predicate = (totalItems) => totalItems === data.expect;
|
|
6700
|
+
const apiCall = async () => {
|
|
6701
|
+
try {
|
|
6702
|
+
return (await this.queryNodesNames(searchTerm)).list?.pagination?.totalItems || 0;
|
|
6703
|
+
}
|
|
6704
|
+
catch {
|
|
6705
|
+
return 0;
|
|
6706
|
+
}
|
|
6707
|
+
};
|
|
6708
|
+
try {
|
|
6709
|
+
await waitForApi(apiCall, predicate, 30, 2500);
|
|
6710
|
+
logger.info(`waitForNodes: Found ${data.expect} node(s) matching "${searchTerm}"`);
|
|
6711
|
+
}
|
|
6712
|
+
catch {
|
|
6713
|
+
const actual = await apiCall();
|
|
6714
|
+
const message = `waitForNodes: Timed out waiting for "${searchTerm}" — expected ${data.expect} nodes, found ${actual}`;
|
|
6715
|
+
logger.error(message);
|
|
6716
|
+
throw new Error(message);
|
|
6717
|
+
}
|
|
6718
|
+
}
|
|
6727
6719
|
}
|
|
6728
6720
|
|
|
6729
6721
|
/*!
|
|
@@ -7235,8 +7227,8 @@ const test = test$1.extend({
|
|
|
7235
7227
|
await use(new RepositoryPage(page));
|
|
7236
7228
|
},
|
|
7237
7229
|
// eslint-disable-next-line no-empty-pattern
|
|
7238
|
-
|
|
7239
|
-
await use(await
|
|
7230
|
+
uploadApiAction: async ({}, use) => {
|
|
7231
|
+
await use(await UploadApi.initialize(users.hruser.username));
|
|
7240
7232
|
},
|
|
7241
7233
|
// eslint-disable-next-line no-empty-pattern
|
|
7242
7234
|
shareAction: async ({}, use) => {
|
|
@@ -7534,5 +7526,5 @@ const TEST_FILES = {
|
|
|
7534
7526
|
* Generated bundle index. Do not edit.
|
|
7535
7527
|
*/
|
|
7536
7528
|
|
|
7537
|
-
export { APP_ROUTES, AcaHeader, ActionType, ActionTypes, ActionsDropdownComponent, AdfConfirmDialogComponent, AdfDeleteTrashComponent, AdfFolderDialogComponent, AdfLibraryDialogComponent, ApiClientFactory, BaseComponent, BasePage, Breadcrumb, CategoriesApi, Comparator, ConditionComponent, ConditionsTypes, ContentNodeSelectorDialog, CreateFromTemplateDialogComponent, DataTableComponent, DateTimePicker, EditDialog, EditModeComponent, ErrorComponent, FavoritesApi, FavoritesLibrariesPage, FavoritesPage, Field,
|
|
7529
|
+
export { APP_ROUTES, AcaHeader, ActionType, ActionTypes, ActionsDropdownComponent, AdfConfirmDialogComponent, AdfDeleteTrashComponent, AdfFolderDialogComponent, AdfLibraryDialogComponent, ApiClientFactory, BaseComponent, BasePage, Breadcrumb, CategoriesApi, Comparator, ConditionComponent, ConditionsTypes, ContentNodeSelectorDialog, CreateFromTemplateDialogComponent, DataTableComponent, DateTimePicker, EditDialog, EditModeComponent, ErrorComponent, FavoritesApi, FavoritesLibrariesPage, FavoritesPage, Field, FolderInformationDialogComponent, InfoDrawerComponent, LinkRulesDialog, LoginPage, ManageRules, ManageRulesDialogComponent, ManageVersionsDialog, MatMenuComponent, MimeType, MyLibrariesPage, NodesApi, NodesPage, PaginationActionsType, PaginationComponent, PasswordOverlayDialogComponent, Person, PersonalFilesPage, QueriesApi, RecentFilesPage, RepositoryPage, RulesApi, RulesToolbarComponent, SIDEBAR_LABELS, SITE_ROLES, SITE_VISIBILITY, SearchApi, SearchFilters, SearchFiltersCategories, SearchFiltersDate, SearchFiltersLocation, SearchFiltersLogic, SearchFiltersProperties, SearchFiltersTags, SearchInputComponent, SearchMenuCard, SearchPage, SearchSortingPicker, ShareDialogComponent, SharedLinksApi, SharedPage, SidenavComponent, SitesApi, SnackBarComponent, TEST_FILES, TagsApi, TrashPage, TrashcanApi, UploadApi, UploadDialog, UploadNewVersionDialog, UserModel, Utils, ViewerComponent, ViewerOverlayDialogComponent, ViewerToolbarComponent, cleanupRepositoryTestData, createSuiteProjects, errorStrings, file, flattenNodeContentTree, folderFavFile, folderFile, getBrowserProjects, getExcludedTestsRegExpArray, getGlobalConfig, getUserState, hasAccessibleAttribute, hasAccessibleName, isInteractiveElement, libraryErrors, logger, multipleSelFile, paths, seedRepositoryTestData, test, testEmailDomain, timeouts, users, verifyDataTableAccessibility, verifyElementsHaveNames, verifyRegionAccessibleNames, waitForApi };
|
|
7538
7530
|
//# sourceMappingURL=alfresco-aca-playwright-shared.mjs.map
|