[ACS-8688] export playwright shared lib (#4068)

* [ACS-8688] export playwright shared lib

* [ACS-8688] changes name

* [ACS-8688] changes name

* [ACS-8688] add lint file and fix lint issue

* [ACS-8688] test fix

* added ng package file
This commit is contained in:
Akash Rathod
2024-09-03 14:16:02 +02:00
committed by GitHub
parent 14bb6b3155
commit 56c2c55daf
66 changed files with 406 additions and 295 deletions

View File

@@ -67,8 +67,8 @@ export class AcaHeader extends BaseComponent {
}
async verifyToolbarPrimaryActions(expectedToolbarPrimary: string[]): Promise<void> {
let buttons = await this.page.$$('aca-toolbar button');
let actualPrimaryActions: string[] = await Promise.all(
const buttons = await this.page.$$('aca-toolbar button');
const actualPrimaryActions: string[] = await Promise.all(
buttons.map(async (button) => {
const title = await button.getAttribute('title');
return title || '';

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-mdc-select-panel .mdc-list-item__primary-text', { hasText: optionName }).first();
private getOptionLocator = (optionName: string): Locator =>
this.page.locator('.mat-mdc-select-panel .mdc-list-item__primary-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"]');

View File

@@ -32,7 +32,8 @@ export class AdfInfoDrawerComponent extends BaseComponent {
super(page, AdfInfoDrawerComponent.rootElement);
}
public getNameField = (labelText: string) => this.getChild(`[data-automation-id="library-name-properties-wrapper"] input[placeholder='${labelText}']`);
public getNameField = (labelText: string) =>
this.getChild(`[data-automation-id="library-name-properties-wrapper"] input[placeholder='${labelText}']`);
public getIdField = (labelText: string) => this.getChild(`[data-automation-id="library-id-properties-wrapper"] input[placeholder='${labelText}']`);
public getVisibilityField = (labelText: string) =>
this.getChild(`[data-automation-id="library-visibility-properties-wrapper"] mat-select[ng-reflect-placeholder='${labelText}']`);
@@ -66,7 +67,7 @@ export class AdfInfoDrawerComponent extends BaseComponent {
async checkCommentsHeaderCount(): Promise<number> {
const commentsCountTextContent = await this.commentsHeader.textContent();
const commentsCountString = commentsCountTextContent.match(/\d+/g)[0];
return parseInt(commentsCountString);
return parseInt(commentsCountString, 10);
}
async verifyCommentsCountFromList(expectedNumber: number): Promise<void> {

View File

@@ -19,7 +19,7 @@
* 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/>.
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { BaseComponent } from '.././base.component';

View File

@@ -56,8 +56,8 @@ export class DataTableComponent extends BaseComponent {
sitesName = this.page.locator('.adf-datatable-body [data-automation-id*="datatable-row"] [aria-label="Name"]');
sitesRole = this.page.locator('.adf-datatable-body [data-automation-id*="datatable-row"] [aria-label="My Role"]');
lockOwner = this.page.locator('.aca-locked-by--name');
uncheckedChecbox = this.page.locator('.mat-mdc-checkbox');
checkedChecbox = this.page.locator('.mat-mdc-checkbox-checked');
uncheckedCheckbox = this.page.locator('.mat-mdc-checkbox');
checkedCheckbox = this.page.locator('.mat-mdc-checkbox-checked');
/** Locator for row (or rows) */
getRowLocator = this.page.getByRole('rowgroup').nth(1).locator('adf-datatable-row');
@@ -244,17 +244,17 @@ export class DataTableComponent extends BaseComponent {
for (const name of names) {
const isSelected = await this.isRowSelected(name);
if (!isSelected) {
let row = this.getRowByName(name);
const row = this.getRowByName(name);
await row.hover();
await row.locator(this.uncheckedChecbox).click();
await row.locator(this.checkedChecbox).waitFor({ state: 'attached' });
await row.locator(this.uncheckedCheckbox).click();
await row.locator(this.checkedCheckbox).waitFor({ state: 'attached' });
}
}
}
async isRowSelected(itemName: string): Promise<boolean> {
const row = this.getRowByName(itemName);
return await row.locator(this.checkedChecbox).isVisible();
return row.locator(this.checkedCheckbox).isVisible();
}
async getColumnHeaders(): Promise<Array<string>> {
@@ -341,7 +341,7 @@ export class DataTableComponent extends BaseComponent {
*/
async getSitesNameAndVisibility(): Promise<{ [siteName: string]: string }> {
const rowsCount = await this.sitesName.count();
let sitesInfo: { [siteName: string]: string } = {};
const sitesInfo: { [siteName: string]: string } = {};
for (let i = 0; i < rowsCount; i++) {
let siteVisibilityText = await this.sitesVisibility.nth(i).textContent();
let siteNameText = await this.sitesName.nth(i).textContent();
@@ -359,7 +359,7 @@ export class DataTableComponent extends BaseComponent {
*/
async getSitesNameAndRole(): Promise<{ [siteName: string]: string }> {
const rowsCount = await this.sitesName.count();
let sitesInfo: { [siteName: string]: string } = {};
const sitesInfo: { [siteName: string]: string } = {};
for (let i = 0; i < rowsCount; i++) {
let siteNameText = await this.sitesName.nth(i).textContent();
let siteRoleText = await this.sitesRole.nth(i).textContent();

View File

@@ -56,13 +56,13 @@ export class MatMenuComponent extends BaseComponent {
async isMenuItemVisible(menuItem: string): Promise<boolean> {
const menuElement = this.getButtonByText(menuItem);
await menuElement.waitFor({ state: 'attached' });
return await menuElement.isVisible();
return menuElement.isVisible();
}
async verifyActualMoreActions(expectedToolbarMore: string[]): Promise<void> {
await this.page.locator('.mat-mdc-menu-content').waitFor({ state: 'attached' });
let menus = await this.page.$$('.mat-mdc-menu-content .mat-mdc-menu-item');
let actualMoreActions: string[] = await Promise.all(
const menus = await this.page.$$('.mat-mdc-menu-content .mat-mdc-menu-item');
const actualMoreActions: string[] = await Promise.all(
menus.map(async (button) => {
const title = await (await button.$('.mdc-list-item__primary-text span')).innerText();
return title || '';

View File

@@ -19,7 +19,7 @@
* 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/>.
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { Page } from '@playwright/test';

View File

@@ -19,7 +19,7 @@
* 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/>.
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { Page } from '@playwright/test';

View File

@@ -1,26 +1,26 @@
/*!
* 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
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
* 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
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { BaseComponent } from '../base.component';
import { Page } from '@playwright/test';
@@ -49,10 +49,14 @@ export class AdfFolderDialogComponent extends BaseComponent {
* @param titleInput input for Title field
* @param descriptionInput input for Description field
*/
async createNewFolderDialog(nameInput: string, titleInput?: string, descriptionInput?: string): Promise<void> {
await this.folderNameInputLocator.fill(nameInput);
if (titleInput) { await this.folderTitleInput.fill(titleInput); }
if (descriptionInput) { await this.folderDescriptionInput.fill(descriptionInput); }
await this.createButton.click();
}
async createNewFolderDialog(nameInput: string, titleInput?: string, descriptionInput?: string): Promise<void> {
await this.folderNameInputLocator.fill(nameInput);
if (titleInput) {
await this.folderTitleInput.fill(titleInput);
}
if (descriptionInput) {
await this.folderDescriptionInput.fill(descriptionInput);
}
await this.createButton.click();
}
}

View File

@@ -1,26 +1,26 @@
/*!
* 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
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
* 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
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { timeouts } from '../../../utils';
import { BaseComponent } from '../base.component';
@@ -39,9 +39,9 @@ export class AdfLibraryDialogComponent extends BaseComponent {
public getLabelText = (text: string) => this.getChild('label', { hasText: text });
public getRequiredMarker = (text: string) => this.getLabelText(text).locator('.mat-mdc-form-field-required-marker');
public getDialogTitle = (text: string) => this.getChild('.mat-mdc-dialog-title', { hasText: text });
public getErrorByText = (text: string): Locator => this.page.locator('mat-error', {hasText: text});
public getErrorByText = (text: string): Locator => this.page.locator('mat-error', { hasText: text });
/**
/**
* This method is used when we want to fill in Create Library Dialog and choose Create button
*
* @param nameInput input for the Name field
@@ -49,18 +49,22 @@ export class AdfLibraryDialogComponent extends BaseComponent {
* @param descriptionInput input for Description field
* @param visibility visibility of the library
*/
async createLibraryWithNameAndId(nameInput: string, libraryIdInput: string, descriptionInput?: string, visibility?: string): Promise<void> {
await this.getLabelText('Name').fill(nameInput);
await this.getLabelText('Library ID').clear();
await this.getLabelText('Library ID').fill(libraryIdInput);
if (descriptionInput) { await this.getLabelText('Description').fill(descriptionInput); }
if (visibility) { await this.getLabelText(visibility).click(); }
await this.createButton.click();
await this.spinnerWaitForReload();
async createLibraryWithNameAndId(nameInput: string, libraryIdInput: string, descriptionInput?: string, visibility?: string): Promise<void> {
await this.getLabelText('Name').fill(nameInput);
await this.getLabelText('Library ID').clear();
await this.getLabelText('Library ID').fill(libraryIdInput);
if (descriptionInput) {
await this.getLabelText('Description').fill(descriptionInput);
}
if (visibility) {
await this.getLabelText(visibility).click();
}
await this.createButton.click();
await this.spinnerWaitForReload();
}
async isErrorMessageDisplayed(errorText: string): Promise<boolean> {
await this.getErrorByText(errorText).waitFor({ state: 'visible', timeout: timeouts.large });
return await this.getErrorByText(errorText).isVisible();
}
async isErrorMessageDisplayed(errorText: string): Promise<boolean> {
await this.getErrorByText(errorText).waitFor({ state: 'visible', timeout: timeouts.large });
return this.getErrorByText(errorText).isVisible();
}
}

View File

@@ -19,7 +19,7 @@
* 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/>.
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { Locator, Page, expect } from '@playwright/test';
@@ -36,7 +36,8 @@ export class ContentNodeSelectorDialog extends BaseComponent {
public actionButton = this.getChild('[data-automation-id="content-node-selector-actions-choose"]');
public locationDropDown = this.getChild('[id="site-dropdown-container"] mat-form-field');
private selectedRow = this.getChild('.adf-is-selected');
getOptionLocator = (optionName: string): Locator => this.page.locator('.mat-mdc-select-panel .mdc-list-item__primary-text', { hasText: optionName });
getOptionLocator = (optionName: string): Locator =>
this.page.locator('.mat-mdc-select-panel .mdc-list-item__primary-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 });

View File

@@ -19,7 +19,7 @@
* 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/>.
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { Locator, Page } from '@playwright/test';
@@ -37,21 +37,24 @@ export class CreateFromTemplateDialogComponent extends BaseComponent {
createButton = this.getChild('[data-automation-id="create-from-template-dialog-create-button"]');
getDialogTitle = (text: string) => this.getChild('.mat-dialog-title', { hasText: text });
getDialogLabel = (text: string) => this.getChild('label', { hasText: text });
getErrorByText = (text: string): Locator => this.page.locator('mat-error', {hasText: text});
getErrorByText = (text: string): Locator => this.page.locator('mat-error', { hasText: text });
async isErrorMessageDisplayed(errorText: string): Promise<boolean> {
await this.getErrorByText(errorText).waitFor({ state: 'visible', timeout: timeouts.large });
return await this.getErrorByText(errorText).isVisible();
return this.getErrorByText(errorText).isVisible();
}
/**
/**
* This method is used when we want to fill in Create new folder/document/file from template dialog and choose Create button
*/
async createFromTemplateAction( nameInput: string, titleInput?: string, descriptionInput?: string): Promise<void> {
await this.getDialogLabel('Name *').fill(nameInput);
if (titleInput) { await this.getDialogLabel('Title').fill(titleInput); }
if (descriptionInput) { await this.getDialogLabel('Description').fill(descriptionInput); }
await this.createButton.click();
async createFromTemplateAction(nameInput: string, titleInput?: string, descriptionInput?: string): Promise<void> {
await this.getDialogLabel('Name *').fill(nameInput);
if (titleInput) {
await this.getDialogLabel('Title').fill(titleInput);
}
if (descriptionInput) {
await this.getDialogLabel('Description').fill(descriptionInput);
}
await this.createButton.click();
}
}

View File

@@ -19,7 +19,7 @@
* 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/>.
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { Page } from '@playwright/test';

View File

@@ -19,7 +19,7 @@
* 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/>.
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { Page } from '@playwright/test';
@@ -39,4 +39,4 @@ export class EditDialog extends BaseComponent {
constructor(page: Page) {
super(page, EditDialog.rootElement);
}
}
}

View File

@@ -19,7 +19,7 @@
* 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/>.
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { Locator, Page, expect } from '@playwright/test';
@@ -35,7 +35,8 @@ export class LinkRulesDialog extends BaseComponent {
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-mdc-select-panel .mdc-list-item__primary-text', { hasText: optionName });
getOptionLocator = (optionName: string): Locator =>
this.page.locator('.mat-mdc-select-panel .mdc-list-item__primary-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 });

View File

@@ -19,7 +19,7 @@
* 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/>.
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { Page } from '@playwright/test';

View File

@@ -50,24 +50,24 @@ export class PasswordOverlayDialogComponent extends BaseComponent {
async isDialogOpen(): Promise<boolean> {
await this.waitForDialogToOpen();
return await this.passwordInput.isVisible();
return this.passwordInput.isVisible();
}
async isCloseVisible(): Promise<boolean> {
return await this.closeButton.isVisible();
return this.closeButton.isVisible();
}
async isSubmitHidden(): Promise<boolean> {
return await this.submitButton.isHidden();
return this.submitButton.isHidden();
}
async isPasswordInputDisplayed(): Promise<boolean> {
return await this.passwordInput.isVisible();
return this.passwordInput.isVisible();
}
async isErrorDisplayed(): Promise<boolean> {
await this.errorMessage.waitFor({ state: 'visible', timeout: timeouts.short });
return await this.errorMessage.isVisible();
return this.errorMessage.isVisible();
}
async getErrorMessage(): Promise<string> {

View File

@@ -19,7 +19,7 @@
* 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/>.
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { ElementHandle, Locator, Page } from '@playwright/test';
@@ -51,19 +51,19 @@ export class ShareDialogComponent extends BaseComponent {
getErrorByText = (text: string): Locator => this.page.locator('mat-error', { hasText: text });
async getLabels(): Promise<Array<string>> {
return await this.page.$$eval('.adf-share-link__label', (elements) => elements.map((element) => element.textContent));
return this.page.$$eval('.adf-share-link__label', (elements) => elements.map((element) => element.textContent));
}
async getDialogTitle(): Promise<string> {
return await this.dialogTitle.innerText();
return this.dialogTitle.innerText();
}
async getInfoText(): Promise<string> {
return await this.infoText.innerText();
return this.infoText.innerText();
}
async getLinkUrl(): Promise<string> {
return await this.url.first().inputValue();
return this.url.first().inputValue();
}
async isUrlReadOnly(): Promise<boolean> {
@@ -72,7 +72,7 @@ export class ShareDialogComponent extends BaseComponent {
}
async isCloseEnabled(): Promise<boolean> {
return await this.closeButton.isEnabled();
return this.closeButton.isEnabled();
}
async clickClose(): Promise<void> {
@@ -96,6 +96,6 @@ export class ShareDialogComponent extends BaseComponent {
}
async getExpireDate(): Promise<string> {
return await this.expireInput.inputValue();
return this.expireInput.inputValue();
}
}

View File

@@ -19,7 +19,7 @@
* 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/>.
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { Page } from '@playwright/test';

View File

@@ -19,7 +19,7 @@
* 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/>.
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { Page } from '@playwright/test';

View File

@@ -54,14 +54,16 @@ export class ManageRulesDialogComponent extends BaseComponent {
}
async deleteActions(noActions: number): Promise<void> {
for(let i = 0; i < noActions; i++) {
await this.actionsEllipsisButtons.first().click();
await this.actionsEllipsisDelete.click();
}}
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();
}}
for (let i = 0; i < noConditions; i++) {
await this.conditionsEllipsisButtons.first().click();
await this.conditionsEllipsisDelete.click();
}
}
}

View File

@@ -53,7 +53,7 @@ export class ManageRules extends BaseComponent {
}
async checkIfRuleListEmpty(): Promise<boolean> {
return await this.rulesEmptyListTitle.isVisible();
return this.rulesEmptyListTitle.isVisible();
}
async checkIfRuleIsOnTheList(ruleName: string): Promise<void> {
@@ -61,7 +61,7 @@ export class ManageRules extends BaseComponent {
}
async countConditionsInGroup(): Promise<number> {
return await this.ruleConditionsInGroup.count();
return this.ruleConditionsInGroup.count();
}
async turnOffRuleToggle(): Promise<void> {

View File

@@ -152,7 +152,7 @@ export class PaginationComponent extends BaseComponent {
}
async getItemsCount(): Promise<number> {
return await this.page.getByRole('menuitem').count();
return this.page.getByRole('menuitem').count();
}
async clickNthItem(nth: number): Promise<void> {

View File

@@ -39,10 +39,10 @@ export class SearchFilters extends BaseComponent {
public locationFilter = this.page.locator('adf-search-widget-chip', { hasText: 'Location' });
public tagsFilter = this.page.locator('adf-search-widget-chip', { hasText: 'Tags' });
public categoriesFilter = this.page.locator('adf-search-widget-chip', { hasText: 'Categories' });
public resetButton = this.page.locator('button' , { hasText: 'Reset' });
public resetButton = this.page.locator('button', { hasText: 'Reset' });
public menuCardTitle = this.page.locator('.adf-search-filter-title');
public menuCardClose = this.page.locator('.adf-search-filter-title-action');
public menuCardClear = this.page.locator('#cancel-filter-button');
public menuCardApply = this.page.locator('#apply-filter-button');
public dropdownOptions = this.page.locator(`mat-option`);
}
}

View File

@@ -89,17 +89,7 @@ export class SearchFiltersDate extends BaseComponent {
* @param endDay end day for time-frame search. DD-MMMM-YY
*/
async filterFilesByDate(params: FilterFilesByDateParams) {
const {
searchPage,
filterType,
dateFilterTab,
searchPhrase,
searchType,
expectSearchResults,
inTheLastInputValue,
startDay,
endDay
} = params;
const { searchPage, filterType, dateFilterTab, searchPhrase, searchType, expectSearchResults, inTheLastInputValue, startDay, endDay } = params;
await searchPage.searchWithin(searchPhrase, searchType);
await searchPage.searchFilters.dateFilter.click();

View File

@@ -19,7 +19,7 @@
* 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/>.
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { Page } from '@playwright/test';
@@ -58,15 +58,15 @@ export class SearchSortingPicker extends BaseComponent {
}
async getSortByOptionsList(): Promise<string[]> {
let sortOptionsCount = await this.sortByList.count();
let sortByOptions: string[] = [];
const sortOptionsCount = await this.sortByList.count();
const sortByOptions: string[] = [];
for (let i = 1; i < sortOptionsCount; i++) {
let textContent = (await this.sortByList.nth(i).textContent()).trim();
sortByOptions.push(textContent);
const textContent = (await this.sortByList.nth(i).textContent()).trim();
sortByOptions.push(textContent);
}
sortByOptions.sort((a, b) => a.localeCompare(b));
return sortByOptions;
}
}
async sortBy(option: SortByType, direction: SortByDirection): Promise<void> {
await this.actionMenu.click();
@@ -76,7 +76,7 @@ export class SearchSortingPicker extends BaseComponent {
await this.clickSortByDropdown();
}
const elem = this.sortByList.getByText(option);
const optionId = await elem.locator("..").getAttribute('id');
const optionId = await elem.locator('..').getAttribute('id');
await elem.click();
const directionSortElement = this.page.locator(`[id="${optionId}-${direction.toLocaleLowerCase()}"]`);
await directionSortElement.click();

View File

@@ -45,7 +45,7 @@ export class SnackBarComponent extends BaseComponent {
}
async getSnackBarActionText(): Promise<string> {
if (await this.actionButton.isVisible()){
if (await this.actionButton.isVisible()) {
return this.actionButton.textContent();
} else {
return '';

View File

@@ -59,17 +59,17 @@ export class ViewerComponent extends BaseComponent {
async isViewerOpened(): Promise<boolean> {
await this.waitForViewerToOpen();
return await this.viewerLocator.isVisible();
return this.viewerLocator.isVisible();
}
async isCloseButtonDisplayed(): Promise<boolean> {
await this.closeButtonLocator.waitFor({ state: 'visible', timeout: timeouts.normal });
return await this.closeButtonLocator.isEnabled({ timeout: timeouts.normal });
return this.closeButtonLocator.isEnabled({ timeout: timeouts.normal });
}
async isFileTitleDisplayed(): Promise<boolean> {
await this.fileTitleButtonLocator.waitFor({ state: 'visible', timeout: timeouts.normal });
return await this.fileTitleButtonLocator.isVisible();
return this.fileTitleButtonLocator.isVisible();
}
async getFileTitle(): Promise<string> {
@@ -79,14 +79,14 @@ export class ViewerComponent extends BaseComponent {
async getCloseButtonTooltip(): Promise<string> {
await this.closeButtonLocator.waitFor({ state: 'visible', timeout: timeouts.normal });
return await this.closeButtonLocator.getAttribute('title');
return this.closeButtonLocator.getAttribute('title');
}
async verifyViewerPrimaryActions(expectedToolbarPrimary: string[]): Promise<void> {
const toRemove = ['Close', 'Previous File', 'Next File', 'View details'];
const removeClosePreviousNextOldInfo = (actions: string[]): string[] => actions.filter((elem) => !toRemove.includes(elem));
let buttons = await this.page.$$('adf-viewer button');
const buttons = await this.page.$$('adf-viewer button');
let actualPrimaryActions: string[] = await Promise.all(
buttons.map(async (button) => {
const title = await button.getAttribute('title');

View File

@@ -24,7 +24,15 @@
import { Page } from '@playwright/test';
import { BasePage } from './base.page';
import { DataTableComponent, MatMenuComponent, ViewerComponent, SidenavComponent, PaginationComponent, Breadcrumb, AdfInfoDrawerComponent } from '../components';
import {
DataTableComponent,
MatMenuComponent,
ViewerComponent,
SidenavComponent,
PaginationComponent,
Breadcrumb,
AdfInfoDrawerComponent
} from '../components';
import { AcaHeader } from '../components/aca-header.component';
import { AdfFolderDialogComponent, ViewerOverlayDialogComponent, ManageVersionsDialog } from '../components/dialogs';

View File

@@ -68,8 +68,8 @@ export class LoginPage extends BasePage {
}
async verifyUserLogin(): Promise<void> {
if (this.username.isVisible()) {
await this.page.reload({ waitUntil:"load" });
if (await this.username.isVisible()) {
await this.page.reload({ waitUntil: 'load' });
}
}
}

View File

@@ -45,5 +45,4 @@ export class SharedPage extends BasePage {
public breadcrumb = new Breadcrumb(this.page);
public infoDrawer = new AdfInfoDrawerComponent(this.page);
public manageVersionsDialog = new ManageVersionsDialog(this.page);
}