[ACS-4892] [E2E] Created new tests for adding folder rules (#3895)

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

* [ACS-4892] excluded one test for now

* [ACS-4892] [E2E] The rest of test cases automated

* [ACS-4892] deleted the unused if enum

* [ACS-4892] review fixes 1

* [ACS-4892] review fixes 2

* [ACS-4892] review fixes 3
This commit is contained in:
Adam Świderski
2024-07-11 10:53:04 +02:00
committed by GitHub
parent 1e176c3300
commit e7cd5741d2
14 changed files with 433 additions and 166 deletions

View File

@@ -22,7 +22,7 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { Locator, Page } from '@playwright/test';
import { Locator, Page, expect } from '@playwright/test';
import { BaseComponent } from '../base.component';
export class ContentNodeSelectorDialog extends BaseComponent {
@@ -40,13 +40,13 @@ export class ContentNodeSelectorDialog extends BaseComponent {
private getRowByName = (name: string | number): Locator => this.getChild(`adf-datatable-row`, { hasText: name.toString() });
getDialogTitle = (text: string) => this.getChild('[data-automation-id="content-node-selector-title"]', { hasText: text });
getBreadcrumb = (text: string) => this.getChild('[data-automation-id="current-folder"]', { hasText: text });
getFolderIcon = this.getChild('mat-icon[role="img"]', { hasText: "folder" });
getFolderIcon = this.getChild('[data-automation-id="dropdown-breadcrumb-trigger"]');
loadMoreButton = this.getChild('[data-automation-id="adf-infinite-pagination-button"]');
async loadMoreNodes(): Promise<void> {
await this.spinnerWaitForReload();
while (await this.loadMoreButton.isVisible()) {
await this.loadMoreButton.click();
await this.loadMoreButton.click();
}
}
@@ -59,8 +59,17 @@ export class ContentNodeSelectorDialog extends BaseComponent {
async selectDestination(folderName: string): Promise<void> {
const row = this.getRowByName(folderName);
await row.click();
await this.selectedRow.waitFor({ state: 'attached' });
await this.selectedRow.isVisible();
await expect(row).toBeVisible();
await row.click({ trial: true });
await expect(async () => {
await row.hover({ timeout: 1000 });
await row.click();
await expect(this.selectedRow).toBeVisible();
}).toPass({
intervals: [2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000],
timeout: 20_000
});
}
}

View File

@@ -34,3 +34,4 @@ export * from './upload-new-version-dialog.component';
export * from './manage-versions-dialog.component';
export * from './upload-dialog.component';
export * from './delete-trash-dialog.component';
export * from './link-rules.component';

View File

@@ -0,0 +1,64 @@
/*!
* Copyright © 2005-2024 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
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { Locator, Page, expect } from '@playwright/test';
import { BaseComponent } from '../base.component';
export class LinkRulesDialog extends BaseComponent {
private static rootElement = 'aca-rule-set-picker';
constructor(page: Page) {
super(page, LinkRulesDialog.rootElement);
}
cancelButton = this.getChild('[data-automation-id="content-node-selector-actions-cancel"]');
selectFolderButton = this.getChild('button', { hasText: ' Select folder ' });
emptyLinkRules = this.getChild('.adf-empty-content__title');
getOptionLocator = (optionName: string): Locator => this.page.locator('.mat-select-panel .mat-option-text', { hasText: optionName });
private getRowByName = (name: string | number): Locator => this.getChild(`adf-datatable-row`, { hasText: name.toString() });
getDialogTitle = (text: string) => this.getChild('[data-automation-id="content-node-selector-title"]', { hasText: text });
getBreadcrumb = (text: string) => this.getChild('[data-automation-id="current-folder"]', { hasText: text });
getFolderIcon = this.getChild('.adf-dropdown-breadcrumb-icon', { hasText: 'folder' });
getLibraryIcon = this.getChild('.adf-empty-content__icon', { hasText: 'library_books' });
async selectDestination(folderName: string): Promise<void> {
const row = this.getRowByName(folderName);
await expect(row).toBeVisible();
await row.click({ trial: true });
await expect(async () => {
await row.hover({ timeout: 1000 });
await row.click();
await expect(this.selectFolderButton).toBeEnabled();
}).toPass({
intervals: [2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000],
timeout: 20_000
});
}
async waitForLinkRules(): Promise<void> {
await this.getLibraryIcon.waitFor();
}
}