diff --git a/automation/pages/OrganizationPage.ts b/automation/pages/OrganizationPage.ts index a6d4bdcf2e..854ffe3173 100644 --- a/automation/pages/OrganizationPage.ts +++ b/automation/pages/OrganizationPage.ts @@ -127,6 +127,9 @@ export class OrganizationPage extends BasePage { secondSignerCheckmarkSelector = 'span-checkmark-public-key-1-0'; spanNotificationNumberSelector = 'span-notification-number'; readyToSignTabBadgeSelector = '[data-testid="tab-2"] [data-testid="span-notification-number"]'; + readyForReviewTabBadgeSelector = '[data-testid="tab-1"] [data-testid="span-notification-number"]'; + readyForExecutionTabBadgeSelector = '[data-testid="tab-4"] [data-testid="span-notification-number"]'; + historyTabBadgeSelector = '[data-testid="tab-5"] [data-testid="span-notification-number"]'; transactionIdInGroupSelector = 'td-group-transaction-id'; validStartTimeInGroupSelector = 'td-group-valid-start-time'; toastMessageSelector = 'css=.v-toast__text'; @@ -2185,6 +2188,26 @@ export class OrganizationPage extends BasePage { return Number.isFinite(parsed) ? parsed : 0; } + private async getTabBadgeCount(selector: string): Promise { + const visible = await this.isElementVisible(selector, null, this.SHORT_TIMEOUT); + if (!visible) return 0; + const text = (await this.getText(selector, null, this.SHORT_TIMEOUT))?.trim(); + const parsed = Number.parseInt(text ?? '', 10); + return Number.isFinite(parsed) ? parsed : 0; + } + + async getReadyForReviewTabBadgeCount(): Promise { + return this.getTabBadgeCount(this.readyForReviewTabBadgeSelector); + } + + async getReadyForExecutionTabBadgeCount(): Promise { + return this.getTabBadgeCount(this.readyForExecutionTabBadgeSelector); + } + + async getHistoryTabBadgeCount(): Promise { + return this.getTabBadgeCount(this.historyTabBadgeSelector); + } + async createNotificationForUser( firstUser: UserDetails, secondUser: UserDetails, diff --git a/automation/tests/organization-basic/organizationNotificationTests.test.ts b/automation/tests/organization-basic/organizationNotificationTests.test.ts index 94fa5e06a1..1dfd6d59e6 100644 --- a/automation/tests/organization-basic/organizationNotificationTests.test.ts +++ b/automation/tests/organization-basic/organizationNotificationTests.test.ts @@ -227,4 +227,44 @@ test.describe('Organization Notification tests @organization-basic', () => { }) .toBe(0); }); + + test.describe('Verify notification badges appear on relevant tabs (4.2.2)', () => { + test('Verify badge appears on the tab with a pending notification and is absent on unrelated tabs', async () => { + const notifiedTransactionId = await organizationPage.ensureNotificationStateForUser( + firstUser, + secondUser, + globalCredentials, + ); + expect(notifiedTransactionId).toBeTruthy(); + + await transactionPage.clickOnTransactionsMenuButton(); + await organizationPage.clickOnReadyToSignTab(); + + // Ready to Sign tab must show a badge while the sign notification is unread + await expect + .poll(() => organizationPage.getReadyToSignTabBadgeCount(), { + timeout: organizationPage.getVeryLongTimeout(), + intervals: [organizationPage.getShortTimeout()], + }) + .toBeGreaterThan(0); + + // Ready for Review has no approve-type notifications in this suite — badge must be absent + expect(await organizationPage.getReadyForReviewTabBadgeCount()).toBe(0); + + // Ready for Execution has no executable notifications — badge must be absent + expect(await organizationPage.getReadyForExecutionTabBadgeCount()).toBe(0); + + // Viewing the transaction marks the notification read and must clear the Ready to Sign badge + await organizationPage.openReadyToSignDetailsForTransaction(notifiedTransactionId!); + await transactionPage.clickOnTransactionsMenuButton(); + await organizationPage.clickOnReadyToSignTab(); + + await expect + .poll(() => organizationPage.getReadyToSignTabBadgeCount(), { + timeout: organizationPage.getLongTimeout(), + intervals: [organizationPage.getShortTimeout()], + }) + .toBe(0); + }); + }); });