[ACS-5882] infoDrawer comments tests migrated to Playwright (#3615)

* [ACS-5882] infoDrawer comments tests migrated to Playwright

* [ACS-5882] Update string names

* [ACS-5882] fixed issues from pull request comments

* [ACS-5882] 2nd part of fixed issues from pull request comments

* [ACS-5882] added Promise void functions without return

* [ACS-5882] Small naming fixes

* [ACS-5882] excluding 2 tests - BE issue

* [ACS-5882] Fixed one test
This commit is contained in:
Adam Świderski
2024-02-02 16:43:40 +01:00
committed by GitHub
parent d5f83d921e
commit 489a84735a
15 changed files with 337 additions and 6 deletions

View File

@@ -39,7 +39,8 @@ import {
SharedlinksApi,
FavoritesApi,
TrashcanApi,
PersonEntry
PersonEntry,
CommentsApi
} from '@alfresco/js-api';
import { ActionTypes, Rule } from './rules-api';
import { users } from '../base-config';
@@ -83,6 +84,7 @@ export class ApiClientFactory {
public share: SharedlinksApi;
public favorites: FavoritesApi;
public trashCan: TrashcanApi;
public commentsApi: CommentsApi;
constructor() {
this.alfrescoApi = new AlfrescoApi(config);
@@ -105,6 +107,7 @@ export class ApiClientFactory {
this.share = new SharedlinksApi(this.alfrescoApi);
this.favorites = new FavoritesApi(this.alfrescoApi);
this.trashCan = new TrashcanApi(this.alfrescoApi);
this.commentsApi = new CommentsApi(this.alfrescoApi);
return this;
}

View File

@@ -23,7 +23,7 @@
*/
import { BaseComponent } from './base.component';
import { Page } from '@playwright/test';
import { Page, expect } from '@playwright/test';
export class AdfInfoDrawerComponent extends BaseComponent {
private static rootElement = 'adf-info-drawer';
@@ -36,4 +36,35 @@ export class AdfInfoDrawerComponent extends BaseComponent {
public getIdField = (labelText: string) => this.getChild('[data-automation-id="library-id-properties-wrapper"]', { hasText: labelText });
public getVisibilityField = (labelText: string) => this.getChild('[data-automation-id="library-visibility-properties-wrapper"]', { hasText: labelText });
public getDescriptionField = this.getChild('[data-automation-id="library-description-properties-wrapper"] textarea');
public propertiesTab = this.getChild('.adf-info-drawer-tab').nth(0);
public commentsTab = this.getChild('.adf-info-drawer-tab').nth(1);
public commentInputField = this.getChild('mat-form-field');
public commentsHeader = this.getChild('#comment-header');
public addCommentButton = this.getChild('[data-automation-id="comments-input-add"]');
public commentsList = this.getChild('.adf-comment-list-item');
public commentUsername = this.getChild('.adf-comment-user-name');
public commentTextContent = this.getChild('.adf-comment-message');
public commentTimestamp = this.getChild('.adf-comment-message-time');
async checkCommentsHeaderCount(): Promise<number> {
const commentsCountTextContent = await this.commentsHeader.textContent();
const commentsCountString = commentsCountTextContent.match(/\d+/g)[0];
return parseInt(commentsCountString);
}
async verifyCommentsCountFromList(expectedNumber: number): Promise<void> {
const commentsCountFromList = await this.commentsList.count();
expect(commentsCountFromList).toEqual(expectedNumber);
}
async waitForComments(): Promise<void> {
await this.commentsList.first().waitFor();
}
async addCommentToNode(commentText: string): Promise<void> {
await this.commentInputField.click();
await this.page.keyboard.type(commentText);
await this.addCommentButton.click();
}
}

View File

@@ -49,6 +49,8 @@ export class DataTableComponent extends BaseComponent {
emptyListSubtitle = this.getChild('.adf-empty-content__subtitle');
emptySearchText = this.getChild('.empty-search__text');
emptyListTest = this.getChild('adf-custom-empty-content-template');
paginationButton = this.page.locator('.adf-pagination__block button').nth(0);
paginationOptions = this.page.locator('#cdk-overlay-0 button');
/** Locator for row (or rows) */
getRowLocator = this.getChild(`adf-datatable-row`);
@@ -319,4 +321,9 @@ export class DataTableComponent extends BaseComponent {
async rightClickOnItem(itemName: string): Promise<void> {
await this.getCellByColumnNameAndRowItem(itemName, 'Name').click({ button: 'right' });
}
async setPaginationTo50(): Promise<void> {
await this.paginationButton.click();
await this.paginationOptions.getByText("50").click();
}
}

View File

@@ -24,7 +24,7 @@
import { Page } from '@playwright/test';
import { BasePage } from './base.page';
import { DataTableComponent, MatMenuComponent, ViewerComponent, SidenavComponent, PaginationComponent, Breadcrumb } from '../components';
import { DataTableComponent, MatMenuComponent, ViewerComponent, SidenavComponent, PaginationComponent, Breadcrumb, AdfInfoDrawerComponent } from '../components';
import { AcaHeader } from '../components/aca-header.component';
import { AdfFolderDialogComponent, ViewerOverlayDialogComponent } from '../components/dialogs';
@@ -44,6 +44,7 @@ export class FavoritesPage extends BasePage {
public sidenav = new SidenavComponent(this.page);
public pagination = new PaginationComponent(this.page);
public breadcrumb = new Breadcrumb(this.page);
public infoDrawer = new AdfInfoDrawerComponent(this.page);
async waitForPageLoad() {
await this.page.waitForURL(`**/${FavoritesPage.pageUrl}`);

View File

@@ -39,7 +39,8 @@ import {
PaginationComponent,
ErrorComponent,
ShareDialogComponent,
AdfConfirmDialogComponent
AdfConfirmDialogComponent,
AdfInfoDrawerComponent
} from '../components';
export class PersonalFilesPage extends BasePage {
@@ -64,6 +65,7 @@ export class PersonalFilesPage extends BasePage {
public errorDialog = new ErrorComponent(this.page);
public shareDialog= new ShareDialogComponent(this.page);
public confirmDialog = new AdfConfirmDialogComponent(this.page);
public infoDrawer = new AdfInfoDrawerComponent(this.page);
async selectCreateFolder(): Promise<void> {
await this.acaHeader.createButton.click();

View File

@@ -24,7 +24,7 @@
import { Page } from '@playwright/test';
import { BasePage } from './base.page';
import { DataTableComponent, MatMenuComponent, ViewerComponent, SidenavComponent, Breadcrumb } from '../components';
import { DataTableComponent, MatMenuComponent, ViewerComponent, SidenavComponent, Breadcrumb, AdfInfoDrawerComponent } from '../components';
import { AcaHeader } from '../components/aca-header.component';
import { AdfFolderDialogComponent } from '../components/dialogs';
@@ -42,4 +42,5 @@ export class RecentFilesPage extends BasePage {
public viewer = new ViewerComponent(this.page);
public sidenav = new SidenavComponent(this.page);
public breadcrumb = new Breadcrumb(this.page);
public infoDrawer = new AdfInfoDrawerComponent(this.page);
}

View File

@@ -24,7 +24,7 @@
import { Page } from '@playwright/test';
import { BasePage } from './base.page';
import { DataTableComponent, MatMenuComponent, ViewerComponent, SidenavComponent, Breadcrumb } from '../components';
import { DataTableComponent, MatMenuComponent, ViewerComponent, SidenavComponent, Breadcrumb, AdfInfoDrawerComponent } from '../components';
import { AcaHeader } from '../components/aca-header.component';
import { AdfFolderDialogComponent, ViewerOverlayDialogComponent } from '../components/dialogs';
@@ -43,4 +43,6 @@ export class SharedPage extends BasePage {
public viewerDialog = new ViewerOverlayDialogComponent(this.page);
public sidenav = new SidenavComponent(this.page);
public breadcrumb = new Breadcrumb(this.page);
public infoDrawer = new AdfInfoDrawerComponent(this.page);
}