[ACS-4894] [E2E] Added new e2e for update folder rules (#3929)

* [ACS-4892] [E2E] Created new tests for adding folder rules

* [ACS-4892] deleted the unused if enum

* [ACS-4894] Added update folder rules tests

* [ACS-4894] sonar fix 1

* [ACS-4894] sonar fix 2

* [ACS-4894] sonar fix 3

* [ACS-4894] review fixes 1

* [ACS-4894] review fixes 2

* [ACS-4894] review fixes 3

* [ACS-4894] comments deleted

* [ACS-4894] eslint fix
This commit is contained in:
Adam Świderski
2024-07-16 13:21:05 +02:00
committed by GitHub
parent 1920dcd929
commit cbbb733551
13 changed files with 435 additions and 138 deletions

View File

@@ -52,7 +52,8 @@ export enum ActionType {
export class ActionsDropdownComponent extends BaseComponent {
private static rootElement = 'aca-edit-rule-dialog aca-rule-action-list';
private getOptionLocator = (optionName: string): Locator => this.page.locator('.mat-select-panel .mat-option-text', { hasText: optionName }).first();
private getOptionLocator = (optionName: string): Locator =>
this.page.locator('.mat-select-panel .mat-option-text', { hasText: optionName }).first();
private ruleActionLocator = this.getChild('aca-rule-action');
private addActionButtonLocator = this.getChild('[data-automation-id="rule-action-list-add-action-button"]');
private actionDropdownLocator = this.getChild('[data-automation-id="rule-action-select"]');
@@ -74,6 +75,7 @@ export class ActionsDropdownComponent extends BaseComponent {
if (index > 0) {
await this.addActionButtonLocator.click();
}
await this.actionDropdownLocator.nth(index).hover({ timeout: 1000 });
await this.actionDropdownLocator.nth(index).click();
const option = this.getOptionLocator(action);
await option.click();

View File

@@ -58,7 +58,7 @@ export class ConditionComponent extends ManageRulesDialogComponent {
}
async addCondition(fields: Partial<Field>, value: string, index: number, comparators?: Partial<Comparator>): Promise<void> {
await this.addConditionButton.click();
await this.addConditionButton.first().click();
await this.selectField(fields, index);
if (comparators) {
await this.selectComparator(comparators, index);

View File

@@ -44,8 +44,24 @@ export class ManageRulesDialogComponent extends BaseComponent {
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"]');
public actionsEllipsisButtons = this.getChild('[data-automation-id="rule-action-list-action-menu"]');
public actionsEllipsisDelete = this.page.locator('[data-automation-id="rule-action-list-remove-action-button"]');
public conditionsEllipsisButtons = this.getChild('[data-automation-id="condition-actions-button"]');
public conditionsEllipsisDelete = this.page.locator('button[title="Remove"]');
constructor(page: Page) {
super(page, ManageRulesDialogComponent.rootElement);
}
async deleteActions(noActions: number): Promise<void> {
for(let i = 0; i < noActions; i++) {
await this.actionsEllipsisButtons.first().click();
await this.actionsEllipsisDelete.click();
}}
async deleteConditions(noConditions: number): Promise<void> {
for(let i = 0; i < noConditions; i++) {
await this.conditionsEllipsisButtons.first().click();
await this.conditionsEllipsisDelete.click();
}}
}

View File

@@ -37,6 +37,8 @@ export class ManageRules extends BaseComponent {
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');
constructor(page: Page) {
super(page, ManageRules.rootElement);
@@ -56,4 +58,19 @@ export class ManageRules extends BaseComponent {
async checkIfRuleIsOnTheList(ruleName: string): Promise<void> {
await expect(this.getGroupsList(ruleName)).toBeVisible({ timeout: 5000 });
}
async countConditionsInGroup(): Promise<number> {
return await this.ruleConditionsInGroup.count();
}
async turnOffRuleToggle(): Promise<void> {
await expect(async () => {
await this.ruleToggle.hover({ timeout: 1000 });
await this.ruleToggle.click();
await expect(this.ruleToggleFalse).toBeVisible();
}).toPass({
intervals: [2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000],
timeout: 20_000
});
}
}