|
| 1 | +import { test, expect } from "@red-hat-developer-hub/e2e-test-utils/test"; |
| 2 | +import { cleanupGreetingComponentEntity } from "../support/utils/catalog-helpers.js"; |
| 3 | +import { ensureDataIndexOrSkip } from "../support/utils/cluster-helpers.js"; |
| 4 | +import { OrchestratorUiPage } from "../support/pages/orchestrator-po.js"; |
| 5 | + |
| 6 | +/** |
| 7 | + * RHIDP-11833 through RHIDP-11838: Entity-Workflow Integration Tests |
| 8 | + * |
| 9 | + * These tests verify the integration between RHDH catalog entities and |
| 10 | + * Orchestrator workflows, including: |
| 11 | + * - EntityPicker-based entity association |
| 12 | + * - orchestrator.io/workflows annotation behavior |
| 13 | + * - Workflows tab visibility on entity pages |
| 14 | + * - Catalog <-> Workflows breadcrumb navigation |
| 15 | + * - Template execution -> workflow run linkage |
| 16 | + * |
| 17 | + * Templates used (from testetson22/greeting_54mjks on GitHub): |
| 18 | + * - greeting.yaml: name=greeting, title="Greeting workflow" - NO orchestrator.io/workflows annotation |
| 19 | + * - greeting_w_component.yaml: name=greetingComponent, title="Greeting Test Picker" - HAS annotation |
| 20 | + * |
| 21 | + * These are scaffolder templates that use the orchestrator:workflow:run action |
| 22 | + * to trigger the "greeting" SonataFlow workflow deployed by CI. |
| 23 | + */ |
| 24 | +export function registerOrchestratorEntityWorkflowTests(): void { |
| 25 | + test.describe("Entity-Workflow Integration", () => { |
| 26 | + let orchestratorUi: OrchestratorUiPage; |
| 27 | + |
| 28 | + test.beforeEach(async ({ page, loginHelper }, testInfo) => { |
| 29 | + orchestratorUi = new OrchestratorUiPage(page); |
| 30 | + await loginHelper.loginAsKeycloakUser(); |
| 31 | + await ensureDataIndexOrSkip(testInfo.project.name, test); |
| 32 | + }); |
| 33 | + |
| 34 | + test.afterAll(async () => { |
| 35 | + await cleanupGreetingComponentEntity(); |
| 36 | + }); |
| 37 | + |
| 38 | + test("RHIDP-11833: Run workflow with existing entity", async ({ |
| 39 | + uiHelper, |
| 40 | + }) => { |
| 41 | + await orchestratorUi.launchGreetingTemplateFromSelfService(uiHelper, { |
| 42 | + entityName: `test-entity-${Date.now()}`, |
| 43 | + selectEnglishIfVisible: true, |
| 44 | + }); |
| 45 | + await expect( |
| 46 | + orchestratorUi.workflowLink(/Greeting workflow/i), |
| 47 | + ).toBeVisible(); |
| 48 | + await orchestratorUi.expectWorkflowHeading(/Greeting workflow/i); |
| 49 | + }); |
| 50 | + |
| 51 | + test("RHIDP-11834: Show workflow for annotated template", async ({ |
| 52 | + uiHelper, |
| 53 | + }) => { |
| 54 | + await orchestratorUi.openGreetingTemplateFromCatalog(uiHelper); |
| 55 | + await orchestratorUi.clickWorkflowsTab(); |
| 56 | + await expect( |
| 57 | + orchestratorUi.workflowLink("Greeting workflow"), |
| 58 | + ).toBeVisible(); |
| 59 | + await orchestratorUi.expectWorkflowVisible("Greeting workflow"); |
| 60 | + }); |
| 61 | + |
| 62 | + test("RHIDP-11835: Hide workflow for unannotated template", async ({ |
| 63 | + uiHelper, |
| 64 | + }) => { |
| 65 | + await orchestratorUi.openTemplateFromCatalog( |
| 66 | + uiHelper, |
| 67 | + /Greeting workflow/i, |
| 68 | + ); |
| 69 | + await orchestratorUi.expectWorkflowMissingInEntityTab( |
| 70 | + "Greeting workflow", |
| 71 | + ); |
| 72 | + await expect( |
| 73 | + orchestratorUi.workflowLink("Greeting workflow"), |
| 74 | + ).toHaveCount(0); |
| 75 | + }); |
| 76 | + |
| 77 | + test("RHIDP-11836: Navigate Catalog and Workflows via breadcrumb", async ({ |
| 78 | + uiHelper, |
| 79 | + page, |
| 80 | + }) => { |
| 81 | + await orchestratorUi.openGreetingTemplateFromCatalog(uiHelper); |
| 82 | + await orchestratorUi.clickWorkflowsTab(); |
| 83 | + await orchestratorUi.openGreetingWorkflowFromEntityTab(); |
| 84 | + await orchestratorUi.openEntityFromBreadcrumb( |
| 85 | + "greetingComponent", |
| 86 | + /Greeting Test Picker/i, |
| 87 | + ); |
| 88 | + await expect(page).toHaveURL( |
| 89 | + /\/catalog\/default\/template\/greetingcomponent(?:\/workflows)?/i, |
| 90 | + ); |
| 91 | + }); |
| 92 | + |
| 93 | + test("RHIDP-11837: Show workflow runs after template run", async ({ |
| 94 | + uiHelper, |
| 95 | + }) => { |
| 96 | + await orchestratorUi.launchGreetingTemplateFromSelfService(uiHelper, { |
| 97 | + entityName: `test-entity-${Date.now()}`, |
| 98 | + selectEnglishIfVisible: true, |
| 99 | + }); |
| 100 | + await orchestratorUi.gotoWorkflows(uiHelper, false); |
| 101 | + await expect( |
| 102 | + orchestratorUi.workflowLink(/Greeting workflow/i), |
| 103 | + ).toBeVisible(); |
| 104 | + await orchestratorUi.expectWorkflowVisible(/Greeting workflow/i); |
| 105 | + }); |
| 106 | + |
| 107 | + test("RHIDP-11838: Show Workflows tab with dynamic plugin config", async ({ |
| 108 | + uiHelper, |
| 109 | + }) => { |
| 110 | + await orchestratorUi.openGreetingTemplateFromCatalog(uiHelper); |
| 111 | + await orchestratorUi.clickWorkflowsTab(); |
| 112 | + await expect( |
| 113 | + orchestratorUi.workflowLink("Greeting workflow"), |
| 114 | + ).toBeVisible(); |
| 115 | + await orchestratorUi.expectWorkflowVisible("Greeting workflow"); |
| 116 | + }); |
| 117 | + }); |
| 118 | +} |
0 commit comments