Skip to content

NotificationPage API

Page object for the RHDH notifications page.

Import

typescript
import { NotificationPage } from "@red-hat-developer-hub/e2e-test-utils/pages";

Constructor

typescript
new NotificationPage(page: Page, uiHelper?: UIhelper)

Creates a new NotificationPage instance. When uiHelper is omitted, an internal UIhelper is created.

ParameterTypeDescription
pagePagePlaywright Page object
uiHelperUIhelperOptional fixture UIhelper for shared wait/navigation behavior

Supports both MUI (legacy) and BUI (new frontend system) selectors.

Methods

typescript
async navigateToNotifications(): Promise<void>

Navigate to the notifications page via the sidebar (with /notifications fallback), dismiss toasts, and wait until the page is ready.

Notification Selection

selectAllNotifications()

typescript
async selectAllNotifications(): Promise<void>

Select all notifications using the header checkbox.

selectNotification(textOrNth?)

typescript
async selectNotification(
  textOrNth?: string | RegExp | number,
): Promise<void>

Select a notification by row title or by checkbox index.

ParameterTypeDescription
textOrNthstring | RegExpRow title to select (preferred)
textOrNthnumberZero-based checkbox index (legacy)

Notification Content

notificationContains(text)

typescript
async notificationContains(text: string | RegExp): Promise<void>

Verify a notification contains specific text. Automatically expands the table to show 20 rows.

ParameterTypeDescription
textstring | RegExpText or pattern to find

Example:

typescript
await notificationPage.notificationContains("Build completed");
await notificationPage.notificationContains(/Pipeline.*succeeded/);
typescript
async clickNotificationHeadingLink(text: string | RegExp): Promise<void>

Click on a notification heading link.

ParameterTypeDescription
textstring | RegExpNotification heading text to click

Mark as Read/Unread

markAllNotificationsAsRead()

typescript
async markAllNotificationsAsRead(): Promise<void>

Mark all notifications as read. If no notifications exist, does nothing.

markLastNotificationAsRead()

typescript
async markLastNotificationAsRead(): Promise<void>

Mark the most recent notification as read.

markNotificationAsRead(text)

typescript
async markNotificationAsRead(text: string): Promise<void>

Mark a specific notification as read by its text content.

ParameterTypeDescription
textstringText to identify the notification

markLastNotificationAsUnRead()

typescript
async markLastNotificationAsUnRead(): Promise<void>

Mark the most recent notification as unread.

Save for Later

saveSelected()

typescript
async saveSelected(): Promise<void>

Save the currently selected notification for later.

saveAllSelected()

typescript
async saveAllSelected(): Promise<void>

Save all selected notifications for later.

Filtering and Views

selectSeverity(severity?)

typescript
async selectSeverity(severity?: string): Promise<void>

Filter notifications by severity.

ParameterTypeDefaultDescription
severitystring""Severity level (e.g., "critical", "high", "normal")

viewSaved()

typescript
async viewSaved(): Promise<void>

Switch to viewing saved notifications.

viewRead()

typescript
async viewRead(): Promise<void>

Switch to viewing read notifications.

viewUnRead()

typescript
async viewUnRead(): Promise<void>

Switch to viewing unread notifications.

Sorting

sortByOldestOnTop()

typescript
async sortByOldestOnTop(): Promise<void>

Sort notifications with oldest first.

sortByNewestOnTop()

typescript
async sortByNewestOnTop(): Promise<void>

Sort notifications with newest first (default).

Complete Example

typescript
import { test, expect } from "@playwright/test";
import { NotificationPage } from "@red-hat-developer-hub/e2e-test-utils/pages";

test("manage notifications", async ({ page }) => {
  const notificationPage = new NotificationPage(page);

  // Navigate to notifications
  await notificationPage.navigateToNotifications();

  // Check for a specific notification
  await notificationPage.notificationContains("Build completed successfully");

  // Filter by severity
  await notificationPage.selectSeverity("high");

  // Select and mark as read
  await notificationPage.selectNotification(0);
  await notificationPage.markLastNotificationAsRead();

  // Save important notifications
  await notificationPage.selectAllNotifications();
  await notificationPage.saveAllSelected();

  // View saved notifications
  await notificationPage.viewSaved();

  // Sort by oldest
  await notificationPage.sortByOldestOnTop();
});

test("clear all notifications", async ({ page }) => {
  const notificationPage = new NotificationPage(page);

  await notificationPage.navigateToNotifications();
  await notificationPage.markAllNotificationsAsRead();
});

Released under the Apache-2.0 License.