Examples
Copy-paste ready code examples for common scenarios.
Available Examples
| Example | Description |
|---|---|
| Basic Test | Minimal working test |
| Guest Authentication | Simple guest login |
| Keycloak Authentication | OIDC authentication |
| Catalog Operations | Catalog interactions |
| API Operations | GitHub/Backstage APIs |
| Custom Deployment | Custom configuration |
| Serial Tests | Shared browser session |
Quick Reference
Minimal Test
typescript
import { test, expect } from "rhdh-e2e-test-utils/test";
test.beforeAll(async ({ rhdh }) => {
await rhdh.deploy();
});
test("example", async ({ page }) => {
await page.goto("/");
await expect(page).toHaveTitle(/Developer Hub/);
});With Login
typescript
import { test, expect } from "rhdh-e2e-test-utils/test";
test.beforeAll(async ({ rhdh }) => {
await rhdh.configure({ auth: "keycloak" });
await rhdh.deploy();
});
test.beforeEach(async ({ loginHelper }) => {
await loginHelper.loginAsKeycloakUser();
});
test("logged in test", async ({ uiHelper }) => {
await uiHelper.verifyHeading("Welcome");
});With Page Object
typescript
import { test } from "rhdh-e2e-test-utils/test";
import { CatalogPage } from "rhdh-e2e-test-utils/pages";
test("catalog test", async ({ page, loginHelper }) => {
await loginHelper.loginAsKeycloakUser();
const catalogPage = new CatalogPage(page);
await catalogPage.go();
await catalogPage.search("my-component");
});