@alfresco/aca-playwright-shared 7.5.0-25545454865 → 7.5.0-25918084657
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.
|
@@ -4724,8 +4724,12 @@ class ApiClientFactory {
|
|
|
4724
4724
|
return await peopleApi.createPerson(person);
|
|
4725
4725
|
}
|
|
4726
4726
|
catch (error) {
|
|
4727
|
+
if (String(error).includes('409')) {
|
|
4728
|
+
logger.warn(`[API Client Factory] createUser: user "${user.username}" already exists, skipping creation`);
|
|
4729
|
+
return null;
|
|
4730
|
+
}
|
|
4727
4731
|
logger.error(`[API Client Factory] createUser failed: ${error}`);
|
|
4728
|
-
|
|
4732
|
+
throw error;
|
|
4729
4733
|
}
|
|
4730
4734
|
}
|
|
4731
4735
|
async changePassword(username, newPassword) {
|
|
@@ -5018,11 +5022,19 @@ class FileActionsApi {
|
|
|
5018
5022
|
}
|
|
5019
5023
|
async uploadFile(fileLocation, fileName, parentFolderId) {
|
|
5020
5024
|
const file = fs.createReadStream(fileLocation);
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5025
|
+
try {
|
|
5026
|
+
const result = await this.apiService.upload.uploadFile(file, '', parentFolderId, undefined, {
|
|
5027
|
+
name: fileName,
|
|
5028
|
+
nodeType: 'cm:content',
|
|
5029
|
+
renditions: 'doclib'
|
|
5030
|
+
});
|
|
5031
|
+
logger.info(`File uploaded successfully: ${fileName}`);
|
|
5032
|
+
return result;
|
|
5033
|
+
}
|
|
5034
|
+
catch (error) {
|
|
5035
|
+
logger.error(`Failed to upload file: ${fileName}: ${error}`);
|
|
5036
|
+
return Promise.reject(error);
|
|
5037
|
+
}
|
|
5026
5038
|
}
|
|
5027
5039
|
async uploadFileWithRename(fileLocation, newName, parentId = '-my-', title = '', description = '') {
|
|
5028
5040
|
const file = fs.createReadStream(fileLocation);
|
|
@@ -5037,9 +5049,12 @@ class FileActionsApi {
|
|
|
5037
5049
|
nodeType: 'cm:content'
|
|
5038
5050
|
};
|
|
5039
5051
|
try {
|
|
5040
|
-
|
|
5052
|
+
const result = await this.apiService.upload.uploadFile(file, '', parentId, nodeProps, opts);
|
|
5053
|
+
logger.info(`File uploaded successfully: ${newName}`);
|
|
5054
|
+
return result;
|
|
5041
5055
|
}
|
|
5042
5056
|
catch (error) {
|
|
5057
|
+
logger.error(`Failed to upload file: ${newName}: ${error}`);
|
|
5043
5058
|
return Promise.reject(error);
|
|
5044
5059
|
}
|
|
5045
5060
|
}
|
|
@@ -5062,7 +5077,7 @@ class FileActionsApi {
|
|
|
5062
5077
|
async getNodeProperty(nodeId, property) {
|
|
5063
5078
|
try {
|
|
5064
5079
|
const node = await this.getNodeById(nodeId);
|
|
5065
|
-
return node
|
|
5080
|
+
return node?.entry?.properties?.[property] || '';
|
|
5066
5081
|
}
|
|
5067
5082
|
catch {
|
|
5068
5083
|
return '';
|
|
@@ -5101,7 +5116,7 @@ class FileActionsApi {
|
|
|
5101
5116
|
async queryNodesNames(searchTerm) {
|
|
5102
5117
|
const data = {
|
|
5103
5118
|
query: {
|
|
5104
|
-
query: `cm:name
|
|
5119
|
+
query: `cm:name:"${searchTerm}*"`,
|
|
5105
5120
|
language: 'afts'
|
|
5106
5121
|
},
|
|
5107
5122
|
filterQueries: [{ query: `+TYPE:'cm:folder' OR +TYPE:'cm:content'` }]
|
|
@@ -5114,10 +5129,16 @@ class FileActionsApi {
|
|
|
5114
5129
|
}
|
|
5115
5130
|
}
|
|
5116
5131
|
async waitForNodes(searchTerm, data) {
|
|
5132
|
+
logger.info(`waitForNodes: Waiting for ${data.expect} node(s) matching "${searchTerm}"`);
|
|
5117
5133
|
const predicate = (totalItems) => totalItems === data.expect;
|
|
5134
|
+
let pollCount = 0;
|
|
5118
5135
|
const apiCall = async () => {
|
|
5119
5136
|
try {
|
|
5120
|
-
|
|
5137
|
+
const totalItems = (await this.queryNodesNames(searchTerm)).list?.pagination?.totalItems || 0;
|
|
5138
|
+
if (pollCount++ % 4 === 0) {
|
|
5139
|
+
logger.info(`waitForNodes: "${searchTerm}" — found ${totalItems}, expecting ${data.expect}`);
|
|
5140
|
+
}
|
|
5141
|
+
return totalItems;
|
|
5121
5142
|
}
|
|
5122
5143
|
catch (error) {
|
|
5123
5144
|
return 0;
|
|
@@ -5172,7 +5193,7 @@ class FileActionsApi {
|
|
|
5172
5193
|
const predicate = (totalItems) => totalItems === data.expect;
|
|
5173
5194
|
const apiCall = async () => {
|
|
5174
5195
|
try {
|
|
5175
|
-
return (await this.queryNodesSearchHighlight(searchTerm)).list
|
|
5196
|
+
return (await this.queryNodesSearchHighlight(searchTerm)).list?.pagination?.totalItems || 0;
|
|
5176
5197
|
}
|
|
5177
5198
|
catch (error) {
|
|
5178
5199
|
logger.warn(`queryNodesSearchHighlight failed for "${searchTerm}": ${error}`);
|
|
@@ -5189,11 +5210,13 @@ class FileActionsApi {
|
|
|
5189
5210
|
}
|
|
5190
5211
|
async updateNodeContent(nodeId, content, majorVersion = true, comment, newName) {
|
|
5191
5212
|
try {
|
|
5192
|
-
const opts = {
|
|
5193
|
-
|
|
5194
|
-
comment
|
|
5195
|
-
|
|
5196
|
-
|
|
5213
|
+
const opts = { majorVersion };
|
|
5214
|
+
if (comment !== undefined) {
|
|
5215
|
+
opts['comment'] = comment;
|
|
5216
|
+
}
|
|
5217
|
+
if (newName !== undefined) {
|
|
5218
|
+
opts['name'] = newName;
|
|
5219
|
+
}
|
|
5197
5220
|
return await this.apiService.nodes.updateNodeContent(nodeId, content, opts);
|
|
5198
5221
|
}
|
|
5199
5222
|
catch (error) {
|
|
@@ -7325,6 +7348,11 @@ const TEST_FILES = {
|
|
|
7325
7348
|
AZW3_FILE: {
|
|
7326
7349
|
path: resolve(__dirname, 'file-azw3.azw3'),
|
|
7327
7350
|
name: 'file-azw3'
|
|
7351
|
+
},
|
|
7352
|
+
PDF_JP2_FILE: {
|
|
7353
|
+
path: resolve(__dirname, 'file-pdf-with-jp2.pdf'),
|
|
7354
|
+
name: 'file-pdf-jp2',
|
|
7355
|
+
data: 'Lorem ipsum dolor sit amet'
|
|
7328
7356
|
}
|
|
7329
7357
|
};
|
|
7330
7358
|
|