mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACS-8063] Migrate editActions e2e from Protractor to Playwright (#3900)
* ACS-8063 Migrate editActions * Removed protractor edit folder tests and protractor e2e run from github
This commit is contained in:
@@ -446,4 +446,23 @@ export class NodesApi {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private async getLockType(nodeId: string): Promise<string> {
|
||||
try {
|
||||
const lockType = await this.getNodeProperty(nodeId, 'cm:lockType');
|
||||
return lockType || '';
|
||||
} catch (error) {
|
||||
console.error(`${this.constructor.name} ${this.getLockType.name}`, error);
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
async isFileLockedWrite(nodeId: string): Promise<boolean> {
|
||||
try {
|
||||
return (await this.getLockType(nodeId)) === 'WRITE_LOCK';
|
||||
} catch (error) {
|
||||
console.error(`${this.constructor.name} ${this.isFileLockedWrite.name}`, error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -55,6 +55,7 @@ export class DataTableComponent extends BaseComponent {
|
||||
sitesVisibility = this.page.locator('.adf-datatable-body [data-automation-id*="datatable-row"] [aria-label="Visibility"]');
|
||||
sitesName = this.page.locator('.adf-datatable-body [data-automation-id*="datatable-row"] [aria-label="Name"]');
|
||||
sitesRole = this.page.locator('.adf-datatable-body [data-automation-id*="datatable-row"] [aria-label="My Role"]');
|
||||
lockOwner = this.page.locator('.aca-locked-by--name');
|
||||
|
||||
/** Locator for row (or rows) */
|
||||
getRowLocator = this.page.getByRole('rowgroup').nth(1).locator('adf-datatable-row');
|
||||
@@ -372,4 +373,14 @@ export class DataTableComponent extends BaseComponent {
|
||||
}
|
||||
return sitesInfo;
|
||||
}
|
||||
|
||||
async hasLockIcon(itemName: string): Promise<boolean> {
|
||||
const row = this.getRowByName(itemName);
|
||||
return row.locator('img[src*="lock"]').isVisible();
|
||||
}
|
||||
|
||||
async getLockOwner(itemName: string): Promise<string> {
|
||||
const row = this.getRowByName(itemName);
|
||||
return row.locator(this.lockOwner).innerText();
|
||||
}
|
||||
}
|
||||
|
@@ -39,12 +39,16 @@ 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-mdc-menu-item[title='Cancel Editing']`);
|
||||
public editOfflineAction = this.getChild(`.mat-mdc-menu-item[title='Edit Offline']`);
|
||||
public getMenuItemFromHeaderMenu = (text: string) => this.page.getByRole('menuitem', { name: text, exact: true });
|
||||
|
||||
async clickMenuItem(menuItem: string): Promise<void> {
|
||||
const menuElement = this.getButtonByText(menuItem);
|
||||
await menuElement.waitFor({ state: 'attached' });
|
||||
await menuElement.click();
|
||||
await menuElement.waitFor({ state: 'detached' });
|
||||
}
|
||||
|
||||
async clickMenuItemFromHeaderMenu(menuItem: string): Promise<void> {
|
||||
const menuElement = this.getMenuItemFromHeaderMenu(menuItem);
|
||||
await menuElement.click();
|
||||
await menuElement.waitFor({ state: 'detached' });
|
||||
}
|
||||
|
@@ -0,0 +1,42 @@
|
||||
/*!
|
||||
* 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 EditDialog extends BaseComponent {
|
||||
private static rootElement = 'mat-dialog-container';
|
||||
|
||||
public editDialog = this.getChild('');
|
||||
public titleInput = this.getChild('[data-automation-id="adf-folder-dialog-title"]');
|
||||
public cancelButton = this.getChild('#adf-folder-cancel-button');
|
||||
public updateButton = this.getChild('#adf-folder-create-button');
|
||||
public descriptionInput = this.getChild('#adf-folder-description-input');
|
||||
public nameInput = this.getChild('#adf-folder-name-input');
|
||||
public fieldHint = this.getChild('mat-hint');
|
||||
|
||||
constructor(page: Page) {
|
||||
super(page, EditDialog.rootElement);
|
||||
}
|
||||
}
|
@@ -35,3 +35,4 @@ export * from './manage-versions-dialog.component';
|
||||
export * from './upload-dialog.component';
|
||||
export * from './delete-trash-dialog.component';
|
||||
export * from './link-rules.component';
|
||||
export * from './edit-dialog.component';
|
||||
|
@@ -44,7 +44,8 @@ import {
|
||||
UploadNewVersionDialog,
|
||||
ManageVersionsDialog,
|
||||
UploadDialog,
|
||||
SnackBarComponent
|
||||
SnackBarComponent,
|
||||
EditDialog
|
||||
} from '../components';
|
||||
|
||||
export class PersonalFilesPage extends BasePage {
|
||||
@@ -74,6 +75,7 @@ export class PersonalFilesPage extends BasePage {
|
||||
public manageVersionsDialog = new ManageVersionsDialog(this.page);
|
||||
public uploadDialog = new UploadDialog(this.page);
|
||||
public snackBar = new SnackBarComponent(this.page);
|
||||
public editDialog = new EditDialog(this.page);
|
||||
|
||||
async selectCreateFolder(): Promise<void> {
|
||||
await this.acaHeader.createButton.click();
|
||||
|
Reference in New Issue
Block a user