diff --git a/e2e/playwright/viewer/src/tests/viewer-action.spec.ts b/e2e/playwright/viewer/src/tests/viewer-action.spec.ts
index 0a2ed4a45..2b7dad58b 100644
--- a/e2e/playwright/viewer/src/tests/viewer-action.spec.ts
+++ b/e2e/playwright/viewer/src/tests/viewer-action.spec.ts
@@ -57,8 +57,7 @@ test.describe('viewer action file', () => {
});
test.afterAll(async () => {
- await apiClientFactory.nodes.deleteNode(folderId);
- await apiClientFactory.trashCan.deleteDeletedNode(folderId);
+ await apiClientFactory.nodes.deleteNode(folderId, { permanent: true });
});
test('[C268129] Download action', async ({ personalFiles }) => {
@@ -82,7 +81,6 @@ test.describe('viewer action file', () => {
await personalFiles.dataTable.getCellLinkByName(randomDocxName).waitFor({ state: 'attached' });
expect(await personalFiles.dataTable.getCellLinkByName(randomDocxDelete).isVisible(), 'file should not visible').toBe(false);
await trashPage.navigate({ waitUntil: 'domcontentloaded' });
- await trashPage.dataTable.goThroughPagesLookingForRowWithName(randomDocxDelete);
expect(await trashPage.dataTable.isItemPresent(randomDocxDelete), 'Item should be present in Trash').toBe(true);
});
@@ -130,7 +128,7 @@ test.describe('viewer action file', () => {
expect(await personalFiles.viewer.isViewerOpened(), 'Viewer should be opened').toBe(true);
});
- test('[C286379] Favorite action from Shared Files', async ({ sharedPage, favoritePage, shareAction }) => {
+ test('[C286379] Favorite action from Shared Files', async ({ sharedPage, favoritePage }) => {
await sharedPage.navigate({ waitUntil: 'domcontentloaded' });
await sharedPage.dataTable.performClickFolderOrFileToOpen(randomDocxNameShare);
expect(await sharedPage.viewer.isViewerOpened(), 'Viewer should be opened').toBe(true);
@@ -146,7 +144,6 @@ test.describe('viewer action file', () => {
await sharedPage.page.keyboard.press('Escape');
await favoritePage.navigate({ waitUntil: 'domcontentloaded' });
expect(await favoritePage.dataTable.isItemPresent(randomDocxNameShare), 'Item is not present in Favorites list').toBe(true);
- expect(await shareAction.isFavorite(randomDocxNameShare, 'hruser'), 'Item is not favorite').toBe(true);
});
test('[C286395] Share action from Favorites', async ({ favoritePage }) => {
diff --git a/e2e/playwright/viewer/src/tests/viewer-protected.spec.ts b/e2e/playwright/viewer/src/tests/viewer-protected.spec.ts
index 8ca3cbfb7..3f613864a 100644
--- a/e2e/playwright/viewer/src/tests/viewer-protected.spec.ts
+++ b/e2e/playwright/viewer/src/tests/viewer-protected.spec.ts
@@ -29,7 +29,7 @@ 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()}`;
+ const randomDocxName = `${TEST_FILES.PDF_PROTECTED.name}-${Utils.random()}`;
let folderId: string;
let fileDocxId: string;
@@ -37,7 +37,7 @@ test.describe('viewer file', () => {
await apiClientFactory.setUpAcaBackend('hruser');
const node = await apiClientFactory.nodes.createNode('-my-', { name: randomFolderName, nodeType: 'cm:folder', relativePath: '/' });
folderId = node.entry.id;
- const fileDoc = await fileAction.uploadFile(TEST_FILES.DOCX_PROTECTED.path, randomDocxName, folderId);
+ const fileDoc = await fileAction.uploadFile(TEST_FILES.PDF_PROTECTED.path, randomDocxName, folderId);
fileDocxId = fileDoc.entry.id;
await shareAction.shareFileById(fileDocxId);
await favoritesPageAction.addFavoriteById('file', fileDocxId);
@@ -61,7 +61,7 @@ test.describe('viewer file', () => {
});
test('[C268959] File content is displayed when entering the correct password', async ({ personalFiles }) => {
- await personalFiles.passwordDialog.enterPassword(TEST_FILES.DOCX_PROTECTED.password);
+ await personalFiles.passwordDialog.enterPassword(TEST_FILES.PDF_PROTECTED.password);
expect(await personalFiles.passwordDialog.submitButton.isVisible(), 'Submit button not enabled').toBe(true);
await personalFiles.passwordDialog.submitButton.click();
@@ -80,7 +80,7 @@ test.describe('viewer file', () => {
});
test('[C268961] Refresh the page while Password dialog is open', async ({ personalFiles }) => {
- await personalFiles.passwordDialog.enterPassword(TEST_FILES.DOCX_PROTECTED.password);
+ await personalFiles.passwordDialog.enterPassword(TEST_FILES.PDF_PROTECTED.password);
await personalFiles.reload({ waitUntil: 'domcontentloaded' });
await personalFiles.viewer.waitForViewerToOpen();
diff --git a/e2e/playwright/viewer/src/tests/viewer-useraction.spec.ts b/e2e/playwright/viewer/src/tests/viewer-useraction.spec.ts
new file mode 100644
index 000000000..b179f20a4
--- /dev/null
+++ b/e2e/playwright/viewer/src/tests/viewer-useraction.spec.ts
@@ -0,0 +1,99 @@
+/*!
+ * 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, LoginPage, test, TEST_FILES, Utils } from '@alfresco/playwright-shared';
+import { SiteBodyCreate } from '@alfresco/js-api';
+import { Logger } from '@alfresco/adf-testing';
+
+test.describe('from File Libraries', () => {
+ const apiClientFactory = new ApiClientFactory();
+ const username = `user-${Utils.random()}`;
+ const siteName = `site-${Utils.random()}`;
+ const destination = `destFL-${Utils.random()}`;
+ let destinationId: string;
+ const xlsxLibraries = `xlsxFL-${Utils.random()}`;
+
+ test.beforeAll(async ({ userActions }) => {
+ await apiClientFactory.setUpAcaBackend('admin');
+ await apiClientFactory.createUser({ username });
+ await userActions.setUpUserAcaBackend(username, username);
+ try {
+ await userActions.sitesApi.createSite({
+ id: siteName,
+ title: siteName,
+ visibility: SiteBodyCreate.VisibilityEnum.PUBLIC
+ });
+ const docLibId = (await userActions.sitesApi.listSiteContainers(siteName)).list.entries[0].entry.id;
+ const node = await userActions.nodesApi.createNode('-my-', { name: destination, nodeType: 'cm:folder', relativePath: '/' });
+ destinationId = node.entry.id;
+ await userActions.uploadFile(TEST_FILES.XLSX.path, xlsxLibraries, docLibId);
+ } catch (error) {
+ Logger.error(`beforeAll failed : ${error}`);
+ }
+ });
+
+ test.beforeEach(async ({ page }) => {
+ const loginPage = new LoginPage(page);
+ await loginPage.loginUser(
+ { username: username, password: username },
+ {
+ withNavigation: true,
+ waitForLoading: true
+ }
+ );
+ });
+
+ test.afterAll(async ({ userActions }) => {
+ try {
+ await userActions.setUpUserAcaBackend(username, username);
+ await userActions.deleteSites([siteName]);
+ await userActions.deleteNodes([destinationId]);
+ } catch (error) {
+ Logger.error(`afterAll failed : ${error}`);
+ }
+ });
+
+ test('[C286371] Move action from File Libraries', async ({ myLibrariesPage, personalFiles }) => {
+ await myLibrariesPage.navigate();
+ await myLibrariesPage.dataTable.getCellLinkByName(siteName).click();
+ await myLibrariesPage.dataTable.performClickFolderOrFileToOpen(xlsxLibraries);
+ expect(await myLibrariesPage.viewer.isViewerOpened(), 'Viewer should be opened').toBe(true);
+
+ await myLibrariesPage.acaHeader.clickViewerMoreActions();
+ await myLibrariesPage.matMenu.clickMenuItem('Move');
+ expect(await myLibrariesPage.viewerDialog.isCopyDialogOpen(), 'Dialog is not open').toBe(true);
+
+ await myLibrariesPage.copyMoveDialog.selectLocation('Personal Files');
+ await myLibrariesPage.copyMoveDialog.selectDestination(destination);
+ await myLibrariesPage.copyMoveDialog.actionButton.click();
+ await expect(myLibrariesPage.snackBar.getByMessageLocator('Moved 1 item')).toBeVisible();
+
+ await myLibrariesPage.viewer.closeButtonLocator.click();
+ await myLibrariesPage.dataTable.getRowByName(xlsxLibraries).waitFor({ state: 'detached' });
+ expect(await myLibrariesPage.dataTable.getRowByName(xlsxLibraries).isVisible(), 'Item was not moved').toBe(false);
+ await personalFiles.navigate({ remoteUrl: `#/personal-files/${destinationId}` });
+ expect(await personalFiles.dataTable.isItemPresent(xlsxLibraries), 'Item is not present in destination').toBe(true);
+ });
+});
diff --git a/e2e/playwright/viewer/src/tests/viewer.spec.ts b/e2e/playwright/viewer/src/tests/viewer.spec.ts
index e721fcf33..7a2d96889 100644
--- a/e2e/playwright/viewer/src/tests/viewer.spec.ts
+++ b/e2e/playwright/viewer/src/tests/viewer.spec.ts
@@ -29,7 +29,7 @@ test.use({ storageState: getUserState('hruser') });
test.describe('viewer file', () => {
const apiClientFactory = new ApiClientFactory();
const randomFolderName = `playwright-folder-${Utils.random()}`;
- const randomDocxName = `$(TEST_FILES.DOCX.name)-${Utils.random()}`;
+ const randomDocxName = `${TEST_FILES.DOCX.name}-${Utils.random()}`;
let folderId: string;
test.beforeAll(async ({ fileAction }) => {
diff --git a/projects/aca-playwright-shared/src/api/api-client-factory.ts b/projects/aca-playwright-shared/src/api/api-client-factory.ts
index 0d18c19e1..f35f2af3c 100644
--- a/projects/aca-playwright-shared/src/api/api-client-factory.ts
+++ b/projects/aca-playwright-shared/src/api/api-client-factory.ts
@@ -38,11 +38,13 @@ import {
UploadApi,
SharedlinksApi,
FavoritesApi,
- TrashcanApi
+ TrashcanApi,
+ PersonEntry
} from '@alfresco/js-api';
import { logger } from '@alfresco/adf-cli/scripts/logger';
import { ActionTypes, Rule } from './rules-api';
import { users } from '../base-config';
+import { Person, PersonModel } from './people-api-models';
export interface AcaBackend {
sites: SitesApi;
@@ -149,4 +151,16 @@ export class ApiClientFactory {
throw error;
}
}
+
+ async createUser(user: PersonModel): Promise {
+ const person = new Person(user);
+ const peopleApi = new PeopleApi(this.alfrescoApi);
+
+ try {
+ return peopleApi.createPerson(person);
+ } catch (error) {
+ logger.error('[API Client Factory] createUser failed : ', error);
+ return null;
+ }
+ }
}
diff --git a/projects/aca-playwright-shared/src/api/index.ts b/projects/aca-playwright-shared/src/api/index.ts
index b7a8762b4..984a043ea 100644
--- a/projects/aca-playwright-shared/src/api/index.ts
+++ b/projects/aca-playwright-shared/src/api/index.ts
@@ -27,3 +27,5 @@ export * from './api-client-factory';
export * from './file-actions';
export * from './shared-links-api';
export * from './favorites-api';
+export * from './user-actions';
+export * from './people-api-models';
diff --git a/projects/aca-playwright-shared/src/api/people-api-models.ts b/projects/aca-playwright-shared/src/api/people-api-models.ts
new file mode 100755
index 000000000..9f683357d
--- /dev/null
+++ b/projects/aca-playwright-shared/src/api/people-api-models.ts
@@ -0,0 +1,52 @@
+/*!
+ * 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
+ * along with Alfresco. If not, see .
+ */
+
+export interface PersonModel {
+ username?: string;
+ password?: string;
+ firstName?: string;
+ lastName?: string;
+ email?: string;
+ enabled?: boolean;
+ properties?: any;
+}
+
+export class Person {
+ id: string;
+ password: string;
+ firstName: string;
+ lastName: string;
+ email: string;
+ enabled: boolean;
+ properties: any;
+
+ constructor(user: PersonModel) {
+ this.id = user.username;
+ this.password = user.password || user.username;
+ this.firstName = user.firstName || user.username;
+ this.lastName = user.lastName || user.username;
+ this.email = user.email || `${user.username}@alfresco.com`;
+ this.enabled = user.enabled || true;
+ }
+}
diff --git a/projects/aca-playwright-shared/src/api/user-actions.ts b/projects/aca-playwright-shared/src/api/user-actions.ts
new file mode 100644
index 000000000..7752e59c7
--- /dev/null
+++ b/projects/aca-playwright-shared/src/api/user-actions.ts
@@ -0,0 +1,134 @@
+/*!
+ * 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
+ * along with Alfresco. If not, see .
+ */
+
+import * as fs from 'fs';
+import { Logger } from '@alfresco/adf-testing';
+import { AlfrescoApi, CommentsApi, NodesApi, TrashcanApi, SitesApi, SharedlinksApi, UploadApi } from '@alfresco/js-api';
+
+const { BASE_URL } = process.env;
+
+const config = {
+ authType: 'BASIC',
+ hostBpm: BASE_URL,
+ hostEcm: BASE_URL,
+ provider: 'ECM',
+ contextRoot: 'alfresco'
+};
+
+export class UserActions {
+ public alfrescoApi: AlfrescoApi;
+
+ public commentsApi: CommentsApi;
+ public nodesApi: NodesApi;
+ public trashCanApi: TrashcanApi;
+ public sitesApi: SitesApi;
+ public sharedLinksApi: SharedlinksApi;
+ public uploadApi: UploadApi;
+
+ protected username: string;
+ protected password: string;
+
+ constructor() {
+ this.alfrescoApi = new AlfrescoApi(config);
+ }
+
+ public async setUpUserAcaBackend(username: string, password: string): Promise {
+ await this.loginUser(username, password );
+
+ this.commentsApi = new CommentsApi(this.alfrescoApi);
+ this.nodesApi = new NodesApi(this.alfrescoApi);
+ this.trashCanApi = new TrashcanApi(this.alfrescoApi);
+ this.sitesApi = new SitesApi(this.alfrescoApi);
+ this.sharedLinksApi = new SharedlinksApi(this.alfrescoApi);
+ this.uploadApi = new UploadApi(this.alfrescoApi);
+ }
+
+ public async loginUser(username: string, password: string): Promise {
+ this.username = username || this.username;
+ this.password = password || this.password;
+
+ try {
+ return this.alfrescoApi.login(this.username, this.password);
+ } catch (error) {
+ Logger.error(`\n [User Actions] - login failed ${error} error :`);
+ }
+ }
+
+ async lockNodes(nodeIds: string[], lockType: string = 'ALLOW_OWNER_CHANGES') {
+ try {
+ for (const nodeId of nodeIds) {
+ await this.nodesApi.lockNode(nodeId, { type: lockType });
+ }
+ } catch (error) {
+ Logger.error(`\n [User Actions] - lockNodes failed ${error} error :`);
+ }
+ }
+
+ async uploadFile(fileLocation: string, fileName: string, parentFolderId: string): Promise {
+ const file = fs.createReadStream(fileLocation);
+ return this.uploadApi.uploadFile(
+ file,
+ '',
+ parentFolderId,
+ null,
+ {
+ name: fileName,
+ nodeType: 'cm:content',
+ renditions: 'doclib'
+ }
+ );
+ }
+
+ /**
+ * Delete multiple sites/libraries.
+ * @param siteIds The list of the site/library IDs to delete.
+ * @param permanent Delete permanently, without moving to the trashcan? (default: true)
+ */
+ async deleteSites(siteIds: string[], permanent: boolean = true) {
+ try {
+ if (siteIds && siteIds.length > 0) {
+ for (const siteId of siteIds) {
+ await this.sitesApi.deleteSite(siteId, { permanent });
+ }
+ }
+ } catch (error) {
+ Logger.error(`\n [User Actions] - deleteSites failed error : ${error}`);
+ }
+ }
+
+ /**
+ * Delete multiple nodes.
+ * @param nodeIds The list of node IDs to delete.
+ * @param permanent Delete permanently, without moving to the trashcan? (default: true)
+ */
+ async deleteNodes(nodeIds: string[], permanent: boolean = true): Promise {
+ try {
+ for (const nodeId of nodeIds) {
+ await this.nodesApi.deleteNode(nodeId, { permanent });
+ }
+ } catch (error) {
+ Logger.error(`\n [User Actions] - deleteNodes failed error : ${error}`);
+ }
+ }
+}
diff --git a/projects/aca-playwright-shared/src/fixtures/page-initialization.ts b/projects/aca-playwright-shared/src/fixtures/page-initialization.ts
index d97cc25de..de1107d28 100644
--- a/projects/aca-playwright-shared/src/fixtures/page-initialization.ts
+++ b/projects/aca-playwright-shared/src/fixtures/page-initialization.ts
@@ -34,7 +34,8 @@ import {
SearchPage,
FavoritesPage,
FavoritesPageApi,
- TrashPage
+ TrashPage,
+ UserActions
} from '../';
interface Pages {
@@ -52,6 +53,7 @@ interface Api {
fileAction: FileActionsApi;
shareAction: SharedLinksApi;
favoritesPageAction: FavoritesPageApi;
+ userActions: UserActions;
}
export const test = base.extend({
@@ -88,6 +90,10 @@ export const test = base.extend({
favoritesPageAction: async ({}, use) => {
await use(await FavoritesPageApi.initialize('hruser'));
},
+ // eslint-disable-next-line no-empty-pattern
+ userActions: async ({}, use) => {
+ await use(new UserActions());
+ },
myLibrariesPage: async ({ page }, use) => {
await use(new MyLibrariesPage(page));
}
diff --git a/projects/aca-playwright-shared/src/page-objects/components/dialogs/content-node-selector-dialog.ts b/projects/aca-playwright-shared/src/page-objects/components/dialogs/content-node-selector-dialog.ts
new file mode 100755
index 000000000..870d3b2f2
--- /dev/null
+++ b/projects/aca-playwright-shared/src/page-objects/components/dialogs/content-node-selector-dialog.ts
@@ -0,0 +1,55 @@
+/*!
+ * 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
+ * along with Alfresco. If not, see .
+ */
+
+import { Locator, Page } from '@playwright/test';
+import { BaseComponent } from '../base.component';
+
+export class ContentNodeSelectorDialog extends BaseComponent {
+ private static rootElement = 'adf-content-node-selector';
+
+ public cancelButton = this.getChild('[data-automation-id="content-node-selector-actions-cancel"]');
+ public actionButton = this.getChild('[data-automation-id="content-node-selector-actions-choose"]');
+ public locationDropDown = this.getChild('[id="site-dropdown-container"]');
+ private selectedRow = this.getChild('.adf-is-selected');
+ private getOptionLocator = (optionName: string): Locator => this.page.locator('.mat-select-panel .mat-option-text', { hasText: optionName });
+ private getRowByName = (name: string | number): Locator => this.getChild(`adf-datatable-row`, { hasText: name.toString() });
+
+ constructor(page: Page) {
+ super(page, ContentNodeSelectorDialog.rootElement);
+ }
+
+ async selectLocation(location: string): Promise {
+ await this.locationDropDown.click();
+ const optionLocator = this.getOptionLocator(location);
+ await optionLocator.click();
+ await optionLocator.waitFor({ state: 'detached' });
+ }
+
+ async selectDestination(folderName: string): Promise {
+ const row = this.getRowByName(folderName);
+ await row.click();
+ await this.selectedRow.waitFor({ state: 'attached' });
+ await this.selectedRow.isVisible();
+ }
+}
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 5a9d3c967..93e39fa9f 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
@@ -26,3 +26,4 @@ export * from './adf-folder-dialog.component';
export * from './adf-library-dialog.component';
export * from './password-overlay-dialog.component';
export * from './viewer-overlay-dialog.component';
+export * from './content-node-selector-dialog';
diff --git a/projects/aca-playwright-shared/src/page-objects/pages/login.page.ts b/projects/aca-playwright-shared/src/page-objects/pages/login.page.ts
index c71229ffb..f8ca74b8f 100644
--- a/projects/aca-playwright-shared/src/page-objects/pages/login.page.ts
+++ b/projects/aca-playwright-shared/src/page-objects/pages/login.page.ts
@@ -38,6 +38,8 @@ export class LoginPage extends BasePage {
private username = this.page.locator('#username');
private password = this.page.locator('#password');
private submitButton = this.page.locator('#login-button');
+ private userProfileButton = this.page.locator('aca-user-menu button');
+ private userLogOutButton = this.page.locator('aca-logout button');
async loginUser(userData: { username: string; password: string } | UserModel, options?: LoginOptions): Promise {
if (options?.withNavigation) {
@@ -51,4 +53,9 @@ export class LoginPage extends BasePage {
await Promise.all([this.page.waitForLoadState('domcontentloaded'), this.spinner.waitForReload()]);
}
}
+
+ async logoutUser(): Promise {
+ await this.userProfileButton.click();
+ await this.userLogOutButton.click();
+ }
}
diff --git a/projects/aca-playwright-shared/src/page-objects/pages/my-libraries.page.ts b/projects/aca-playwright-shared/src/page-objects/pages/my-libraries.page.ts
index 0ff6bbf64..b8b5191eb 100644
--- a/projects/aca-playwright-shared/src/page-objects/pages/my-libraries.page.ts
+++ b/projects/aca-playwright-shared/src/page-objects/pages/my-libraries.page.ts
@@ -25,7 +25,15 @@
import { Page } from '@playwright/test';
import { BasePage } from './base.page';
import { AcaHeader } from '../components/aca-header.component';
-import { AdfInfoDrawerComponent, AdfLibraryDialogComponent, DataTableComponent, MatMenuComponent } from '../components';
+import {
+ AdfInfoDrawerComponent,
+ AdfLibraryDialogComponent,
+ DataTableComponent,
+ MatMenuComponent,
+ ViewerComponent,
+ ViewerOverlayDialogComponent,
+ ContentNodeSelectorDialog
+} from '../components';
export class MyLibrariesPage extends BasePage {
private static pageUrl = 'libraries';
@@ -38,6 +46,9 @@ export class MyLibrariesPage extends BasePage {
public libraryDialog = new AdfLibraryDialogComponent(this.page);
public dataTable = new DataTableComponent(this.page);
public libraryDetails = new AdfInfoDrawerComponent(this.page);
+ public viewer = new ViewerComponent(this.page);
+ public viewerDialog = new ViewerOverlayDialogComponent(this.page);
+ public copyMoveDialog = new ContentNodeSelectorDialog(this.page);
async selectCreateLibrary(): Promise {
await this.acaHeader.createButton.click();
diff --git a/projects/aca-playwright-shared/src/resources/test-files/file-pdf.pdf b/projects/aca-playwright-shared/src/resources/test-files/file-pdf.pdf
new file mode 100644
index 000000000..dbf091df9
--- /dev/null
+++ b/projects/aca-playwright-shared/src/resources/test-files/file-pdf.pdf
@@ -0,0 +1,198 @@
+%PDF-1.3
+%âãÏÓ
+
+1 0 obj
+<<
+/Type /Catalog
+/Outlines 2 0 R
+/Pages 3 0 R
+>>
+endobj
+
+2 0 obj
+<<
+/Type /Outlines
+/Count 0
+>>
+endobj
+
+3 0 obj
+<<
+/Type /Pages
+/Count 2
+/Kids [ 4 0 R 6 0 R ]
+>>
+endobj
+
+4 0 obj
+<<
+/Type /Page
+/Parent 3 0 R
+/Resources <<
+/Font <<
+/F1 9 0 R
+>>
+/ProcSet 8 0 R
+>>
+/MediaBox [0 0 612.0000 792.0000]
+/Contents 5 0 R
+>>
+endobj
+
+5 0 obj
+<< /Length 1074 >>
+stream
+2 J
+BT
+0 0 0 rg
+/F1 0027 Tf
+57.3750 722.2800 Td
+( A Simple PDF File ) Tj
+ET
+BT
+/F1 0010 Tf
+69.2500 688.6080 Td
+( This is a small demonstration .pdf file - ) Tj
+ET
+BT
+/F1 0010 Tf
+69.2500 664.7040 Td
+( just for use in the Virtual Mechanics tutorials. More text. And more ) Tj
+ET
+BT
+/F1 0010 Tf
+69.2500 652.7520 Td
+( text. And more text. And more text. And more text. ) Tj
+ET
+BT
+/F1 0010 Tf
+69.2500 628.8480 Td
+( And more text. And more text. And more text. And more text. And more ) Tj
+ET
+BT
+/F1 0010 Tf
+69.2500 616.8960 Td
+( text. And more text. Boring, zzzzz. And more text. And more text. And ) Tj
+ET
+BT
+/F1 0010 Tf
+69.2500 604.9440 Td
+( more text. And more text. And more text. And more text. And more text. ) Tj
+ET
+BT
+/F1 0010 Tf
+69.2500 592.9920 Td
+( And more text. And more text. ) Tj
+ET
+BT
+/F1 0010 Tf
+69.2500 569.0880 Td
+( And more text. And more text. And more text. And more text. And more ) Tj
+ET
+BT
+/F1 0010 Tf
+69.2500 557.1360 Td
+( text. And more text. And more text. Even more. Continued on page 2 ...) Tj
+ET
+endstream
+endobj
+
+6 0 obj
+<<
+/Type /Page
+/Parent 3 0 R
+/Resources <<
+/Font <<
+/F1 9 0 R
+>>
+/ProcSet 8 0 R
+>>
+/MediaBox [0 0 612.0000 792.0000]
+/Contents 7 0 R
+>>
+endobj
+
+7 0 obj
+<< /Length 676 >>
+stream
+2 J
+BT
+0 0 0 rg
+/F1 0027 Tf
+57.3750 722.2800 Td
+( Simple PDF File 2 ) Tj
+ET
+BT
+/F1 0010 Tf
+69.2500 688.6080 Td
+( ...continued from page 1. Yet more text. And more text. And more text. ) Tj
+ET
+BT
+/F1 0010 Tf
+69.2500 676.6560 Td
+( And more text. And more text. And more text. And more text. And more ) Tj
+ET
+BT
+/F1 0010 Tf
+69.2500 664.7040 Td
+( text. Oh, how boring typing this stuff. But not as boring as watching ) Tj
+ET
+BT
+/F1 0010 Tf
+69.2500 652.7520 Td
+( paint dry. And more text. And more text. And more text. And more text. ) Tj
+ET
+BT
+/F1 0010 Tf
+69.2500 640.8000 Td
+( Boring. More, a little more text. The end, and just as well. ) Tj
+ET
+endstream
+endobj
+
+8 0 obj
+[/PDF /Text]
+endobj
+
+9 0 obj
+<<
+/Type /Font
+/Subtype /Type1
+/Name /F1
+/BaseFont /Helvetica
+/Encoding /WinAnsiEncoding
+>>
+endobj
+
+10 0 obj
+<<
+/Creator (Rave \(http://www.nevrona.com/rave\))
+/Producer (Nevrona Designs)
+/CreationDate (D:20060301072826)
+>>
+endobj
+
+xref
+0 11
+0000000000 65535 f
+0000000019 00000 n
+0000000093 00000 n
+0000000147 00000 n
+0000000222 00000 n
+0000000390 00000 n
+0000001522 00000 n
+0000001690 00000 n
+0000002423 00000 n
+0000002456 00000 n
+0000002574 00000 n
+
+trailer
+<<
+/Size 11
+/Root 1 0 R
+/Info 10 0 R
+>>
+
+startxref
+2714
+%%EOF
diff --git a/projects/aca-playwright-shared/src/resources/test-files/file-xlsx.xlsx b/projects/aca-playwright-shared/src/resources/test-files/file-xlsx.xlsx
new file mode 100644
index 000000000..3039a7cdc
Binary files /dev/null and b/projects/aca-playwright-shared/src/resources/test-files/file-xlsx.xlsx 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 7c745a119..297040f2a 100644
--- a/projects/aca-playwright-shared/src/resources/test-files/index.ts
+++ b/projects/aca-playwright-shared/src/resources/test-files/index.ts
@@ -35,10 +35,15 @@ export const TEST_FILES = {
name: 'file-pdf',
data: 'Lorem ipsum dolor sit amet'
},
- DOCX_PROTECTED: {
+ PDF_PROTECTED: {
path: resolve(__dirname, 'file-pdf-protected.pdf'),
name: 'file-pdf-protected',
data: 'Lorem ipsum dolor sit amet',
password: '0000'
+ },
+ XLSX: {
+ path: resolve(__dirname, 'file-xlsx.xlsx'),
+ name: 'file-xlsx',
+ data: 'Lorem ipsum dolor sit amet'
}
};