mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2026-09-09 18:02:54 +00:00
[ACS-11868] check pdf viewer e2e file (#5279)
* [ACS-11868] fix for excluded test add document check * [ACS-11868] fix test check pdf and image viewer-e2e-test * [ACS-11868] fix test check pdf and image viewer-e2e-test * resolve pr review changes * text fix * review fix
This commit is contained in:
@@ -69,6 +69,34 @@ export class FileActionsApi {
|
||||
}
|
||||
}
|
||||
|
||||
async uploadNewVersionFile(nodeId: string, fileLocation: string, newFileName: string, majorVersion = true, comment = ''): Promise<NodeEntry> {
|
||||
try {
|
||||
const existingNode = await this.apiService.nodes.getNode(nodeId);
|
||||
const parentId = existingNode.entry.parentId;
|
||||
|
||||
if (newFileName !== existingNode.entry.name) {
|
||||
await this.apiService.nodes.updateNode(nodeId, { name: newFileName });
|
||||
}
|
||||
|
||||
const file = await toUploadFile(fileLocation);
|
||||
await this.apiService.upload.uploadFile(file, '', parentId, undefined, {
|
||||
name: newFileName,
|
||||
nodeType: 'cm:content',
|
||||
renditions: 'doclib',
|
||||
overwrite: true,
|
||||
majorVersion,
|
||||
comment
|
||||
});
|
||||
|
||||
logger.info(`New version uploaded successfully for node ${nodeId}: ${newFileName}`);
|
||||
return await this.apiService.nodes.getNode(nodeId);
|
||||
} catch (error) {
|
||||
const errorMessage = error instanceof Error ? (error.stack ?? error.message) : JSON.stringify(error);
|
||||
logger.error(`Failed to upload new version for node ${nodeId}: ${errorMessage}`);
|
||||
return Promise.reject(error);
|
||||
}
|
||||
}
|
||||
|
||||
async uploadFileWithRename(
|
||||
fileLocation: string,
|
||||
newName: string,
|
||||
@@ -262,9 +290,4 @@ export class FileActionsApi {
|
||||
return Promise.reject(error);
|
||||
}
|
||||
}
|
||||
|
||||
async updateNodeContentFromFile(nodeId: string, fileLocation: string, majorVersion = true, comment?: string, newName?: string): Promise<NodeEntry> {
|
||||
const fileContent = await fs.promises.readFile(fileLocation);
|
||||
return this.updateNodeContent(nodeId, fileContent, majorVersion, comment, newName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,13 +154,8 @@ export class ViewerComponent extends BaseComponent {
|
||||
const toRemove = ['Close', 'Previous File', 'Next File', 'View details'];
|
||||
const removeClosePreviousNextOldInfo = (actions: string[]): string[] => actions.filter((elem) => !toRemove.includes(elem));
|
||||
|
||||
const buttons = await this.page.$$('adf-viewer button');
|
||||
let actualPrimaryActions: string[] = await Promise.all(
|
||||
buttons.map(async (button) => {
|
||||
const title = await button.getAttribute('title');
|
||||
return title || '';
|
||||
})
|
||||
);
|
||||
const buttons = await this.page.locator('adf-viewer button').all();
|
||||
let actualPrimaryActions: string[] = await Promise.all(buttons.map(async (button) => (await button.getAttribute('title')) ?? ''));
|
||||
|
||||
actualPrimaryActions = removeClosePreviousNextOldInfo(actualPrimaryActions);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user