diff --git a/e2e/playwright/viewer/exclude.tests.json b/e2e/playwright/viewer/exclude.tests.json
index 0967ef424b..e43a787031 100644
--- a/e2e/playwright/viewer/exclude.tests.json
+++ b/e2e/playwright/viewer/exclude.tests.json
@@ -1 +1,6 @@
-{}
+{
+ "C284636" : "https://alfresco.atlassian.net/browse/ACS-5639",
+ "C284635" : "https://alfresco.atlassian.net/browse/ACS-5639",
+ "C279175" : "https://alfresco.atlassian.net/browse/ACS-5639",
+ "C284634" : "https://alfresco.atlassian.net/browse/ACS-5639"
+}
diff --git a/e2e/playwright/viewer/src/tests/viewer-protected.spec.ts b/e2e/playwright/viewer/src/tests/viewer-protected.spec.ts
new file mode 100644
index 0000000000..565ab2863f
--- /dev/null
+++ b/e2e/playwright/viewer/src/tests/viewer-protected.spec.ts
@@ -0,0 +1,91 @@
+/*!
+ * Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
+ *
+ * Alfresco Example Content Application
+ *
+ * This file is part of the Alfresco Example Content Application.
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ *
+ * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Alfresco Example Content Application is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * from Hyland Software. If not, see .
+ */
+
+import { expect } from '@playwright/test';
+import { ApiClientFactory, getUserState, test, TEST_FILES, Utils } from '@alfresco/playwright-shared';
+
+test.use({ storageState: getUserState('hruser') });
+test.describe('viewer file', () => {
+ const apiClientFactory = new ApiClientFactory();
+ const randomFolderName = `playwright-folder-${Utils.random()}`;
+ const randomDocxName = `${TEST_FILES.DOCX_PROTECTED.name}-${Utils.random()}`;
+ let folderId: string;
+ let fileDocxId: string;
+
+ test.beforeAll(async ({ fileAction, shareAction, favoritesPageAction: favoritesPageAction }) => {
+ await apiClientFactory.setUpAcaBackend('hruser');
+ const node = await apiClientFactory.nodes.createNode('-my-', { name: randomFolderName, nodeType: 'cm:folder', relativePath: '/' });
+ folderId = await node.entry.id;
+ const fileDoc = await fileAction.uploadFile(TEST_FILES.DOCX_PROTECTED.path, randomDocxName, folderId);
+ fileDocxId = await fileDoc.entry.id;
+ await shareAction.shareFileById(fileDocxId);
+ await favoritesPageAction.addFavoriteById('file', fileDocxId);
+ });
+
+ test.beforeEach(async ({ personalFiles }) => {
+ const gotoNodeURL = `#/personal-files/${folderId}`;
+ await personalFiles.navigate({ remoteUrl: gotoNodeURL });
+ await personalFiles.dataTable.performClickFolderOrFileToOpen(randomDocxName);
+ });
+
+ test.afterAll(async () => {
+ await apiClientFactory.nodes.deleteNode(folderId);
+ });
+
+ test('[C268958] Password dialog appears when opening a protected file', async ({ personalFiles }) => {
+ expect(await personalFiles.passwordDialog.isDialogOpen(), 'Password dialog not open').toBe(true);
+ expect(await personalFiles.passwordDialog.isPasswordInputDisplayed(), 'Password input not displayed').toBe(true);
+ expect(await personalFiles.passwordDialog.submitButton.isHidden(), 'Submit button not disabled').toBe(false);
+ expect(await personalFiles.passwordDialog.isCloseVisible(), 'Close button not enabled').toBe(true);
+ expect(await personalFiles.viewer.pdfViewerContentPages.isVisible(), 'Viewer did not close').toBe(false);
+ });
+
+ test('[C268959] File content is displayed when entering the correct password', async ({ personalFiles }) => {
+ await personalFiles.passwordDialog.enterPassword(TEST_FILES.DOCX_PROTECTED.password);
+ expect(await personalFiles.passwordDialog.submitButton.isVisible(), 'Submit button not enabled').toBe(true);
+
+ await personalFiles.passwordDialog.submitButton.click();
+ await personalFiles.passwordDialog.waitForDialogToClose();
+
+ expect(await personalFiles.viewer.isPdfViewerContentDisplayed(), 'file content not displayed').toBe(true);
+ });
+
+ test('[C268960] Error appears when entering an incorrect password', async ({ personalFiles }) => {
+ await personalFiles.passwordDialog.enterPassword('incorrect');
+ expect(await personalFiles.passwordDialog.submitButton.isVisible(), 'Submit button not enabled').toBe(true);
+ await personalFiles.passwordDialog.submitButton.click();
+
+ expect(await personalFiles.passwordDialog.getErrorMessage()).toBe('Password is wrong');
+ expect(await personalFiles.viewer.isPdfViewerContentDisplayed(), 'file content is displayed').toBe(false);
+ });
+
+ test('[C268961] Refresh the page while Password dialog is open', async ({ personalFiles }) => {
+ await personalFiles.passwordDialog.enterPassword(TEST_FILES.DOCX_PROTECTED.password);
+ await personalFiles.reload({ waitUntil: 'domcontentloaded' });
+ await personalFiles.viewer.waitForViewerToOpen();
+
+ expect(await personalFiles.viewer.isPdfViewerContentDisplayed(), 'file content is displayed').toBe(false);
+ expect(await personalFiles.passwordDialog.isDialogOpen(), 'Password dialog not open').toBe(true);
+ });
+});
diff --git a/e2e/playwright/viewer/src/tests/viewer.spec.ts b/e2e/playwright/viewer/src/tests/viewer.spec.ts
index 709b554a4e..205f933b41 100644
--- a/e2e/playwright/viewer/src/tests/viewer.spec.ts
+++ b/e2e/playwright/viewer/src/tests/viewer.spec.ts
@@ -23,29 +23,25 @@
*/
import { expect } from '@playwright/test';
-import { ApiClientFactory, getUserState, test, TEST_FILES } from '@alfresco/playwright-shared';
+import { ApiClientFactory, getUserState, test, TEST_FILES, Utils } from '@alfresco/playwright-shared';
test.use({ storageState: getUserState('admin') });
test.describe('viewer file', () => {
const apiClientFactory = new ApiClientFactory();
- const randomFolderName = `playwright-folder-${(Math.random() + 1).toString(36).substring(6)}`;
- const randomDocxName = TEST_FILES.DOCX.name + (Math.random() + 1).toString(36).substring(6);
+ const randomFolderName = `playwright-folder-${Utils.random()}`;
+ const randomDocxName = `$(TEST_FILES.DOCX.name)-${Utils.random()}`;
let folderId: string;
- let fileDocxId: string;
- test.beforeAll(async ({ fileAction, shareAction, favoritesPageAction: favoritesPageAction }) => {
+ test.beforeAll(async ({ fileAction }) => {
await apiClientFactory.setUpAcaBackend('admin');
const node = await apiClientFactory.nodes.createNode('-my-', { name: randomFolderName, nodeType: 'cm:folder', relativePath: '/' });
folderId = await node.entry.id;
- const fileDoc = await fileAction.uploadFile(TEST_FILES.DOCX.path, randomDocxName, folderId);
- fileDocxId = await fileDoc.entry.id;
- await shareAction.shareFileById(fileDocxId);
- await favoritesPageAction.addFavoriteById('file', fileDocxId);
+ await fileAction.uploadFile(TEST_FILES.DOCX.path, randomDocxName, folderId);
});
test.beforeEach(async ({ personalFiles }) => {
- await personalFiles.navigate({ waitUntil: 'domcontentloaded' });
- await personalFiles.dataTable.performClickFolderOrFileToOpen(randomFolderName);
+ const gotoNodeURL = `#/personal-files/${folderId}`;
+ await personalFiles.navigate({ remoteUrl: gotoNodeURL });
});
test.afterAll(async () => {
@@ -76,7 +72,7 @@ test.describe('viewer file', () => {
await personalFiles.dataTable.performClickFolderOrFileToOpen(randomDocxName);
expect(await personalFiles.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true);
await personalFiles.viewer.closeButtonLocator.click();
- expect(await personalFiles.viewer.isViewerOpened(), 'Viewer did not close').toBe(false);
+ expect(await personalFiles.dataTable.getCellLinkByName(randomDocxName).isVisible(), 'Viewer did not close').toBe(true);
});
test('[C284632] Close button tooltip', async ({ personalFiles }) => {
@@ -84,14 +80,6 @@ test.describe('viewer file', () => {
expect(await personalFiles.viewer.getCloseButtonTooltip()).toEqual('Close');
});
- test('[C279285] Viewer opens when accessing the preview URL for a file', 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);
- expect(await personalFiles.viewer.fileTitleButtonLocator.innerText()).toEqual(randomDocxName);
- });
-
test('[C284636] Viewer opens for a file from Recent Files', async ({ personalFiles, recentFilesPage }) => {
await personalFiles.dataTable.performClickFolderOrFileToOpen(randomDocxName);
expect(await personalFiles.viewer.getCloseButtonTooltip()).toEqual('Close');
@@ -103,9 +91,53 @@ test.describe('viewer file', () => {
expect(await recentFilesPage.viewer.isFileTitleDisplayed(), 'File title is not displayed').toBe(true);
});
+ test('[C279175] Viewer opens for a file from Search Results', async ({ personalFiles, searchPage }) => {
+ await personalFiles.acaHeader.searchButton.click();
+ await searchPage.searchInput.searchButton.click();
+ await searchPage.searchOverlay.checkFilesAndFolders();
+ await searchPage.searchOverlay.searchFor(randomDocxName);
+ await searchPage.reload({ waitUntil: 'domcontentloaded' });
+ await searchPage.dataTable.goThroughPagesLookingForRowWithName(randomDocxName);
+ await searchPage.searchInput.performDoubleClickFolderOrFileToOpen(randomDocxName);
+ expect(await searchPage.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true);
+ expect(await searchPage.viewer.isCloseButtonDisplayed(), 'Close button is not displayed').toBe(true);
+ expect(await searchPage.viewer.isFileTitleDisplayed(), 'File title is not displayed').toBe(true);
+ });
+});
+
+test.describe('viewer file', () => {
+ const apiClientFactory = new ApiClientFactory();
+ const randomFolderName = `playwright-folder-${Utils.random()}`;
+ const randomDocxName = `$(TEST_FILES.DOCX.name)-${Utils.random()}`;
+ let folderId: string;
+ let fileDocxId: string;
+
+ test.beforeAll(async ({ fileAction, shareAction, favoritesPageAction: favoritesPageAction }) => {
+ await apiClientFactory.setUpAcaBackend('admin');
+ const node = await apiClientFactory.nodes.createNode('-my-', { name: randomFolderName, nodeType: 'cm:folder', relativePath: '/' });
+ folderId = await node.entry.id;
+ const fileDoc = await fileAction.uploadFile(TEST_FILES.DOCX.path, randomDocxName, folderId);
+ fileDocxId = await fileDoc.entry.id;
+ await shareAction.shareFileById(fileDocxId);
+ await favoritesPageAction.addFavoriteById('file', fileDocxId);
+ });
+
+ test.afterAll(async () => {
+ await apiClientFactory.nodes.deleteNode(folderId);
+ });
+
+ test('[C279285] Viewer opens when accessing the preview URL for a file', 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);
+ expect(await personalFiles.viewer.fileTitleButtonLocator.innerText()).toEqual(randomDocxName);
+ });
+
test('[C284635] Viewer opens for a file from Shared Files', async ({ sharedPage }) => {
await sharedPage.navigate();
await sharedPage.reload();
+ await sharedPage.dataTable.goThroughPagesLookingForRowWithName(randomDocxName);
await sharedPage.dataTable.performClickFolderOrFileToOpen(randomDocxName);
expect(await sharedPage.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true);
expect(await sharedPage.viewer.isCloseButtonDisplayed(), 'Close button is not displayed').toBe(true);
@@ -114,22 +146,10 @@ test.describe('viewer file', () => {
test('[C284634] Viewer opens for a file from Favorites', async ({ favoritePage }) => {
await favoritePage.navigate({ waitUntil: 'domcontentloaded' });
+ await favoritePage.dataTable.goThroughPagesLookingForRowWithName(randomDocxName);
await favoritePage.dataTable.performClickFolderOrFileToOpen(randomDocxName);
expect(await favoritePage.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true);
expect(await favoritePage.viewer.isCloseButtonDisplayed(), 'Close button is not displayed').toBe(true);
expect(await favoritePage.viewer.isFileTitleDisplayed(), 'File title is not displayed').toBe(true);
});
-
- test('[C279175] Viewer opens for a file from Search Results', async ({ personalFiles, searchPage }) => {
- await personalFiles.acaHeader.searchButton.click();
- await searchPage.searchInput.searchButton.click();
- await searchPage.searchOverlay.checkFilesAndFolders();
- await searchPage.searchOverlay.searchFor(randomDocxName);
- await searchPage.reload({ waitUntil: 'domcontentloaded' });
-
- await searchPage.searchInput.performDoubleClickFolderOrFileToOpen(randomDocxName);
- expect(await searchPage.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true);
- expect(await searchPage.viewer.isCloseButtonDisplayed(), 'Close button is not displayed').toBe(true);
- expect(await searchPage.viewer.isFileTitleDisplayed(), 'File title is not displayed').toBe(true);
- });
});
diff --git a/e2e/protractor/protractor.excludes.json b/e2e/protractor/protractor.excludes.json
index 8f26192e3a..353fbcc7d9 100644
--- a/e2e/protractor/protractor.excludes.json
+++ b/e2e/protractor/protractor.excludes.json
@@ -19,5 +19,11 @@
"C279221": "temp, will be fixed in https://alfresco.atlassian.net/browse/ACS-4985",
"C279220": "temp, will be fixed in https://alfresco.atlassian.net/browse/ACS-4985",
"C325006": "temp, will be fixed in https://alfresco.atlassian.net/browse/ACS-4985",
- "C213097": "https://alfresco.atlassian.net/browse/ACS-5479"
+ "C213097": "https://alfresco.atlassian.net/browse/ACS-5479",
+
+ "C268958" : "test migrated to playwright https://alfresco.atlassian.net/browse/ACS-5604",
+ "C268959" : "test migrated to playwright https://alfresco.atlassian.net/browse/ACS-5604",
+ "C268960" : "test migrated to playwright https://alfresco.atlassian.net/browse/ACS-5604",
+ "C268961" : "test migrated to playwright https://alfresco.atlassian.net/browse/ACS-5604"
+
}
diff --git a/e2e/protractor/suites/viewer/viewer-general.test.ts b/e2e/protractor/suites/viewer/viewer-general.test.ts
index 37f12450d1..0685d5fcdc 100755
--- a/e2e/protractor/suites/viewer/viewer-general.test.ts
+++ b/e2e/protractor/suites/viewer/viewer-general.test.ts
@@ -48,8 +48,9 @@ describe('Viewer general', () => {
const loginPage = new LoginPage();
const page = new BrowsingPage();
- const { dataTable } = page;
+ const { dataTable, toolbar } = page;
const viewer = new Viewer();
+ const { searchInput } = page.pageLayoutHeader;
const adminApiActions = new AdminActions();
const userActions = new UserActions();
@@ -112,4 +113,45 @@ describe('Viewer general', () => {
expect(await viewer.isCloseButtonDisplayed()).toBe(true, 'Close button is not displayed');
expect(await viewer.isFileTitleDisplayed()).toBe(true, 'File title is not displayed');
});
+
+ it('[C284636] Viewer opens for a file from Recent Files', async () => {
+ await page.clickRecentFilesAndWait();
+ await dataTable.doubleClickOnRowByName(xlsxFile);
+ expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
+ expect(await viewer.isViewerToolbarDisplayed()).toBe(true, 'Toolbar not displayed');
+ expect(await viewer.isCloseButtonDisplayed()).toBe(true, 'Close button is not displayed');
+ expect(await viewer.isFileTitleDisplayed()).toBe(true, 'File title is not displayed');
+ });
+
+ it('[C284635] Viewer opens for a file from Shared Files', async () => {
+ await page.clickSharedFilesAndWait();
+ await dataTable.doubleClickOnRowByName(xlsxFile);
+ expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
+ expect(await viewer.isViewerToolbarDisplayed()).toBe(true, 'Toolbar not displayed');
+ expect(await viewer.isCloseButtonDisplayed()).toBe(true, 'Close button is not displayed');
+ expect(await viewer.isFileTitleDisplayed()).toBe(true, 'File title is not displayed');
+ });
+
+ it('[C284634] Viewer opens for a file from Favorites', async () => {
+ await page.clickFavoritesAndWait();
+ await dataTable.doubleClickOnRowByName(xlsxFile);
+ expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
+ expect(await viewer.isViewerToolbarDisplayed()).toBe(true, 'Toolbar not displayed');
+ expect(await viewer.isCloseButtonDisplayed()).toBe(true, 'Close button is not displayed');
+ expect(await viewer.isFileTitleDisplayed()).toBe(true, 'File title is not displayed');
+ });
+
+ it('[C279175] Viewer opens for a file from Search Results', async () => {
+ await toolbar.clickSearchIconButton();
+ await searchInput.clickSearchButton();
+ await searchInput.checkFilesAndFolders();
+ await searchInput.searchFor(xlsxFile);
+ await dataTable.waitForBody();
+
+ await dataTable.doubleClickOnRowByName(xlsxFile);
+ expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
+ expect(await viewer.isViewerToolbarDisplayed()).toBe(true, 'Toolbar not displayed');
+ expect(await viewer.isCloseButtonDisplayed()).toBe(true, 'Close button is not displayed');
+ expect(await viewer.isFileTitleDisplayed()).toBe(true, 'File title is not displayed');
+ });
});
diff --git a/projects/aca-playwright-shared/src/page-objects/components/dataTable/data-table.component.ts b/projects/aca-playwright-shared/src/page-objects/components/dataTable/data-table.component.ts
index 33b079a3cc..c1be07e465 100644
--- a/projects/aca-playwright-shared/src/page-objects/components/dataTable/data-table.component.ts
+++ b/projects/aca-playwright-shared/src/page-objects/components/dataTable/data-table.component.ts
@@ -160,11 +160,10 @@ export class DataTableComponent extends BaseComponent {
*
* @param name of the data table element with which we want to double click
*/
- async performClickFolderOrFileToOpen(name: string): Promise {
- await this.goThroughPagesLookingForRowWithName(name);
- await this.getCellLinkByName(name).click();
- await this.spinnerWaitForReload();
- }
+ async performClickFolderOrFileToOpen(name: string): Promise {
+ await this.getCellLinkByName(name).click();
+ await this.spinnerWaitForReload();
+ }
async getActionLocatorFromExpandableMenu(name: string | number, action: string): Promise {
await this.getRowByName(name).click({ button: 'right' });
@@ -200,8 +199,8 @@ export class DataTableComponent extends BaseComponent {
async selectItem(name: string): Promise {
const isSelected = await this.hasCheckMarkIcon(name);
if (!isSelected) {
- const row = await this.getRowByName(name);
- await row.locator('.mat-checkbox[id*="mat-checkbox"]').check();
+ const row = await this.getRowByName(name);
+ await row.locator('.mat-checkbox[id*="mat-checkbox"]').check();
}
}
diff --git a/projects/aca-playwright-shared/src/page-objects/components/dialogs/index.ts b/projects/aca-playwright-shared/src/page-objects/components/dialogs/index.ts
index 1177660266..8a0e9a2a04 100644
--- a/projects/aca-playwright-shared/src/page-objects/components/dialogs/index.ts
+++ b/projects/aca-playwright-shared/src/page-objects/components/dialogs/index.ts
@@ -24,4 +24,4 @@
export * from './adf-folder-dialog.component';
export * from './adf-library-dialog.component';
-
+export * from './password-overlay-dialog.component';
diff --git a/projects/aca-playwright-shared/src/page-objects/components/dialogs/password-overlay-dialog.component.ts b/projects/aca-playwright-shared/src/page-objects/components/dialogs/password-overlay-dialog.component.ts
new file mode 100644
index 0000000000..0255cb12a1
--- /dev/null
+++ b/projects/aca-playwright-shared/src/page-objects/components/dialogs/password-overlay-dialog.component.ts
@@ -0,0 +1,83 @@
+/*!
+ * Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
+ *
+ * Alfresco Example Content Application
+ *
+ * This file is part of the Alfresco Example Content Application.
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ *
+ * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Alfresco Example Content Application is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * from Hyland Software. If not, see .
+ */
+
+import { Page } from '@playwright/test';
+import { BaseComponent } from '../base.component';
+import { timeouts } from '../../../utils';
+
+export class PasswordOverlayDialogComponent extends BaseComponent {
+ private static rootElement = '.cdk-overlay-pane';
+
+ public closeButton = this.getChild('[data-automation-id="adf-password-dialog-close"]');
+ public submitButton = this.getChild('[data-automation-id="adf-password-dialog-submit"]');
+ public passwordInput = this.getChild('[data-automation-id="adf-password-dialog-input"]');
+ public errorMessage = this.getChild('[data-automation-id="adf-password-dialog-error"]');
+
+ constructor(page: Page, rootElement = PasswordOverlayDialogComponent.rootElement) {
+ super(page, rootElement);
+ }
+
+ async waitForDialogToOpen(): Promise {
+ await this.spinnerWaitForReload();
+ await this.passwordInput.waitFor({ state: 'attached', timeout: timeouts.large });
+ await this.passwordInput.isVisible();
+ }
+
+ async waitForDialogToClose(): Promise {
+ await this.passwordInput.waitFor({ state: 'detached', timeout: timeouts.large });
+ }
+
+ async isDialogOpen(): Promise {
+ await this.waitForDialogToOpen();
+ return await this.passwordInput.isVisible();
+ }
+
+ async isCloseVisible(): Promise {
+ return await this.closeButton.isVisible();
+ }
+
+ async isSubmitHidden(): Promise {
+ return await this.submitButton.isHidden();
+ }
+
+ async isPasswordInputDisplayed(): Promise {
+ return await this.passwordInput.isVisible();
+ }
+
+ async isErrorDisplayed(): Promise {
+ await this.errorMessage.waitFor({ state: 'visible', timeout: timeouts.short });
+ return await this.errorMessage.isVisible();
+ }
+
+ async getErrorMessage(): Promise {
+ if (await this.isErrorDisplayed()) {
+ return this.errorMessage.innerText();
+ }
+ return '';
+ }
+
+ async enterPassword(password: string): Promise {
+ await this.passwordInput.fill(password);
+ }
+}
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 0aaa290014..16b7ad4093 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
@@ -33,6 +33,7 @@ export class ViewerComponent extends BaseComponent {
private viewerLocator = this.getChild('.adf-viewer-render-layout-content');
public closeButtonLocator = this.getChild('.adf-viewer-close-button');
public fileTitleButtonLocator = this.getChild('.adf-viewer__file-title');
+ public pdfViewerContentPages = this.getChild('.adf-pdf-viewer__content .page');
toolbar = new AcaHeader(this.page);
@@ -40,7 +41,17 @@ export class ViewerComponent extends BaseComponent {
super(page, ViewerComponent.rootElement);
}
+ async isPdfViewerContentDisplayed(): Promise {
+ const count = await this.pdfViewerContentPages.count();
+ return count > 0;
+ }
+
+ async waitForViewerToOpen(): Promise {
+ await this.viewerLocator.waitFor({ state: 'visible', timeout: timeouts.medium });
+ }
+
async isViewerOpened(): Promise {
+ await this.waitForViewerToOpen();
return await this.viewerLocator.isVisible();
}
diff --git a/projects/aca-playwright-shared/src/page-objects/pages/personal-files.page.ts b/projects/aca-playwright-shared/src/page-objects/pages/personal-files.page.ts
index 94251cc440..daf2d2aa2b 100644
--- a/projects/aca-playwright-shared/src/page-objects/pages/personal-files.page.ts
+++ b/projects/aca-playwright-shared/src/page-objects/pages/personal-files.page.ts
@@ -22,12 +22,11 @@
* from Hyland Software. If not, see .
*/
-
import { Page } from '@playwright/test';
import { BasePage } from './base.page';
import { DataTableComponent, MatMenuComponent, ViewerComponent } from '../components';
import { AcaHeader } from '../components/aca-header.component';
-import { AdfFolderDialogComponent } from '../components/dialogs';
+import { AdfFolderDialogComponent, PasswordOverlayDialogComponent } from '../components/dialogs';
export class PersonalFilesPage extends BasePage {
private static pageUrl = 'personal-files';
@@ -41,4 +40,5 @@ export class PersonalFilesPage extends BasePage {
public folderDialog = new AdfFolderDialogComponent(this.page);
public dataTable = new DataTableComponent(this.page);
public viewer = new ViewerComponent(this.page);
+ public passwordDialog = new PasswordOverlayDialogComponent(this.page);
}
diff --git a/projects/aca-playwright-shared/src/resources/test-files/file-pdf-protected.pdf b/projects/aca-playwright-shared/src/resources/test-files/file-pdf-protected.pdf
new file mode 100644
index 0000000000..d0d083f114
Binary files /dev/null and b/projects/aca-playwright-shared/src/resources/test-files/file-pdf-protected.pdf differ
diff --git a/projects/aca-playwright-shared/src/resources/test-files/index.ts b/projects/aca-playwright-shared/src/resources/test-files/index.ts
index a516a5d5c3..7c745a1199 100644
--- a/projects/aca-playwright-shared/src/resources/test-files/index.ts
+++ b/projects/aca-playwright-shared/src/resources/test-files/index.ts
@@ -1,22 +1,44 @@
-/*
- * Copyright © 2005 - 2021 Alfresco Software, Ltd. All rights reserved.
+/*!
+ * Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
- * License rights for this program may be obtained from Alfresco Software, Ltd.
- * pursuant to a written agreement and any use of this program without such an
- * agreement is prohibited.
+ * Alfresco Example Content Application
+ *
+ * This file is part of the Alfresco Example Content Application.
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ *
+ * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Alfresco Example Content Application is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * from Hyland Software. If not, see .
*/
import { resolve } from 'path';
export const TEST_FILES = {
- DOCX: {
- path: resolve(__dirname, 'file-docx.docx'),
- name: 'file-docx',
- data: 'Lorem ipsum dolor sit amet'
- },
- PDF: {
- path: resolve(__dirname, 'file-pdf.pdf'),
- name: 'file-pdf',
- data: 'Lorem ipsum dolor sit amet'
- },
+ DOCX: {
+ path: resolve(__dirname, 'file-docx.docx'),
+ name: 'file-docx',
+ data: 'Lorem ipsum dolor sit amet'
+ },
+ PDF: {
+ path: resolve(__dirname, 'file-pdf.pdf'),
+ name: 'file-pdf',
+ data: 'Lorem ipsum dolor sit amet'
+ },
+ DOCX_PROTECTED: {
+ path: resolve(__dirname, 'file-pdf-protected.pdf'),
+ name: 'file-pdf-protected',
+ data: 'Lorem ipsum dolor sit amet',
+ password: '0000'
+ }
};