[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:
Akash Rathod
2023-12-22 09:36:32 +01:00
committed by GitHub
parent 1d0752ce8f
commit 7465bbbf6d
20 changed files with 859 additions and 817 deletions

View File

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

View File

@@ -0,0 +1,36 @@
/*!
* 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
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { Page } from '@playwright/test';
import { BaseComponent } from './base.component';
export class ErrorComponent extends BaseComponent {
private static rootElement = 'aca-page-layout';
genericError = this.getChild('aca-generic-error');
genericErrorTitle = this.getChild('.generic-error__title');
constructor(page: Page) {
super(page, ErrorComponent.rootElement);
}
}

View File

@@ -38,3 +38,4 @@ export * from './search/search-overlay.components';
export * from './breadcrumb/breadcrumb.component';
export * from './sidenav.component';
export * from './aca-header.component';
export * from './error.component';

View File

@@ -105,7 +105,7 @@ export class PaginationComponent extends BaseComponent {
if (await this.isNextEnabled()) {
await this.nextButton.click();
}
} catch(error) {
} catch (error) {
throw new Error(`Failed on previous click: ${error}`);
}
}
@@ -115,7 +115,7 @@ export class PaginationComponent extends BaseComponent {
if (await this.isPreviousEnabled()) {
await this.previousButton.click();
}
} catch(error) {
} catch (error) {
throw new Error(`Failed on previous click: ${error}`);
}
}
@@ -166,4 +166,12 @@ export class PaginationComponent extends BaseComponent {
async closeMenu(): Promise<void> {
await this.page.keyboard.press('Escape');
}
async isRangePresent(): Promise<boolean> {
return this.range.isVisible();
}
async isMaxItemsPresent(): Promise<boolean> {
return this.maxItems.isVisible();
}
}