From 6d330f91e5e8687267ca81c196664de726df8cc9 Mon Sep 17 00:00:00 2001 From: VitoAlbano Date: Tue, 8 Apr 2025 09:25:20 +0100 Subject: [PATCH] [AAE-30877] - Here we go --- .github/workflows/pull-request.yml | 21 +++++++++--- .../pdf-viewer/pdf-viewer.component.spec.ts | 32 +++++++++---------- package-lock.json | 10 +++--- package.json | 2 +- 4 files changed, 37 insertions(+), 28 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index b8b4ec2162..dba5154e47 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -64,7 +64,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Ensure SHA pinned actions - uses: zgosalvez/github-actions-ensure-sha-pinned-actions@25ed13d0628a1601b4b44048e63cc4328ed03633 # v3.0.22 + uses: zgosalvez/github-actions-ensure-sha-pinned-actions@4830be28ce81da52ec70d65c552a7403821d98d4 # v3.0.23 - name: Check package-lock.json version run: | @@ -84,10 +84,10 @@ jobs: fetch-depth: 0 - name: Get branch name - uses: Alfresco/alfresco-build-tools/.github/actions/get-branch-name@c1236aee36bb9b35c5972819fcf8a4d07572e6cd # v8.16.0 + uses: Alfresco/alfresco-build-tools/.github/actions/get-branch-name@45bb8b664779b691f8a21d9fd49e360916726c11 # v8.18.1 - name: Save commit message - uses: Alfresco/alfresco-build-tools/.github/actions/get-commit-message@c1236aee36bb9b35c5972819fcf8a4d07572e6cd # v8.16.0 + uses: Alfresco/alfresco-build-tools/.github/actions/get-commit-message@45bb8b664779b691f8a21d9fd49e360916726c11 # v8.18.1 - name: ci:force flag parser shell: bash @@ -173,7 +173,7 @@ jobs: - uses: ./.github/actions/upload-node-modules-and-artifacts unit-tests: - timeout-minutes: 60 + timeout-minutes: 30 name: "Unit tests: ${{ matrix.unit-tests.name }}" runs-on: ubuntu-latest needs: [setup] @@ -182,7 +182,18 @@ jobs: # max-parallel: 4 matrix: unit-tests: + - name: js-api + exclude: "core,insights,content-services,process-services,process-services-cloud,eslint-plugin-eslint-angular" + - name: content-services + exclude: "insights,core,extensions,process-services,process-services-cloud,eslint-plugin-eslint-angular,js-api" - name: core + exclude: "insights,content-services,process-services,process-services-cloud,eslint-plugin-eslint-angular,js-api" + - name: insights + exclude: "core,extensions,content-services,process-services-cloud,process-services,eslint-plugin-eslint-angular,js-api" + - name: process-services + exclude: "core,extensions,content-services,process-services-cloud,insights,eslint-plugin-eslint-angular,js-api" + - name: process-services-cloud + exclude: "insights,core,extensions,content-services,process-services$,eslint-plugin-eslint-angular,js-api" steps: - name: Checkout repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 @@ -192,7 +203,7 @@ jobs: - uses: ./.github/actions/download-node-modules-and-artifacts - name: Run unit tests run: | - xvfb-run --auto-servernum npx nx run ${{ matrix.unit-tests.name}}:test --verbose + /usr/bin/xvfb-run --auto-servernum npx nx affected:test $NX_CALCULATION_FLAGS --exclude=${{ matrix.unit-tests.exclude }} lint: # long timeout required when cache has to be recreated diff --git a/lib/core/src/lib/viewer/components/pdf-viewer/pdf-viewer.component.spec.ts b/lib/core/src/lib/viewer/components/pdf-viewer/pdf-viewer.component.spec.ts index efee968f4a..5e8a6802ba 100644 --- a/lib/core/src/lib/viewer/components/pdf-viewer/pdf-viewer.component.spec.ts +++ b/lib/core/src/lib/viewer/components/pdf-viewer/pdf-viewer.component.spec.ts @@ -100,7 +100,7 @@ class BlobTestComponent { } } //eslint-disable-next-line -xdescribe('Test PdfViewer component', () => { +fdescribe('Test PdfViewer component', () => { let component: PdfViewerComponent; let fixture: ComponentFixture; let change: any; @@ -353,7 +353,7 @@ xdescribe('Test PdfViewer component', () => { }); }); }); - +// eslint-disable-next-line fdescribe('Test PdfViewer - Zoom customization', () => { let fixtureUrlTestComponent: ComponentFixture; let componentUrlTestComponent: UrlTestComponent; @@ -381,35 +381,33 @@ fdescribe('Test PdfViewer - Zoom customization', () => { }); describe('custom value', () => { - beforeEach((done) => { + beforeEach(async () => { const appConfig: AppConfigService = TestBed.inject(AppConfigService); appConfig.config['adf-viewer.pdf-viewer-scaling'] = 80; fixtureUrlTestComponent.detectChanges(); - - firstValueFrom(componentUrlTestComponent.pdfViewerComponent.rendered).then(() => { - done(); - }); - }, 55000); + await fixtureUrlTestComponent.whenStable(); + await firstValueFrom(componentUrlTestComponent.pdfViewerComponent.rendered); + }); it('should use the custom zoom if it is present in the app.config', fakeAsync(() => { spyOn(componentUrlTestComponent.pdfViewerComponent.pdfViewer, 'forceRendering').and.callFake(() => {}); fixtureUrlTestComponent.detectChanges(); - tick(2000); + tick(); expect(componentUrlTestComponent.pdfViewerComponent.pdfViewer.currentScale).toBe(0.8); })); }); - xdescribe('less than the minimum allowed value', () => { + describe('less than the minimum allowed value', () => { beforeEach(async () => { const appConfig: AppConfigService = TestBed.inject(AppConfigService); appConfig.config['adf-viewer.pdf-viewer-scaling'] = 10; fixtureUrlTestComponent.detectChanges(); await fixtureUrlTestComponent.whenStable(); - + await firstValueFrom(componentUrlTestComponent.pdfViewerComponent.rendered); }); it('should use the minimum scale zoom if the value given in app.config is less than the minimum allowed scale', async () => { @@ -422,18 +420,18 @@ fdescribe('Test PdfViewer - Zoom customization', () => { }); }); - xdescribe('greater than the maximum allowed value', () => { + describe('greater than the maximum allowed value', () => { beforeEach(async () => { const appConfig: AppConfigService = TestBed.inject(AppConfigService); appConfig.config['adf-viewer.pdf-viewer-scaling'] = 5555; fixtureUrlTestComponent.detectChanges(); await fixtureUrlTestComponent.whenStable(); - + await firstValueFrom(componentUrlTestComponent.pdfViewerComponent.rendered); }); it('should use the maximum scale zoom if the value given in app.config is greater than the maximum allowed scale', async () => { - + await firstValueFrom(componentUrlTestComponent.pdfViewerComponent.rendered); spyOn(componentUrlTestComponent.pdfViewerComponent.pdfViewer, 'forceRendering').and.callFake(() => {}); fixtureUrlTestComponent.detectChanges(); @@ -442,8 +440,8 @@ fdescribe('Test PdfViewer - Zoom customization', () => { }); }); }); - -xdescribe('Test PdfViewer - User interaction', () => { +// eslint-disable-next-line +fdescribe('Test PdfViewer - User interaction', () => { let fixtureUrlTestComponent: ComponentFixture; let componentUrlTestComponent: UrlTestComponent; let testingUtils: UnitTestingUtils; @@ -471,7 +469,7 @@ xdescribe('Test PdfViewer - User interaction', () => { fixtureUrlTestComponent.detectChanges(); await fixtureUrlTestComponent.whenStable(); - + await firstValueFrom(componentUrlTestComponent.pdfViewerComponent.rendered); }); afterEach(() => { diff --git a/package-lock.json b/package-lock.json index e607b53e55..18cd456736 100644 --- a/package-lock.json +++ b/package-lock.json @@ -38,7 +38,7 @@ "material-icons": "^1.13.12", "minimatch": "^10.0.1", "ng2-charts": "^4.1.1", - "pdfjs-dist": "4.10.38", + "pdfjs-dist": "5.1.91", "raphael": "2.3.0", "rxjs": "7.8.1", "superagent": "^9.0.1", @@ -33837,15 +33837,15 @@ } }, "node_modules/pdfjs-dist": { - "version": "4.10.38", - "resolved": "https://registry.npmjs.org/pdfjs-dist/-/pdfjs-dist-4.10.38.tgz", - "integrity": "sha512-/Y3fcFrXEAsMjJXeL9J8+ZG9U01LbuWaYypvDW2ycW1jL269L3js3DVBjDJ0Up9Np1uqDXsDrRihHANhZOlwdQ==", + "version": "5.1.91", + "resolved": "https://registry.npmjs.org/pdfjs-dist/-/pdfjs-dist-5.1.91.tgz", + "integrity": "sha512-qSIADdagooJB4wWCBnrBJjRvASevmxL0BwafvOuKJG5uTQdYoFBrhrRYnucKNiSc9qS6JIk0hC5y1yktFljXkA==", "license": "Apache-2.0", "engines": { "node": ">=20" }, "optionalDependencies": { - "@napi-rs/canvas": "^0.1.65" + "@napi-rs/canvas": "^0.1.67" } }, "node_modules/picocolors": { diff --git a/package.json b/package.json index 5ab1e50f99..95ab4aa002 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "material-icons": "^1.13.12", "minimatch": "^10.0.1", "ng2-charts": "^4.1.1", - "pdfjs-dist": "4.10.38", + "pdfjs-dist": "5.1.91", "raphael": "2.3.0", "rxjs": "7.8.1", "superagent": "^9.0.1",