Skip to content

Commit ba3bd6c

Browse files
docs: improve overlay docs and navigation (#27)
1 parent 3a2e45a commit ba3bd6c

23 files changed

+475
-350
lines changed

docs/.vitepress/config.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,10 @@ export default defineConfig({
353353
text: "Pre-requisite Services",
354354
link: "/overlay/tutorials/custom-deployment",
355355
},
356+
{
357+
text: "Using Secrets",
358+
link: "/overlay/tutorials/using-secrets",
359+
},
356360
{
357361
text: "Running Tests Locally",
358362
link: "/overlay/tutorials/running-locally",
@@ -376,12 +380,16 @@ export default defineConfig({
376380
},
377381
{
378382
text: "Reference",
379-
collapsed: true,
383+
collapsed: false,
380384
items: [
381385
{
382386
text: "Environment Variables",
383387
link: "/overlay/reference/environment-variables",
384388
},
389+
{
390+
text: "Local OCI Testing",
391+
link: "/overlay/reference/local-oci-testing",
392+
},
385393
{
386394
text: "Package.json Scripts",
387395
link: "/overlay/reference/scripts",

docs/guide/configuration/config-files.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
RHDH deployment uses YAML configuration files for app config, plugins, and secrets.
44

5+
If you are working inside the overlay repository, see [Overlay Configuration Files](/overlay/test-structure/configuration-files) for overlay-specific behavior and CI integration details.
6+
57
## File Structure
68

79
Create configuration files in `tests/config/`:
@@ -137,6 +139,21 @@ When you deploy RHDH, configurations are merged:
137139
138140
Later files override earlier files. You only need to specify what's different from defaults.
139141
142+
## Verify the Final Merged Config
143+
144+
If you need to confirm the final merged configuration:
145+
146+
1. Run a test once so RHDH is deployed.
147+
2. Inspect the ConfigMaps in the test namespace:
148+
149+
```bash
150+
oc get configmap -n <namespace>
151+
oc get configmap app-config-rhdh -n <namespace> -o yaml
152+
oc get configmap dynamic-plugins -n <namespace> -o yaml
153+
```
154+
155+
This shows the exact content after defaults, auth config, and your overrides are merged.
156+
140157
## Plugin Metadata Injection
141158

142159
During deployment, the package automatically handles plugin configurations from metadata files. The behavior depends on whether your [`dynamic-plugins.yaml`](#dynamic-plugins-yaml) file exists:
@@ -219,6 +236,31 @@ When `GIT_PR_NUMBER` is set (by OpenShift CI), local plugin paths are automatica
219236
220237
This allows E2E tests to run against the actual OCI images built for the PR.
221238
239+
### Local Reproduction (Optional)
240+
241+
If you want to reproduce OCI URL replacement locally, create the required files at the workspace root:
242+
243+
**source.json**
244+
```json
245+
{
246+
"repo": "https://github.com/redhat-developer/rhdh-plugin-export-overlays",
247+
"repo-ref": "abc123def4567890"
248+
}
249+
```
250+
251+
**plugins-list.yaml**
252+
```yaml
253+
plugins/tech-radar:
254+
plugins/my-plugin:
255+
```
256+
257+
Then set `GIT_PR_NUMBER` and run tests:
258+
259+
```bash
260+
export GIT_PR_NUMBER=1845
261+
yarn test
262+
```
263+
222264
::: warning
223265
For PR builds, OCI URL generation is required. Deployment will fail if `source.json` or `plugins-list.yaml` doesn't exist, or if version fetching fails.
224266
:::

docs/guide/configuration/environment-variables.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22

33
Complete reference of all environment variables used by the package.
44

5-
## Required Variables
5+
## Recommended Variables
66

7-
| Variable | Description | Example |
8-
|----------|-------------|---------|
9-
| `RHDH_VERSION` | RHDH version to deploy | `"1.5"` |
10-
| `INSTALLATION_METHOD` | Deployment method | `"helm"` or `"operator"` |
7+
These are optional but commonly set to control deployment behavior:
8+
9+
| Variable | Description | Example | Default |
10+
|----------|-------------|---------|---------|
11+
| `RHDH_VERSION` | RHDH version to deploy | `"1.5"` | `"next"` |
12+
| `INSTALLATION_METHOD` | Deployment method | `"helm"` or `"operator"` | `"helm"` |
1113

1214
## Auto-Generated Variables
1315

docs/guide/core-concepts/playwright-config.md

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -25,25 +25,28 @@ The `defineConfig` function extends your configuration with sensible defaults fo
2525
|---------|-------|-------------|
2626
| `testDir` | `./tests` | Test files location |
2727
| `timeout` | 90,000ms | Test timeout |
28-
| `expect.timeout` | 30,000ms | Assertion timeout |
28+
| `expect.timeout` | 10,000ms | Assertion timeout |
2929
| `retries` | 2 (CI), 0 (local) | Test retries |
3030
| `workers` | 50% of CPUs | Parallel workers |
31-
| `fullyParallel` | `true` | Parallel test execution |
31+
| `outputDir` | `node_modules/.cache/e2e-test-results` | Playwright artifacts |
3232

3333
### Reporter Settings
3434

3535
| Setting | Value |
3636
|---------|-------|
37-
| `reporter` | `[["list"], ["html"]]` |
37+
| `reporter` | `[["list"], ["html"], ["json"]]` |
3838

3939
### Browser Settings
4040

4141
| Setting | Value |
4242
|---------|-------|
43-
| `viewport` | `{ width: 1920, height: 1080 }` |
44-
| `video` | `"on"` |
43+
| `ignoreHTTPSErrors` | `true` |
4544
| `trace` | `"retain-on-failure"` |
4645
| `screenshot` | `"only-on-failure"` |
46+
| `viewport` | `{ width: 1920, height: 1080 }` |
47+
| `video` | `"on"` |
48+
| `actionTimeout` | 10,000ms |
49+
| `navigationTimeout` | 50,000ms |
4750

4851
## Global Setup
4952

@@ -55,22 +58,12 @@ The base configuration includes a global setup that runs before all tests:
5558

5659
## Customizing Configuration
5760

58-
You can override any setting by passing it to `defineConfig`:
61+
`defineConfig` only accepts `projects` overrides. To change other settings, use `baseConfig` with Playwright's `defineConfig`.
5962

6063
```typescript
6164
import { defineConfig } from "rhdh-e2e-test-utils/playwright-config";
6265

6366
export default defineConfig({
64-
// Override timeout
65-
timeout: 120000,
66-
67-
// Override retries
68-
retries: 3,
69-
70-
// Override workers
71-
workers: 2,
72-
73-
// Add projects
7467
projects: [
7568
{
7669
name: "my-plugin",
@@ -81,9 +74,6 @@ export default defineConfig({
8174
testMatch: "**/another-*.spec.ts",
8275
},
8376
],
84-
85-
// Add custom reporter
86-
reporter: [["list"], ["html"], ["json", { outputFile: "results.json" }]],
8777
});
8878
```
8979

@@ -179,12 +169,14 @@ GITHUB_TOKEN=ghp_xxxxx
179169
## Example: Full Configuration
180170

181171
```typescript
182-
import { defineConfig } from "rhdh-e2e-test-utils/playwright-config";
172+
import { baseConfig } from "rhdh-e2e-test-utils/playwright-config";
173+
import { defineConfig } from "@playwright/test";
183174
import dotenv from "dotenv";
184175

185176
dotenv.config({ path: `${import.meta.dirname}/.env` });
186177

187178
export default defineConfig({
179+
...baseConfig,
188180
// Test settings
189181
timeout: 120000,
190182
retries: process.env.CI ? 3 : 0,

docs/guide/core-concepts/playwright-fixtures.md

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ This import replaces the standard Playwright import and provides additional fixt
2525

2626
The `rhdh` fixture is worker-scoped, meaning:
2727

28-
- One deployment is shared across all tests in a worker
29-
- Deployment happens once per worker, not per test
30-
- All tests in the same worker share the same RHDH instance
28+
- One deployment object is shared across all tests in a worker
29+
- You control *when* deployment happens (usually in `test.beforeAll`)
30+
- All tests in the same worker can share the same RHDH instance
3131

3232
```typescript
3333
test.beforeAll(async ({ rhdh }) => {
@@ -165,6 +165,47 @@ For local development:
165165
- Namespaces are preserved for debugging
166166
- Manual cleanup may be required
167167

168+
## Best Practices for Projects and Spec Files
169+
170+
Each Playwright project name creates a **separate namespace**. The fixture creates one `RHDHDeployment` per worker, and you typically call `rhdh.deploy()` once in `beforeAll`.
171+
172+
**Recommended for overlay workspaces:**
173+
174+
- Use **one Playwright project** named after the workspace.
175+
- Keep **one spec file** per workspace unless you have a strong reason to split.
176+
177+
This keeps deployment cost low and avoids multiple namespaces unless required.
178+
179+
## When You Need Multiple Projects or Spec Files
180+
181+
If requirements differ (different auth, configs, or namespaces), you can:
182+
183+
1. **Use multiple projects** with different names and config overrides.
184+
2. **Manually manage deployments** using `RHDHDeployment` for advanced flows.
185+
186+
Example using multiple projects:
187+
188+
```typescript
189+
export default defineConfig({
190+
projects: [
191+
{ name: "workspace-default" },
192+
{ name: "workspace-guest" },
193+
],
194+
});
195+
```
196+
197+
Example with manual deployment:
198+
199+
```typescript
200+
import { RHDHDeployment } from "rhdh-e2e-test-utils/rhdh";
201+
202+
test.beforeAll(async () => {
203+
const rhdh = new RHDHDeployment("custom-namespace");
204+
await rhdh.configure({ auth: "guest" });
205+
await rhdh.deploy();
206+
});
207+
```
208+
168209
## Example: Complete Test Setup
169210

170211
```typescript

docs/guide/deployment/rhdh-deployment.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ test("example", async ({ rhdh }) => {
4848

4949
| Option | Type | Description |
5050
|--------|------|-------------|
51-
| `version` | `string` | RHDH version (e.g., "1.5"). Defaults to `RHDH_VERSION` env var |
51+
| `version` | `string` | RHDH version (e.g., "1.5"). Defaults to `RHDH_VERSION` or `"next"` |
5252
| `namespace` | `string` | Kubernetes namespace. Set via constructor |
53-
| `method` | `"helm" \| "operator"` | Installation method. Defaults to `INSTALLATION_METHOD` env var |
53+
| `method` | `"helm" \| "operator"` | Installation method. Defaults to `INSTALLATION_METHOD` or `"helm"` |
5454
| `auth` | `"guest" \| "keycloak"` | Authentication provider. Defaults to `"keycloak"` |
5555
| `appConfig` | `string` | Path to app-config YAML |
5656
| `secrets` | `string` | Path to secrets YAML |
@@ -102,6 +102,26 @@ This method:
102102
6. Waits for the deployment to be ready
103103
7. Sets `RHDH_BASE_URL` environment variable
104104

105+
#### Base URL format
106+
107+
The base URL prefix depends on the installation method:
108+
109+
- Helm: `https://redhat-developer-hub-<namespace>.<cluster>`
110+
- Operator: `https://backstage-developer-hub-<namespace>.<cluster>`
111+
112+
#### Helm behavior
113+
114+
Helm deployments perform a scale-down and restart after applying configs to avoid migration locks.
115+
116+
#### Operator version constraints
117+
118+
Operator deployments accept only:
119+
120+
- Semantic versions like `1.5`
121+
- `"next"`
122+
123+
Any other value will throw an error during deployment.
124+
105125
### `waitUntilReady(timeout?)`
106126

107127
Wait for the RHDH deployment to be ready:

docs/guide/installation.md

Lines changed: 3 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -41,74 +41,10 @@ import { defineConfig } from "rhdh-e2e-test-utils/playwright-config";
4141

4242
## Project Setup
4343

44-
### 1. Create E2E Test Directory
44+
For full project scaffolding (config files, folder structure, and first test), follow:
4545

46-
```bash
47-
mkdir e2e-tests && cd e2e-tests
48-
yarn init -y
49-
```
50-
51-
### 2. Install Dependencies
52-
53-
```bash
54-
yarn add @playwright/test rhdh-e2e-test-utils typescript
55-
```
56-
57-
### 3. Create Configuration Files
58-
59-
Create the following files in your project:
60-
61-
**playwright.config.ts**
62-
```typescript
63-
import { defineConfig } from "rhdh-e2e-test-utils/playwright-config";
64-
65-
export default defineConfig({
66-
projects: [
67-
{
68-
name: "my-plugin",
69-
},
70-
],
71-
});
72-
```
73-
74-
**tsconfig.json**
75-
```json
76-
{
77-
"extends": "rhdh-e2e-test-utils/tsconfig",
78-
"include": ["tests/**/*.ts"]
79-
}
80-
```
81-
82-
**eslint.config.js**
83-
```javascript
84-
import { createEslintConfig } from "rhdh-e2e-test-utils/eslint";
85-
86-
export default createEslintConfig(import.meta.dirname);
87-
```
88-
89-
### 4. Create Test Directory Structure
90-
91-
```bash
92-
mkdir -p tests/config tests/specs
93-
```
94-
95-
Your project structure should look like:
96-
97-
```
98-
e2e-tests/
99-
├── package.json
100-
├── playwright.config.ts
101-
├── tsconfig.json
102-
├── eslint.config.js
103-
├── .env # Environment variables
104-
└── tests/
105-
├── config/
106-
│ ├── app-config-rhdh.yaml # RHDH app configuration
107-
│ ├── dynamic-plugins.yaml # Plugin configuration
108-
│ └── rhdh-secrets.yaml # Secrets template
109-
└── specs/
110-
└── my-plugin.spec.ts # Test files
111-
```
46+
- [Quick Start](/guide/quick-start) - complete setup walkthrough
47+
- [Your First Test](/tutorials/first-test) - step-by-step with explanations
11248

11349
## Next Steps
11450

0 commit comments

Comments
 (0)