[ACS-4896] [E2E] delete view folder rules tests added (#3955)

This commit is contained in:
Adam Świderski
2024-07-19 09:04:15 +02:00
committed by GitHub
parent 2ff54affb2
commit 66f3b5a7d5
3 changed files with 143 additions and 1 deletions

View File

@@ -101,6 +101,38 @@ export class RulesApi {
});
}
async createRandomComplexRule(folderId: string, ruleName: string, numOfConditions: number, numOfActions: number, ruleDescription?: string): Promise<Rule> {
if (numOfConditions > ConditionsTypes.conditions.length) {
numOfConditions = ConditionsTypes.conditions.length;
}
let conditionsArray = [];
for (let i = 0; i < numOfConditions; i++) {
const randomIndex = crypto.randomInt(0, ConditionsTypes.conditions.length);
const randomCondition = ConditionsTypes.conditions[randomIndex];
conditionsArray.push(randomCondition);
}
if (numOfActions > ActionTypes.actions.length) {
numOfActions = ActionTypes.actions.length;
}
let actionsArray = [];
for (let i = 0; i < numOfActions; i++) {
const randomIndex = crypto.randomInt(0, ActionTypes.actions.length);
const randomAction = ActionTypes.actions[randomIndex];
actionsArray.push(randomAction);
}
return await this.createRule(folderId, {
name: ruleName,
description: ruleDescription,
isEnabled: true,
actions: actionsArray,
conditions: {
inverted: false,
booleanMode: 'and',
compositeConditions: conditionsArray
}
});
}
async createRuleWithRandomAspects(folderId: string, ruleName: string): Promise<Rule> {
return await this.createRule(folderId, {
name: ruleName,

View File

@@ -32,13 +32,14 @@ export class ManageRules extends BaseComponent {
public ruleToggle = this.getChild('.aca-manage-rules__container .mat-slide-toggle-bar').first();
public ruleToggleFalse = this.getChild('aca-rule-list-grouping input[type="checkbox"][aria-checked="false"]').first();
public ruleDetailsTitle = this.getChild('.aca-manage-rules__container__rule-details__header__title__name');
public ruleDetailsTrashButton = this.getChild('#delete-rule-btn');
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-textitem mat-form-field input');
public rulesEmptyListTitle = this.getChild('.adf-empty-content__title');
public ruleActions = this.getChild('aca-rule-action');
public ruleConditionsInGroup = this.getChild('aca-rule-composite-condition aca-rule-simple-condition');
public ruleDescription = this.getChild('.aca-manage-rules__container__rule-details__header__title__description');
constructor(page: Page) {
super(page, ManageRules.rootElement);