Skip to content

Commit 8ae4ce7

Browse files
feat(orchestrator): Add orchestrator page and helpers, updated rbac-api helper (#57)
Signed-by: rlan@redhat.com Assisted-by: Cursor Co-authored-by: Subhash Khileri <skhileri@redhat.com>
1 parent 41bf831 commit 8ae4ce7

File tree

7 files changed

+404
-13
lines changed

7 files changed

+404
-13
lines changed

docs/changelog.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,17 @@
22

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

5-
## [1.1.19] - Current
5+
## [1.1.20] - Current
66

77
### Added
88

9+
- **`OrchestratorPage`**: New page object for orchestrator e2e tests. Provides methods for selecting, running, and re-running Greeting and FailSwitch workflows, validating workflow table columns and row data, inspecting run details and status (Running / Completed / Failed), verifying all-runs filters and status icons, aborting running workflows, and checking entity-workflow integration (Workflows tab and linked workflow names). Exported from `@red-hat-developer-hub/e2e-test-utils/pages`.
10+
- **`workflowsTable` locator helper**: Reusable Playwright locator for the workflows table, shared by `OrchestratorPage`.
11+
- **`RbacApiHelper` — role & policy CRUD methods**: `createRoles(role)`, `getRoles()`, `updateRole(role, oldRole, newRole)`, and `createPolicies(policy)` join the existing delete helpers, giving full CRUD coverage for roles and policies.
12+
- **`Role` interface**: Exported alongside `Policy` from `@red-hat-developer-hub/e2e-test-utils/helpers`.
13+
14+
## [1.1.19]
15+
916
- **installOrchestrator(namespace?: string)**: Runs the orchestrator install script via a TypeScript wrapper; creates or reuses the given namespace (default `"orchestrator"`). Exported from `@red-hat-developer-hub/e2e-test-utils/orchestrator`.
1017

1118
## [1.1.18]

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.19",
3+
"version": "1.1.20",
44
"description": "Test utilities for RHDH E2E tests",
55
"license": "Apache-2.0",
66
"repository": {

src/playwright/helpers/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ export { GITHUB_API_ENDPOINTS } from "./api-endpoints.js";
22
export { APIHelper } from "./api-helper.js";
33
export { LoginHelper, setupBrowser } from "./common.js";
44
export { UIhelper } from "./ui-helper.js";
5-
export { RbacApiHelper, Policy, Response } from "./rbac-api-helper.js";
5+
export { RbacApiHelper, Policy, Role, Response } from "./rbac-api-helper.js";
66
export { AuthApiHelper } from "./auth-api-helper.js";

src/playwright/helpers/rbac-api-helper.ts

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ export interface Policy {
1111
effect: string;
1212
}
1313

14+
export interface Role {
15+
memberReferences: string[];
16+
name: string;
17+
}
18+
1419
/**
1520
* Thin HTTP client for the RHDH RBAC permission API.
1621
* Uses a static factory (`build`) because the Playwright `APIRequestContext`
@@ -43,10 +48,48 @@ export class RbacApiHelper {
4348
return instance;
4449
}
4550

51+
// Roles:
52+
53+
public async createRoles(role: Role): Promise<APIResponse> {
54+
return await this.myContext.post("roles", { data: role });
55+
}
56+
57+
public async getRoles(): Promise<APIResponse> {
58+
return await this.myContext.get("roles");
59+
}
60+
61+
public async updateRole(
62+
role: string,
63+
oldRole: Role,
64+
newRole: Role,
65+
): Promise<APIResponse> {
66+
return await this.myContext.put(`roles/role/default/${role}`, {
67+
data: { oldRole, newRole },
68+
});
69+
}
70+
71+
public async deleteRole(role: string): Promise<APIResponse> {
72+
return await this.myContext.delete(`roles/role/default/${role}`);
73+
}
74+
75+
// Policies:
76+
4677
public async getPoliciesByRole(policy: string): Promise<APIResponse> {
4778
return await this.myContext.get(`policies/role/default/${policy}`);
4879
}
4980

81+
public async createPolicies(policy: Policy[]): Promise<APIResponse> {
82+
return await this.myContext.post("policies", { data: policy });
83+
}
84+
85+
public async deletePolicy(policy: string, policies: Policy[]) {
86+
return await this.myContext.delete(`policies/role/default/${policy}`, {
87+
data: policies,
88+
});
89+
}
90+
91+
// Conditions:
92+
5093
/** Fetches all conditional policies across all roles. */
5194
public async getConditions(): Promise<APIResponse> {
5295
return await this.myContext.get(`roles/conditions`);
@@ -62,16 +105,6 @@ export class RbacApiHelper {
62105
);
63106
}
64107

65-
public async deleteRole(role: string): Promise<APIResponse> {
66-
return await this.myContext.delete(`roles/role/default/${role}`);
67-
}
68-
69-
public async deletePolicy(policy: string, policies: Policy[]) {
70-
return await this.myContext.delete(`policies/role/default/${policy}`, {
71-
data: policies,
72-
});
73-
}
74-
75108
/** `id` comes from the `RoleConditionalPolicyDecision.id` field returned by the API. */
76109
public async deleteCondition(id: string): Promise<APIResponse> {
77110
return await this.myContext.delete(`roles/conditions/${id}`);

src/playwright/pages/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ export { CatalogPage } from "./catalog.js";
33
export { ExtensionsPage } from "./extensions.js";
44
export { HomePage } from "./home-page.js";
55
export { NotificationPage } from "./notifications.js";
6+
export { OrchestratorPage } from "./orchestrator.js";

0 commit comments

Comments
 (0)