mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2026-09-09 18:02:54 +00:00
[ACS-11219] removed unused locators and methods from E2E components (#5061)
* [ACS-11219] removed unused locators and methods from E2E components * [ACS-11219] more refactoring * [ACS-11219] deleted spinner from pagination component
This commit is contained in:
@@ -41,7 +41,6 @@ export class AcaHeader extends BaseComponent {
|
||||
public sharedDownloadButton = this.getChild('button[id="app.viewer.shared.download"]');
|
||||
public uploadButton = this.getChild('button[id="app.toolbar.upload"]');
|
||||
public uploadFileButton = this.page.locator('button[id="app.create.uploadFile"]');
|
||||
public uploadInput = this.page.locator('input[id="app-upload-files"]');
|
||||
public uploadNewVersionButton = this.page.locator('#app-upload-file-version');
|
||||
public permanentlyDeleteButton = this.getChild('button[id="app.toolbar.purgeDeletedNodes"]');
|
||||
public restoreButton = this.getChild('button[id="app.toolbar.restoreDeletedNodes"]');
|
||||
|
||||
@@ -28,7 +28,6 @@ import { timeouts } from '../../utils';
|
||||
|
||||
export abstract class BaseComponent extends PlaywrightBase {
|
||||
private readonly rootElement: string;
|
||||
private overlayElement = this.page.locator('.cdk-overlay-backdrop-showing');
|
||||
private progressBar = this.page.locator('[role="progressbar"]');
|
||||
|
||||
protected constructor(page: Page, rootElement: string) {
|
||||
@@ -48,13 +47,6 @@ export abstract class BaseComponent extends PlaywrightBase {
|
||||
return this.page.locator(`${this.rootElement} ${cssLocator}`, options);
|
||||
}
|
||||
|
||||
async closeAdditionalOverlayElementIfVisible(): Promise<void> {
|
||||
if (await this.overlayElement.isVisible()) {
|
||||
await this.page.keyboard.press('Escape');
|
||||
await this.overlayElement.waitFor({ state: 'detached', timeout: timeouts.medium });
|
||||
}
|
||||
}
|
||||
|
||||
async spinnerWaitForReload(): Promise<void> {
|
||||
try {
|
||||
await this.page.locator('[role="progressbar"]').waitFor({ state: 'attached', timeout: timeouts.medium });
|
||||
|
||||
-48
@@ -37,10 +37,7 @@ export class DataTableComponent extends BaseComponent {
|
||||
}
|
||||
|
||||
public pagination = new PaginationComponent(this.page);
|
||||
body = this.getChild('.adf-datatable-body');
|
||||
getEmptyFolderLocator = this.getChild('.adf-empty-folder');
|
||||
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`);
|
||||
@@ -72,15 +69,6 @@ export class DataTableComponent extends BaseComponent {
|
||||
*/
|
||||
getRowByName = (name: string | number): Locator => this.getChild(`adf-datatable-row`, { hasText: name.toString() });
|
||||
|
||||
/**
|
||||
* Method used in cases where we want to check that some record is visible in the datatable.
|
||||
* But we want to check it by column header title and value of this column.
|
||||
*
|
||||
* @returns reference to cell element which contains text.
|
||||
*/
|
||||
getRowByColumnTitleAndItsCellValue = (columnTitle: string, cellValue: string | number): Locator =>
|
||||
this.page.locator(`//div[contains(@title, '${columnTitle}')]//span[contains(text(), '${cellValue}')]/ancestor::adf-datatable-row`);
|
||||
|
||||
/**
|
||||
* Method used in cases where we want to retrieve a row from the datatable based on its numerical order within the array.
|
||||
*
|
||||
@@ -96,28 +84,6 @@ export class DataTableComponent extends BaseComponent {
|
||||
*/
|
||||
getCellLinkByName = (name: string): Locator => this.getChild('.adf-cell-value span[role="link"]', { hasText: name });
|
||||
|
||||
/**
|
||||
* Method used in cases where we want to localize the element by [aria-label]
|
||||
*
|
||||
* @returns reference to cell element.
|
||||
*/
|
||||
getByAriaLabelTitle = (title: string): Locator => this.getChild(`[aria-label="${title}"]`);
|
||||
|
||||
/**
|
||||
* Method used in cases where we want to get the edit button and there is no hamburger menu
|
||||
*
|
||||
* @returns reference to edit button placed in row localized by the name
|
||||
*/
|
||||
getEditButtonByName = (name: string): Locator => this.getRowByName(name).locator('button#editButton');
|
||||
|
||||
/**
|
||||
* Method used in cases where we want to get the button and there is no hamburger menu
|
||||
*
|
||||
* @returns reference to button placed in row localized by the name
|
||||
*/
|
||||
getButtonByNameForSpecificRow = (elementTitleInRow: string, buttonTitle: string): Locator =>
|
||||
this.getRowByName(elementTitleInRow).locator('button', { hasText: buttonTitle });
|
||||
|
||||
/**
|
||||
* Method used in cases where you want to get some specific cell (by column name) for row which contains some name/title/etc.
|
||||
*
|
||||
@@ -132,10 +98,6 @@ export class DataTableComponent extends BaseComponent {
|
||||
*/
|
||||
getCheckboxForElement = (item: string): Locator => this.getRowByName(item).locator('[type="checkbox"]');
|
||||
|
||||
getColumnHeaderByTitleLocator = (headerTitle: string): Locator => this.getChild('[role="columnheader"]', { hasText: headerTitle });
|
||||
|
||||
getSearchResultLinkByName = (name: string): Locator => this.getChild('.aca-search-results-row span[role="link"]', { hasText: name });
|
||||
|
||||
getColumnValuesByName = (name: string): Locator => this.getChild(`div[title="${name}"] span`);
|
||||
|
||||
getColumnHeaderByName = (headerTitle: string): Locator =>
|
||||
@@ -187,11 +149,6 @@ export class DataTableComponent extends BaseComponent {
|
||||
return this.contextMenuActions.getButtonByText(action);
|
||||
}
|
||||
|
||||
async performActionInExpandableMenu(name: string | number, action: string): Promise<void> {
|
||||
await this.getRowByName(name).click({ button: 'right' });
|
||||
await this.contextMenuActions.getButtonByText(action).click();
|
||||
}
|
||||
|
||||
async goThroughPagesLookingForRowWithName(name: string | number): Promise<void> {
|
||||
await this.spinnerWaitForReload();
|
||||
if (await this.getRowByName(name).isVisible()) {
|
||||
@@ -344,11 +301,6 @@ export class DataTableComponent extends BaseComponent {
|
||||
return sitesInfo;
|
||||
}
|
||||
|
||||
async hasLockIcon(itemName: string): Promise<boolean> {
|
||||
const row = this.getRowByName(itemName);
|
||||
return row.locator('img[src*="lock"]').isVisible();
|
||||
}
|
||||
|
||||
async getLockOwner(itemName: string): Promise<string> {
|
||||
const row = this.getRowByName(itemName);
|
||||
return row.locator(this.lockOwner).innerText();
|
||||
|
||||
-2
@@ -32,8 +32,6 @@ export class MatMenuComponent extends BaseComponent {
|
||||
super(page, MatMenuComponent.rootElement);
|
||||
}
|
||||
|
||||
public getMenuItemsLocator = this.getChild('button');
|
||||
public getMenuItemTextLocator = this.getChild('[data-automation-id="menu-item-title"]');
|
||||
public createFolder = this.getChild('[id="app.create.folder"]');
|
||||
public createFolderFromTemplate = this.getChild('[id="app.create.folderFromTemplate"]');
|
||||
public createFileFromTemplate = this.getChild('[id="app.create.fileFromTemplate"]');
|
||||
|
||||
-4
@@ -29,12 +29,8 @@ export class LinkRulesDialog extends BaseComponent {
|
||||
private static rootElement = 'aca-rule-set-picker';
|
||||
private getRowByName = (name: string | number): Locator => this.getChild(`adf-datatable-row`, { hasText: name.toString() });
|
||||
|
||||
cancelButton = this.getChild('[data-automation-id="content-node-selector-actions-cancel"]');
|
||||
selectFolderButton = this.getChild('button', { hasText: ' Select folder ' });
|
||||
emptyLinkRules = this.getChild('.adf-empty-content__title');
|
||||
getOptionLocator = (optionName: string): Locator => this.page.locator('[role=listbox] [role=option]', { hasText: optionName }).first();
|
||||
getDialogTitle = (text: string) => this.getChild('[data-automation-id="content-node-selector-title"]', { hasText: text });
|
||||
getBreadcrumb = (text: string) => this.getChild('[data-automation-id="current-folder"]', { hasText: text });
|
||||
getFolderIcon = this.getChild('.adf-dropdown-breadcrumb-icon', { hasText: 'folder' });
|
||||
getLibraryIcon = this.getChild('.adf-empty-content__icon', { hasText: 'library_books' });
|
||||
|
||||
|
||||
-4
@@ -57,10 +57,6 @@ export class PasswordOverlayDialogComponent extends BaseComponent {
|
||||
return this.closeButton.isVisible();
|
||||
}
|
||||
|
||||
async isSubmitHidden(): Promise<boolean> {
|
||||
return this.submitButton.isHidden();
|
||||
}
|
||||
|
||||
async isPasswordInputDisplayed(): Promise<boolean> {
|
||||
return this.passwordInput.isVisible();
|
||||
}
|
||||
|
||||
-3
@@ -37,7 +37,6 @@ export class ShareDialogComponent extends BaseComponent {
|
||||
closeButton = this.getChild('[data-automation-id="adf-share-dialog-close"]');
|
||||
dialogTitle = this.getChild('[data-automation-id="adf-share-dialog-title"]');
|
||||
infoText = this.getChild('.adf-share-link__info').first();
|
||||
labels = '.adf-share-link__label';
|
||||
shareToggle = this.getChild(`[data-automation-id='adf-share-toggle']`);
|
||||
url = this.getChild(`[data-automation-id='adf-share-link']`);
|
||||
urlAction = this.getChild('.adf-input-action');
|
||||
@@ -49,8 +48,6 @@ export class ShareDialogComponent extends BaseComponent {
|
||||
|
||||
dateTimePicker = new DateTimePicker(this.page);
|
||||
|
||||
getDialogLabel = () => this.getChild('label').innerText();
|
||||
|
||||
async getLabels(): Promise<Array<string>> {
|
||||
return this.page.$$eval('.adf-share-link__label', (elements) => elements.map((element) => element.textContent));
|
||||
}
|
||||
|
||||
-1
@@ -31,7 +31,6 @@ export class UploadNewVersionDialog extends BaseComponent {
|
||||
public cancelButton = this.getChild('#adf-new-version-cancel');
|
||||
public uploadButton = this.getChild('[data-automation-id="adf-new-version-file-upload"]');
|
||||
public majorOption = this.getChild('#adf-new-version-major');
|
||||
public minorOption = this.getChild('#adf-new-version-minor');
|
||||
public description = this.getChild('#adf-new-version-text-area');
|
||||
public title = this.getChild(' [data-automation-id="new-version-uploader-dialog-title"]');
|
||||
|
||||
|
||||
-4
@@ -29,10 +29,6 @@ import { timeouts } from '../../../utils';
|
||||
export class ViewerOverlayDialogComponent extends BaseComponent {
|
||||
private static rootElement = '.cdk-overlay-pane';
|
||||
|
||||
public closeButton = this.getChild('[data-automation-id="adf-password-dialog-close"]');
|
||||
public submitButton = this.getChild('[data-automation-id="adf-password-dialog-submit"]');
|
||||
public passwordInput = this.getChild('[data-automation-id="adf-password-dialog-input"]');
|
||||
public errorMessage = this.getChild('[data-automation-id="adf-password-dialog-error"]');
|
||||
public copyDialog = this.getChild('[data-automation-id="content-node-selector-title"]');
|
||||
public copyMenuButton = this.getChild('[id="app.viewer.copy"]');
|
||||
public deleteMenuButton = this.getChild('[id="app.viewer.delete"]');
|
||||
|
||||
-2
@@ -38,10 +38,8 @@ export class ManageRulesDialogComponent extends BaseComponent {
|
||||
public comparatorDropDown = this.getChild('[data-automation-id="comparator-select"]');
|
||||
public valueField = this.getChild('[data-automation-id="value-input"]');
|
||||
public whenCreatedCheckbox = this.getChild('[data-automation-id="rule-trigger-checkbox-inbound"]');
|
||||
public whenUpdatedCheckbox = this.getChild('[data-automation-id="rule-trigger-checkbox-update"]');
|
||||
public whenDeletedCheckbox = this.getChild('[data-automation-id="rule-trigger-checkbox-outbound"]');
|
||||
public destinationFolderButton = this.getChild('[data-automation-id="card-textitem-clickable-icon-destination-folder"]');
|
||||
public ruleInBackgroundCheckbox = this.getChild('[data-automation-id="rule-option-checkbox-asynchronous"]');
|
||||
public ruleSubfoldersCheckbox = this.getChild('[data-automation-id="rule-option-checkbox-inheritable"]');
|
||||
public ruleDisableCheckbox = this.getChild('[data-automation-id="rule-option-checkbox-disabled"] input');
|
||||
public actionsEllipsisButtons = this.getChild('[data-automation-id="rule-action-list-action-menu"]');
|
||||
|
||||
-2
@@ -31,10 +31,8 @@ export class ManageRules extends BaseComponent {
|
||||
public getGroupsList = (optionName: string): Locator => this.getChild('.aca-rule-list-item__header', { hasText: optionName });
|
||||
public ruleToggle = this.getChild('.aca-manage-rules__container [role="switch"]').first();
|
||||
public ruleToggleFalse = this.getChild('aca-rule-list-grouping aca-rule-list-item [role="switch"][aria-checked="false"]').first();
|
||||
public ruleDetailsTitle = this.getChild('.aca-manage-rules__container__rule-details__header__title__name');
|
||||
public ruleDetailsDeleteButton = this.getChild('#delete-rule-btn');
|
||||
public ruleDetailsEditButton = this.getChild('#edit-rule-btn');
|
||||
public ruleDetailsWhenText = this.getChild('[data-automation-id="rule-details-triggers-component"]');
|
||||
public ruleDetailsPerformActionsDiv = this.getChild('adf-card-view-selectitem [data-automation-id="select-box"]');
|
||||
public rulesEmptyListTitle = this.getChild('.adf-empty-content__title');
|
||||
public ruleActions = this.getChild('aca-rule-action');
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
import { BaseComponent } from './base.component';
|
||||
import { Locator, Page } from '@playwright/test';
|
||||
import { MatMenuComponent } from './dataTable/mat-menu.component';
|
||||
import { timeouts } from '../../utils';
|
||||
|
||||
export enum PaginationActionsType {
|
||||
@@ -48,33 +47,10 @@ export class PaginationComponent extends BaseComponent {
|
||||
private nextButton = this.getChild('.adf-pagination__next-button');
|
||||
private maxItemsButton = this.getChild('.adf-pagination__max-items + button[mat-icon-button]');
|
||||
|
||||
private itemsPerPageMenu = new MatMenuComponent(this.page);
|
||||
|
||||
public currentPageLocator = this.getChild('.adf-pagination__current-page');
|
||||
public totalPageLocator = this.getChild('.adf-pagination__total-pages');
|
||||
public getArrowLocatorFor = (action: PaginationActionsType) => this.getChild(`[aria-label="${action}"]`);
|
||||
|
||||
async setItemsPerPage(amount: number): Promise<void> {
|
||||
await this.getArrowLocatorFor(PaginationActionsType.PageSizeSelector).click();
|
||||
await this.itemsPerPageMenu.getButtonByText(amount.toString()).click();
|
||||
await this.spinnerWaitForReload();
|
||||
}
|
||||
|
||||
async navigateToPage(pageNumber: number): Promise<void> {
|
||||
await this.getArrowLocatorFor(PaginationActionsType.CurrentPageSelector).click();
|
||||
await this.itemsPerPageMenu.getButtonByText(pageNumber.toString()).click();
|
||||
await this.spinnerWaitForReload();
|
||||
}
|
||||
|
||||
async spinnerWaitForReload(): Promise<void> {
|
||||
try {
|
||||
await this.page.locator('[role="progressbar"]').waitFor({ state: 'attached', timeout: 2000 });
|
||||
await this.page.locator('[role="progressbar"]').waitFor({ state: 'detached', timeout: 2000 });
|
||||
} catch (e) {
|
||||
this.logger.info('Spinner was not present');
|
||||
}
|
||||
}
|
||||
|
||||
async getRange(): Promise<string> {
|
||||
return this.range.innerText();
|
||||
}
|
||||
|
||||
-5
@@ -32,7 +32,6 @@ export class SearchFilters extends BaseComponent {
|
||||
super(page, SearchFilters.rootElement);
|
||||
}
|
||||
|
||||
public filtersButtons = this.getChild('adf-search-widget-chip');
|
||||
public logicFilter = this.getChild('adf-search-widget-chip', { hasText: 'Logic' });
|
||||
public propertiesFilter = this.getChild('adf-search-widget-chip', { hasText: 'Properties' });
|
||||
public dateFilter = this.getChild('adf-search-widget-chip', { hasText: 'Date' });
|
||||
@@ -40,9 +39,5 @@ export class SearchFilters extends BaseComponent {
|
||||
public tagsFilter = this.getChild('adf-search-widget-chip', { hasText: 'Tags' });
|
||||
public categoriesFilter = this.getChild('adf-search-widget-chip', { hasText: 'Categories' });
|
||||
public resetButton = this.getChild('button', { hasText: 'Reset' });
|
||||
public menuCardTitle = this.getChild('.adf-search-filter-title');
|
||||
public menuCardClose = this.getChild('.adf-search-filter-title-action');
|
||||
public menuCardClear = this.getChild('#cancel-filter-button');
|
||||
public menuCardApply = this.getChild('#apply-filter-button');
|
||||
public dropdownOptions = this.page.locator(`[role="option"]`);
|
||||
}
|
||||
|
||||
-7
@@ -37,17 +37,10 @@ export class SearchFiltersDate extends BaseComponent {
|
||||
|
||||
public createdTab = this.getChild(`[role='tab']`, { hasText: 'Created' });
|
||||
public modifiedTab = this.getChild(`[role='tab']`, { hasText: 'Modified' });
|
||||
public createdTabTitle = this.createdTab.locator(`div`);
|
||||
public modifiedTabTitle = this.modifiedTab.locator(`div`);
|
||||
public anytimeButton = this.getChild(`[data-automation-id$='date-range-anytime']`);
|
||||
public anytimeRadioButton = this.anytimeButton.locator(`input`);
|
||||
public inTheLastButton = this.getChild(`[data-automation-id$='date-range-in-last']`);
|
||||
public inTheLastInput = this.getChild(`[data-automation-id$='date-range-in-last-input']`);
|
||||
public inTheLastDropdown = this.getChild(`[data-automation-id$='date-range-in-last-dropdown']`);
|
||||
public betweenButton = this.getChild(`[data-automation-id$='date-range-between']`);
|
||||
public betweenRadioButton = this.betweenButton.locator(`input`);
|
||||
public betweenStartDate = this.getChild(`[data-automation-id$='date-range-between-start-input']`);
|
||||
public betweenEndDate = this.getChild(`[data-automation-id$='date-range-between-end-input']`);
|
||||
|
||||
async openCreatedModifiedTab(page: SearchPage, tab: FilterTab): Promise<void> {
|
||||
switch (tab) {
|
||||
|
||||
-1
@@ -28,7 +28,6 @@ import { timeouts } from '../../../utils';
|
||||
|
||||
export class SearchInputComponent extends BaseComponent {
|
||||
private static rootElement = 'aca-page-layout';
|
||||
public searchInput = this.page.locator('#app-control-input');
|
||||
public searchButton = this.page.locator('.aca-search-input--search-button');
|
||||
public searchCloseButton = this.page.locator('.aca-search-input--close-button');
|
||||
|
||||
|
||||
-2
@@ -28,12 +28,10 @@ import { Page } from '@playwright/test';
|
||||
export class SearchMenuCard extends BaseComponent {
|
||||
private static readonly rootElement = '.adf-search-filter-menu-card';
|
||||
|
||||
public resetButton = this.getChild('button', { hasText: 'Reset' });
|
||||
public menuCardTitle = this.getChild('.adf-search-filter-title');
|
||||
public menuCardClose = this.getChild('.adf-search-filter-title-action');
|
||||
public menuCardClear = this.getChild('#cancel-filter-button');
|
||||
public menuCardApply = this.getChild('#apply-filter-button');
|
||||
public dropdownOptions = this.page.locator(`[role="option"]`);
|
||||
|
||||
constructor(page: Page) {
|
||||
super(page, SearchMenuCard.rootElement);
|
||||
|
||||
@@ -36,7 +36,6 @@ export class ViewerComponent extends BaseComponent {
|
||||
public pdfViewerContentPages = this.getChild('.adf-pdf-viewer__content .page');
|
||||
public shareButton = this.getChild('button[id="share-action-button"]');
|
||||
public downloadButton = this.getChild('button[id="app.viewer.download"]');
|
||||
public allButtons = this.getChild('button');
|
||||
public unknownFormat = this.getChild(`adf-viewer-unknown-format .adf-viewer__unknown-format-view`);
|
||||
public viewerImage = this.viewerLocator.locator('.cropper-canvas img');
|
||||
public viewerDocument = this.viewerLocator.locator('.adf-pdf-viewer__content [role="document"]');
|
||||
|
||||
Reference in New Issue
Block a user