[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:
Akash Rathod
2023-08-18 15:09:04 +02:00
committed by GitHub
parent ff8a9844d8
commit 9f1b8a0ac6
16 changed files with 595 additions and 14 deletions

View File

@@ -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();
}
}

View File

@@ -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';

View File

@@ -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<void> {
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<void> {
await this.userProfileButton.click();
await this.userLogOutButton.click();
}
}

View File

@@ -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<void> {
await this.acaHeader.createButton.click();