[ACS-11617] added test for XAT-19318 and fixed false positives for viewer e2es (#5163)

* [ACS-11617] added test for XAT-19318 and fixed false positives for viewer e2es

* [ACS-11617] cleaned exclude file

* [ACS-11617] added 1s delay in openFileInViewer

* [ACS-11617] changed name for override-ci to ci:skip-e2e
This commit is contained in:
Adam Świderski
2026-04-22 12:58:41 +02:00
committed by GitHub
parent aa3e21dc0e
commit dfe27c6032
5 changed files with 43 additions and 12 deletions
+3 -3
View File
@@ -109,7 +109,7 @@ jobs:
run: npm run ci:test -- $TEST_OPTS run: npm run ci:test -- $TEST_OPTS
e2es-playwright: e2es-playwright:
if: ${{ !contains(github.event.pull_request.labels.*.name, 'override-ci') }} if: ${{ !contains(github.event.pull_request.labels.*.name, 'ci:skip-e2e') }}
needs: [lint, build, unit-tests] needs: [lint, build, unit-tests]
name: E2E | ${{ matrix.browser || 'chromium' }} | ${{ matrix.e2e-suites.name }} | Playwright name: E2E | ${{ matrix.browser || 'chromium' }} | ${{ matrix.e2e-suites.name }} | Playwright
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
@@ -258,8 +258,8 @@ jobs:
run: exit 1 run: exit 1
- name: Check e2e skipped - name: Check e2e skipped
if: ${{ contains(github.event.pull_request.labels.*.name, 'override-ci') }} if: ${{ contains(github.event.pull_request.labels.*.name, 'ci:skip-e2e') }}
run: echo "E2E tests were skipped due to override-ci label" run: echo "E2E tests were skipped due to ci:skip-e2e label"
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@v6
@@ -1,7 +1,6 @@
{ {
"all": { "all": {
"XAT-5523": "https://hyland.atlassian.net/browse/ACA-4697", "XAT-5523": "https://hyland.atlassian.net/browse/ACA-4697",
"XAT-5516": "https://hyland.atlassian.net/browse/ACS-9889", "XAT-5516": "https://hyland.atlassian.net/browse/ACS-9889"
"XAT-5546": "https://hyland.atlassian.net/browse/ACS-10621"
} }
} }
@@ -32,7 +32,8 @@ import {
Utils, Utils,
TrashcanApi, TrashcanApi,
PersonalFilesPage, PersonalFilesPage,
timeouts timeouts,
logger
} from '@alfresco/aca-playwright-shared'; } from '@alfresco/aca-playwright-shared';
test.use({ channel: 'chrome' }); test.use({ channel: 'chrome' });
@@ -49,6 +50,7 @@ test.describe('viewer file types', () => {
const randomMp3Name = `${TEST_FILES.MP3_FILE.name}-${randomString}.mp3`; const randomMp3Name = `${TEST_FILES.MP3_FILE.name}-${randomString}.mp3`;
const randomMp4Name = `${TEST_FILES.MP4_FILE.name}-${randomString}.mp4`; const randomMp4Name = `${TEST_FILES.MP4_FILE.name}-${randomString}.mp4`;
const randomWebmName = `${TEST_FILES.WEBM_FILE.name}-${randomString}.webm`; const randomWebmName = `${TEST_FILES.WEBM_FILE.name}-${randomString}.webm`;
const randomAzw3Name = `${TEST_FILES.AZW3_FILE.name}-${randomString}.azw3`;
let nodesApi: NodesApi; let nodesApi: NodesApi;
let trashcanApi: TrashcanApi; let trashcanApi: TrashcanApi;
let fileActionApi: FileActionsApi; let fileActionApi: FileActionsApi;
@@ -61,7 +63,9 @@ test.describe('viewer file types', () => {
await apiClientFactory.createUser({ username }); await apiClientFactory.createUser({ username });
} catch (exception) { } catch (exception) {
if (JSON.parse(exception.message).error.statusCode !== 409) { if (JSON.parse(exception.message).error.statusCode !== 409) {
throw new Error(`----- beforeAll failed : ${exception}`); const errorMessage = `----- beforeAll failed : ${exception}`;
logger.error(errorMessage);
throw new Error(errorMessage);
} }
} }
@@ -78,7 +82,8 @@ test.describe('viewer file types', () => {
{ path: TEST_FILES.PPTX_FILE.path, name: randomPptxName }, { path: TEST_FILES.PPTX_FILE.path, name: randomPptxName },
{ path: TEST_FILES.MP3_FILE.path, name: randomMp3Name }, { path: TEST_FILES.MP3_FILE.path, name: randomMp3Name },
{ path: TEST_FILES.MP4_FILE.path, name: randomMp4Name }, { path: TEST_FILES.MP4_FILE.path, name: randomMp4Name },
{ path: TEST_FILES.WEBM_FILE.path, name: randomWebmName } { path: TEST_FILES.WEBM_FILE.path, name: randomWebmName },
{ path: TEST_FILES.AZW3_FILE.path, name: randomAzw3Name }
]; ];
for (const file of filesToUpload) { for (const file of filesToUpload) {
@@ -86,6 +91,7 @@ test.describe('viewer file types', () => {
} }
await fileActionApi.waitForNodes(randomWebmName, { expect: 1 }); await fileActionApi.waitForNodes(randomWebmName, { expect: 1 });
await fileActionApi.waitForNodes(randomAzw3Name, { expect: 1 });
}); });
test.beforeEach(async ({ loginPage }) => { test.beforeEach(async ({ loginPage }) => {
@@ -96,14 +102,25 @@ test.describe('viewer file types', () => {
await Utils.deleteNodesSitesEmptyTrashcan(nodesApi, trashcanApi, 'afterAll failed'); await Utils.deleteNodesSitesEmptyTrashcan(nodesApi, trashcanApi, 'afterAll failed');
}); });
async function openFileInViewer(page: PersonalFilesPage, fileName: string) {
await page.dataTable.performClickFolderOrFileToOpen(fileName);
expect(await page.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true);
await page.viewer.waitForViewerLoaderToFinish(timeouts.fortySeconds);
await Utils.delayInSeconds(1);
}
async function checkViewerDisplay( async function checkViewerDisplay(
page: PersonalFilesPage, page: PersonalFilesPage,
fileName: string, fileName: string,
fileType: 'viewerImage' | 'viewerDocument' | 'viewerMedia' = 'viewerImage' fileType: 'viewerImage' | 'viewerDocument' | 'viewerMedia' = 'viewerImage'
) { ) {
await page.dataTable.performClickFolderOrFileToOpen(fileName); await openFileInViewer(page, fileName);
expect(await page.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true);
await page.viewer.waitForViewerLoaderToFinish(timeouts.fortySeconds); if (await page.viewer.unknownFormat.isVisible()) {
const unknownFormatErrorMessage = `File ${fileName} is not displayed in the viewer. Unknown format message is shown instead.`;
logger.error(unknownFormatErrorMessage);
throw new Error(unknownFormatErrorMessage);
}
const viewerElements = { const viewerElements = {
viewerImage: page.viewer.viewerImage, viewerImage: page.viewer.viewerImage,
@@ -113,12 +130,19 @@ test.describe('viewer file types', () => {
const viewerElement = viewerElements[fileType]; const viewerElement = viewerElements[fileType];
if (!viewerElement) { if (!viewerElement) {
throw new Error(`Wrong viewer file type: ${fileType}`); const errorMessage = `Wrong viewer file type: ${fileType}`;
logger.error(errorMessage);
throw new Error(errorMessage);
} }
await expect(viewerElement).toBeVisible(); await expect(viewerElement).toBeVisible();
} }
async function checkViewerDisplayUnknownFormat(page: PersonalFilesPage, fileName: string) {
await openFileInViewer(page, fileName);
await expect(page.viewer.unknownFormat).toBeVisible();
}
test('[XAT-17177] Image files are properly displayed in the viewer - JPG', async ({ personalFiles }) => { test('[XAT-17177] Image files are properly displayed in the viewer - JPG', async ({ personalFiles }) => {
await checkViewerDisplay(personalFiles, randomJpgName, 'viewerImage'); await checkViewerDisplay(personalFiles, randomJpgName, 'viewerImage');
}); });
@@ -155,6 +179,10 @@ test.describe('viewer file types', () => {
await checkViewerDisplay(personalFiles, randomWebmName, 'viewerMedia'); await checkViewerDisplay(personalFiles, randomWebmName, 'viewerMedia');
}); });
test('[XAT-19318] Unsupported file types have proper fallback', async ({ personalFiles }) => {
await checkViewerDisplayUnknownFormat(personalFiles, randomAzw3Name);
});
test('[XAT-5485] User can select a document page through the thumbnail pane', async ({ personalFiles }) => { test('[XAT-5485] User can select a document page through the thumbnail pane', async ({ personalFiles }) => {
await personalFiles.dataTable.performClickFolderOrFileToOpen(randomPdfName); await personalFiles.dataTable.performClickFolderOrFileToOpen(randomPdfName);
expect(await personalFiles.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true); expect(await personalFiles.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true);
@@ -107,5 +107,9 @@ export const TEST_FILES = {
name: 'file-protected', name: 'file-protected',
data: 'Lorem ipsum dolor sit amet', data: 'Lorem ipsum dolor sit amet',
password: '0000' password: '0000'
},
AZW3_FILE: {
path: resolve(__dirname, 'file-azw3.azw3'),
name: 'file-azw3'
} }
}; };