[ACS-5343] refactor Playwright framework in ACA (#3261)

* [ACS-5343] refactor Playwright framework in ACA

* Add the tests for Actions, from the Adam PR [ACS-5328]

* Small fixes

* Improve logs

* [ACS-5343] adding-goThroughPages-and-delete

* [ACS-5343] added git changes

* [ACS-5343] added git changes for playwright

* [ACS-5343] fix for e2e

* [ACS-5343] e2e protractor path fix

* remove import

* [ACS-5343] e2e playwright user fix

* [ACS-5343] e2e playwright user ids fix

* [ACS-5343] e2e playwright users ids fix

* changes for git

* fix playwright test run

* tsconfig path fix

* playwright action yml added

* retrigger checks

* add test id from testrail

* merge conflits

* fix gha

* fix credentials

---------

Co-authored-by: adam.zakrzewski <adam.zakrzewski@hyland.com>
Co-authored-by: akash.rathod@hyland.com <akash.rathod@hyland.com>
Co-authored-by: Denys Vuika <denys.vuika@gmail.com>
This commit is contained in:
Michał Fidor
2023-06-16 19:07:09 +02:00
committed by GitHub
parent e0a74d7fb9
commit c843a8dbaa
180 changed files with 897 additions and 235 deletions

View File

@@ -0,0 +1,35 @@
/*!
* 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 { BaseComponent } from './base.component';
import { Page } from '@playwright/test';
export class AcaHeader extends BaseComponent {
private static rootElement = 'adf-toolbar';
public createButton = this.getChild('[id="app.toolbar.create"]');
constructor(page: Page) {
super(page, AcaHeader.rootElement);
}
}

View File

@@ -0,0 +1,108 @@
/*!
* 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 { Locator, Page } from '@playwright/test';
import { BaseComponent } from './base.component';
export enum ActionType {
AddAspect = 'Add aspect',
SimpleWorkflow = 'Add simple workflow',
IncrementCounter = 'Increment Counter',
CheckIn = 'Check in',
AutoDeclareOptions = 'Auto-Declare Options',
CheckOut = 'Check out',
Copy = 'Copy',
ExecuteScript = 'Execute script',
ExtractCommonMetadataFields = 'Extract common metadata fields',
FileAsRecord = 'File as Record',
FileVersionAsRecord = 'File Version as Record',
HideRecord = 'Hide Record',
Import = 'Import',
Move = 'Move',
RemoveAspect = 'Remove aspect',
RequestAIRenditions = 'Request AI renditions',
SendEmail = 'Send email',
SetPropertyValue = 'Set property value',
SpecialiseType = 'Specialise type',
TransformAndCopyContent = 'Transform and copy content',
TransformAndCopyImage = 'Transform and copy image'
}
export class ActionsDropdownComponent extends BaseComponent {
private static rootElement = 'aca-rule-action-list';
private getOptionLocator = (optionName: string): Locator => this.page.locator('.mat-select-panel .mat-option-text', { hasText: optionName });
private ruleActionLocator = this.getChild('aca-rule-action [data-automation-id="rule-action-card-view"]');
private addActionButtonLocator = this.getChild('[data-automation-id="rule-action-list-add-action-button"]');
private actionDropdownLocator = this.getChild('[data-automation-id="rule-action-select"]');
private actionAspectNameLocator = '[data-automation-id="header-aspect-name"] mat-select';
private actionCheckInInputLocator = '[data-automation-id="header-description"] input';
private actionAutoDeclareLocator = '[data-automation-id="header-version"] mat-select';
private actionSimpleWorkflowStepInputLocator = '[data-automation-id="header-approve-step"] input';
private actionSimpleWorkflowApproveFolderLocator = `[data-automation-id="header-approve-folder"] input`;
private actionSimpleWorkflowActionChoiceLocator = '[data-automation-id="content-node-selector-actions-choose"]';
private actionSimpleWorkflowLabelApproveLocator = `[data-automation-id="card-boolean-label-approve-move"]`;
private actionSimpleWorkflowSRejectStepLocator = '[data-automation-id="header-reject-step"] input';
private actionSimpleWorkflowRejectFolderLocator = `[data-automation-id="header-reject-folder"] input`;
constructor(page: Page) {
super(page, ActionsDropdownComponent.rootElement);
}
async selectAction(action: Partial<ActionType>, index: number): Promise<void> {
if (index > 0) {
await this.addActionButtonLocator.click();
}
await this.actionDropdownLocator.nth(index).click();
const option = this.getOptionLocator(action);
await option.click();
}
async dropdownSelection(selectValue: string, locator: string, index: number): Promise<void> {
await this.ruleActionLocator.nth(index).locator(locator).click();
await this.getOptionLocator(selectValue).nth(0).click();
}
async insertCheckInActionValues(checkInValue: string, index: number): Promise<void> {
await this.ruleActionLocator.nth(index).locator(this.actionCheckInInputLocator).type(checkInValue, { delay: 50 });
}
async insertAddAspectActionValues(AspectValue: string, index: number): Promise<void> {
await this.dropdownSelection(AspectValue, this.actionAspectNameLocator, index);
}
async insertAutoDeclareOptionsActionValues(autoDeclareOptionsValue: string, index: number): Promise<void> {
await this.dropdownSelection(autoDeclareOptionsValue, this.actionAutoDeclareLocator, index);
}
async insertSimpleWorkflowActionValues(stepValue: string, index: number): Promise<void> {
await this.ruleActionLocator.nth(index).locator(this.actionSimpleWorkflowStepInputLocator).type(stepValue, { delay: 50 });
await this.ruleActionLocator.nth(index).locator(this.actionSimpleWorkflowApproveFolderLocator).click();
await this.page.locator(this.actionSimpleWorkflowActionChoiceLocator).click();
await this.ruleActionLocator.nth(index).locator(this.actionSimpleWorkflowLabelApproveLocator).click();
await this.ruleActionLocator.nth(index).locator(this.actionSimpleWorkflowSRejectStepLocator).type(stepValue, { delay: 50 });
await this.ruleActionLocator.nth(index).locator(this.actionSimpleWorkflowRejectFolderLocator).click();
await this.page.locator(this.actionSimpleWorkflowActionChoiceLocator).click();
}
}

View File

@@ -0,0 +1,64 @@
/*!
* 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 { Locator, Page } from '@playwright/test';
import { PlaywrightBase } from '../playwright-base';
export abstract class BaseComponent extends PlaywrightBase {
private readonly rootElement: string;
private overlayElement = this.page.locator('.cdk-overlay-backdrop-showing');
protected constructor(page: Page, rootElement: string) {
super(page);
this.rootElement = rootElement;
}
/**
* Method which should be used across the repository, while creating
* reference to elements, which are in root element of component.
*
* @param cssLocator css selector as String. Need to be in the tree under the root element
* @param options if you want to localize it by text, then provide an optional hasText
* @returns Locator object
*/
getChild(cssLocator: string, options?: { hasText?: string | RegExp; has?: Locator }): Locator {
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: 5000 });
}
}
async spinnerWaitForReload(): Promise<void> {
try {
await this.page.locator('mat-progress-spinner').waitFor({ state: 'attached', timeout: 2000 });
await this.page.locator('mat-progress-spinner').waitFor({ state: 'detached', timeout: 2000 });
} catch (e) {
this.logger.info('Spinner was not present');
}
}
}

View File

@@ -0,0 +1,73 @@
/*!
* 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 { Locator, Page } from '@playwright/test';
import { ManageRulesDialogComponent } from './manageRules/manage-rules-dialog.component';
export enum Field {
Name = 'Name',
Size = 'Size',
Mimetype = 'Mimetype'
}
export enum Comparator {
Equals = '(=) Equals',
Contains = 'Contains',
StartsWith = 'Starts with',
EndsWith = 'Ends with'
}
export class ConditionComponent extends ManageRulesDialogComponent {
private getOptionLocator = (optionName: string): Locator => this.page.locator(`.cdk-overlay-pane .mat-option span`, { hasText: optionName });
constructor(page: Page) {
super(page);
}
private async selectField(fields: Partial<Field>, index: number): Promise<void> {
await this.fieldDropDown.nth(index).click();
const option = this.getOptionLocator(fields);
await option.click();
}
private async selectComparator(comparators: Partial<Comparator>, index: number): Promise<void> {
await this.comparatorDropDown.nth(index).click();
const option = this.getOptionLocator(comparators);
await option.click();
}
async addCondition(fields: Partial<Field>, comparators: Partial<Comparator>, value: string, index: number): Promise<void> {
await this.addConditionButton.click();
await this.selectField(fields, index);
await this.selectComparator(comparators, index);
await this.valueField.nth(index).type(value);
}
async addConditionGroup(fields: Partial<Field>, comparators: Partial<Comparator>, value: string, index: number): Promise<void> {
await this.addConditionButton.nth(0).click();
await this.selectField(fields, index);
await this.selectComparator(comparators, index);
await this.valueField.nth(index).type(value);
}
}

View File

@@ -0,0 +1,183 @@
/*!
* 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 { Locator, Page } from '@playwright/test';
import { BaseComponent } from '../base.component';
import { MatMenuComponent } from './mat-menu.component';
import { PaginationActionsType, PaginationComponent } from '../pagination.component';
export class DataTableComponent extends BaseComponent {
private static rootElement = 'adf-datatable';
contextMenuActions = new MatMenuComponent(this.page);
constructor(page: Page, rootElement = DataTableComponent.rootElement) {
super(page, rootElement);
}
public pagination = new PaginationComponent(this.page);
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');
/** Locator for row (or rows) */
getRowLocator = this.getChild(`adf-datatable-row`);
/**
* Method used in cases where we want to check that some record is visible in the datatable. It will consider whole row
*
* @returns reference to cell element which contains text.
*/
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 user have possibility to navigate "inside" the element (it's clickable and has link attribute).
* Perform action .click() to navigate inside it
*
* @returns reference to cell element which contains link.
*/
getCellLinkByName = (name: string): Locator => this.getChild('.adf-datatable-cell-value[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 button (hamburger menu) for row element
*
* @returns reference to menu placed in row localized by the name
*/
getActionsButtonByName = (name: string): Locator =>
this.getRowByName(name).locator('mat-icon', { hasText: new RegExp(`^\\s*more_vert\\s*$`, 'g') });
/**
* 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.
*
* @returns reference to cell element
*/
getCellByColumnNameAndRowItem = (item: string | number, columnName: string): Locator => this.getRowByName(item).locator(`[title="${columnName}"]`);
/**
* Method used in cases where we want to get the checkbox for row element
*
* @returns reference to checkbox placed in row localized by the name
*/
getCheckboxForElement = (item: string): Locator => this.getRowByName(item).locator('mat-checkbox');
getColumnHeaderByTitleLocator = (headerTitle: string): Locator => this.getChild('[role="columnheader"]', { hasText: headerTitle });
async sortBy(columnTitle: string, order: 'Ascending' | 'Descending'): Promise<void> {
const columnHeaderLocator = this.getColumnHeaderByTitleLocator(columnTitle);
await this.spinnerWaitForReload();
await columnHeaderLocator.click();
const sortAttribute = await columnHeaderLocator.getAttribute('aria-sort');
if (sortAttribute !== order) {
await columnHeaderLocator.click();
}
await this.spinnerWaitForReload();
}
/**
* This method is used when we want to perform right mouse click on the dataTable row and perform some action
*
* @param name of the data table element with which we want to click
* @param action provide which action you want to perform
*/
async performActionFromExpandableMenu(name: string | number, action: string): Promise<void> {
await this.goThroughPagesLookingForRowWithName(name);
const actionButtonLocator = await this.getActionLocatorFromExpandableMenu(name, action);
await actionButtonLocator.click();
await this.spinnerWaitForReload();
}
/**
* Click action from the expandable kebab menu for the element in datatable
*
* @param name title of the record you would like to proceed
* @param action provide button title for the action
* @param subAction if the action is in sub menu, then provide it here
*/
async performActionForElement(name: string, action: string, subAction?: string): Promise<void> {
await this.getActionsButtonByName(name).click();
await this.contextMenuActions.getButtonByText(action).click();
if (subAction) {
await this.contextMenuActions.getButtonByText(subAction).click();
}
}
async getActionLocatorFromExpandableMenu(name: string | number, action: string): Promise<Locator> {
await this.getRowByName(name).click({ button: 'right' });
return this.contextMenuActions.getButtonByText(action);
}
async goThroughPagesLookingForRowWithName(name: string | number): Promise<void> {
await this.spinnerWaitForReload();
if (await this.getRowByName(name).isVisible()) {
return null;
}
if ((await this.pagination.currentPageLocator.textContent()) !== ' Page 1 ') {
await this.pagination.navigateToPage(1);
}
const maxPages = (await this.pagination.totalPageLocator.textContent()).match(/\d/)[0];
for (let page = 1; page <= Number(maxPages); page++) {
if (await this.getRowByName(name).isVisible()) {
break;
}
await this.pagination.getArrowLocatorFor(PaginationActionsType.NextPageSelector).isEnabled();
await this.pagination.getArrowLocatorFor(PaginationActionsType.NextPageSelector).click();
await this.spinnerWaitForReload();
}
}
}

View File

@@ -0,0 +1,27 @@
/*!
* 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/>.
*/
export * from './data-table.component';
export * from './mat-menu.component';
export * from './toolbar.component';

View File

@@ -0,0 +1,39 @@
/*!
* 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 MatMenuComponent extends BaseComponent {
private static rootElement = '.mat-menu-content';
constructor(page: Page) {
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 getButtonByText = (text: string) => this.getChild('button', { hasText: text });
}

View File

@@ -0,0 +1,39 @@
/*!
* 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 { BaseComponent } from '../base.component';
import { Page } from '@playwright/test';
export class ToolbarComponent extends BaseComponent {
private static rootElement = 'adf-toolbar';
private createRuleButton = this.getChild('[data-automation-id="manage-rules-create-button"]');
constructor(page: Page) {
super(page, ToolbarComponent.rootElement);
}
async clickCreateRuleButton(): Promise<void> {
await this.createRuleButton.click();
}
}

View File

@@ -0,0 +1,37 @@
/*!
* 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 { BaseComponent } from '../base.component';
import { Page } from '@playwright/test';
export class AdfFolderDialogComponent extends BaseComponent {
private static rootElement = 'adf-folder-dialog';
public folderNameInputLocator = this.getChild('[id="adf-folder-name-input"]');
public createButton = this.getChild('[id="adf-folder-create-button"]');
constructor(page: Page) {
super(page, AdfFolderDialogComponent.rootElement);
}
}

View File

@@ -0,0 +1,25 @@
/*!
* 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/>.
*/
export * from './adf-folder-dialog.component';

View File

@@ -0,0 +1,34 @@
/*!
* 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/>.
*/
export * from './snackBar/snack-bar.component';
export * from './dataTable';
export * from './dialogs';
export * from './manageRules';
export * from './base.component';
export * from './spinner.component';
export * from './actions-dropdown.component';
export * from './conditions.component';
export * from './pagination.component';

View File

@@ -0,0 +1,26 @@
/*!
* 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/>.
*/
export * from './manage-rules-dialog.component';
export * from './manage-rules.component';

View File

@@ -0,0 +1,43 @@
/*!
* 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 { BaseComponent } from '../base.component';
import { Page } from '@playwright/test';
export class ManageRulesDialogComponent extends BaseComponent {
private static rootElement = 'aca-edit-rule-dialog';
public createRuleButton = this.getChild('[data-automation-id="edit-rule-dialog-submit"]');
public ruleNameInputLocator = this.getChild('[id="rule-details-name-input"]');
public addConditionButton = this.getChild('[data-automation-id="add-condition-button"]');
public addConditionGroupButton = this.getChild('[data-automation-id="add-group-button"]');
public fieldDropDown = this.getChild('[data-automation-id="field-select"]');
public comparatorDropDown = this.getChild('[data-automation-id="comparator-select"]');
public valueField = this.getChild('[data-automation-id="value-input"]');
constructor(page: Page) {
super(page, ManageRulesDialogComponent.rootElement);
}
}

View File

@@ -0,0 +1,37 @@
/*!
* 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 { Locator, Page } from '@playwright/test';
import { BaseComponent } from '../base.component';
export class ManageRules extends BaseComponent {
private static rootElement = '.aca-manage-rules';
public getGroupsList = (optionName: string): Locator => this.getChild('.aca-rule-list-item__header', { hasText: optionName });
public disableRuleToggle = this.getChild('.aca-manage-rules__container .mat-slide-toggle-bar').first();
constructor(page: Page) {
super(page, ManageRules.rootElement);
}
}

View File

@@ -0,0 +1,68 @@
/*!
* 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 { BaseComponent } from './base.component';
import { Page } from '@playwright/test';
import { MatMenuComponent } from './dataTable/mat-menu.component';
export enum PaginationActionsType {
PageSizeSelector = 'Page size selector',
CurrentPageSelector = 'Current page selector',
NextPageSelector = 'Next page button'
}
export class PaginationComponent extends BaseComponent {
private static rootElement = 'adf-pagination';
constructor(page: Page) {
super(page, PaginationComponent.rootElement);
}
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('mat-progress-spinner').waitFor({ state: 'attached', timeout: 2000 });
await this.page.locator('mat-progress-spinner').waitFor({ state: 'detached', timeout: 2000 });
} catch (e) {
this.logger.info('Spinner was not present');
}
}
}

View File

@@ -0,0 +1,37 @@
/*!
* 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 SnackBarComponent extends BaseComponent {
private static rootElement = 'simple-snack-bar';
public message = this.getChild(' > span');
public getByMessageLocator = (message: string) => this.getChild('span', { hasText: message });
constructor(page: Page, rootElement = SnackBarComponent.rootElement) {
super(page, rootElement);
}
}

View File

@@ -0,0 +1,43 @@
/*!
* 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 SpinnerComponent extends BaseComponent {
private static rootElement = 'mat-progress-spinner';
constructor(page: Page, rootElement = SpinnerComponent.rootElement) {
super(page, rootElement);
}
async waitForReload(): Promise<void> {
try {
await this.getChild('').waitFor({ state: 'attached', timeout: 2000 });
await this.getChild('').waitFor({ state: 'detached', timeout: 2000 });
} catch (e) {
this.logger.info('Spinner was not present');
}
}
}