This file contains essential information for maintaining and extending the VitePress documentation for rhdh-e2e-test-utils.
docs/
├── .vitepress/
│ └── config.ts # VitePress configuration (nav, sidebar, theme)
├── snippets/ # Reusable code snippets (included via <!--@include:-->)
├── guide/ # Conceptual documentation
│ ├── core-concepts/ # Architecture, fixtures, patterns
│ ├── deployment/ # RHDH, Keycloak, Helm, Operator
│ ├── helpers/ # UIhelper, LoginHelper, APIHelper
│ ├── page-objects/ # CatalogPage, HomePage, etc.
│ ├── utilities/ # Kubernetes client, bash, YAML merging
│ └── configuration/ # Config files, ESLint, TypeScript
├── api/ # API reference (method signatures, types)
│ ├── deployment/ # RHDHDeployment, KeycloakHelper
│ ├── playwright/ # Fixtures, base config, global setup
│ ├── helpers/ # Helper class APIs
│ ├── pages/ # Page object APIs
│ ├── utils/ # Utility APIs
│ └── eslint/ # ESLint config API
├── tutorials/ # Step-by-step learning guides
├── examples/ # Copy-paste ready code examples
├── index.md # Home page
└── changelog.md # Version history
- Class name:
UIhelper(capital U, lowercase h) - matches source code - Fixture variable:
uiHelper(camelCase) - used in test fixtures - Method names: Follow source exactly (e.g.,
verifyTextinCardnotverifyTextInCard) - Project name in examples: Use
"my-plugin"consistently
- Use TypeScript for all code examples
- Include imports at the top of code blocks
- Use the fixture pattern (recommended) over direct instantiation
- Standard test structure:
import { test, expect } from "rhdh-e2e-test-utils/test"; test.describe("Feature", () => { test.beforeAll(async ({ rhdh }) => { /* deploy */ }); test.beforeEach(async ({ loginHelper }) => { /* login */ }); test("should...", async ({ uiHelper }) => { /* test */ }); });
Located in docs/snippets/. Include them using:
<!--@include: @/snippets/keycloak-credentials.md-->Available snippets:
playwright-config.ts- Base Playwright configenv-example.env- Environment variablesbasic-test.ts- Basic test templatekeycloak-test.ts- Keycloak auth testguest-test.ts- Guest auth testglobal-setup.ts- Global setup templateapp-config-rhdh.yaml- RHDH config templatekeycloak-credentials.md- Default user credentials tableerror-handling.ts- Error handling patternsserial-vs-parallel.ts- Testing patterns comparison
Always add "Related Pages" section at the end of documentation pages:
## Related Pages
- [Page Name](/path/to/page.md) - Brief description| Section | Purpose | Content Style |
|---|---|---|
| Guide | Explain concepts | Detailed prose, multiple examples, best practices |
| API | Reference | Method signatures, parameter tables, brief examples |
| Tutorial | Teach step-by-step | Sequential steps, explanations, learning-focused |
| Example | Copy-paste code | Minimal prose, complete working code |
- Create the
.mdfile in the appropriate directory - Update
docs/.vitepress/config.tsto add to sidebar:{ text: "Section Name", items: [ { text: "Page Title", link: "/path/to/page" }, ], }
collapsed: false- Section expanded by defaultcollapsed: true- Section collapsed by default- Items without
collapsedare always visible
When documenting, reference these source files:
| Component | Source Path |
|---|---|
| UIhelper | src/playwright/helpers/ui-helper.ts |
| LoginHelper | src/playwright/helpers/login-helper.ts |
| APIHelper | src/playwright/helpers/api-helper.ts |
| RHDHDeployment | src/deployment/rhdh/rhdh-deployment.ts |
| KeycloakHelper | src/deployment/keycloak/keycloak-helper.ts |
| Page Objects | src/playwright/pages/*.ts |
| Fixtures | src/playwright/fixtures/test.ts |
| Base Config | src/playwright/base-config.ts |
| Global Setup | src/playwright/global-setup.ts |
- Read the source file to get accurate method signatures
- Update both Guide (
/guide/helpers/) and API (/api/helpers/) sections - Ensure method names match source exactly
- Add to Guide section with detailed explanation
- Add to API section with method signatures
- Add example to Examples section if applicable
- Update Related Pages in relevant files
- Add to sidebar in
config.ts
- Update version in
docs/.vitepress/config.tsnav dropdown - Update
docs/changelog.mdwith changes
The docs are a standalone package, independent of the root project. This allows:
- Separate dependency management
- Faster CI builds (no need to install root dependencies)
- Easier local development
corepack enable # Enable Yarn 3 via Corepack (one-time setup)
cd docs
yarn installRun from the docs/ directory:
yarn dev # Start dev server (http://localhost:5173)
yarn build # Build for production
yarn preview # Preview production builddocs/
├── package.json # Standalone dependencies (vitepress only)
├── node_modules/ # Local dependencies (gitignored)
├── .vitepress/
│ ├── config.ts # VitePress configuration
│ ├── cache/ # Build cache (gitignored)
│ └── dist/ # Build output (gitignored)
└── ...
The documentation automatically deploys via .github/workflows/deploy-docs.yml when:
- Changes are pushed to
mainbranch indocs/directory - Manually triggered via workflow_dispatch
The workflow:
- Checks out the repository
- Runs
yarn installindocs/directory - Runs
yarn buildindocs/directory - Deploys
.vitepress/distto GitHub Pages
Base URL is configured as /rhdh-e2e-test-utils/ in config.ts.
- Consider adding search indexing for Algolia (currently using local search)
- Add API documentation for remaining utility functions
- Consider adding interactive code examples with StackBlitz
| Export | Import Path | Description |
|---|---|---|
| Test fixtures | rhdh-e2e-test-utils/test |
Main test API |
| Playwright config | rhdh-e2e-test-utils/playwright-config |
Base config |
| RHDH deployment | rhdh-e2e-test-utils/rhdh |
RHDHDeployment |
| Keycloak | rhdh-e2e-test-utils/keycloak |
KeycloakHelper |
| Helpers | rhdh-e2e-test-utils/helpers |
UIhelper, LoginHelper, etc. |
| Page objects | rhdh-e2e-test-utils/pages |
CatalogPage, HomePage, etc. |
| Utilities | rhdh-e2e-test-utils/utils |
KubernetesClientHelper, etc. |
| ESLint | rhdh-e2e-test-utils/eslint |
ESLint config |
| TypeScript | rhdh-e2e-test-utils/tsconfig |
TSConfig base |