diff --git a/e2e/playwright/share-action/src/tests/share/share-file.spec.ts b/e2e/playwright/share-action/src/tests/share/share-file.spec.ts
index e6e040b78..d415be0d8 100644
--- a/e2e/playwright/share-action/src/tests/share/share-file.spec.ts
+++ b/e2e/playwright/share-action/src/tests/share/share-file.spec.ts
@@ -151,7 +151,7 @@ test.describe('Share a file', () => {
const url = await personalFiles.shareDialog.getLinkUrl();
await personalFiles.shareDialog.clickClose();
- const sharedId = await nodesApiAction.getSharedId(file3Id);
+ const sharedId = await nodesApiAction.getNodeProperty(file3Id, 'qshare:sharedId');
expect(url).toContain(sharedId);
});
@@ -190,14 +190,13 @@ test.describe('Share a file', () => {
const inputDate = await personalFiles.shareDialog.getExpireDate();
await page.waitForTimeout(timeouts.normal);
- const expireDateProperty = await nodesApiAction.getSharedExpiryDate(file5Id);
-
+ const expireDateProperty = await nodesApiAction.getNodeProperty(file5Id, 'qshare:expiryDate');
expect(Utils.formatDate(expireDateProperty)).toEqual(Utils.formatDate(inputDate));
});
test('[C286337] Expire date is displayed correctly', async ({ personalFiles, nodesApiAction }) => {
expect(await personalFiles.dataTable.performActionFromExpandableMenu(file6, 'Share'));
- const expireProperty = await nodesApiAction.getSharedExpiryDate(file6Id);
+ const expireProperty = await nodesApiAction.getNodeProperty(file6Id, 'qshare:expiryDate');
expect(expireProperty).toEqual(expiryDate);
expect(await personalFiles.shareDialog.isExpireToggleEnabled()).toBe(true);
@@ -215,7 +214,7 @@ test.describe('Share a file', () => {
await page.waitForTimeout(timeouts.tiny);
await personalFiles.shareDialog.clickClose();
- expect(await nodesApiAction.getSharedExpiryDate(file7Id)).toBe('');
+ expect(await nodesApiAction.getNodeProperty(file7Id, 'qshare:expiryDate')).toBe('');
});
test('[C286335] Shared file URL is not changed when Share dialog is closed and opened again', async ({ personalFiles }) => {
@@ -237,7 +236,7 @@ test.describe('Share a file', () => {
const url = await personalFiles.shareDialog.getLinkUrl();
await personalFiles.shareDialog.clickClose();
- const sharedId = await nodesApiAction.getSharedId(file9Id);
+ const sharedId = await nodesApiAction.getNodeProperty(file9Id, 'qshare:sharedId');
expect(await nodesApiAction.isFileShared(file9Id)).toBe(true);
expect(url).toContain(sharedId);
});
diff --git a/e2e/playwright/viewer/src/tests/viewer-action.spec.ts b/e2e/playwright/viewer/src/tests/viewer-action.spec.ts
index 7f45bb51b..8b8aabe6a 100644
--- a/e2e/playwright/viewer/src/tests/viewer-action.spec.ts
+++ b/e2e/playwright/viewer/src/tests/viewer-action.spec.ts
@@ -35,20 +35,33 @@ test.describe('viewer action file', () => {
const randomDocxDelete = `${TEST_FILES.DOCX.name}-${Utils.random()}`;
const fileForEditOffline = `playwright-file1-${Utils.random()}.docx`;
const fileForCancelEditing = `playwright-file2-${Utils.random()}.docx`;
+ const docxFile2 = TEST_FILES.DOCX2.name;
+ const docxFile = TEST_FILES.DOCX.name;
let folderId: string;
let fileDocxShareId: string;
let randomDocxNameFavoriteId: string;
let fileForCancelEditingId: string;
+ const filePersonalFiles = `file3-${Utils.random()}.docx`;
+ let filePersonalFilesId: string;
+ const fileForUploadNewVersion2 = `file4-${Utils.random()}.docx`;
+ let fileForUploadNewVersionId2: string;
+ const destination = `destRF-${Utils.random()}`;
+ let destinationId: string;
+ const docxRecentFiles = `docxRF-${Utils.random()}.docx`;
test.beforeAll(async ({ fileAction, favoritesPageAction, shareAction }) => {
await apiClientFactory.setUpAcaBackend('hruser');
const node = await apiClientFactory.nodes.createNode('-my-', { name: randomFolderName, nodeType: 'cm:folder', relativePath: '/' });
+ destinationId = (await apiClientFactory.nodes.createNode('-my-', { name: destination, nodeType: 'cm:folder', relativePath: '/' })).entry.id;
folderId = node.entry.id;
fileDocxShareId = (await fileAction.uploadFile(TEST_FILES.DOCX.path, randomDocxNameShare, folderId)).entry.id;
+ filePersonalFilesId = (await fileAction.uploadFile(TEST_FILES.DOCX2.path, filePersonalFiles, folderId)).entry.id;
+ fileForUploadNewVersionId2 = (await fileAction.uploadFileWithRename(TEST_FILES.DOCX.path, fileForUploadNewVersion2, folderId)).entry.id;
+ await fileAction.uploadFileWithRename(TEST_FILES.DOCX.path, docxRecentFiles, folderId);
await shareAction.shareFileById(fileDocxShareId);
fileForCancelEditingId = (await fileAction.uploadFile(TEST_FILES.DOCX.path, fileForCancelEditing, folderId)).entry.id;
- await fileAction.lockNodes([fileForCancelEditingId]);
+ await fileAction.lockNodes([fileForCancelEditingId, fileForUploadNewVersionId2]);
await fileAction.uploadFile(TEST_FILES.DOCX.path, randomDocxName, folderId);
await fileAction.uploadFile(TEST_FILES.DOCX.path, randomDocxDelete, folderId);
const fileFavoritesNode = await fileAction.uploadFile(TEST_FILES.DOCX.path, randomDocxNameFavorite, folderId);
@@ -65,6 +78,7 @@ test.describe('viewer action file', () => {
test.afterAll(async () => {
await apiClientFactory.nodes.deleteNode(folderId, { permanent: true });
+ await apiClientFactory.nodes.deleteNode(destinationId, { permanent: true });
});
test('[C268129] Download action', async ({ personalFiles }) => {
@@ -164,4 +178,54 @@ test.describe('viewer action file', () => {
await favoritePage.viewerDialog.shareDialogClose.waitFor({ state: 'detached', timeout: timeouts.large });
expect(await favoritePage.viewerDialog.shareDialogTitle.isVisible(), 'Share dialog should be open').toBe(false);
});
+
+ test('[C297586] Upload new version action', async ({ personalFiles, nodesApiAction }) => {
+ await personalFiles.dataTable.performClickFolderOrFileToOpen(filePersonalFiles);
+ await personalFiles.viewer.waitForViewerToOpen();
+
+ await Utils.uploadFileNewVersion(personalFiles, docxFile2);
+
+ await personalFiles.uploadNewVersionDialog.majorOption.click();
+ await personalFiles.uploadNewVersionDialog.description.fill('new major version description');
+ await personalFiles.uploadNewVersionDialog.uploadButton.click();
+ await expect(personalFiles.uploadNewVersionDialog.cancelButton).toHaveCount(0);
+ expect(await personalFiles.viewer.isViewerOpened(), 'Viewer is not open').toBe(true);
+ expect(await personalFiles.viewer.fileTitleButtonLocator.innerText()).toContain(docxFile2);
+ expect(await nodesApiAction.getNodeProperty(filePersonalFilesId, 'cm:versionType'), 'File has incorrect version type').toEqual('MAJOR');
+ expect(await nodesApiAction.getNodeProperty(filePersonalFilesId, 'cm:versionLabel'), 'File has incorrect version label').toEqual('2.0');
+ });
+
+ test('[MNT-21058] Upload new version action when node is locked', async ({ personalFiles }) => {
+ await personalFiles.dataTable.performClickFolderOrFileToOpen(fileForUploadNewVersion2);
+ await personalFiles.viewer.waitForViewerToOpen();
+
+ await Utils.uploadFileNewVersion(personalFiles, docxFile);
+
+ await personalFiles.uploadNewVersionDialog.uploadButton.click();
+ await expect(personalFiles.uploadNewVersionDialog.cancelButton).toHaveCount(0);
+
+ await personalFiles.viewer.waitForViewerToOpen();
+ expect(await personalFiles.viewer.fileTitleButtonLocator.innerText()).toContain(docxFile);
+
+ await personalFiles.acaHeader.clickViewerMoreActions();
+ expect(await personalFiles.matMenu.cancelEditingAction.isVisible(), `'Cancel Editing' button shouldn't be shown`).toBe(false);
+ expect(await personalFiles.matMenu.editOfflineAction.isVisible(), `'Edit Offline' should be shown`).toBe(true);
+ });
+
+ test('[C286384] Copy action from Recent Files', async ({ recentFilesPage, personalFiles }) => {
+ await recentFilesPage.navigate();
+ await recentFilesPage.dataTable.performClickFolderOrFileToOpen(docxRecentFiles);
+ expect(await recentFilesPage.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true);
+
+ await recentFilesPage.acaHeader.clickViewerMoreActions();
+ await recentFilesPage.matMenu.clickMenuItem('Copy');
+ expect(await recentFilesPage.contentNodeSelector.actionButton.isVisible(), 'Dialog is not open').toBe(true);
+ await recentFilesPage.contentNodeSelector.selectLocation('Personal Files');
+ await recentFilesPage.contentNodeSelector.selectDestination(destination);
+ await recentFilesPage.contentNodeSelector.actionButton.click();
+ expect(await recentFilesPage.snackBar.message.innerText()).toContain('Copied 1 item');
+ await recentFilesPage.viewer.closeButtonLocator.click();
+ await personalFiles.navigate({ remoteUrl: `#/personal-files/${destinationId}` });
+ expect(await personalFiles.dataTable.isItemPresent(docxRecentFiles), 'Item is not present in destination').toBe(true);
+ });
});
diff --git a/e2e/protractor/suites/viewer/viewer-actions.test.ts b/e2e/protractor/suites/viewer/viewer-actions.test.ts
deleted file mode 100755
index 1445c0afc..000000000
--- a/e2e/protractor/suites/viewer/viewer-actions.test.ts
+++ /dev/null
@@ -1,251 +0,0 @@
-/*!
- * 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 {
- AdminActions,
- UserActions,
- LoginPage,
- BrowsingPage,
- FILES,
- RepoClient,
- Utils,
- Viewer,
- ContentNodeSelectorDialog,
- UploadNewVersionDialog,
- UploadFilesDialog
-} from '@alfresco/aca-testing-shared';
-
-describe('Viewer actions', () => {
- const username = `user-${Utils.random()}`;
-
- const docxFile = FILES.docxFile;
- const docxFile2 = FILES.docxFile2;
- const xlsxFileForMove = FILES.xlsxFile;
- const pdfFileForDelete = FILES.pdfFile;
-
- const apis = {
- user: new RepoClient(username, username)
- };
-
- const loginPage = new LoginPage();
- const page = new BrowsingPage();
- const dataTable = page.dataTable;
- const viewer = new Viewer();
- const { toolbar } = viewer;
- const copyMoveDialog = new ContentNodeSelectorDialog();
- const uploadNewVersionDialog = new UploadNewVersionDialog();
-
- const adminApiActions = new AdminActions();
- const userActions = new UserActions();
-
- const uploadFilesDialog = new UploadFilesDialog();
-
- beforeAll(async () => {
- await adminApiActions.createUser({ username });
- await userActions.login(username, username);
- });
-
- describe('from Personal Files', () => {
- const parent = `parentPF-${Utils.random()}`;
- let parentId: string;
- const destination = `destPF-${Utils.random()}`;
- let destinationId: string;
-
- const docxPersonalFiles = `docxPF-${Utils.random()}.docx`;
-
- const xlsxPersonalFiles = `xlsxPF-${Utils.random()}.xlsx`;
- const pdfPersonalFiles = `pdfPF-${Utils.random()}.pdf`;
- const filePersonalFiles = docxFile2;
- let filePersonalFilesId: string;
-
- const fileForCancelEditing = `file2-${Utils.random()}.docx`;
- let fileForCancelEditingId: string;
- const fileForUploadNewVersion = `file3-${Utils.random()}.docx`;
- let fileForUploadNewVersionId: string;
- const fileForUploadNewVersion2 = `file4-${Utils.random()}.docx`;
- let fileForUploadNewVersionId2: string;
-
- beforeAll(async () => {
- try {
- parentId = await apis.user.createFolder(parent);
- destinationId = await apis.user.createFolder(destination);
-
- await apis.user.upload.uploadFileWithRename(docxFile, parentId, docxPersonalFiles);
-
- filePersonalFilesId = (await apis.user.upload.uploadFile(docxFile2, parentId)).entry.id;
- await apis.user.upload.uploadFileWithRename(xlsxFileForMove, parentId, xlsxPersonalFiles);
- await apis.user.upload.uploadFileWithRename(pdfFileForDelete, parentId, pdfPersonalFiles);
-
- fileForCancelEditingId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForCancelEditing)).entry.id;
- fileForUploadNewVersionId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForUploadNewVersion)).entry.id;
- fileForUploadNewVersionId2 = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForUploadNewVersion2)).entry.id;
-
- await userActions.lockNodes([fileForCancelEditingId, fileForUploadNewVersionId, fileForUploadNewVersionId2]);
- await loginPage.loginWith(username);
- } catch {}
- });
-
- beforeEach(async () => {
- try {
- await page.clickPersonalFilesAndWait();
- await dataTable.doubleClickOnRowByName(parent);
- await dataTable.waitForHeader();
- } catch {}
- });
-
- afterEach(async () => {
- await Utils.pressEscape();
- await uploadFilesDialog.closeUploadDialog();
- });
-
- afterAll(async () => {
- try {
- await userActions.login(username, username);
- await apis.user.nodes.deleteNodesById([parentId, destinationId]);
- await userActions.emptyTrashcan();
- } catch {}
- });
-
- it('[C297585] Cancel Editing action', async () => {
- await dataTable.doubleClickOnRowByName(fileForCancelEditing);
- await viewer.waitForViewerToOpen();
- await toolbar.clickMoreActionsCancelEditing();
-
- expect(await apis.user.nodes.isFileLockedWriteWithRetry(fileForCancelEditingId, false)).toBe(false, `${fileForCancelEditing} is still locked`);
- expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not open');
- });
-
- it('[C297586] Upload new version action', async () => {
- await dataTable.doubleClickOnRowByName(filePersonalFiles);
- await viewer.waitForViewerToOpen();
-
- await Utils.uploadFileNewVersion(docxFile2);
- await page.waitForDialog();
-
- await uploadNewVersionDialog.majorOption.click();
- await uploadNewVersionDialog.enterDescription('new major version description');
- await uploadNewVersionDialog.uploadButton.click();
-
- expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not open');
- expect(await viewer.getFileTitle()).toContain(docxFile2);
- expect(await apis.user.nodes.getFileVersionType(filePersonalFilesId)).toEqual('MAJOR', 'File has incorrect version type');
- expect(await apis.user.nodes.getFileVersionLabel(filePersonalFilesId)).toEqual('2.0', 'File has incorrect version label');
- });
-
- it('[MNT-21058] Upload new version action when node is locked', async () => {
- await dataTable.doubleClickOnRowByName(fileForUploadNewVersion2);
- await viewer.waitForViewerToOpen();
-
- await Utils.uploadFileNewVersion(docxFile);
- await page.waitForDialog();
-
- await uploadNewVersionDialog.uploadButton.click();
- await uploadNewVersionDialog.waitForDialogToClose();
-
- await viewer.waitForViewerToOpen();
- await viewer.waitForFileTitleToBeDisplayed(docxFile);
-
- await toolbar.openMoreMenu();
- expect(await toolbar.menu.cancelEditingAction.isPresent()).toBe(false, `'Cancel Editing' button shouldn't be shown`);
- expect(await toolbar.menu.editOfflineAction.isPresent()).toBe(true, `'Edit Offline' should be shown`);
- });
- });
-
- describe('from Recent Files', () => {
- const parent = `parentRF-${Utils.random()}`;
- let parentId: string;
- const destination = `destRF-${Utils.random()}`;
- let destinationId: string;
-
- const docxRecentFiles = `docxRF-${Utils.random()}.docx`;
- const xlsxRecentFiles = `xlsxRF-${Utils.random()}.xlsx`;
- const pdfRecentFiles = `pdfRF-${Utils.random()}.pdf`;
-
- const fileForEditOffline = `file1-${Utils.random()}.docx`;
- const fileForCancelEditing = `file2-${Utils.random()}.docx`;
- let fileForCancelEditingId: string;
- const fileForUploadNewVersion = `file3-${Utils.random()}.docx`;
- let fileForUploadNewVersionId: string;
-
- beforeAll(async () => {
- try {
- await apis.user.search.waitForApi(username, { expect: 0 });
-
- parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
- destinationId = (await apis.user.nodes.createFolder(destination)).entry.id;
- await apis.user.upload.uploadFileWithRename(docxFile, parentId, docxRecentFiles);
- await apis.user.upload.uploadFile(docxFile2, parentId);
-
- await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForEditOffline);
- fileForCancelEditingId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForCancelEditing)).entry.id;
- fileForUploadNewVersionId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForUploadNewVersion)).entry.id;
-
- await userActions.lockNodes([fileForCancelEditingId, fileForUploadNewVersionId]);
-
- await apis.user.upload.uploadFileWithRename(xlsxFileForMove, parentId, xlsxRecentFiles);
- await apis.user.upload.uploadFileWithRename(pdfFileForDelete, parentId, pdfRecentFiles);
-
- await apis.user.search.waitForApi(username, { expect: 7 });
-
- await loginPage.loginWith(username);
- } catch {}
- });
-
- beforeEach(async () => {
- await page.clickRecentFilesAndWait();
- });
-
- afterEach(async () => {
- await Utils.pressEscape();
- await uploadFilesDialog.closeUploadDialog();
- });
-
- afterAll(async () => {
- try {
- await userActions.login(username, username);
- await apis.user.nodes.deleteNodesById([parentId, destinationId]);
- await userActions.emptyTrashcan();
- } catch {}
- });
-
- it('[C286384] Copy action', async () => {
- await dataTable.doubleClickOnRowByName(docxRecentFiles);
- expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
-
- await toolbar.clickMoreActionsCopy();
- expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
- await copyMoveDialog.selectLocation('Personal Files');
- await copyMoveDialog.selectDestination(destination);
- await copyMoveDialog.copyButton.click();
- expect(await page.getSnackBarMessage()).toContain('Copied 1 item');
- await viewer.closeButton.click();
- expect(await dataTable.isItemPresent(docxRecentFiles)).toBe(true, 'Item is not in the list');
- await page.clickPersonalFilesAndWait();
- await dataTable.doubleClickOnRowByName(destination);
- expect(await dataTable.isItemPresent(docxRecentFiles)).toBe(true, 'Item is not present in destination');
-
- await apis.user.nodes.deleteNodeChildren(destinationId);
- });
- });
-});
diff --git a/projects/aca-playwright-shared/src/api/nodes-api.ts b/projects/aca-playwright-shared/src/api/nodes-api.ts
index 47ac6f8f6..65f823519 100755
--- a/projects/aca-playwright-shared/src/api/nodes-api.ts
+++ b/projects/aca-playwright-shared/src/api/nodes-api.ts
@@ -418,29 +418,9 @@ export class NodesApi {
}
}
- async getSharedId(nodeId: string): Promise {
- try {
- const sharedId = await this.getNodeProperty(nodeId, 'qshare:sharedId');
- return sharedId || '';
- } catch (error) {
- console.error(`${this.constructor.name} ${this.getSharedId.name}`, error);
- return '';
- }
- }
-
- async getSharedExpiryDate(nodeId: string): Promise {
- try {
- const expiryDate = await this.getNodeProperty(nodeId, 'qshare:expiryDate');
- return expiryDate || '';
- } catch (error) {
- console.error(`${this.constructor.name} ${this.getSharedExpiryDate.name}`, error);
- return '';
- }
- }
-
async isFileShared(nodeId: string): Promise {
try {
- const sharedId = await this.getSharedId(nodeId);
+ const sharedId = await this.getNodeProperty(nodeId, 'qshare:sharedId');
return sharedId !== '';
} catch (error) {
console.error(`${this.constructor.name} ${this.isFileShared.name}`, error);
diff --git a/projects/aca-playwright-shared/src/page-objects/components/dataTable/mat-menu.component.ts b/projects/aca-playwright-shared/src/page-objects/components/dataTable/mat-menu.component.ts
index 97c4edbbd..aebaa2e07 100644
--- a/projects/aca-playwright-shared/src/page-objects/components/dataTable/mat-menu.component.ts
+++ b/projects/aca-playwright-shared/src/page-objects/components/dataTable/mat-menu.component.ts
@@ -39,6 +39,8 @@ export class MatMenuComponent extends BaseComponent {
public createFileFromTemplate = this.getChild('[id="app.create.fileFromTemplate"]');
public createLibrary = this.getChild('[id="app.create.library"]');
public getButtonByText = (text: string) => this.getChild('button', { hasText: text });
+ public cancelEditingAction = this.getChild(`.mat-menu-item[title='Cancel Editing']`);
+ public editOfflineAction = this.getChild(`.mat-menu-item[title='Edit Offline']`);
async clickMenuItem(menuItem: string): Promise {
const menuElement = this.getButtonByText(menuItem);
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 091bd0332..a7f0f8675 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
@@ -30,3 +30,4 @@ export * from './content-node-selector-dialog';
export * from './create-from-template-dialog-component';
export * from './adf-confirm-dialog.component';
export * from './share-dialog.component';
+export * from './upload-new-version-dialog.component';
diff --git a/projects/aca-playwright-shared/src/page-objects/components/dialogs/upload-new-version-dialog.component.ts b/projects/aca-playwright-shared/src/page-objects/components/dialogs/upload-new-version-dialog.component.ts
new file mode 100755
index 000000000..851bd0c27
--- /dev/null
+++ b/projects/aca-playwright-shared/src/page-objects/components/dialogs/upload-new-version-dialog.component.ts
@@ -0,0 +1,39 @@
+/*!
+ * 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 { Page } from '@playwright/test';
+import { BaseComponent } from '../base.component';
+
+export class UploadNewVersionDialog extends BaseComponent {
+ private static rootElement = 'adf-new-version-uploader-dialog';
+
+ public cancelButton = this.getChild('#adf-new-version-cancel');
+ public uploadButton = this.getChild('[data-automation-id="adf-new-version-file-upload"]');
+ public majorOption = this.getChild('#adf-new-version-major');
+ public description = this.getChild('#adf-new-version-text-area');
+
+ constructor(page: Page) {
+ super(page, UploadNewVersionDialog.rootElement);
+ }
+}
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 8098788fb..0a27a90c0 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
@@ -40,7 +40,8 @@ import {
ErrorComponent,
ShareDialogComponent,
AdfConfirmDialogComponent,
- AdfInfoDrawerComponent
+ AdfInfoDrawerComponent,
+ UploadNewVersionDialog
} from '../components';
export class PersonalFilesPage extends BasePage {
@@ -63,9 +64,10 @@ export class PersonalFilesPage extends BasePage {
public createFromTemplateDialogComponent = new CreateFromTemplateDialogComponent(this.page);
public pagination = new PaginationComponent(this.page);
public errorDialog = new ErrorComponent(this.page);
- public shareDialog= new ShareDialogComponent(this.page);
+ public shareDialog = new ShareDialogComponent(this.page);
public confirmDialog = new AdfConfirmDialogComponent(this.page);
public infoDrawer = new AdfInfoDrawerComponent(this.page);
+ public uploadNewVersionDialog = new UploadNewVersionDialog(this.page);
async selectCreateFolder(): Promise {
await this.acaHeader.createButton.click();
diff --git a/projects/aca-playwright-shared/src/page-objects/pages/recent-files.page.ts b/projects/aca-playwright-shared/src/page-objects/pages/recent-files.page.ts
index 19bd1600e..5b6972464 100644
--- a/projects/aca-playwright-shared/src/page-objects/pages/recent-files.page.ts
+++ b/projects/aca-playwright-shared/src/page-objects/pages/recent-files.page.ts
@@ -26,7 +26,7 @@ import { Page } from '@playwright/test';
import { BasePage } from './base.page';
import { DataTableComponent, MatMenuComponent, ViewerComponent, SidenavComponent, Breadcrumb, AdfInfoDrawerComponent } from '../components';
import { AcaHeader } from '../components/aca-header.component';
-import { AdfFolderDialogComponent } from '../components/dialogs';
+import { AdfFolderDialogComponent, ContentNodeSelectorDialog } from '../components/dialogs';
export class RecentFilesPage extends BasePage {
private static pageUrl = 'recent-files';
@@ -43,4 +43,5 @@ export class RecentFilesPage extends BasePage {
public sidenav = new SidenavComponent(this.page);
public breadcrumb = new Breadcrumb(this.page);
public infoDrawer = new AdfInfoDrawerComponent(this.page);
+ public contentNodeSelector = new ContentNodeSelectorDialog(this.page);
}
diff --git a/projects/aca-playwright-shared/src/utils/utils.ts b/projects/aca-playwright-shared/src/utils/utils.ts
index 9987fd577..e8151dc03 100644
--- a/projects/aca-playwright-shared/src/utils/utils.ts
+++ b/projects/aca-playwright-shared/src/utils/utils.ts
@@ -23,11 +23,11 @@
*/
const crypto = require('crypto');
-import { LoginPage } from '../';
+import * as path from 'path';
+import { LoginPage, PersonalFilesPage } from '../';
import { NodesApi, TrashcanApi, SitesApi } from '@alfresco/playwright-shared';
export class Utils {
-
static string257Long = 'x'.repeat(257);
static string513Long = 'x'.repeat(513);
@@ -49,15 +49,15 @@ export class Utils {
return new Date(date).toLocaleDateString('en-US');
}
- /**
+ /**
* Method used to login user with navigation. Also waits for the page to load after login
- *
+ *
* @param loginPage page context passed from the test
* @param username username string
* @param password password string
* @param errorMessage error message string if the login fails
- *
- */
+ *
+ */
static async tryLoginUser(loginPage: LoginPage, username: string, password: string, errorMessage = 'Error '): Promise {
try {
await loginPage.loginUser({ username, password }, { withNavigation: true, waitForLoading: true });
@@ -66,17 +66,23 @@ export class Utils {
}
}
- /**
+ /**
* Method used to delete nodes and sites from user's account
- *
+ *
* @param nodesApi nodesApi initialized with user credentials passed from the test
* @param trashcanApi trashcanApi initialized with user credentials passed from the test
* @param errorMessage error message string if the deleting sites/nodes fails
* @param sitesApi sitesApi initialized with user credentials passed from the test
* @param sitesToDelete array of sites' ids
- *
- */
- static async deleteNodesSitesEmptyTrashcan(nodesApi?: NodesApi, trashcanApi?: TrashcanApi, errorMessage = 'Error ', sitesApi?: SitesApi, sitesToDelete?: string[]): Promise {
+ *
+ */
+ static async deleteNodesSitesEmptyTrashcan(
+ nodesApi?: NodesApi,
+ trashcanApi?: TrashcanApi,
+ errorMessage = 'Error ',
+ sitesApi?: SitesApi,
+ sitesToDelete?: string[]
+ ): Promise {
try {
await nodesApi?.deleteCurrentUserNodes();
await trashcanApi?.emptyTrashcan();
@@ -87,4 +93,9 @@ export class Utils {
console.error(`${errorMessage}: ${error}`);
}
}
+
+ static async uploadFileNewVersion(personalFilesPage: PersonalFilesPage, fileFromOS: string): Promise {
+ const fileInput = await personalFilesPage.page.$('#app-upload-file-version');
+ await fileInput.setInputFiles(path.join(__dirname, `../resources/test-files/${fileFromOS}.docx`));
+ }
}