Skip to content

HomePage API

Page object for the RHDH home page.

Import

typescript
import { HomePage } from "rhdh-e2e-test-utils/pages";

Constructor

typescript
new HomePage(page: Page)

Creates a new HomePage instance with an internal UIhelper.

ParameterTypeDescription
pagePagePlaywright Page object

Methods

verifyQuickSearchBar(text)

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

Verify the quick search bar functionality by entering text and verifying a matching link appears.

ParameterTypeDescription
textstringText to search for

Example:

typescript
await homePage.verifyQuickSearchBar("my-component");

verifyQuickAccess(section, quickAccessItem, expand?)

typescript
async verifyQuickAccess(
  section: string,
  quickAccessItem: string,
  expand?: boolean
): Promise<void>

Verify a quick access item is visible in a specific section.

ParameterTypeDefaultDescription
sectionstring-The accordion section name
quickAccessItemstring-The item to verify
expandbooleanfalseWhether to expand the section first

Example:

typescript
// Verify item in already-expanded section
await homePage.verifyQuickAccess("Favorites", "My Component");

// Expand section first, then verify
await homePage.verifyQuickAccess("Recent", "backstage-janus", true);

verifyVisitedCardContent(section)

typescript
async verifyVisitedCardContent(section: string): Promise<void>

Verify that a visited card section exists and may contain items.

ParameterTypeDescription
sectionstringThe card section name

Example:

typescript
await homePage.verifyVisitedCardContent("Recently Visited");

Complete Example

typescript
import { test, expect } from "@playwright/test";
import { HomePage } from "rhdh-e2e-test-utils/pages";

test("verify home page features", async ({ page }) => {
  const homePage = new HomePage(page);

  // Verify quick search works
  await homePage.verifyQuickSearchBar("my-service");

  // Verify quick access sections
  await homePage.verifyQuickAccess("Favorites", "My App");
  await homePage.verifyQuickAccess("Documentation", "Getting Started", true);

  // Verify visited content
  await homePage.verifyVisitedCardContent("Recently Visited");
});

Released under the Apache-2.0 License.