diff --git a/projects/aca-playwright-shared/src/api/nodes-api.ts b/projects/aca-playwright-shared/src/api/nodes-api.ts index 8f3415f27a..cd09437913 100755 --- a/projects/aca-playwright-shared/src/api/nodes-api.ts +++ b/projects/aca-playwright-shared/src/api/nodes-api.ts @@ -405,7 +405,7 @@ export class NodesApi { async getNodeProperty(nodeId: string, property: string): Promise { try { const node = await this.getNodeById(nodeId); - return (node.entry.properties && node.entry.properties[property]) || ''; + return node.entry.properties?.[property] || ''; } catch (error) { console.error(`${this.constructor.name} ${this.getNodeProperty.name}`, error); return ''; diff --git a/projects/aca-playwright-shared/src/page-objects/components/dialogs/share-dialog.component.ts b/projects/aca-playwright-shared/src/page-objects/components/dialogs/share-dialog.component.ts index 6bcdc8cf4a..4b0c6bb252 100644 --- a/projects/aca-playwright-shared/src/page-objects/components/dialogs/share-dialog.component.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/dialogs/share-dialog.component.ts @@ -22,7 +22,7 @@ * along with Alfresco. If not, see . */ -import { Locator, Page } from '@playwright/test'; +import { ElementHandle, Locator, Page } from '@playwright/test'; import { BaseComponent } from '../base.component'; import { timeouts } from '../../../utils'; import { DateTimePicker } from '../datetime-picker/datetime-picker.component'; @@ -85,19 +85,24 @@ export class ShareDialogComponent extends BaseComponent { await this.closeButton.click(); } + async isToggleStatus(toggle: ElementHandle, status: string): Promise { + const toggleClass = await toggle.getAttribute('class'); + return toggleClass.includes(status); + } + async isShareToggleChecked(): Promise { - const toggleClass = await this.shareToggle.getAttribute('class'); - return toggleClass.includes('checked'); + const shareToggleElement = await this.shareToggle.elementHandle(); + return this.isToggleStatus(shareToggleElement, 'checked'); } async isShareToggleDisabled(): Promise { - const toggleClass = await this.shareToggle.getAttribute('class'); - return toggleClass.includes('mat-disabled'); + const shareToggleElement = await this.shareToggle.elementHandle(); + return this.isToggleStatus(shareToggleElement, 'mat-disabled'); } async isExpireToggleEnabled(): Promise { - const toggleClass = await this.expireToggle.getAttribute('class'); - return toggleClass.includes('checked'); + const expireToggleElement = await this.expireToggle.elementHandle(); + return this.isToggleStatus(expireToggleElement, 'checked'); } async getExpireDate(): Promise {