mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2026-09-09 18:02:54 +00:00
[ACS-4887] e2e added test step for action tests (#3208)
* [ACS-4887] e2e added test step for action tests * e2e test remove commented code * missing spell check added
This commit is contained in:
+2
-1
@@ -38,7 +38,8 @@
|
|||||||
"superadmin",
|
"superadmin",
|
||||||
"textitem",
|
"textitem",
|
||||||
"thumbnailed",
|
"thumbnailed",
|
||||||
"versionable"
|
"versionable",
|
||||||
|
"sfdc"
|
||||||
],
|
],
|
||||||
"dictionaries": [
|
"dictionaries": [
|
||||||
"html",
|
"html",
|
||||||
|
|||||||
+67
-7
@@ -26,23 +26,83 @@ import { Locator, Page } from '@playwright/test';
|
|||||||
import { BaseComponent } from '@alfresco/playwright-shared';
|
import { BaseComponent } from '@alfresco/playwright-shared';
|
||||||
|
|
||||||
export enum ActionType {
|
export enum ActionType {
|
||||||
Aspect = 'Add aspect',
|
AddAspect = 'Add aspect',
|
||||||
SimpleWorkflow = 'Add simple workflow',
|
SimpleWorkflow = 'Add simple workflow',
|
||||||
IncrementCounter = 'Increment Counter'
|
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 {
|
export class ActionsDropdownComponent extends BaseComponent {
|
||||||
private static rootElement = '.mat-select-panel';
|
private static rootElement = 'aca-rule-action-list';
|
||||||
|
|
||||||
public getOptionLocator = (optionName: string): Locator => this.getChild('.mat-option-text', { hasText: optionName });
|
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) {
|
constructor(page: Page) {
|
||||||
super(page, ActionsDropdownComponent.rootElement);
|
super(page, ActionsDropdownComponent.rootElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
async selectAction(action: Partial<ActionType>): Promise<void> {
|
async selectAction(action: Partial<ActionType>, index: number): Promise<void> {
|
||||||
await this.page.locator(`aca-edit-rule-dialog [data-automation-id="rule-action-select"]`).click();
|
if (index > 0) {
|
||||||
|
await this.addActionButtonLocator.click();
|
||||||
|
}
|
||||||
|
await this.actionDropdownLocator.nth(index).click();
|
||||||
const option = this.getOptionLocator(action);
|
const option = this.getOptionLocator(action);
|
||||||
await option.click();
|
await option.nth(0).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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,22 +45,33 @@ export class ConditionComponent extends ManageRulesDialogComponent {
|
|||||||
super(page);
|
super(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async selectField(fields: Partial<Field>): Promise<void> {
|
private async selectField(fields: Partial<Field>, index: number): Promise<void> {
|
||||||
await this.fieldDropDown.click();
|
await this.fieldDropDown.nth(index).click();
|
||||||
const option = this.getOptionLocator(fields);
|
const option = this.getOptionLocator(fields);
|
||||||
await option.click();
|
await option.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async selectComparator(comparators: Partial<Comparator>): Promise<void> {
|
private async selectComparator(comparators: Partial<Comparator>, index: number): Promise<void> {
|
||||||
await this.comparatorDropDown.click();
|
await this.comparatorDropDown.nth(index).click();
|
||||||
const option = this.getOptionLocator(comparators);
|
const option = this.getOptionLocator(comparators);
|
||||||
await option.click();
|
await option.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
async addCondition(fields: Partial<Field>, comparators: Partial<Comparator>, value: string): Promise<void> {
|
async addCondition(fields: Partial<Field>, comparators: Partial<Comparator>, value: string, index: number): Promise<void> {
|
||||||
await this.addConditionButton.click();
|
await this.addConditionButton.click();
|
||||||
await this.selectField(fields);
|
await this.selectField(fields, index);
|
||||||
await this.selectComparator(comparators);
|
await this.selectComparator(comparators, index);
|
||||||
await this.typeConditionValue(value);
|
await this.typeConditionValue(value, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
async createConditionGroup(): Promise<void> {
|
||||||
|
await this.addConditionGroupButton.click();
|
||||||
|
}
|
||||||
|
|
||||||
|
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.typeConditionValue(value, index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-2
@@ -31,6 +31,7 @@ export class ManageRulesDialogComponent extends BaseComponent {
|
|||||||
public createRuleButton = this.getChild('[data-automation-id="edit-rule-dialog-submit"]');
|
public createRuleButton = this.getChild('[data-automation-id="edit-rule-dialog-submit"]');
|
||||||
private ruleNameInputLocator = this.getChild('[id="rule-details-name-input"]');
|
private ruleNameInputLocator = this.getChild('[id="rule-details-name-input"]');
|
||||||
public addConditionButton = this.getChild('[data-automation-id="add-condition-button"]');
|
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 fieldDropDown = this.getChild('[data-automation-id="field-select"]');
|
||||||
public comparatorDropDown = this.getChild('[data-automation-id="comparator-select"]');
|
public comparatorDropDown = this.getChild('[data-automation-id="comparator-select"]');
|
||||||
private valueField = this.getChild('[data-automation-id="value-input"]');
|
private valueField = this.getChild('[data-automation-id="value-input"]');
|
||||||
@@ -43,7 +44,7 @@ export class ManageRulesDialogComponent extends BaseComponent {
|
|||||||
await this.ruleNameInputLocator.type(ruleName, { delay: 50 });
|
await this.ruleNameInputLocator.type(ruleName, { delay: 50 });
|
||||||
}
|
}
|
||||||
|
|
||||||
async typeConditionValue(ruleName: string): Promise<void> {
|
async typeConditionValue(ruleName: string, index: number): Promise<void> {
|
||||||
await this.valueField.type(ruleName, { delay: 50 });
|
await this.valueField.nth(index).type(ruleName, { delay: 50 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ export const config: PlaywrightTestConfig = {
|
|||||||
retries: process.env.CI ? 2 : 0,
|
retries: process.env.CI ? 2 : 0,
|
||||||
/* Opt out of parallel tests on CI. */
|
/* Opt out of parallel tests on CI. */
|
||||||
workers: 5,
|
workers: 5,
|
||||||
timeout: 20000,
|
timeout: 40000,
|
||||||
|
|
||||||
globalSetup: require.resolve('../../shared/base-config/global.setup'),
|
globalSetup: require.resolve('../../shared/base-config/global.setup'),
|
||||||
use: {
|
use: {
|
||||||
|
|||||||
@@ -29,6 +29,10 @@ import { expect } from '@playwright/test';
|
|||||||
test.describe('Folder Rules Actions', () => {
|
test.describe('Folder Rules Actions', () => {
|
||||||
const randomFolderName = `playwright-folder-${(Math.random() + 1).toString(36).substring(6)}`;
|
const randomFolderName = `playwright-folder-${(Math.random() + 1).toString(36).substring(6)}`;
|
||||||
const randomRuleName = `playwright-rule-${(Math.random() + 1).toString(36).substring(6)}`;
|
const randomRuleName = `playwright-rule-${(Math.random() + 1).toString(36).substring(6)}`;
|
||||||
|
const checkInValue = 'check In Value';
|
||||||
|
const actionValue = ' A site which contains sfdc content [sfdc:site] ';
|
||||||
|
const autoDeclareOptionsValue = 'For all major and minor versions [ALL]';
|
||||||
|
const simpleWorkFlow = 'accept reject';
|
||||||
|
|
||||||
let folderId: string;
|
let folderId: string;
|
||||||
|
|
||||||
@@ -50,7 +54,18 @@ test.describe('Folder Rules Actions', () => {
|
|||||||
|
|
||||||
await nodesPage.toolbar.clickCreateRuleButton();
|
await nodesPage.toolbar.clickCreateRuleButton();
|
||||||
await nodesPage.manageRulesDialog.typeRuleName(randomRuleName);
|
await nodesPage.manageRulesDialog.typeRuleName(randomRuleName);
|
||||||
await nodesPage.actionsDropdown.selectAction(ActionType.IncrementCounter);
|
|
||||||
|
await nodesPage.actionsDropdown.selectAction(ActionType.HideRecord, 0);
|
||||||
|
await nodesPage.actionsDropdown.selectAction(ActionType.IncrementCounter, 1);
|
||||||
|
await nodesPage.actionsDropdown.selectAction(ActionType.CheckIn, 2);
|
||||||
|
await nodesPage.actionsDropdown.insertCheckInActionValues(checkInValue, 2);
|
||||||
|
await nodesPage.actionsDropdown.selectAction(ActionType.AddAspect, 3);
|
||||||
|
await nodesPage.actionsDropdown.insertAddAspectActionValues(actionValue, 3);
|
||||||
|
await nodesPage.actionsDropdown.selectAction(ActionType.AutoDeclareOptions, 4);
|
||||||
|
await nodesPage.actionsDropdown.insertAutoDeclareOptionsActionValues(autoDeclareOptionsValue, 4);
|
||||||
|
await nodesPage.actionsDropdown.selectAction(ActionType.SimpleWorkflow, 5);
|
||||||
|
await nodesPage.actionsDropdown.insertSimpleWorkflowActionValues(simpleWorkFlow, 5);
|
||||||
|
|
||||||
await nodesPage.manageRulesDialog.createRuleButton.click();
|
await nodesPage.manageRulesDialog.createRuleButton.click();
|
||||||
|
|
||||||
await expect.soft(nodesPage.manageRules.getGroupsList(randomRuleName)).toBeVisible();
|
await expect.soft(nodesPage.manageRules.getGroupsList(randomRuleName)).toBeVisible();
|
||||||
|
|||||||
@@ -52,8 +52,12 @@ test.describe('Folder Rules Conditions', () => {
|
|||||||
|
|
||||||
await nodesPage.toolbar.clickCreateRuleButton();
|
await nodesPage.toolbar.clickCreateRuleButton();
|
||||||
await nodesPage.manageRulesDialog.typeRuleName(randomRuleName);
|
await nodesPage.manageRulesDialog.typeRuleName(randomRuleName);
|
||||||
await nodesPage.conditionsDropdown.addCondition(Field.Size, Comparator.Equals, specialChars);
|
await nodesPage.conditionsDropdown.addCondition(Field.Size, Comparator.Equals, specialChars, 0);
|
||||||
await nodesPage.actionsDropdown.selectAction(ActionType.IncrementCounter);
|
await nodesPage.conditionsDropdown.addCondition(Field.Size, Comparator.Equals, specialChars, 1);
|
||||||
|
await nodesPage.conditionsDropdown.createConditionGroup();
|
||||||
|
await nodesPage.conditionsDropdown.addConditionGroup(Field.Size, Comparator.Equals, specialChars, 0);
|
||||||
|
await nodesPage.conditionsDropdown.addConditionGroup(Field.Size, Comparator.Equals, specialChars, 1);
|
||||||
|
await nodesPage.actionsDropdown.selectAction(ActionType.IncrementCounter, 0);
|
||||||
await nodesPage.manageRulesDialog.createRuleButton.click();
|
await nodesPage.manageRulesDialog.createRuleButton.click();
|
||||||
|
|
||||||
await expect.soft(nodesPage.manageRules.getGroupsList(randomRuleName)).toBeVisible();
|
await expect.soft(nodesPage.manageRules.getGroupsList(randomRuleName)).toBeVisible();
|
||||||
|
|||||||
Reference in New Issue
Block a user