mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-19 17:14:45 +00:00
[ACS-5650] viewer user actions test (#3373)
* viewer action files e2e migration * viewer action files e2e remove comment * review code fix * [ci:force] * [ACS-5650]viewer test with new user * remove commented code
This commit is contained in:
parent
ff8a9844d8
commit
9f1b8a0ac6
@ -57,8 +57,7 @@ test.describe('viewer action file', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test.afterAll(async () => {
|
test.afterAll(async () => {
|
||||||
await apiClientFactory.nodes.deleteNode(folderId);
|
await apiClientFactory.nodes.deleteNode(folderId, { permanent: true });
|
||||||
await apiClientFactory.trashCan.deleteDeletedNode(folderId);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('[C268129] Download action', async ({ personalFiles }) => {
|
test('[C268129] Download action', async ({ personalFiles }) => {
|
||||||
@ -82,7 +81,6 @@ test.describe('viewer action file', () => {
|
|||||||
await personalFiles.dataTable.getCellLinkByName(randomDocxName).waitFor({ state: 'attached' });
|
await personalFiles.dataTable.getCellLinkByName(randomDocxName).waitFor({ state: 'attached' });
|
||||||
expect(await personalFiles.dataTable.getCellLinkByName(randomDocxDelete).isVisible(), 'file should not visible').toBe(false);
|
expect(await personalFiles.dataTable.getCellLinkByName(randomDocxDelete).isVisible(), 'file should not visible').toBe(false);
|
||||||
await trashPage.navigate({ waitUntil: 'domcontentloaded' });
|
await trashPage.navigate({ waitUntil: 'domcontentloaded' });
|
||||||
await trashPage.dataTable.goThroughPagesLookingForRowWithName(randomDocxDelete);
|
|
||||||
expect(await trashPage.dataTable.isItemPresent(randomDocxDelete), 'Item should be present in Trash').toBe(true);
|
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);
|
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.navigate({ waitUntil: 'domcontentloaded' });
|
||||||
await sharedPage.dataTable.performClickFolderOrFileToOpen(randomDocxNameShare);
|
await sharedPage.dataTable.performClickFolderOrFileToOpen(randomDocxNameShare);
|
||||||
expect(await sharedPage.viewer.isViewerOpened(), 'Viewer should be opened').toBe(true);
|
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 sharedPage.page.keyboard.press('Escape');
|
||||||
await favoritePage.navigate({ waitUntil: 'domcontentloaded' });
|
await favoritePage.navigate({ waitUntil: 'domcontentloaded' });
|
||||||
expect(await favoritePage.dataTable.isItemPresent(randomDocxNameShare), 'Item is not present in Favorites list').toBe(true);
|
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 }) => {
|
test('[C286395] Share action from Favorites', async ({ favoritePage }) => {
|
||||||
|
@ -29,7 +29,7 @@ test.use({ storageState: getUserState('hruser') });
|
|||||||
test.describe('viewer file', () => {
|
test.describe('viewer file', () => {
|
||||||
const apiClientFactory = new ApiClientFactory();
|
const apiClientFactory = new ApiClientFactory();
|
||||||
const randomFolderName = `playwright-folder-${Utils.random()}`;
|
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 folderId: string;
|
||||||
let fileDocxId: string;
|
let fileDocxId: string;
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ test.describe('viewer file', () => {
|
|||||||
await apiClientFactory.setUpAcaBackend('hruser');
|
await apiClientFactory.setUpAcaBackend('hruser');
|
||||||
const node = await apiClientFactory.nodes.createNode('-my-', { name: randomFolderName, nodeType: 'cm:folder', relativePath: '/' });
|
const node = await apiClientFactory.nodes.createNode('-my-', { name: randomFolderName, nodeType: 'cm:folder', relativePath: '/' });
|
||||||
folderId = node.entry.id;
|
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;
|
fileDocxId = fileDoc.entry.id;
|
||||||
await shareAction.shareFileById(fileDocxId);
|
await shareAction.shareFileById(fileDocxId);
|
||||||
await favoritesPageAction.addFavoriteById('file', 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 }) => {
|
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);
|
expect(await personalFiles.passwordDialog.submitButton.isVisible(), 'Submit button not enabled').toBe(true);
|
||||||
|
|
||||||
await personalFiles.passwordDialog.submitButton.click();
|
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 }) => {
|
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.reload({ waitUntil: 'domcontentloaded' });
|
||||||
await personalFiles.viewer.waitForViewerToOpen();
|
await personalFiles.viewer.waitForViewerToOpen();
|
||||||
|
|
||||||
|
99
e2e/playwright/viewer/src/tests/viewer-useraction.spec.ts
Normal file
99
e2e/playwright/viewer/src/tests/viewer-useraction.spec.ts
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
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);
|
||||||
|
});
|
||||||
|
});
|
@ -29,7 +29,7 @@ test.use({ storageState: getUserState('hruser') });
|
|||||||
test.describe('viewer file', () => {
|
test.describe('viewer file', () => {
|
||||||
const apiClientFactory = new ApiClientFactory();
|
const apiClientFactory = new ApiClientFactory();
|
||||||
const randomFolderName = `playwright-folder-${Utils.random()}`;
|
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;
|
let folderId: string;
|
||||||
|
|
||||||
test.beforeAll(async ({ fileAction }) => {
|
test.beforeAll(async ({ fileAction }) => {
|
||||||
|
@ -38,11 +38,13 @@ import {
|
|||||||
UploadApi,
|
UploadApi,
|
||||||
SharedlinksApi,
|
SharedlinksApi,
|
||||||
FavoritesApi,
|
FavoritesApi,
|
||||||
TrashcanApi
|
TrashcanApi,
|
||||||
|
PersonEntry
|
||||||
} from '@alfresco/js-api';
|
} from '@alfresco/js-api';
|
||||||
import { logger } from '@alfresco/adf-cli/scripts/logger';
|
import { logger } from '@alfresco/adf-cli/scripts/logger';
|
||||||
import { ActionTypes, Rule } from './rules-api';
|
import { ActionTypes, Rule } from './rules-api';
|
||||||
import { users } from '../base-config';
|
import { users } from '../base-config';
|
||||||
|
import { Person, PersonModel } from './people-api-models';
|
||||||
|
|
||||||
export interface AcaBackend {
|
export interface AcaBackend {
|
||||||
sites: SitesApi;
|
sites: SitesApi;
|
||||||
@ -149,4 +151,16 @@ export class ApiClientFactory {
|
|||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async createUser(user: PersonModel): Promise<PersonEntry> {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,3 +27,5 @@ export * from './api-client-factory';
|
|||||||
export * from './file-actions';
|
export * from './file-actions';
|
||||||
export * from './shared-links-api';
|
export * from './shared-links-api';
|
||||||
export * from './favorites-api';
|
export * from './favorites-api';
|
||||||
|
export * from './user-actions';
|
||||||
|
export * from './people-api-models';
|
||||||
|
52
projects/aca-playwright-shared/src/api/people-api-models.ts
Executable file
52
projects/aca-playwright-shared/src/api/people-api-models.ts
Executable file
@ -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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
134
projects/aca-playwright-shared/src/api/user-actions.ts
Normal file
134
projects/aca-playwright-shared/src/api/user-actions.ts
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
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<void> {
|
||||||
|
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<any> {
|
||||||
|
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<any> {
|
||||||
|
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<any> {
|
||||||
|
try {
|
||||||
|
for (const nodeId of nodeIds) {
|
||||||
|
await this.nodesApi.deleteNode(nodeId, { permanent });
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
Logger.error(`\n [User Actions] - deleteNodes failed error : ${error}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -34,7 +34,8 @@ import {
|
|||||||
SearchPage,
|
SearchPage,
|
||||||
FavoritesPage,
|
FavoritesPage,
|
||||||
FavoritesPageApi,
|
FavoritesPageApi,
|
||||||
TrashPage
|
TrashPage,
|
||||||
|
UserActions
|
||||||
} from '../';
|
} from '../';
|
||||||
|
|
||||||
interface Pages {
|
interface Pages {
|
||||||
@ -52,6 +53,7 @@ interface Api {
|
|||||||
fileAction: FileActionsApi;
|
fileAction: FileActionsApi;
|
||||||
shareAction: SharedLinksApi;
|
shareAction: SharedLinksApi;
|
||||||
favoritesPageAction: FavoritesPageApi;
|
favoritesPageAction: FavoritesPageApi;
|
||||||
|
userActions: UserActions;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const test = base.extend<Pages & Api>({
|
export const test = base.extend<Pages & Api>({
|
||||||
@ -88,6 +90,10 @@ export const test = base.extend<Pages & Api>({
|
|||||||
favoritesPageAction: async ({}, use) => {
|
favoritesPageAction: async ({}, use) => {
|
||||||
await use(await FavoritesPageApi.initialize('hruser'));
|
await use(await FavoritesPageApi.initialize('hruser'));
|
||||||
},
|
},
|
||||||
|
// eslint-disable-next-line no-empty-pattern
|
||||||
|
userActions: async ({}, use) => {
|
||||||
|
await use(new UserActions());
|
||||||
|
},
|
||||||
myLibrariesPage: async ({ page }, use) => {
|
myLibrariesPage: async ({ page }, use) => {
|
||||||
await use(new MyLibrariesPage(page));
|
await use(new MyLibrariesPage(page));
|
||||||
}
|
}
|
||||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
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<void> {
|
||||||
|
await this.locationDropDown.click();
|
||||||
|
const optionLocator = this.getOptionLocator(location);
|
||||||
|
await optionLocator.click();
|
||||||
|
await optionLocator.waitFor({ state: 'detached' });
|
||||||
|
}
|
||||||
|
|
||||||
|
async selectDestination(folderName: string): Promise<void> {
|
||||||
|
const row = this.getRowByName(folderName);
|
||||||
|
await row.click();
|
||||||
|
await this.selectedRow.waitFor({ state: 'attached' });
|
||||||
|
await this.selectedRow.isVisible();
|
||||||
|
}
|
||||||
|
}
|
@ -26,3 +26,4 @@ export * from './adf-folder-dialog.component';
|
|||||||
export * from './adf-library-dialog.component';
|
export * from './adf-library-dialog.component';
|
||||||
export * from './password-overlay-dialog.component';
|
export * from './password-overlay-dialog.component';
|
||||||
export * from './viewer-overlay-dialog.component';
|
export * from './viewer-overlay-dialog.component';
|
||||||
|
export * from './content-node-selector-dialog';
|
||||||
|
@ -38,6 +38,8 @@ export class LoginPage extends BasePage {
|
|||||||
private username = this.page.locator('#username');
|
private username = this.page.locator('#username');
|
||||||
private password = this.page.locator('#password');
|
private password = this.page.locator('#password');
|
||||||
private submitButton = this.page.locator('#login-button');
|
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<void> {
|
async loginUser(userData: { username: string; password: string } | UserModel, options?: LoginOptions): Promise<void> {
|
||||||
if (options?.withNavigation) {
|
if (options?.withNavigation) {
|
||||||
@ -51,4 +53,9 @@ export class LoginPage extends BasePage {
|
|||||||
await Promise.all([this.page.waitForLoadState('domcontentloaded'), this.spinner.waitForReload()]);
|
await Promise.all([this.page.waitForLoadState('domcontentloaded'), this.spinner.waitForReload()]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async logoutUser(): Promise<void> {
|
||||||
|
await this.userProfileButton.click();
|
||||||
|
await this.userLogOutButton.click();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,15 @@
|
|||||||
import { Page } from '@playwright/test';
|
import { Page } from '@playwright/test';
|
||||||
import { BasePage } from './base.page';
|
import { BasePage } from './base.page';
|
||||||
import { AcaHeader } from '../components/aca-header.component';
|
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 {
|
export class MyLibrariesPage extends BasePage {
|
||||||
private static pageUrl = 'libraries';
|
private static pageUrl = 'libraries';
|
||||||
@ -38,6 +46,9 @@ export class MyLibrariesPage extends BasePage {
|
|||||||
public libraryDialog = new AdfLibraryDialogComponent(this.page);
|
public libraryDialog = new AdfLibraryDialogComponent(this.page);
|
||||||
public dataTable = new DataTableComponent(this.page);
|
public dataTable = new DataTableComponent(this.page);
|
||||||
public libraryDetails = new AdfInfoDrawerComponent(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<void> {
|
async selectCreateLibrary(): Promise<void> {
|
||||||
await this.acaHeader.createButton.click();
|
await this.acaHeader.createButton.click();
|
||||||
|
@ -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
|
Binary file not shown.
@ -35,10 +35,15 @@ export const TEST_FILES = {
|
|||||||
name: 'file-pdf',
|
name: 'file-pdf',
|
||||||
data: 'Lorem ipsum dolor sit amet'
|
data: 'Lorem ipsum dolor sit amet'
|
||||||
},
|
},
|
||||||
DOCX_PROTECTED: {
|
PDF_PROTECTED: {
|
||||||
path: resolve(__dirname, 'file-pdf-protected.pdf'),
|
path: resolve(__dirname, 'file-pdf-protected.pdf'),
|
||||||
name: 'file-pdf-protected',
|
name: 'file-pdf-protected',
|
||||||
data: 'Lorem ipsum dolor sit amet',
|
data: 'Lorem ipsum dolor sit amet',
|
||||||
password: '0000'
|
password: '0000'
|
||||||
|
},
|
||||||
|
XLSX: {
|
||||||
|
path: resolve(__dirname, 'file-xlsx.xlsx'),
|
||||||
|
name: 'file-xlsx',
|
||||||
|
data: 'Lorem ipsum dolor sit amet'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user