diff --git a/e2e/playwright/info-drawer/exclude.tests.json b/e2e/playwright/info-drawer/exclude.tests.json index e4666e4d9..c353bf559 100644 --- a/e2e/playwright/info-drawer/exclude.tests.json +++ b/e2e/playwright/info-drawer/exclude.tests.json @@ -1,8 +1,6 @@ { "XAT-5523": "https://hyland.atlassian.net/browse/ACA-4697", - "XAT-17239": "https://hyland.atlassian.net/browse/ACS-9795", - "XAT-5516": "https://hyland.atlassian.net/browse/ACS-9795", - "XAT-5520": "https://hyland.atlassian.net/browse/ACS-9795", "XAT-5544": "https://hyland.atlassian.net/browse/ACS-9767", - "XAT-5539": "https://hyland.atlassian.net/browse/ACS-9767" + "XAT-5539": "https://hyland.atlassian.net/browse/ACS-9767", + "XAT-5516": "https://hyland.atlassian.net/browse/ACS-9889" } diff --git a/e2e/playwright/info-drawer/src/tests/file-folder-properties.e2e.ts b/e2e/playwright/info-drawer/src/tests/file-folder-properties.e2e.ts index cff45bf61..64f227aad 100755 --- a/e2e/playwright/info-drawer/src/tests/file-folder-properties.e2e.ts +++ b/e2e/playwright/info-drawer/src/tests/file-folder-properties.e2e.ts @@ -58,7 +58,7 @@ test.describe('Info Drawer - file folder Properties', () => { const folder5514 = `xat-5514-e2e-${Utils.random()}`; const folder5516 = `xat-5516-e2e-${Utils.random()}`; const propertiesFolder = `properties-folder-${Utils.random()}`; - const file5516 = `xat-5516-e2e-${Utils.random()}`; + const file5516 = `xat-5516-e2e-${Utils.random()}.jpg`; const folder17238 = `xat-17238-e2e-${Utils.random()}`; const folder17239 = `xat-17239-e2e-${Utils.random()}`; const folder17240 = `xat-17240-e2e-${Utils.random()}`; diff --git a/e2e/playwright/list-views/exclude.tests.json b/e2e/playwright/list-views/exclude.tests.json index 23651ed4a..b947e1d69 100644 --- a/e2e/playwright/list-views/exclude.tests.json +++ b/e2e/playwright/list-views/exclude.tests.json @@ -1,4 +1,3 @@ { - "XAT-4525": "https://hyland.atlassian.net/browse/ACS-9741", - "XAT-4526": "https://hyland.atlassian.net/browse/ACS-9795" + "XAT-4525": "https://hyland.atlassian.net/browse/ACS-9741" } diff --git a/e2e/playwright/search/exclude.tests.json b/e2e/playwright/search/exclude.tests.json index 05d2b54a1..e936e17a3 100644 --- a/e2e/playwright/search/exclude.tests.json +++ b/e2e/playwright/search/exclude.tests.json @@ -1,9 +1,7 @@ { - "XAT-5601": "https://hyland.atlassian.net/browse/ACS-6928", - "XAT-5600": "https://hyland.atlassian.net/browse/ACS-6928", "XAT-17697": "https://hyland.atlassian.net/browse/ACS-7464", - "XAT-17121": "https://hyland.atlassian.net/browse/ACS-9795", - "XAT-17702": "https://hyland.atlassian.net/browse/ACS-9795", + "XAT-17121": "https://hyland.atlassian.net/browse/ACS-9889", + "XAT-17702": "https://hyland.atlassian.net/browse/ACS-9889", "XAT-17701": "https://hyland.atlassian.net/browse/ACS-9860", "XAT-17700": "https://hyland.atlassian.net/browse/ACS-9860", "XAT-5581": "https://hyland.atlassian.net/browse/ACS-9860", diff --git a/e2e/playwright/search/src/tests/search-highlighting.e2e.ts b/e2e/playwright/search/src/tests/search-highlighting.e2e.ts index e63b05d31..653effcd6 100644 --- a/e2e/playwright/search/src/tests/search-highlighting.e2e.ts +++ b/e2e/playwright/search/src/tests/search-highlighting.e2e.ts @@ -53,6 +53,8 @@ test.describe('Search Highlighting', () => { await nodesApi.createFile(fileNameHighlight, '-my-'); await nodesApi.createFile(fileDescriptionHighlight, '-my-', null, fileDescription); await fileActionsApi.uploadFileWithRename(TEST_FILES.PDF.path, fileContentHighlight); + + await fileActionsApi.waitForNodesSearchHighlight(fileContentHighlight, { expect: 1 }); } catch (error) { console.error(`beforeAll failed: ${error}`); } @@ -75,7 +77,8 @@ test.describe('Search Highlighting', () => { expect(await searchPage.dataTable.hasHighlightedText('name')).toBe(false); }); - test('[XAT-17121] Matching phrases should be highlighted in the file content for search results', async ({ searchPage }) => { + test('[XAT-17121] Matching phrases should be highlighted in the file content for search results', async ({ searchPage, personalFiles }) => { + await personalFiles.navigate(); await searchPage.searchWithin(fileContent, 'files'); await searchPage.dataTable.progressBarWaitForReload(); expect(await searchPage.dataTable.hasHighlightedText('content')).toBe(true); diff --git a/e2e/playwright/smoke-test/exclude.tests.json b/e2e/playwright/smoke-test/exclude.tests.json index 445330fc0..3f268cba5 100644 --- a/e2e/playwright/smoke-test/exclude.tests.json +++ b/e2e/playwright/smoke-test/exclude.tests.json @@ -1,3 +1,3 @@ { - "XAT-17738": "https://hyland.atlassian.net/browse/ACS-9795" + "XAT-17738": "https://hyland.atlassian.net/browse/ACS-9889" } diff --git a/e2e/playwright/smoke-test/src/tests/viewer/viewer.e2e.ts b/e2e/playwright/smoke-test/src/tests/viewer/viewer.e2e.ts index c19a4ef5d..f02014042 100644 --- a/e2e/playwright/smoke-test/src/tests/viewer/viewer.e2e.ts +++ b/e2e/playwright/smoke-test/src/tests/viewer/viewer.e2e.ts @@ -109,8 +109,7 @@ test.describe('viewer file', () => { test('[XAT-17738] Viewer with preview URL', async ({ personalFiles }) => { const previewURL = `#/personal-files/${folderId}/(viewer:view/${fileDocxId})`; await personalFiles.navigate({ remoteUrl: previewURL }); - await personalFiles.dataTable.spinnerWaitForReload(); - expect(await personalFiles.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true); + await personalFiles.viewer.waitForViewerLoaderToFinish(timeouts.sixtySeconds); await expect(personalFiles.viewer.fileTitleButtonLocator).toHaveText(randomDocxName); }); }); diff --git a/e2e/playwright/viewer/exclude.tests.json b/e2e/playwright/viewer/exclude.tests.json index 05779a2f6..2f759d57b 100644 --- a/e2e/playwright/viewer/exclude.tests.json +++ b/e2e/playwright/viewer/exclude.tests.json @@ -1,9 +1,6 @@ { - "XAT-5465": "https://hyland.atlassian.net/browse/ACS-9795", - "XAT-17781": "https://hyland.atlassian.net/browse/ACS-9795", - "XAT-17181": "https://hyland.atlassian.net/browse/ACS-9795", - "XAT-17182": "https://hyland.atlassian.net/browse/ACS-9795", - "XAT-17640": "https://hyland.atlassian.net/browse/ACS-9795", - "XAT-17644": "https://hyland.atlassian.net/browse/ACS-9795", - "XAT-5476": "https://hyland.atlassian.net/browse/ACS-9795" + "XAT-17181": "https://hyland.atlassian.net/browse/ACS-9889", + "XAT-17640": "https://hyland.atlassian.net/browse/ACS-9889", + "XAT-17644": "https://hyland.atlassian.net/browse/ACS-9889", + "XAT-17182": "https://hyland.atlassian.net/browse/ACS-9889" } diff --git a/e2e/playwright/viewer/src/tests/viewer-action.e2e.ts b/e2e/playwright/viewer/src/tests/viewer-action.e2e.ts index 28c13bb20..6aa188ea0 100644 --- a/e2e/playwright/viewer/src/tests/viewer-action.e2e.ts +++ b/e2e/playwright/viewer/src/tests/viewer-action.e2e.ts @@ -35,16 +35,16 @@ test.describe('viewer action file', () => { const randomDocxDelete = `${TEST_FILES.DOCX.name}-${Utils.random()}`; const fileForEditOffline = `playwright-file1-${Utils.random()}.docx`; const fileForCancelEditing = `playwright-file2-${Utils.random()}.docx`; - const docxFile2 = TEST_FILES.DOCX2.name; - const docxFile = TEST_FILES.DOCX.name; let folderId: string; let fileDocxShareId: string; let randomDocxNameFavoriteId: string; let fileForCancelEditingId: string; - const filePersonalFiles = `file3-${Utils.random()}.docx`; + const filePersonalFiles = `file3-${Utils.random()}.jpg`; let filePersonalFilesId: string; - const fileForUploadNewVersion2 = `file4-${Utils.random()}.docx`; - let fileForUploadNewVersionId2: string; + const filePersonalFiles2 = TEST_FILES.JPG_FILE.name; + const fileNewVersionLocked = `file4-${Utils.random()}.jpg`; + const fileNewVersionLocked2 = TEST_FILES.JPG_FILE.name; + let fileNewVersionLockedId: string; const destination = `viewer-action-destRF-${Utils.random()}`; let destinationId: string; const docxRecentFiles = `docxRF-${Utils.random()}.docx`; @@ -56,12 +56,12 @@ test.describe('viewer action file', () => { folderId = node.entry.id; fileDocxShareId = (await fileAction.uploadFile(TEST_FILES.DOCX.path, randomDocxNameShare, folderId)).entry.id; - filePersonalFilesId = (await fileAction.uploadFile(TEST_FILES.DOCX2.path, filePersonalFiles, folderId)).entry.id; - fileForUploadNewVersionId2 = (await fileAction.uploadFileWithRename(TEST_FILES.DOCX.path, fileForUploadNewVersion2, folderId)).entry.id; + filePersonalFilesId = (await fileAction.uploadFile(TEST_FILES.JPG_FILE.path, filePersonalFiles, folderId)).entry.id; + fileNewVersionLockedId = (await fileAction.uploadFileWithRename(TEST_FILES.JPG_FILE.path, fileNewVersionLocked, folderId)).entry.id; await fileAction.uploadFileWithRename(TEST_FILES.DOCX.path, docxRecentFiles, folderId); await shareAction.shareFileById(fileDocxShareId); fileForCancelEditingId = (await fileAction.uploadFile(TEST_FILES.DOCX.path, fileForCancelEditing, folderId)).entry.id; - await fileAction.lockNodes([fileForCancelEditingId, fileForUploadNewVersionId2]); + await fileAction.lockNodes([fileForCancelEditingId, fileNewVersionLockedId]); await fileAction.uploadFile(TEST_FILES.DOCX.path, randomDocxName, folderId); await fileAction.uploadFile(TEST_FILES.DOCX.path, randomDocxDelete, folderId); const fileFavoritesNode = await fileAction.uploadFile(TEST_FILES.DOCX.path, randomDocxNameFavorite, folderId); @@ -183,7 +183,7 @@ test.describe('viewer action file', () => { await personalFiles.dataTable.performClickFolderOrFileToOpen(filePersonalFiles); await personalFiles.viewer.waitForViewerToOpen('wait for viewer content'); - await Utils.uploadFileNewVersion(personalFiles, docxFile2); + await Utils.uploadFileNewVersion(personalFiles, filePersonalFiles2, 'jpg'); await personalFiles.uploadNewVersionDialog.majorOption.click(); await personalFiles.uploadNewVersionDialog.description.fill('new major version description'); @@ -193,16 +193,16 @@ test.describe('viewer action file', () => { expect(await personalFiles.viewer.isViewerOpened(), 'Viewer is not open').toBe(true); await Utils.waitForApiResponse(personalFiles, 'content', 200); - expect(await personalFiles.viewer.getFileTitle()).toContain(docxFile2); + expect(await personalFiles.viewer.getFileTitle()).toContain(filePersonalFiles2); expect(await nodesApiAction.getNodeProperty(filePersonalFilesId, 'cm:versionType'), 'File has incorrect version type').toEqual('MAJOR'); expect(await nodesApiAction.getNodeProperty(filePersonalFilesId, 'cm:versionLabel'), 'File has incorrect version label').toEqual('2.0'); }); test('[XAT-17781] Upload new version action when node is locked', async ({ personalFiles }) => { - await personalFiles.dataTable.performClickFolderOrFileToOpen(fileForUploadNewVersion2); + await personalFiles.dataTable.performClickFolderOrFileToOpen(fileNewVersionLocked); await personalFiles.viewer.waitForViewerToOpen('wait for viewer content'); - await Utils.uploadFileNewVersion(personalFiles, docxFile); + await Utils.uploadFileNewVersion(personalFiles, fileNewVersionLocked2, 'jpg'); await personalFiles.uploadNewVersionDialog.uploadButton.click(); await personalFiles.uploadNewVersionDialog.uploadButton.waitFor({ state: 'detached' }); @@ -210,7 +210,7 @@ test.describe('viewer action file', () => { await personalFiles.viewer.waitForViewerToOpen(); await Utils.waitForApiResponse(personalFiles, 'content', 200); - expect(await personalFiles.viewer.getFileTitle()).toContain(docxFile); + expect(await personalFiles.viewer.getFileTitle()).toContain(fileNewVersionLocked2); await personalFiles.acaHeader.clickViewerMoreActions(); await expect(personalFiles.matMenu.getMenuItemFromHeaderMenu('Cancel Editing'), `'Cancel Editing' button shouldn't be shown`).toBeHidden(); diff --git a/e2e/playwright/viewer/src/tests/viewer-file-types.e2e.ts b/e2e/playwright/viewer/src/tests/viewer-file-types.e2e.ts index ae37e1347..1889faba5 100644 --- a/e2e/playwright/viewer/src/tests/viewer-file-types.e2e.ts +++ b/e2e/playwright/viewer/src/tests/viewer-file-types.e2e.ts @@ -23,7 +23,17 @@ */ import { expect } from '@playwright/test'; -import { ApiClientFactory, FileActionsApi, NodesApi, test, TEST_FILES, Utils, TrashcanApi, PersonalFilesPage } from '@alfresco/aca-playwright-shared'; +import { + ApiClientFactory, + FileActionsApi, + NodesApi, + test, + TEST_FILES, + Utils, + TrashcanApi, + PersonalFilesPage, + timeouts +} from '@alfresco/aca-playwright-shared'; test.use({ channel: 'chrome' }); test.describe('viewer file types', () => { @@ -92,7 +102,7 @@ test.describe('viewer file types', () => { ) { await page.dataTable.performClickFolderOrFileToOpen(fileName); expect(await page.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true); - await page.viewer.waitForViewerLoaderToFinish(); + await page.viewer.waitForViewerLoaderToFinish(timeouts.fortySeconds); const viewerElements = { viewerImage: page.viewer.viewerImage, diff --git a/e2e/playwright/viewer/src/tests/viewer-version-actions.e2e.ts b/e2e/playwright/viewer/src/tests/viewer-version-actions.e2e.ts index dc189a3dd..be6dbd31e 100644 --- a/e2e/playwright/viewer/src/tests/viewer-version-actions.e2e.ts +++ b/e2e/playwright/viewer/src/tests/viewer-version-actions.e2e.ts @@ -37,7 +37,8 @@ import { PersonalFilesPage, FavoritesPage, SharedPage, - SearchPage + SearchPage, + timeouts } from '@alfresco/aca-playwright-shared'; test.describe('Version actions', () => { @@ -180,7 +181,7 @@ test.describe('Version actions', () => { test('[XAT-5506] Previous document version title should be the same in Preview mode as in Version Manager - Shared Files', async ({ sharedPage }) => { - await sharedPage.viewer.waitForViewerToOpen('wait for viewer content'); + await sharedPage.viewer.waitForViewerLoaderToFinish(timeouts.fortySeconds); expect(await sharedPage.viewer.getFileTitle()).toContain(filenameBeforeUpdate); }); diff --git a/e2e/playwright/viewer/src/tests/viewer-zoom-functionality.e2e.ts b/e2e/playwright/viewer/src/tests/viewer-zoom-functionality.e2e.ts index fa271111f..4fa3d4eb6 100644 --- a/e2e/playwright/viewer/src/tests/viewer-zoom-functionality.e2e.ts +++ b/e2e/playwright/viewer/src/tests/viewer-zoom-functionality.e2e.ts @@ -186,7 +186,7 @@ test.describe('viewer zoom functionality and reset', () => { await myLibrariesPage.navigate(); await myLibrariesPage.dataTable.performClickFolderOrFileToOpen(randomLibraryName); await myLibrariesPage.dataTable.performClickFolderOrFileToOpen(randomDocxName); - await myLibrariesPage.viewer.waitForViewerLoaderToFinish(); + await myLibrariesPage.viewer.waitForViewerLoaderToFinish(timeouts.fortySeconds); expect(await myLibrariesPage.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true); await myLibrariesPage.viewer.waitForZoomPercentageToDisplay(); await validateZoomScaleInViewer(myLibrariesPage); @@ -224,7 +224,7 @@ test.describe('viewer zoom functionality and reset', () => { await myLibrariesPage.navigate(); await myLibrariesPage.dataTable.performClickFolderOrFileToOpen(randomLibraryName); await myLibrariesPage.dataTable.performClickFolderOrFileToOpen(randomDocxName); - await myLibrariesPage.viewer.waitForViewerLoaderToFinish(); + await myLibrariesPage.viewer.waitForViewerLoaderToFinish(timeouts.fortySeconds); expect(await myLibrariesPage.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true); await myLibrariesPage.viewer.waitForZoomPercentageToDisplay(); await validateFitToPageButtonActivity(myLibrariesPage); diff --git a/e2e/playwright/viewer/src/tests/viewer.e2e.ts b/e2e/playwright/viewer/src/tests/viewer.e2e.ts index aac593c62..21d4f2e19 100644 --- a/e2e/playwright/viewer/src/tests/viewer.e2e.ts +++ b/e2e/playwright/viewer/src/tests/viewer.e2e.ts @@ -41,6 +41,7 @@ import { Site } from '@alfresco/js-api'; test.describe('viewer file', () => { const username = `user-${Utils.random()}`; const randomDocxName = `${TEST_FILES.DOCX.name}-${Utils.random()}`; + const randomJpgName = `${TEST_FILES.JPG_FILE.name}-${Utils.random()}`; const siteUser = `siteUser-${Utils.random()}`; const fileInSite = TEST_FILES.DOCX.name; const siteAdmin = `siteAdmin-${Utils.random()}`; @@ -50,6 +51,7 @@ test.describe('viewer file', () => { let docLibSiteUserId: string; let folderId: string; let fileDocxId: string; + let fileJpgId: string; let nodesApi: NodesApi; let trashcanApi: TrashcanApi; let siteActionsAdmin: SitesApi; @@ -79,6 +81,8 @@ test.describe('viewer file', () => { folderId = node.entry.id; const fileDoc = await fileActionApi.uploadFile(TEST_FILES.DOCX.path, randomDocxName, folderId); fileDocxId = fileDoc.entry.id; + const fileJpg = await fileActionApi.uploadFile(TEST_FILES.JPG_FILE.path, randomJpgName, folderId); + fileJpgId = fileJpg.entry.id; const consumerFavoritesTotalItems = await favoritesActions.getFavoritesTotalItems(username); await shareActions.shareFileById(fileDocxId); await favoritesActions.addFavoriteById('file', fileDocxId); @@ -189,11 +193,10 @@ test.describe('viewer file', () => { }); test('[XAT-5476] Viewer opens when accessing the preview URL for a file', async ({ personalFiles }) => { - const previewURL = `#/personal-files/${folderId}/(viewer:view/${fileDocxId})`; + const previewURL = `#/personal-files/${folderId}/(viewer:view/${fileJpgId})`; await personalFiles.navigate({ remoteUrl: previewURL }); - await personalFiles.dataTable.spinnerWaitForReload(); - expect(await personalFiles.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true); - await expect(personalFiles.viewer.fileTitleButtonLocator).toHaveText(randomDocxName); + await personalFiles.viewer.waitForViewerLoaderToFinish(timeouts.fortySeconds); + await expect(personalFiles.viewer.fileTitleButtonLocator).toContainText(randomJpgName); }); test('[XAT-5480] Viewer opens for a file from Shared Files', async ({ sharedPage }) => { diff --git a/projects/aca-playwright-shared/src/api/file-actions.ts b/projects/aca-playwright-shared/src/api/file-actions.ts index 374fab53d..c4d38e5a9 100644 --- a/projects/aca-playwright-shared/src/api/file-actions.ts +++ b/projects/aca-playwright-shared/src/api/file-actions.ts @@ -25,7 +25,7 @@ import * as fs from 'fs'; import { ApiClientFactory } from './api-client-factory'; import { Utils, waitForApi } from '../utils'; -import { NodeBodyCreate, NodeEntry, ResultSetPaging } from '@alfresco/js-api'; +import { NodeBodyCreate, NodeEntry, ResultSetPaging, SearchRequest } from '@alfresco/js-api'; export class FileActionsApi { private apiService: ApiClientFactory; @@ -159,6 +159,63 @@ export class FileActionsApi { try { await waitForApi(apiCall, predicate, 30, 2500); + console.log(`waitForNodes: Found ${data.expect} nodes with search term "${searchTerm}"`); + } catch (error) { + console.error(`Error: ${error}`); + } + } + + private async queryNodesSearchHighlight(searchTerm: string): Promise { + const data: SearchRequest = { + query: { + query: `cm:name:"${searchTerm}*"`, + language: 'afts' + }, + filterQueries: [{ query: `+TYPE:'cm:folder' OR +TYPE:'cm:content'` }], + highlight: { + prefix: "", + postfix: '', + fields: [ + { + field: 'cm:title' + }, + { + field: 'cm:name' + }, + { + field: 'cm:description', + snippetCount: 1 + }, + { + field: 'cm:content', + snippetCount: 1 + } + ] + } + }; + + try { + return this.apiService.search.search(data); + } catch { + return new ResultSetPaging(); + } + } + + async waitForNodesSearchHighlight(searchTerm: string, data: { expect: number }): Promise { + const predicate = (totalItems: number): boolean => totalItems === data.expect; + + const apiCall = async (): Promise => { + try { + return (await this.queryNodesSearchHighlight(searchTerm)).list.pagination.totalItems; + } catch (error) { + console.warn(`queryNodesSearchHighlight failed for "${searchTerm}":`, error); + return 0; + } + }; + + try { + await waitForApi(apiCall, predicate, 30, 2500); + console.log(`waitForNodesSearchHighlight: Found ${data.expect} nodes with search term "${searchTerm}"`); } catch (error) { console.error(`Error: ${error}`); } diff --git a/projects/aca-playwright-shared/src/page-objects/components/search/search-filters/search-filters-properties.component.ts b/projects/aca-playwright-shared/src/page-objects/components/search/search-filters/search-filters-properties.component.ts index 1bbe09a50..f90d81f3f 100644 --- a/projects/aca-playwright-shared/src/page-objects/components/search/search-filters/search-filters-properties.component.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/search/search-filters/search-filters-properties.component.ts @@ -90,9 +90,8 @@ export class SearchFiltersProperties extends BaseComponent { if (fileTypeInputText) { await this.fileTypeInput?.fill(fileTypeInputText); - const targetDropdownOption = this.page.locator(`mat-option`, { hasText: fileTypeInputText }); - - await targetDropdownOption.click(); + await this.dropdownOptions.getByText(fileTypeInputText).waitFor(); + await this.dropdownOptions.getByText(fileTypeInputText).click(); } await page.searchFilters.menuCardApply.click(); diff --git a/projects/aca-playwright-shared/src/page-objects/components/viewer.component.ts b/projects/aca-playwright-shared/src/page-objects/components/viewer.component.ts index 870b062f9..c00cb0a3f 100644 --- a/projects/aca-playwright-shared/src/page-objects/components/viewer.component.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/viewer.component.ts @@ -63,6 +63,11 @@ export class ViewerComponent extends BaseComponent { return count > 0; } + async isViewerOpened(): Promise { + await this.waitForViewerToOpen(); + return this.viewerLocator.isVisible(); + } + async waitForViewerToOpen(waitForViewerContent?: 'wait for viewer content'): Promise { if (waitForViewerContent) { await this.waitForViewerLoaderToFinish(); @@ -70,13 +75,13 @@ export class ViewerComponent extends BaseComponent { await this.viewerLocator.waitFor({ state: 'visible', timeout: timeouts.large }); } - async isViewerOpened(): Promise { - await this.waitForViewerToOpen(); - return this.viewerLocator.isVisible(); - } - - async waitForViewerLoaderToFinish(): Promise { - await this.viewerSpinner.waitFor({ state: 'hidden', timeout: timeouts.extraLarge }); + async waitForViewerLoaderToFinish(customTimeout?: number): Promise { + try { + await this.viewerSpinner.waitFor({ state: 'hidden', timeout: customTimeout || timeouts.extraLarge }); + } catch (error) { + this.logger.log('waitForViewerLoaderToFinish: Timeout reached while waiting for viewer loader to finish.'); + throw error; + } } async checkViewerActivePage(pageNumber: number): Promise { diff --git a/projects/aca-playwright-shared/src/utils/timeouts.ts b/projects/aca-playwright-shared/src/utils/timeouts.ts index 2e4ab38d0..eb8d21e8c 100644 --- a/projects/aca-playwright-shared/src/utils/timeouts.ts +++ b/projects/aca-playwright-shared/src/utils/timeouts.ts @@ -31,6 +31,8 @@ export const timeouts = { big: 7.5 * 1000, large: 10 * 1000, extraLarge: 20 * 1000, + fortySeconds: 40 * 1000, + sixtySeconds: 60 * 1000, globalTest: 85 * 1000, extendedTest: 150 * 1000, extendedLongTest: 200 * 1000, diff --git a/projects/aca-playwright-shared/src/utils/utils.ts b/projects/aca-playwright-shared/src/utils/utils.ts index 582d84567..aa555c6f1 100644 --- a/projects/aca-playwright-shared/src/utils/utils.ts +++ b/projects/aca-playwright-shared/src/utils/utils.ts @@ -96,9 +96,9 @@ export class Utils { } } - static async uploadFileNewVersion(personalFilesPage: PersonalFilesPage, fileFromOS: string): Promise { + static async uploadFileNewVersion(personalFilesPage: PersonalFilesPage, fileFromOS: string, fileType: string): Promise { const fileInput = await personalFilesPage.page.$('#app-upload-file-version'); - await fileInput.setInputFiles(path.join(__dirname, `../resources/test-files/${fileFromOS}.docx`)); + await fileInput.setInputFiles(path.join(__dirname, `../resources/test-files/${fileFromOS}.${fileType}`)); } static async reloadPageIfRowNotVisible(