Skip to content

test(orchestrator): cover Run as Event UX at L3 #RHIDP-16049 - #4175

Open
rostalan wants to merge 2 commits into
redhat-developer:mainfrom
rostalan:rhidp-16049-l3-run-as-event-tests
Open

test(orchestrator): cover Run as Event UX at L3 #RHIDP-16049#4175
rostalan wants to merge 2 commits into
redhat-developer:mainfrom
rostalan:rhidp-16049-l3-run-as-event-tests

Conversation

@rostalan

@rostalan rostalan commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Add RTL tests for isEvent execute payload, kafkaEvent redirect, and runs-tab eventTriggered alert so RHIDP-9144 regressions are caught without cluster or Kafka.
Closes RHIDP-16049

Add RTL tests for isEvent execute payload, kafkaEvent redirect, and
runs-tab eventTriggered alert so RHIDP-9144 regressions are caught
without cluster or Kafka.

Co-authored-by: Cursor <cursoragent@cursor.com>
@rhdh-qodo-merge

Copy link
Copy Markdown

PR Summary by Qodo

Add RTL coverage for Run as Event UX flows in orchestrator

🧪 Tests 🕐 20-40 Minutes

Grey Divider

AI Description

• Add RTL tests validating "Run as Event" sets isEvent: true in execute payload
• Assert post-execute redirects when backend returns kafkaEvent, including entity-targeted routes
• Cover eventTriggered runs-tab alert rendering and dismissal behavior via query params
Diagram

graph TD
T["RTL tests"] --> E["ExecuteWorkflowPage"] --> API["Orchestrator API"] --> NAV["Redirect"]
T --> R["WorkflowRunsTabContent"] --> Q("eventTriggered param")
E --> K("Kafka enabled")
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. End-to-end (Cypress/Playwright) with real Kafka/cluster
  • ➕ Highest fidelity validation of the full "Run as Event" pipeline
  • ➕ Catches integration issues across frontend, backend, and infra
  • ➖ Significantly slower and more brittle
  • ➖ Requires Kafka/cluster setup; not ideal for quick regression coverage
2. MSW-powered integration tests (mock HTTP at network boundary)
  • ➕ Closer to real API behavior than direct function mocks
  • ➕ Less coupling to component internals and hook mocking
  • ➖ More setup/maintenance (handlers, fixtures)
  • ➖ Still doesn’t validate Kafka infrastructure, only UI/network behavior
3. Route-level tests using MemoryRouter with fewer Backstage component mocks
  • ➕ Improves confidence in routing/query-param interactions
  • ➕ Reduces test brittleness from heavy component mocking
  • ➖ May require more complex wrapper/setup for Backstage providers
  • ➖ Potentially slower and more verbose per test

Recommendation: Keep the current RTL/unit-style approach: it directly targets the RHIDP-9144 regression surface (payload, redirect, query-param alert) without requiring Kafka/cluster infrastructure. If these tests become brittle due to extensive mocking, consider gradually moving the API layer to MSW to reduce coupling while preserving fast feedback.

Files changed (2) +399 / -0

Tests (2) +399 / -0
ExecuteWorkflowPage.test.tsxAdd RTL tests for Run as Event execute payload and redirects +254/-0

Add RTL tests for Run as Event execute payload and redirects

• Introduces tests for ExecuteWorkflowPage covering the Run as Event click path, asserting 'executeWorkflow' receives 'parameters.isEvent: true' and that navigation redirects to the appropriate runs URL when the returned id is 'kafkaEvent'. Also verifies normal runs navigate to instance pages and that the Run as Event button is hidden when Kafka is disabled.

workspaces/orchestrator/plugins/orchestrator/src/components/ExecuteWorkflowPage/ExecuteWorkflowPage.test.tsx

WorkflowRunsTabContent.test.tsxAdd RTL tests for eventTriggered alert behavior on runs tab +145/-0

Add RTL tests for eventTriggered alert behavior on runs tab

• Adds tests ensuring the runs tab shows an alert when 'eventTriggered=true' is present, hides it when absent, and removes the query param (via 'setSearchParams' with replace) when the alert is dismissed.

workspaces/orchestrator/plugins/orchestrator/src/components/OrchestratorPage/WorkflowRunsTabContent.test.tsx

@rhdh-qodo-merge

rhdh-qodo-merge Bot commented Aug 5, 2026

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Test skips OrchestratorForm path ✓ Resolved 🐞 Bug ≡ Correctness
Description
ExecuteWorkflowPage.test.tsx mocks getWorkflowDataInputSchema to return no inputSchema, so
ExecuteWorkflowPage renders MissingSchemaNotice instead of OrchestratorForm. As a result, the new
“Run as Event UX” tests don’t cover the primary OrchestratorForm integration path and may miss
regressions in OrchestratorForm button wiring/props.
Code

workspaces/orchestrator/plugins/orchestrator/src/components/ExecuteWorkflowPage/ExecuteWorkflowPage.test.tsx[R158-161]

+    mockSearchParams = new URLSearchParams();
+    mockAuthenticate.mockResolvedValue([]);
+    mockGetWorkflowDataInputSchema.mockResolvedValue({ data: {} });
+    mockGetWorkflowOverview.mockResolvedValue({ data: { name: 'WF' } });
Relevance

●●● Strong

Team has accepted requests to add/strengthen test coverage; fixing mocks to hit primary form path is
aligned.

PR-#3758

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The test sets getWorkflowDataInputSchema to resolve { data: {} }, which provides no
inputSchema. ExecuteWorkflowPage derives schema from value?.inputSchema and renders
MissingSchemaNotice when schema is falsy, bypassing OrchestratorForm entirely; additionally,
the test’s module mock for orchestrator-form-react only exports SubmitButton, not
OrchestratorForm, making it hard to cover the intended path without changes.

workspaces/orchestrator/plugins/orchestrator/src/components/ExecuteWorkflowPage/ExecuteWorkflowPage.test.tsx[155-163]
workspaces/orchestrator/plugins/orchestrator/src/components/ExecuteWorkflowPage/ExecuteWorkflowPage.test.tsx[109-135]
workspaces/orchestrator/plugins/orchestrator/src/components/ExecuteWorkflowPage/ExecuteWorkflowPage.tsx[104-119]
workspaces/orchestrator/plugins/orchestrator/src/components/ExecuteWorkflowPage/ExecuteWorkflowPage.tsx[223-253]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`ExecuteWorkflowPage.test.tsx` currently stubs `getWorkflowDataInputSchema` with `{ data: {} }`, which makes `schema` stay `undefined` and forces the component to render `MissingSchemaNotice` instead of the normal `OrchestratorForm` UI. This reduces the intended regression coverage for the Run-as-Event UX.

### Issue Context
`ExecuteWorkflowPage` sets `schema` from `value?.inputSchema` and renders `OrchestratorForm` only when `schema` is truthy.

### Fix Focus Areas
- workspaces/orchestrator/plugins/orchestrator/src/components/ExecuteWorkflowPage/ExecuteWorkflowPage.test.tsx[155-163]
- workspaces/orchestrator/plugins/orchestrator/src/components/ExecuteWorkflowPage/ExecuteWorkflowPage.test.tsx[109-135]

### Suggested fix
1. Update `mockGetWorkflowDataInputSchema` to return a minimal valid `inputSchema`, e.g. `{ data: { inputSchema: { type: 'object', properties: {} }, data: {} } }`, so the page renders `OrchestratorForm`.
2. Adjust the `@red-hat-developer-hub/backstage-plugin-orchestrator-form-react` mock to also export an `OrchestratorForm` test-double (or spread `jest.requireActual(...)` and override only what you need). The stub can render two buttons (run + runAsEvent) that call the provided `handleExecute` / `handleExecuteAsEvent` props with `{}`.
3. Keep the existing assertions, but now they will validate the OrchestratorForm integration path rather than the missing-schema fallback.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context used
✅ Compliance rules (platform): 11 rules
✅ Cross-repo context
  Not relevant to this PR: redhat-developer/rhdh
  Not relevant to this PR: redhat-developer/rhdh-chart
  Not relevant to this PR: redhat-developer/rhdh-operator
  Not relevant to this PR: redhat-developer/rhdh-local

To customize comments, go to the Qodo configuration screen, or learn more in the docs.

Qodo Logo

@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.35%. Comparing base (0f32982) to head (e4ce04f).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4175      +/-   ##
==========================================
+ Coverage   58.11%   58.35%   +0.23%     
==========================================
  Files        2422     2422              
  Lines       96484    96548      +64     
  Branches    26885    26889       +4     
==========================================
+ Hits        56075    56342     +267     
+ Misses      38914    38711     -203     
  Partials     1495     1495              
Flag Coverage Δ *Carryforward flag
adoption-insights 84.55% <ø> (ø) Carriedforward from c1f598b
ai-integrations 69.76% <ø> (ø) Carriedforward from c1f598b
app-defaults 69.79% <ø> (ø) Carriedforward from c1f598b
augment 46.67% <ø> (ø) Carriedforward from c1f598b
boost 76.77% <ø> (ø) Carriedforward from c1f598b
bulk-import 72.56% <ø> (ø) Carriedforward from c1f598b
cost-management 13.55% <ø> (ø) Carriedforward from c1f598b
dcm 60.72% <ø> (ø) Carriedforward from c1f598b
extensions 56.59% <ø> (ø) Carriedforward from c1f598b
global-floating-action-button 71.18% <ø> (ø) Carriedforward from c1f598b
global-header 66.50% <ø> (ø) Carriedforward from c1f598b
homepage 47.59% <ø> (ø) Carriedforward from c1f598b
install-dynamic-plugins 59.95% <ø> (ø) Carriedforward from c1f598b
intelligent-assistant 74.59% <ø> (ø) Carriedforward from c1f598b
konflux 91.98% <ø> (ø) Carriedforward from c1f598b
lightspeed 69.02% <ø> (ø) Carriedforward from c1f598b
mcp-integrations 83.40% <ø> (ø) Carriedforward from c1f598b
orchestrator 69.99% <ø> (+3.12%) ⬆️
quickstart 63.74% <ø> (ø) Carriedforward from c1f598b
sandbox 79.56% <ø> (ø) Carriedforward from c1f598b
scorecard 85.98% <ø> (ø) Carriedforward from c1f598b
theme 88.77% <ø> (ø) Carriedforward from c1f598b
translations 5.12% <ø> (ø) Carriedforward from c1f598b
x2a 79.20% <ø> (ø) Carriedforward from c1f598b

*This pull request uses carry forward flags. Click here to find out more.


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0f32982...e4ce04f. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@rhdh-qodo-merge rhdh-qodo-merge Bot added the Tests label Aug 5, 2026
Drive ExecuteWorkflowPage tests through a schema-backed OrchestratorForm
stub so page-level isEvent/kafkaEvent coverage hits the primary UX path
instead of only MissingSchemaNotice.

Co-authored-by: Cursor <cursoragent@cursor.com>
@sonarqubecloud

sonarqubecloud Bot commented Aug 5, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant