Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,17 @@

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

## [1.1.19] - Current
## [1.1.20] - Current

### Added

- **`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`.
- **`workflowsTable` locator helper**: Reusable Playwright locator for the workflows table, shared by `OrchestratorPage`.
- **`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.
- **`Role` interface**: Exported alongside `Policy` from `@red-hat-developer-hub/e2e-test-utils/helpers`.

## [1.1.19]

- **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`.

## [1.1.18]
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@red-hat-developer-hub/e2e-test-utils",
"version": "1.1.19",
"version": "1.1.20",
"description": "Test utilities for RHDH E2E tests",
"license": "Apache-2.0",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion src/playwright/helpers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ export { GITHUB_API_ENDPOINTS } from "./api-endpoints.js";
export { APIHelper } from "./api-helper.js";
export { LoginHelper, setupBrowser } from "./common.js";
export { UIhelper } from "./ui-helper.js";
export { RbacApiHelper, Policy, Response } from "./rbac-api-helper.js";
export { RbacApiHelper, Policy, Role, Response } from "./rbac-api-helper.js";
export { AuthApiHelper } from "./auth-api-helper.js";
53 changes: 43 additions & 10 deletions src/playwright/helpers/rbac-api-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ export interface Policy {
effect: string;
}

export interface Role {
memberReferences: string[];
name: string;
}

/**
* Thin HTTP client for the RHDH RBAC permission API.
* Uses a static factory (`build`) because the Playwright `APIRequestContext`
Expand Down Expand Up @@ -43,10 +48,48 @@ export class RbacApiHelper {
return instance;
}

// Roles:

public async createRoles(role: Role): Promise<APIResponse> {
return await this.myContext.post("roles", { data: role });
}

public async getRoles(): Promise<APIResponse> {
return await this.myContext.get("roles");
}

public async updateRole(
role: string,
oldRole: Role,
newRole: Role,
): Promise<APIResponse> {
return await this.myContext.put(`roles/role/default/${role}`, {
data: { oldRole, newRole },
});
}

public async deleteRole(role: string): Promise<APIResponse> {
return await this.myContext.delete(`roles/role/default/${role}`);
}

// Policies:

public async getPoliciesByRole(policy: string): Promise<APIResponse> {
return await this.myContext.get(`policies/role/default/${policy}`);
}

public async createPolicies(policy: Policy[]): Promise<APIResponse> {
return await this.myContext.post("policies", { data: policy });
}

public async deletePolicy(policy: string, policies: Policy[]) {
return await this.myContext.delete(`policies/role/default/${policy}`, {
data: policies,
});
}

// Conditions:

/** Fetches all conditional policies across all roles. */
public async getConditions(): Promise<APIResponse> {
return await this.myContext.get(`roles/conditions`);
Expand All @@ -62,16 +105,6 @@ export class RbacApiHelper {
);
}

public async deleteRole(role: string): Promise<APIResponse> {
return await this.myContext.delete(`roles/role/default/${role}`);
}

public async deletePolicy(policy: string, policies: Policy[]) {
return await this.myContext.delete(`policies/role/default/${policy}`, {
data: policies,
});
}

/** `id` comes from the `RoleConditionalPolicyDecision.id` field returned by the API. */
public async deleteCondition(id: string): Promise<APIResponse> {
return await this.myContext.delete(`roles/conditions/${id}`);
Expand Down
1 change: 1 addition & 0 deletions src/playwright/pages/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ export { CatalogPage } from "./catalog.js";
export { ExtensionsPage } from "./extensions.js";
export { HomePage } from "./home-page.js";
export { NotificationPage } from "./notifications.js";
export { OrchestratorPage } from "./orchestrator.js";
Loading
Loading