mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACS-4586] Implemented Playwright Framework and add it to CI/CD (#2985)
This commit is contained in:
committed by
GitHub
parent
197ef8f0e3
commit
d68deab2bd
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright © 2005 - 2023 Alfresco Software, Ltd. All rights reserved.
|
||||
*
|
||||
* License rights for this program may be obtained from Alfresco Software, Ltd.
|
||||
* pursuant to a written agreement and any use of this program without such an
|
||||
* agreement is prohibited.
|
||||
*/
|
||||
|
||||
import { Locator, Page } from '@playwright/test';
|
||||
import { BaseComponent } from '@alfresco/playwright-shared';
|
||||
|
||||
export enum ActionType {
|
||||
Aspect = 'Add aspect',
|
||||
SimpleWorkflow = 'Add simple workflow',
|
||||
IncrementCounter = 'Increment Counter'
|
||||
}
|
||||
|
||||
export class ActionsDropdownComponent extends BaseComponent {
|
||||
private static rootElement = '.mat-select-panel';
|
||||
|
||||
public getOptionLocator = (optionName: string): Locator => this.getChild('.mat-option-text', { hasText: optionName });
|
||||
|
||||
constructor(page: Page) {
|
||||
super(page, ActionsDropdownComponent.rootElement);
|
||||
}
|
||||
|
||||
async selectAction(action: Partial<ActionType>): Promise<void> {
|
||||
await this.page.locator(`aca-edit-rule-dialog [data-automation-id="rule-action-select"]`).click();
|
||||
const option = this.getOptionLocator(action);
|
||||
await option.click();
|
||||
}
|
||||
}
|
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright © 2005 - 2023 Alfresco Software, Ltd. All rights reserved.
|
||||
*
|
||||
* License rights for this program may be obtained from Alfresco Software, Ltd.
|
||||
* pursuant to a written agreement and any use of this program without such an
|
||||
* agreement is prohibited.
|
||||
*/
|
||||
|
||||
import { Locator, Page } from '@playwright/test';
|
||||
import { ManageRulesDialogComponent } from './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>): Promise<void> {
|
||||
await this.fieldDropDown.click();
|
||||
const option = this.getOptionLocator(fields);
|
||||
await option.click();
|
||||
}
|
||||
|
||||
private async selectComparator(comparators: Partial<Comparator>): Promise<void> {
|
||||
await this.comparatorDropDown.click();
|
||||
const option = this.getOptionLocator(comparators);
|
||||
await option.click();
|
||||
}
|
||||
|
||||
async addCondition(fields: Partial<Field>, comparators: Partial<Comparator>, value: string): Promise<void> {
|
||||
await this.addConditionButton.click();
|
||||
await this.selectField(fields);
|
||||
await this.selectComparator(comparators);
|
||||
await this.typeConditionValue(value);
|
||||
}
|
||||
}
|
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright © 2005 - 2023 Alfresco Software, Ltd. All rights reserved.
|
||||
*
|
||||
* License rights for this program may be obtained from Alfresco Software, Ltd.
|
||||
* pursuant to a written agreement and any use of this program without such an
|
||||
* agreement is prohibited.
|
||||
*/
|
||||
|
||||
import { BaseComponent } from '@alfresco/playwright-shared';
|
||||
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"]');
|
||||
private ruleNameInputLocator = this.getChild('[id="rule-details-name-input"]');
|
||||
public addConditionButton = this.getChild('[data-automation-id="add-condition-button"]');
|
||||
public fieldDropDown = this.getChild('[data-automation-id="field-select"]');
|
||||
public comparatorDropDown = this.getChild('[data-automation-id="comparator-select"]');
|
||||
private valueField = this.getChild('[data-automation-id="value-input"]');
|
||||
|
||||
constructor(page: Page) {
|
||||
super(page, ManageRulesDialogComponent.rootElement);
|
||||
}
|
||||
|
||||
async typeRuleName(ruleName: string): Promise<void> {
|
||||
await this.ruleNameInputLocator.type(ruleName, { delay: 50 });
|
||||
}
|
||||
|
||||
async typeConditionValue(ruleName: string): Promise<void> {
|
||||
await this.valueField.type(ruleName, { delay: 50 });
|
||||
}
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright © 2005 - 2023 Alfresco Software, Ltd. All rights reserved.
|
||||
*
|
||||
* License rights for this program may be obtained from Alfresco Software, Ltd.
|
||||
* pursuant to a written agreement and any use of this program without such an
|
||||
* agreement is prohibited.
|
||||
*/
|
||||
|
||||
import { Locator, Page } from '@playwright/test';
|
||||
import { BaseComponent } from '@alfresco/playwright-shared';
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user