mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACS-6435] playwright e2e for list views personal files (#3551)
* [ACS-6435] playwright e2e for list views personal files * e2e test for trash page * e2e test for trash page * e2e test for file-libraries page * e2e test for file-libraries page fix * e2e test for file-libraries page fix * e2e test shared recent page * e2e test shared recent page fix * e2e test review comment fix * e2e test review fix flaky test fix * e2e test fail test fix * e2e test fail fix * test code fix * protractor list-view test enable
This commit is contained in:
@@ -26,6 +26,7 @@ import { Locator, Page } from '@playwright/test';
|
||||
import { BaseComponent } from '../base.component';
|
||||
import { MatMenuComponent } from './mat-menu.component';
|
||||
import { PaginationActionsType, PaginationComponent } from '../pagination.component';
|
||||
import { timeouts } from '../../../utils';
|
||||
|
||||
export class DataTableComponent extends BaseComponent {
|
||||
private static rootElement = 'adf-datatable';
|
||||
@@ -40,6 +41,9 @@ export class DataTableComponent extends BaseComponent {
|
||||
getEmptyContentTitleLocator = this.getChild('adf-empty-content .adf-empty-content__title');
|
||||
getEmptyContentSubTitleLocator = this.getChild('adf-empty-content .adf-empty-content__subtitle');
|
||||
getSelectedRow = this.getChild('.adf-datatable-row.adf-is-selected');
|
||||
sortedColumnHeader = this.getChild(`.adf-datatable__header--sorted-asc .adf-datatable-cell-header-content .adf-datatable-cell-value,
|
||||
.adf-datatable__header--sorted-desc .adf-datatable-cell-header-content .adf-datatable-cell-value`);
|
||||
columnHeaders = this.getChild('.adf-datatable-row .adf-datatable-cell-header .adf-datatable-cell-value');
|
||||
|
||||
/** Locator for row (or rows) */
|
||||
getRowLocator = this.getChild(`adf-datatable-row`);
|
||||
@@ -188,7 +192,7 @@ export class DataTableComponent extends BaseComponent {
|
||||
|
||||
async goThroughPagesLookingForRowWithName(name: string | number): Promise<void> {
|
||||
await this.spinnerWaitForReload();
|
||||
if (await this.getRowByName(name).isVisible()) {
|
||||
if ((await this.getRowByName(name).isVisible()) || (await this.pagination.totalPageLocator.textContent()) === ' of 1 ') {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -234,4 +238,47 @@ export class DataTableComponent extends BaseComponent {
|
||||
const row = this.getRowByName(itemName);
|
||||
return await row.locator('.adf-datatable-selected').isVisible();
|
||||
}
|
||||
|
||||
async getColumnHeaders(): Promise<Array<string>> {
|
||||
const columnNameLocator = this.columnHeaders;
|
||||
await this.columnHeaders.nth(0).waitFor({ state: 'attached' });
|
||||
return columnNameLocator.allTextContents();
|
||||
}
|
||||
|
||||
async getSortedColumnHeaderText(): Promise<string> {
|
||||
return this.sortedColumnHeader.innerText();
|
||||
}
|
||||
|
||||
private getItemLocationEl(name: string): Locator {
|
||||
return this.getRowByName(name).locator('.aca-location-link');
|
||||
}
|
||||
|
||||
async getItemLocationText(name: string): Promise<string> {
|
||||
await this.getItemLocationEl(name).locator('a').waitFor({ state: 'attached' });
|
||||
return this.getItemLocationEl(name).innerText();
|
||||
}
|
||||
|
||||
async getItemLocationTooltip(name: string): Promise<string> {
|
||||
const location = this.getItemLocationEl(name);
|
||||
await location.hover();
|
||||
return location.locator('a').getAttribute('title', { timeout: timeouts.normal });
|
||||
}
|
||||
|
||||
async clickItemLocation(name: string): Promise<void> {
|
||||
await this.getItemLocationEl(name).click();
|
||||
}
|
||||
|
||||
async getSortingOrder(): Promise<string> {
|
||||
const str = await this.sortedColumnHeader.locator('../..').getAttribute('class');
|
||||
if (str.includes('asc')) {
|
||||
return 'asc';
|
||||
} else if (str.includes('desc')) {
|
||||
return 'desc';
|
||||
}
|
||||
return 'none';
|
||||
}
|
||||
|
||||
async getRowAllInnerTexts(name: string): Promise<string> {
|
||||
return (await this.getRowByName(name).locator('span').allInnerTexts()).toString();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user