Skip to content

Commit f01448a

Browse files
feat(deploy): update version, docs, changeset
Signed-off-by: Oleksandr Andriienko <oandriie@redhat.com>
1 parent 629e808 commit f01448a

7 files changed

Lines changed: 96 additions & 6 deletions

File tree

docs/.vitepress/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export default defineConfig({
3333
{ text: "Examples", link: "/examples/" },
3434
{ text: "Overlay Testing", link: "/overlay/" },
3535
{
36-
text: "v1.1.30",
36+
text: "v1.1.32",
3737
items: [{ text: "Changelog", link: "/changelog" }],
3838
},
3939
],

docs/api/deployment/rhdh-deployment.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ await rhdh.configure({
7070
### `deploy()`
7171

7272
```typescript
73-
async deploy(options?: { timeout?: number | null }): Promise<void>
73+
async deploy(options?: { timeout?: number | null; force?: boolean }): Promise<void>
7474
```
7575

7676
Deploy RHDH to the cluster. This:
@@ -83,6 +83,7 @@ Deploy RHDH to the cluster. This:
8383
| Parameter | Type | Default | Description |
8484
|-----------|------|---------|-------------|
8585
| `options.timeout` | `number \| null` | `600_000` | Playwright test timeout (ms) for the deployment. Pass a custom number to override, `0` for no timeout, or `null` to skip and let the consumer control the timeout. |
86+
| `options.force` | `boolean` | `false` | Force redeployment even if already deployed. Bypasses the built-in `runOnce` protection. Useful for complex test scenarios where multiple `describe` sections need different RHDH configurations. |
8687

8788
```typescript
8889
// Default (600s timeout)
@@ -97,6 +98,10 @@ await rhdh.deploy({ timeout: 0 });
9798
// Skip — consumer controls the timeout
9899
test.setTimeout(900_000);
99100
await rhdh.deploy({ timeout: null });
101+
102+
// Force redeploy with new configuration
103+
await rhdh.configure({ dynamicPlugins: "tests/config/new-plugins.yaml" });
104+
await rhdh.deploy({ force: true });
100105
```
101106

102107
### `waitUntilReady()`

docs/api/playwright/test-fixtures.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { test, expect } from "@red-hat-developer-hub/e2e-test-utils/test";
1616

1717
**Type:** `RHDHDeployment`
1818

19-
Shared RHDH deployment across all tests in a worker. `deploy()` automatically skips if the deployment already succeeded, even after worker restarts.
19+
Shared RHDH deployment across all tests in a worker. `deploy()` automatically skips if the deployment already succeeded, even after worker restarts. Use `deploy({ force: true })` to bypass this protection when you need to redeploy with different configurations in the same test file.
2020

2121
```typescript
2222
test.beforeAll(async ({ rhdh }) => {
@@ -28,6 +28,14 @@ test("access rhdh", async ({ rhdh }) => {
2828
console.log(rhdh.rhdhUrl);
2929
console.log(rhdh.deploymentConfig.namespace);
3030
});
31+
32+
// Force redeploy with new config
33+
test.describe("Different Config", () => {
34+
test.beforeAll(async ({ rhdh }) => {
35+
await rhdh.configure({ appConfig: "tests/config/new-app-config-rhdh.yaml" });
36+
await rhdh.deploy({ force: true });
37+
});
38+
});
3139
```
3240

3341
### `uiHelper`

docs/changelog.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22

33
All notable changes to this project will be documented in this file.
44

5-
## [1.1.31] - Current
5+
## [1.1.32] - Current
6+
7+
### Added
8+
9+
- **Force redeploy option for `rhdh.deploy()`**: Added optional `force` parameter to `rhdh.deploy({ force: true })` to bypass the built-in `runOnce` protection and force a fresh deployment. This enables complex test scenarios where multiple `describe` sections need different RHDH configurations (different app configs or dynamic plugin sets) within the same test file. Test writers can now call `rhdh.configure()` with new settings and `rhdh.deploy({ force: true })` to redeploy with the desired configuration.
10+
11+
## [1.1.31]
612

713
### Fixed
814

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

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,38 @@ test.beforeAll(async ({ rhdh }) => {
171171
Playwright's `beforeAll` runs once **per worker**, not once per test run. When a test fails, Playwright kills the worker and creates a new one for remaining tests — causing `beforeAll` to run again. Without protection, this would re-deploy RHDH from scratch every time a test fails.
172172
:::
173173

174+
### Bypassing Protection with `force`
175+
176+
For complex test scenarios where multiple `describe` sections need different RHDH configurations (different app configs or dynamic plugin sets), you can use the `force` option to bypass the built-in protection:
177+
178+
```typescript
179+
test.describe("Plugin Set A", () => {
180+
test.beforeAll(async ({ rhdh }) => {
181+
await rhdh.configure({
182+
dynamicPlugins: "tests/config/plugins-set-a.yaml",
183+
});
184+
await rhdh.deploy(); // First deployment
185+
});
186+
187+
test("test with plugin set A", async ({ page }) => {
188+
// Tests using plugin set A
189+
});
190+
});
191+
192+
test.describe("Plugin Set B", () => {
193+
test.beforeAll(async ({ rhdh }) => {
194+
await rhdh.configure({
195+
dynamicPlugins: "tests/config/plugins-set-b.yaml",
196+
});
197+
await rhdh.deploy({ force: true }); // Force redeploy with new config
198+
});
199+
200+
test("test with plugin set B", async ({ page }) => {
201+
// Tests using plugin set B
202+
});
203+
});
204+
```
205+
174206
## `test.runOnce` — Run Any Expensive Operation Once
175207

176208
While `rhdh.deploy()` has built-in protection, you may have **other expensive operations** in your `beforeAll` that also shouldn't repeat on worker restart — deploying external services, seeding databases, running setup scripts, etc.

docs/guide/deployment/rhdh-deployment.md

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,12 @@ Deploy RHDH to the cluster:
9393
await deployment.deploy();
9494
```
9595

96-
The `deploy()` method accepts an optional `{ timeout }` parameter to control the Playwright test timeout during deployment. By default, it sets the timeout to 600 seconds (10 minutes).
96+
The `deploy()` method accepts optional parameters:
97+
98+
| Option | Type | Default | Description |
99+
|--------|------|---------|-------------|
100+
| `timeout` | `number \| null` | `600_000` | Playwright test timeout (ms) during deployment |
101+
| `force` | `boolean` | `false` | Force redeployment even if already deployed |
97102

98103
```typescript
99104
// Default (600s)
@@ -112,6 +117,40 @@ await rhdh.deploy({ timeout: null });
112117

113118
`deploy()` automatically skips if the deployment already succeeded in the current test run (e.g., after a worker restart due to test failure). This prevents expensive re-deployments.
114119

120+
#### Force Redeploy
121+
122+
Use the `force` option to bypass the built-in `runOnce` protection and force a fresh deployment. This is useful for complex test scenarios where multiple `describe` sections need different RHDH configurations (different app configs or dynamic plugin sets) within the same test file:
123+
124+
```typescript
125+
test.describe("Plugin Set A", () => {
126+
test.beforeAll(async ({ rhdh }) => {
127+
await rhdh.configure({
128+
auth: "keycloak",
129+
dynamicPlugins: "tests/config/plugins-set-a.yaml",
130+
});
131+
await rhdh.deploy(); // First deployment
132+
});
133+
134+
test("test with plugin set A", async ({ page }) => {
135+
// Tests using plugin set A
136+
});
137+
});
138+
139+
test.describe("Plugin Set B", () => {
140+
test.beforeAll(async ({ rhdh }) => {
141+
await rhdh.configure({
142+
auth: "keycloak",
143+
dynamicPlugins: "tests/config/plugins-set-b.yaml",
144+
});
145+
await rhdh.deploy({ force: true }); // Force redeploy with new config
146+
});
147+
148+
test("test with plugin set B", async ({ page }) => {
149+
// Tests using plugin set B
150+
});
151+
});
152+
```
153+
115154
This method:
116155
1. Merges configuration files (common → auth → project)
117156
2. [Injects plugin metadata](/guide/configuration/config-files#plugin-metadata-injection) into dynamic plugins config

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@red-hat-developer-hub/e2e-test-utils",
3-
"version": "1.1.31",
3+
"version": "1.1.32",
44
"description": "Test utilities for RHDH E2E tests",
55
"license": "Apache-2.0",
66
"repository": {

0 commit comments

Comments
 (0)