Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions automation/pages/OrganizationPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -2185,6 +2188,26 @@ export class OrganizationPage extends BasePage {
return Number.isFinite(parsed) ? parsed : 0;
}

private async getTabBadgeCount(selector: string): Promise<number> {
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<number> {
return this.getTabBadgeCount(this.readyForReviewTabBadgeSelector);
}

async getReadyForExecutionTabBadgeCount(): Promise<number> {
return this.getTabBadgeCount(this.readyForExecutionTabBadgeSelector);
}

async getHistoryTabBadgeCount(): Promise<number> {
return this.getTabBadgeCount(this.historyTabBadgeSelector);
}

async createNotificationForUser(
firstUser: UserDetails,
secondUser: UserDetails,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
});
Loading