mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACS-5016] [E2E] delete actions migrated to playwright (#3868)
* [ACS-5016] [E2E] delete actions migrated to playwright * [ACS-5016] sonar fix 1 * [ACS-5016] sonar fix 2 * [ACS-5016] upload.effects.spec.ts reverted * [ACS-5016] upload-file.test.ts reverted * [ACS-5016] review fix 1
This commit is contained in:
@@ -81,6 +81,15 @@ export class NodesApi {
|
||||
}
|
||||
}
|
||||
|
||||
async createFolders(names: string[], relativePath = '/'): Promise<NodePaging> {
|
||||
try {
|
||||
return await this.createContent({ folders: names }, relativePath);
|
||||
} catch (error) {
|
||||
console.error(`${this.constructor.name} ${this.createFolders.name}: ${error}`);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
async deleteDeletedNode(name: string): Promise<void> {
|
||||
try {
|
||||
await this.apiService.trashCan.deleteDeletedNode(name);
|
||||
@@ -174,6 +183,16 @@ export class NodesApi {
|
||||
}
|
||||
}
|
||||
|
||||
async unlockNodes(nodeIds: string[]) {
|
||||
try {
|
||||
for (const nodeId of nodeIds) {
|
||||
await this.apiService.nodes.unlockNode(nodeId);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`${this.constructor.name} ${this.unlockNodes.name}`, error);
|
||||
}
|
||||
}
|
||||
|
||||
async createContent(content: NodeContentTree, relativePath: string = '/'): Promise<NodePaging> {
|
||||
try {
|
||||
return await this.apiService.nodes.createNode('-my-', flattenNodeContentTree(content, relativePath) as any);
|
||||
|
@@ -42,6 +42,8 @@ export class AcaHeader extends BaseComponent {
|
||||
public uploadButton = this.getChild('button[id="app.toolbar.upload"]');
|
||||
public uploadFileButton = this.page.locator('button[id="app.create.uploadFile"]');
|
||||
public uploadInput = this.page.locator('input[id="app-upload-files"]');
|
||||
public permanentlyDeleteButton = this.getChild('button[id="app.toolbar.purgeDeletedNodes"]');
|
||||
public restoreButton = this.getChild('button[id="app.toolbar.restoreDeletedNodes"]');
|
||||
|
||||
constructor(page: Page) {
|
||||
super(page, AcaHeader.rootElement);
|
||||
|
@@ -0,0 +1,63 @@
|
||||
/*!
|
||||
* Copyright © 2005-2024 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 { Page } from '@playwright/test';
|
||||
import { BaseComponent } from '../base.component';
|
||||
|
||||
export class AdfDeleteTrashComponent extends BaseComponent {
|
||||
private static rootElement = 'adf-confirm-dialog';
|
||||
|
||||
constructor(page: Page) {
|
||||
super(page, AdfDeleteTrashComponent.rootElement);
|
||||
}
|
||||
|
||||
dialogTitle = this.getChild('[data-automation-id="adf-confirm-dialog-title"]');
|
||||
dialogDescription = this.getChild('[data-automation-id="adf-confirm-dialog-base-message"]');
|
||||
deleteButton = this.getChild('[id="adf-confirm-accept"]');
|
||||
keepButton = this.getChild('[id="adf-confirm-cancel"]');
|
||||
|
||||
async waitForDialog(): Promise<void> {
|
||||
await this.dialogTitle.waitFor();
|
||||
}
|
||||
|
||||
async isDialogOpen(): Promise<boolean> {
|
||||
return this.dialogTitle.isVisible();
|
||||
}
|
||||
|
||||
async getDialogTitle(): Promise<string> {
|
||||
return this.dialogTitle.textContent();
|
||||
}
|
||||
|
||||
async getDialogDescription(): Promise<string> {
|
||||
return this.dialogDescription.textContent();
|
||||
}
|
||||
|
||||
async isDeleteEnabled(): Promise<boolean> {
|
||||
return this.deleteButton.isEnabled();
|
||||
}
|
||||
|
||||
async isKeepEnabled(): Promise<boolean> {
|
||||
return this.keepButton.isEnabled();
|
||||
}
|
||||
}
|
@@ -33,3 +33,4 @@ export * from './share-dialog.component';
|
||||
export * from './upload-new-version-dialog.component';
|
||||
export * from './manage-versions-dialog.component';
|
||||
export * from './upload-dialog.component';
|
||||
export * from './delete-trash-dialog.component';
|
||||
|
@@ -171,6 +171,10 @@ export class PaginationComponent extends BaseComponent {
|
||||
return this.range.isVisible();
|
||||
}
|
||||
|
||||
async getMaxRange(): Promise<string> {
|
||||
return this.range.textContent();
|
||||
}
|
||||
|
||||
async isMaxItemsPresent(): Promise<boolean> {
|
||||
return this.maxItems.isVisible();
|
||||
}
|
||||
|
@@ -22,7 +22,7 @@
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Page } from '@playwright/test';
|
||||
import { Page, expect } from '@playwright/test';
|
||||
import { BaseComponent } from '../base.component';
|
||||
|
||||
export class SnackBarComponent extends BaseComponent {
|
||||
@@ -30,13 +30,33 @@ export class SnackBarComponent extends BaseComponent {
|
||||
|
||||
public message = this.getChild('[data-automation-id="adf-snackbar-message-content"]').first();
|
||||
|
||||
public actionButton = this.getChild('[data-automation-id="adf-snackbar-message-content-action-button"]')
|
||||
public actionButton = this.getChild('[data-automation-id="adf-snackbar-message-content-action-button"]');
|
||||
|
||||
public closeIcon = this.getChild('.adf-snackbar-message-content-action-icon');
|
||||
public getByMessageLocator = (message: string) => this.getChild(`[data-automation-id='adf-snackbar-message-content']`,
|
||||
{ hasText: message }).first();
|
||||
public getByMessageLocator = (message: string) =>
|
||||
this.getChild(`[data-automation-id='adf-snackbar-message-content']`, { hasText: message }).first();
|
||||
|
||||
constructor(page: Page, rootElement = SnackBarComponent.rootElement) {
|
||||
super(page, rootElement);
|
||||
}
|
||||
|
||||
async getSnackBarMessage(): Promise<string> {
|
||||
return this.message.textContent();
|
||||
}
|
||||
|
||||
async getSnackBarActionText(): Promise<string> {
|
||||
if (await this.actionButton.isVisible()){
|
||||
return this.actionButton.textContent();
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
async verifySnackBarActionText(text: string): Promise<void> {
|
||||
expect(await this.message.textContent()).toContain(text);
|
||||
}
|
||||
|
||||
async clickSnackBarAction(): Promise<void> {
|
||||
await this.actionButton.click();
|
||||
}
|
||||
}
|
||||
|
@@ -43,7 +43,8 @@ import {
|
||||
AdfInfoDrawerComponent,
|
||||
UploadNewVersionDialog,
|
||||
ManageVersionsDialog,
|
||||
UploadDialog
|
||||
UploadDialog,
|
||||
SnackBarComponent
|
||||
} from '../components';
|
||||
|
||||
export class PersonalFilesPage extends BasePage {
|
||||
@@ -72,6 +73,7 @@ export class PersonalFilesPage extends BasePage {
|
||||
public uploadNewVersionDialog = new UploadNewVersionDialog(this.page);
|
||||
public manageVersionsDialog = new ManageVersionsDialog(this.page);
|
||||
public uploadDialog = new UploadDialog(this.page);
|
||||
public snackBar = new SnackBarComponent(this.page);
|
||||
|
||||
async selectCreateFolder(): Promise<void> {
|
||||
await this.acaHeader.createButton.click();
|
||||
|
@@ -26,7 +26,7 @@ import { Page } from '@playwright/test';
|
||||
import { BasePage } from './base.page';
|
||||
import { DataTableComponent, MatMenuComponent, ViewerComponent, SidenavComponent, Breadcrumb, PaginationComponent } from '../components';
|
||||
import { AcaHeader } from '../components/aca-header.component';
|
||||
import { AdfFolderDialogComponent, ViewerOverlayDialogComponent } from '../components/dialogs';
|
||||
import { AdfFolderDialogComponent, ViewerOverlayDialogComponent, AdfDeleteTrashComponent } from '../components/dialogs';
|
||||
|
||||
export class TrashPage extends BasePage {
|
||||
private static pageUrl = 'trashcan';
|
||||
@@ -44,4 +44,5 @@ export class TrashPage extends BasePage {
|
||||
public sidenav = new SidenavComponent(this.page);
|
||||
public breadcrumb = new Breadcrumb(this.page);
|
||||
public pagination = new PaginationComponent(this.page);
|
||||
public deleteDialog = new AdfDeleteTrashComponent(this.page);
|
||||
}
|
||||
|
Reference in New Issue
Block a user