mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2026-09-09 18:02:54 +00:00
GH Auto: Upstream dependencies ADF:8.6.0-26272920976 JS-API:9.6.0-26272920976 using Tag:8.6.0-26272920976 (#5178)
* [ci:force][auto-commit] Update dependencies ADF:8.6.0-26272920976 JS:9.6.0-26272920976 * remove adf-core.globals * file upload fix * fail e2e with wait fix * fix(e2e): unique username + viewer content render wait * feat(viewer): register providePdfViewer for ADF 8.6.0+ * exclude test * fix comment --------- Co-authored-by: MichalKinas <113341662+MichalKinas@users.noreply.github.com> Co-authored-by: Mykyta Maliarchuk <mykyta.maliarchuk@hyland.com> Co-authored-by: akashrathod28 <akash.rathod@hyland.com>
This commit is contained in:
co-authored by
MichalKinas
Mykyta Maliarchuk
akashrathod28
parent
adadbe17d5
commit
c4ff14f359
@@ -25,6 +25,7 @@
|
||||
import { importProvidersFrom, ApplicationConfig } from '@angular/core';
|
||||
import { provideNoopAnimations, provideAnimations } from '@angular/platform-browser/animations';
|
||||
import { AuthGuard, provideAppConfig, provideCoreAuth, provideI18N } from '@alfresco/adf-core';
|
||||
import { providePdfViewer } from '@alfresco/adf-core/viewer/pdf';
|
||||
import { AppService, provideContentAppExtensions } from '@alfresco/aca-shared';
|
||||
import { provideApplicationExtensions } from './extensions.module';
|
||||
import { environment } from '../environments/environment';
|
||||
@@ -73,6 +74,7 @@ export const AppConfig: ApplicationConfig = {
|
||||
providers: [
|
||||
provideCoreAuth({ useHash: true }),
|
||||
provideAppConfig(),
|
||||
providePdfViewer(),
|
||||
importProvidersFrom(ContentServiceExtensionModule),
|
||||
provideI18N({
|
||||
assets: [['app', 'assets']]
|
||||
|
||||
@@ -61,6 +61,8 @@ test.describe('File preview', () => {
|
||||
await Utils.reloadPageIfRowNotVisible(personalFiles, fileName);
|
||||
await personalFiles.dataTable.getRowByName(fileName).click();
|
||||
await personalFiles.acaHeader.viewButton.click();
|
||||
await personalFiles.viewer.waitForViewerToOpen();
|
||||
await personalFiles.viewer.waitForViewerContentToRender('document');
|
||||
await expect(personalFiles.viewer.pdfViewerContentPages.first()).toBeVisible();
|
||||
expect(await personalFiles.viewer.viewerDocument.textContent()).toContain('PDF');
|
||||
});
|
||||
|
||||
@@ -36,7 +36,7 @@ import {
|
||||
} from '@alfresco/aca-playwright-shared';
|
||||
|
||||
test.describe('Upload new version', () => {
|
||||
const username = `user-${Utils.random()}`;
|
||||
const username = `user-${Date.now()}-${Utils.random()}`;
|
||||
|
||||
const file1 = `file1-${Utils.random()}.docx`;
|
||||
let file1Id: string;
|
||||
|
||||
@@ -30,7 +30,7 @@ test.describe('Upload files', () => {
|
||||
let nodesApi: NodesApi;
|
||||
|
||||
const random = Utils.random();
|
||||
const username = `user-${random}`;
|
||||
const username = `user-${Date.now()}-${random}`;
|
||||
const folder1 = `folder1-${Utils.random()}`;
|
||||
|
||||
test.beforeAll(async () => {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
{
|
||||
"all": {},
|
||||
"all": {
|
||||
"XAT-19377": "https://hyland.atlassian.net/browse/ACS-11868"
|
||||
},
|
||||
"firefox": {
|
||||
"XAT-17177": "https://hyland.atlassian.net/browse/ACS-10917",
|
||||
"XAT-17178": "https://hyland.atlassian.net/browse/ACS-10917",
|
||||
|
||||
@@ -127,7 +127,13 @@ test.describe('viewer file types', () => {
|
||||
throw new Error(errorMessage);
|
||||
}
|
||||
|
||||
await expect(viewerElement).toBeVisible();
|
||||
let renderType: 'image' | 'media' | 'document' = 'document';
|
||||
if (fileType === 'viewerImage') {
|
||||
renderType = 'image';
|
||||
} else if (fileType === 'viewerMedia') {
|
||||
renderType = 'media';
|
||||
}
|
||||
await page.viewer.waitForViewerContentToRender(renderType);
|
||||
}
|
||||
|
||||
async function checkViewerDisplayUnknownFormat(page: PersonalFilesPage, fileName: string) {
|
||||
@@ -178,6 +184,7 @@ test.describe('viewer file types', () => {
|
||||
test('[XAT-5485] User can select a document page through the thumbnail pane', async ({ personalFiles }) => {
|
||||
await personalFiles.dataTable.performClickFolderOrFileToOpen(randomPdfName);
|
||||
expect(await personalFiles.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true);
|
||||
await personalFiles.viewer.waitForViewerContentToRender('document');
|
||||
await personalFiles.viewer.documentThumbnailButton.click();
|
||||
await expect(personalFiles.viewer.thumbnailsPages.first()).toBeVisible();
|
||||
await personalFiles.viewer.checkViewerActivePage(1);
|
||||
@@ -188,6 +195,7 @@ test.describe('viewer file types', () => {
|
||||
test('[XAT-5486] User can close the thumbnail pane', async ({ personalFiles }) => {
|
||||
await personalFiles.dataTable.performClickFolderOrFileToOpen(randomPdfName);
|
||||
expect(await personalFiles.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true);
|
||||
await personalFiles.viewer.waitForViewerContentToRender('document');
|
||||
await personalFiles.viewer.documentThumbnailButton.click();
|
||||
await expect(personalFiles.viewer.thumbnailsPages.first()).toBeVisible();
|
||||
await personalFiles.viewer.thumbnailsCloseButton.click();
|
||||
|
||||
@@ -84,7 +84,7 @@ test.describe('Version actions', () => {
|
||||
await sharedLinksApi.shareFilesByIds([fileId]);
|
||||
await sharedLinksApi.waitForFilesToBeShared([fileId]);
|
||||
} catch (error) {
|
||||
console.error(`beforeAll failed: ${error}`);
|
||||
throw new Error(`beforeAll failed: ${error}`);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -107,6 +107,7 @@ test.describe('Version actions', () => {
|
||||
personalFiles
|
||||
}) => {
|
||||
await personalFiles.viewer.waitForViewerToOpen();
|
||||
await personalFiles.viewer.waitForViewerContentToRender('document');
|
||||
expect(await personalFiles.viewer.getFileTitle()).toContain(filenameBeforeUpdate);
|
||||
});
|
||||
|
||||
@@ -138,6 +139,7 @@ test.describe('Version actions', () => {
|
||||
test('[XAT-5499] Should be possible to view a previous document version - Recent Files', async ({ recentFilesPage }) => {
|
||||
expect(recentFilesPage.page.url()).toContain('1.0');
|
||||
await recentFilesPage.viewer.waitForViewerToOpen();
|
||||
await recentFilesPage.viewer.waitForViewerContentToRender('document');
|
||||
await expect(recentFilesPage.viewer.unknownFormat).toBeHidden();
|
||||
expect(await recentFilesPage.viewer.getFileTitle()).toContain(filenameBeforeUpdate);
|
||||
});
|
||||
@@ -146,6 +148,7 @@ test.describe('Version actions', () => {
|
||||
recentFilesPage
|
||||
}) => {
|
||||
await recentFilesPage.viewer.waitForViewerToOpen();
|
||||
await recentFilesPage.viewer.waitForViewerContentToRender('document');
|
||||
expect(await recentFilesPage.viewer.getFileTitle()).toContain(filenameBeforeUpdate);
|
||||
});
|
||||
|
||||
@@ -170,6 +173,7 @@ test.describe('Version actions', () => {
|
||||
favoritePage
|
||||
}) => {
|
||||
await favoritePage.viewer.waitForViewerToOpen();
|
||||
await favoritePage.viewer.waitForViewerContentToRender('document');
|
||||
expect(await favoritePage.viewer.getFileTitle()).toContain(filenameBeforeUpdate);
|
||||
});
|
||||
|
||||
@@ -194,6 +198,7 @@ test.describe('Version actions', () => {
|
||||
sharedPage
|
||||
}) => {
|
||||
await sharedPage.viewer.waitForViewerLoaderToFinish();
|
||||
await sharedPage.viewer.waitForViewerContentToRender('document');
|
||||
expect(await sharedPage.viewer.getFileTitle()).toContain(filenameBeforeUpdate);
|
||||
});
|
||||
|
||||
@@ -218,6 +223,7 @@ test.describe('Version actions', () => {
|
||||
searchPage
|
||||
}) => {
|
||||
await searchPage.viewer.waitForViewerToOpen();
|
||||
await searchPage.viewer.waitForViewerContentToRender('document');
|
||||
expect(await searchPage.viewer.getFileTitle()).toContain(filenameBeforeUpdate);
|
||||
});
|
||||
|
||||
|
||||
@@ -178,6 +178,7 @@ test.describe('viewer zoom functionality and reset', () => {
|
||||
await favoritePage.navigate();
|
||||
await favoritePage.dataTable.performClickFolderOrFileToOpen(randomPdfName);
|
||||
expect(await favoritePage.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true);
|
||||
await favoritePage.viewer.waitForViewerContentToRender('document');
|
||||
await favoritePage.viewer.waitForZoomPercentageToDisplay();
|
||||
await validateZoomScaleInViewer(favoritePage);
|
||||
});
|
||||
@@ -188,6 +189,7 @@ test.describe('viewer zoom functionality and reset', () => {
|
||||
await myLibrariesPage.dataTable.performClickFolderOrFileToOpen(randomDocxName);
|
||||
await myLibrariesPage.viewer.waitForViewerLoaderToFinish();
|
||||
expect(await myLibrariesPage.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true);
|
||||
await myLibrariesPage.viewer.waitForViewerContentToRender('document');
|
||||
await myLibrariesPage.viewer.waitForZoomPercentageToDisplay();
|
||||
await validateZoomScaleInViewer(myLibrariesPage);
|
||||
});
|
||||
@@ -216,6 +218,7 @@ test.describe('viewer zoom functionality and reset', () => {
|
||||
await favoritePage.navigate();
|
||||
await favoritePage.dataTable.performClickFolderOrFileToOpen(randomPdfName);
|
||||
expect(await favoritePage.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true);
|
||||
await favoritePage.viewer.waitForViewerContentToRender('document');
|
||||
await favoritePage.viewer.waitForZoomPercentageToDisplay();
|
||||
await validateFitToPageButtonActivity(favoritePage);
|
||||
});
|
||||
@@ -225,6 +228,7 @@ test.describe('viewer zoom functionality and reset', () => {
|
||||
await myLibrariesPage.dataTable.performClickFolderOrFileToOpen(randomLibraryName);
|
||||
await myLibrariesPage.dataTable.performClickFolderOrFileToOpen(randomDocxName);
|
||||
await myLibrariesPage.viewer.waitForViewerToOpen();
|
||||
await myLibrariesPage.viewer.waitForViewerContentToRender('document');
|
||||
await myLibrariesPage.viewer.waitForZoomPercentageToDisplay();
|
||||
await validateFitToPageButtonActivity(myLibrariesPage);
|
||||
});
|
||||
|
||||
Generated
+75
-567
File diff suppressed because it is too large
Load Diff
+6
-6
@@ -42,11 +42,11 @@
|
||||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@alfresco/adf-content-services": "8.6.0-25384976868",
|
||||
"@alfresco/adf-core": "8.6.0-25384976868",
|
||||
"@alfresco/adf-extensions": "8.6.0-25384976868",
|
||||
"@alfresco/eslint-plugin-eslint-angular": "8.6.0-25384976868",
|
||||
"@alfresco/js-api": "9.6.0-25384976868",
|
||||
"@alfresco/adf-content-services": "8.6.0-26272920976",
|
||||
"@alfresco/adf-core": "8.6.0-26272920976",
|
||||
"@alfresco/adf-extensions": "8.6.0-26272920976",
|
||||
"@alfresco/eslint-plugin-eslint-angular": "8.6.0-26272920976",
|
||||
"@alfresco/js-api": "9.6.0-26272920976",
|
||||
"@angular/animations": "19.2.20",
|
||||
"@angular/cdk": "19.2.19",
|
||||
"@angular/common": "19.2.20",
|
||||
@@ -79,7 +79,7 @@
|
||||
"zone.js": "0.15.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@alfresco/adf-cli": "8.6.0-25384976868",
|
||||
"@alfresco/adf-cli": "8.6.0-26272920976",
|
||||
"@angular-devkit/build-angular": "19.2.22",
|
||||
"@angular-devkit/core": "19.2.20",
|
||||
"@angular-devkit/schematics": "19.2.20",
|
||||
|
||||
@@ -100,6 +100,4 @@
|
||||
#{$name}: #{$value};
|
||||
}
|
||||
}
|
||||
|
||||
@include adf-core.globals;
|
||||
}
|
||||
|
||||
@@ -23,10 +23,23 @@
|
||||
*/
|
||||
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import { File as NodeFile } from 'node:buffer';
|
||||
import { ApiClientFactory } from './api-client-factory';
|
||||
import { logger, Utils, waitForApi } from '../utils';
|
||||
import { NodeBodyCreate, NodeEntry, ResultSetPaging, SearchRequest } from '@alfresco/js-api';
|
||||
|
||||
const fileFixtureCache = new Map<string, Buffer>();
|
||||
|
||||
async function toUploadFile(fileLocation: string): Promise<NodeFile> {
|
||||
let buffer = fileFixtureCache.get(fileLocation);
|
||||
if (!buffer) {
|
||||
buffer = await fs.promises.readFile(fileLocation);
|
||||
fileFixtureCache.set(fileLocation, buffer);
|
||||
}
|
||||
return new NodeFile([buffer], path.basename(fileLocation));
|
||||
}
|
||||
|
||||
export class FileActionsApi {
|
||||
private readonly apiService: ApiClientFactory;
|
||||
|
||||
@@ -41,7 +54,7 @@ export class FileActionsApi {
|
||||
}
|
||||
|
||||
async uploadFile(fileLocation: string, fileName: string, parentFolderId: string): Promise<NodeEntry> {
|
||||
const file = fs.createReadStream(fileLocation);
|
||||
const file = await toUploadFile(fileLocation);
|
||||
try {
|
||||
const result = await this.apiService.upload.uploadFile(file, '', parentFolderId, undefined, {
|
||||
name: fileName,
|
||||
@@ -63,7 +76,7 @@ export class FileActionsApi {
|
||||
title: string = '',
|
||||
description: string = ''
|
||||
): Promise<NodeEntry> {
|
||||
const file = fs.createReadStream(fileLocation);
|
||||
const file = await toUploadFile(fileLocation);
|
||||
const nodeProps = {
|
||||
properties: {
|
||||
'cm:title': title,
|
||||
|
||||
@@ -37,7 +37,7 @@ export class ViewerComponent extends BaseComponent {
|
||||
public shareButton = this.getChild('button[id="share-action-button"]');
|
||||
public downloadButton = this.getChild('button[id="app.viewer.download"]');
|
||||
public unknownFormat = this.getChild(`adf-viewer-unknown-format .adf-viewer__unknown-format-view`);
|
||||
public viewerImage = this.viewerLocator.locator('.cropper-canvas img');
|
||||
public viewerImage = this.viewerLocator.locator('#viewer-image');
|
||||
public viewerDocument = this.viewerLocator.locator('.adf-pdf-viewer__content [role="document"]');
|
||||
public documentThumbnailButton = this.getChild('[data-automation-id="adf-thumbnails-button"]');
|
||||
public thumbnailsPages = this.getChild('[data-automation-id="adf-thumbnails-content"] adf-pdf-thumb');
|
||||
@@ -72,12 +72,24 @@ export class ViewerComponent extends BaseComponent {
|
||||
|
||||
async waitForViewerToOpen(): Promise<void> {
|
||||
await this.waitForViewerLoaderToFinish();
|
||||
await this.viewerLocator.waitFor({ state: 'visible', timeout: timeouts.extraLarge });
|
||||
await this.viewerLocator.waitFor({ state: 'visible', timeout: timeouts.large });
|
||||
}
|
||||
|
||||
async waitForViewerLoaderToFinish(): Promise<void> {
|
||||
await this.viewerSpinner.waitFor({ state: 'attached', timeout: timeouts.medium }).catch(() => {});
|
||||
await this.viewerSpinner.waitFor({ state: 'detached', timeout: timeouts.fortySeconds }).catch(() => {});
|
||||
await this.viewerSpinner.waitFor({ state: 'attached', timeout: timeouts.short }).catch(() => {});
|
||||
await this.viewerSpinner.waitFor({ state: 'detached', timeout: timeouts.extraLarge }).catch(() => {});
|
||||
}
|
||||
|
||||
async waitForViewerContentToRender(type: 'document' | 'image' | 'media' = 'document'): Promise<void> {
|
||||
if (type === 'image') {
|
||||
await this.viewerImage.waitFor({ state: 'attached', timeout: timeouts.extraLarge });
|
||||
return;
|
||||
}
|
||||
if (type === 'media') {
|
||||
await this.viewerMedia.waitFor({ state: 'visible', timeout: timeouts.extraLarge });
|
||||
return;
|
||||
}
|
||||
await this.pdfViewerContentPages.first().waitFor({ state: 'attached', timeout: timeouts.extraLarge });
|
||||
}
|
||||
|
||||
async checkViewerActivePage(pageNumber: number): Promise<void> {
|
||||
@@ -118,7 +130,6 @@ export class ViewerComponent extends BaseComponent {
|
||||
|
||||
async getFileTitle(): Promise<string> {
|
||||
await this.fileTitleButtonLocator.waitFor({ state: 'visible', timeout: timeouts.normal });
|
||||
await this.waitForViewerLoaderToFinish();
|
||||
const title = await this.fileTitleButtonLocator.textContent();
|
||||
if (!title) {
|
||||
const errorMessage = 'File title is not displayed in the viewer';
|
||||
@@ -159,7 +170,8 @@ export class ViewerComponent extends BaseComponent {
|
||||
}
|
||||
|
||||
async checkUnknownFormatIsDisplayed(): Promise<void> {
|
||||
await this.unknownFormat.waitFor({ state: 'visible', timeout: timeouts.normal });
|
||||
await this.waitForViewerLoaderToFinish();
|
||||
await this.unknownFormat.waitFor({ state: 'visible', timeout: timeouts.fortySeconds });
|
||||
}
|
||||
|
||||
async getUnknownFormatMessage(): Promise<string> {
|
||||
|
||||
Reference in New Issue
Block a user