mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-08-07 17:48:27 +00:00
[ACS-6510] playwright List View e2e test (#3566)
* [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 * [ACS-6510] listview playwright e2e test * code fix * code fix * code fix * code fix * code fix * code fix * code fix for review * code fix for review
This commit is contained in:
@@ -44,6 +44,11 @@ export class DataTableComponent extends BaseComponent {
|
||||
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');
|
||||
emptyList = this.getChild('div.adf-no-content-container');
|
||||
emptyListTitle = this.getChild('.adf-empty-content__title');
|
||||
emptyListSubtitle = this.getChild('.adf-empty-content__subtitle');
|
||||
emptySearchText = this.getChild('.empty-search__text');
|
||||
emptyListTest = this.getChild('adf-custom-empty-content-template');
|
||||
|
||||
/** Locator for row (or rows) */
|
||||
getRowLocator = this.getChild(`adf-datatable-row`);
|
||||
@@ -123,17 +128,21 @@ export class DataTableComponent extends BaseComponent {
|
||||
|
||||
getSearchResultLinkByName = (name: string): Locator => this.getChild('.aca-search-results-row span[role="link"]', { hasText: name });
|
||||
|
||||
async sortBy(columnTitle: string, order: 'Ascending' | 'Descending'): Promise<void> {
|
||||
const columnHeaderLocator = this.getColumnHeaderByTitleLocator(columnTitle);
|
||||
await this.spinnerWaitForReload();
|
||||
await columnHeaderLocator.click();
|
||||
getColumnValuesByName = (name: string): Locator => this.getChild(`div[title="${name}"] span`);
|
||||
|
||||
const sortAttribute = await columnHeaderLocator.getAttribute('aria-sort');
|
||||
if (sortAttribute !== order) {
|
||||
await columnHeaderLocator.click();
|
||||
getColumnHeaderByName = (headerTitle: string): Locator =>
|
||||
this.getChild('.adf-datatable-row .adf-datatable-cell-header .adf-datatable-cell-value', { hasText: headerTitle });
|
||||
|
||||
async sortBy(label: string, order: 'asc' | 'desc'): Promise<void> {
|
||||
const sortColumn = await this.getSortedColumnHeaderText();
|
||||
let sortOrder = await this.getSortingOrder();
|
||||
if (sortColumn !== label) {
|
||||
await this.getColumnHeaderByName(label).click({ force: true });
|
||||
sortOrder = await this.getSortingOrder();
|
||||
}
|
||||
if (sortOrder !== order) {
|
||||
await this.getChild('span[class*="adf-datatable__header--sorted"]').click();
|
||||
}
|
||||
|
||||
await this.spinnerWaitForReload();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -281,4 +290,29 @@ export class DataTableComponent extends BaseComponent {
|
||||
async getRowAllInnerTexts(name: string): Promise<string> {
|
||||
return (await this.getRowByName(name).locator('span').allInnerTexts()).toString();
|
||||
}
|
||||
|
||||
async getFirstElementDetail(name: string): Promise<string> {
|
||||
const firstNode = this.getColumnValuesByName(name).first();
|
||||
return firstNode.innerText();
|
||||
}
|
||||
|
||||
async isEmpty(): Promise<boolean> {
|
||||
return this.emptyList.isVisible();
|
||||
}
|
||||
|
||||
async getEmptyStateTitle(): Promise<string> {
|
||||
return (await this.isEmpty()) ? this.emptyListTitle.innerText() : '';
|
||||
}
|
||||
|
||||
async getEmptyStateSubtitle(): Promise<string> {
|
||||
return (await this.isEmpty()) ? this.emptyListSubtitle.innerText() : '';
|
||||
}
|
||||
|
||||
async getEmptyListText(): Promise<string> {
|
||||
return (await this.isEmpty()) ? this.emptyListTest.innerText() : '';
|
||||
}
|
||||
|
||||
async getRowsCount(): Promise<number> {
|
||||
return this.getRowLocator.count();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user