You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kie.apache.org by "kumaradityaraj (via GitHub)" <gi...@apache.org> on 2024/07/23 07:30:00 UTC

[PR] kie-tools-issues#2428: [serverless-workflow-dev-ui-webapp] The reload button doesn't fetch data [incubator-kie-tools]

kumaradityaraj opened a new pull request, #2478:
URL: https://github.com/apache/incubator-kie-tools/pull/2478

   (no comment)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] kie-tools-issues#2428: [serverless-workflow-dev-ui-webapp] The reload button doesn't fetch data [incubator-kie-tools]

Posted by "fantonangeli (via GitHub)" <gi...@apache.org>.
fantonangeli commented on code in PR #2478:
URL: https://github.com/apache/incubator-kie-tools/pull/2478#discussion_r1688056605


##########
packages/runtime-tools-swf-enveloped-components/src/workflowDefinitions/envelope/components/WorkflowDefinitionList/WorkflowDefinitionList.tsx:
##########
@@ -44,6 +44,29 @@ const WorkflowDefinitionList: React.FC<WorkflowDefinitionListProps & OUIAProps>
   const [isLoading, setIsLoading] = useState<boolean>(true);
   const [filterWorkflowNames, setFilterWorkflowNames] = useState<string[]>([]);
   const [error, setError] = useState<string>();
+  const [defaultPageSize] = useState<number>(10);
+  const [isLoadingMore, setIsLoadingMore] = useState<boolean>(false);
+  const [limit, setLimit] = useState<number>(defaultPageSize);
+
+  const doQuery = async (
+    _offset: number,
+    _limit: number,
+    _resetWorkflows: boolean,
+    _resetPagination: boolean = false,
+    _loadMore: boolean = false

Review Comment:
   Same as the previous comment



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] kie-tools#2428: [serverless-workflow-dev-ui-webapp] The reload button doesn't fetch data [incubator-kie-tools]

Posted by "fantonangeli (via GitHub)" <gi...@apache.org>.
fantonangeli commented on code in PR #2478:
URL: https://github.com/apache/incubator-kie-tools/pull/2478#discussion_r1704035096


##########
packages/runtime-tools-swf-enveloped-components/tests/components/WorkflowDefinitionList.test.tsx:
##########
@@ -80,17 +52,13 @@ describe("WorkflowDefinitionList component", () => {
     );
 
     await waitFor(() => {
-      expect(mockGetWorkflowDefinitionsQuery).toHaveBeenCalled();
+      expect(mockDriver.getWorkflowDefinitionsQuery).toHaveBeenCalled();
+      expect(component.queryByText("Test Workflow 2")).toBeInTheDocument();

Review Comment:
   ```suggestion
         expect(component.queryByText("Test Workflow 1")).toBeInTheDocument();
         expect(component.queryByText("Test Workflow 2")).toBeInTheDocument();
   ```



##########
packages/runtime-tools-swf-enveloped-components/tests/components/WorkflowDefinitionList.test.tsx:
##########
@@ -101,26 +69,21 @@ describe("WorkflowDefinitionList component", () => {
       />
     );
 
-    mockGetWorkflowDefinitionFilter.mockResolvedValue(["Test Workflow 1"]);
-    await act(async () => {
-      await mockDriver.setWorkflowDefinitionFilter(["Test Workflow 1"]);
+    await (async () => {
+      await mockDriver.setWorkflowDefinitionFilter();
     });
 
-    expect(mockDriver.setWorkflowDefinitionFilter).toHaveBeenCalledWith(["Test Workflow 1"]);
-    await (() => {
-      const filteredElement = component.getByTestId("workflow-definition-list-with-filter");
-      expect(filteredElement).toBeInTheDocument();
-    });
+    expect(component.queryByText("Test Workflow 1")).toBeInTheDocument();
+    expect(component.queryByText("Test Workflow 2")).toBeInTheDocument();
 
-    mockGetWorkflowDefinitionsQuery.mockResolvedValue(sampleWorkflowDefinitions);
-    await act(async () => {
-      await mockDriver.getWorkflowDefinitionsQuery();
+    fireEvent.change(component.getByPlaceholderText("Filter by workflow name"), {

Review Comment:
   Can we use `getByTestId()` instead of` getByPlaceholderText()` and add `data-testid` html attribute to the component, for a stronger selection?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] kie-tools-issues#2428: [serverless-workflow-dev-ui-webapp] The reload button doesn't fetch data [incubator-kie-tools]

Posted by "fantonangeli (via GitHub)" <gi...@apache.org>.
fantonangeli commented on code in PR #2478:
URL: https://github.com/apache/incubator-kie-tools/pull/2478#discussion_r1687774148


##########
packages/runtime-tools-swf-enveloped-components/src/workflowDefinitions/envelope/components/WorkflowDefinitionList/WorkflowDefinitionList.tsx:
##########
@@ -44,6 +44,29 @@ const WorkflowDefinitionList: React.FC<WorkflowDefinitionListProps & OUIAProps>
   const [isLoading, setIsLoading] = useState<boolean>(true);
   const [filterWorkflowNames, setFilterWorkflowNames] = useState<string[]>([]);
   const [error, setError] = useState<string>();
+  const [defaultPageSize] = useState<number>(10);
+  const [isLoadingMore, setIsLoadingMore] = useState<boolean>(false);
+  const [limit, setLimit] = useState<number>(defaultPageSize);
+
+  const doQuery = async (

Review Comment:
   We can move the logic from `init()` inside the `doQuery()`  and in the `init()` call the `doQuery()`.
   See `WorkflowList.initLoad()` as example.



##########
packages/runtime-tools-swf-enveloped-components/src/workflowDefinitions/envelope/components/WorkflowDefinitionListToolbar/WorkflowDefinitionListToolbar.tsx:
##########
@@ -60,9 +62,8 @@ const WorkflowDefinitionListToolbar: React.FC<WorkflowDefinitionListToolbarProps
     setFilterWorkflowNames([]);
   };
 
-  const doRefresh = (): void => {
-    setFilterWorkflowNames([...filterWorkflowNames]);
-    applyFilter();
+  const refresh = (): void => {

Review Comment:
   I think we can remove the `refresh()` function and call directly the `doRefresh()` received from `WorkflowDefinitionList`.
   Together with this we can rename `doRefresh()` to `refresh()` following the same names and style of `WorkflowListToolbar`



##########
packages/runtime-tools-swf-enveloped-components/src/workflowDefinitions/envelope/components/WorkflowDefinitionList/WorkflowDefinitionList.tsx:
##########
@@ -44,6 +44,29 @@ const WorkflowDefinitionList: React.FC<WorkflowDefinitionListProps & OUIAProps>
   const [isLoading, setIsLoading] = useState<boolean>(true);
   const [filterWorkflowNames, setFilterWorkflowNames] = useState<string[]>([]);
   const [error, setError] = useState<string>();
+  const [defaultPageSize] = useState<number>(10);
+  const [isLoadingMore, setIsLoadingMore] = useState<boolean>(false);
+  const [limit, setLimit] = useState<number>(defaultPageSize);
+
+  const doQuery = async (
+    _offset: number,
+    _limit: number,
+    _resetWorkflows: boolean,
+    _resetPagination: boolean = false,
+    _loadMore: boolean = false

Review Comment:
   Please remove the parameters which we don't use



##########
packages/runtime-tools-swf-enveloped-components/src/workflowDefinitions/envelope/components/WorkflowDefinitionList/WorkflowDefinitionList.tsx:
##########
@@ -44,6 +44,31 @@ const WorkflowDefinitionList: React.FC<WorkflowDefinitionListProps & OUIAProps>
   const [isLoading, setIsLoading] = useState<boolean>(true);
   const [filterWorkflowNames, setFilterWorkflowNames] = useState<string[]>([]);
   const [error, setError] = useState<string>();
+  const [defaultPageSize] = useState<number>(10);
+  const [isLoadingMore, setIsLoadingMore] = useState<boolean>(false);
+  // const [selectableInstances, setSelectableInstances] = useState<number>(0);
+  const [limit, setLimit] = useState<number>(defaultPageSize);

Review Comment:
   These variables are used in `WorkflowList` but we don't need these variables in `WorkflowDefinitionList` 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] kie-tools#2428: [serverless-workflow-dev-ui-webapp] The reload button doesn't fetch data [incubator-kie-tools]

Posted by "kumaradityaraj (via GitHub)" <gi...@apache.org>.
kumaradityaraj commented on PR #2478:
URL: https://github.com/apache/incubator-kie-tools/pull/2478#issuecomment-2247211595

   > Thanks @kumaradityaraj added some comments, will work on the verification in the meantime.
   > 
   > One thing that I see missing is a test related to this. Would it be possible to add some?
   
   @domhanak  I am working on this.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] kie-tools#2428: [serverless-workflow-dev-ui-webapp] The reload button doesn't fetch data [incubator-kie-tools]

Posted by "fantonangeli (via GitHub)" <gi...@apache.org>.
fantonangeli merged PR #2478:
URL: https://github.com/apache/incubator-kie-tools/pull/2478


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] kie-tools#2428: [serverless-workflow-dev-ui-webapp] The reload button doesn't fetch data [incubator-kie-tools]

Posted by "fantonangeli (via GitHub)" <gi...@apache.org>.
fantonangeli commented on code in PR #2478:
URL: https://github.com/apache/incubator-kie-tools/pull/2478#discussion_r1705130966


##########
packages/runtime-tools-swf-enveloped-components/src/workflowDefinitions/envelope/components/WorkflowDefinitionListToolbar/WorkflowDefinitionListToolbar.tsx:
##########
@@ -109,6 +109,7 @@ const WorkflowDefinitionListToolbar: React.FC<WorkflowDefinitionListToolbarProps
               onKeyPress={onEnterClicked}
               placeholder={`Filter by workflow name`}
               value={workflowNameInput}
+              data-testid="workflowFilterInput"

Review Comment:
   Extra small suggestion to follow the repository style for `data-testid`
   ```suggestion
                 data-testid="workflow-filter-input"
   ```



##########
packages/runtime-tools-swf-enveloped-components/tests/components/WorkflowDefinitionList.test.tsx:
##########
@@ -76,7 +77,7 @@ describe("WorkflowDefinitionList component", () => {
     expect(component.queryByText("Test Workflow 1")).toBeInTheDocument();
     expect(component.queryByText("Test Workflow 2")).toBeInTheDocument();
 
-    fireEvent.change(component.getByPlaceholderText("Filter by workflow name"), {
+    fireEvent.change(component.getByTestId("workflowFilterInput"), {

Review Comment:
   ```suggestion
       fireEvent.change(component.getByTestId("workflow-filter-input"), {
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] kie-tools-issues#2428: [serverless-workflow-dev-ui-webapp] The reload button doesn't fetch data [incubator-kie-tools]

Posted by "kumaradityaraj (via GitHub)" <gi...@apache.org>.
kumaradityaraj commented on code in PR #2478:
URL: https://github.com/apache/incubator-kie-tools/pull/2478#discussion_r1687713898


##########
packages/runtime-tools-swf-enveloped-components/src/workflowDefinitions/envelope/components/WorkflowDefinitionList/WorkflowDefinitionList.tsx:
##########
@@ -44,6 +44,31 @@ const WorkflowDefinitionList: React.FC<WorkflowDefinitionListProps & OUIAProps>
   const [isLoading, setIsLoading] = useState<boolean>(true);
   const [filterWorkflowNames, setFilterWorkflowNames] = useState<string[]>([]);
   const [error, setError] = useState<string>();
+  const [defaultPageSize] = useState<number>(10);
+  const [isLoadingMore, setIsLoadingMore] = useState<boolean>(false);
+  // const [selectableInstances, setSelectableInstances] = useState<number>(0);

Review Comment:
   Removed it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] kie-tools#2428: [serverless-workflow-dev-ui-webapp] The reload button doesn't fetch data [incubator-kie-tools]

Posted by "fantonangeli (via GitHub)" <gi...@apache.org>.
fantonangeli commented on code in PR #2478:
URL: https://github.com/apache/incubator-kie-tools/pull/2478#discussion_r1701634388


##########
packages/runtime-tools-swf-enveloped-components/tests/components/WorkflowDefinitionList.test.tsx:
##########
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import * as React from "react";
+import { render, waitFor, screen, fireEvent, act } from "@testing-library/react";
+import "@testing-library/jest-dom";
+import WorkflowDefinitionList from "@kie-tools/runtime-tools-swf-enveloped-components/dist/workflowDefinitions/envelope/components/WorkflowDefinitionList/WorkflowDefinitionList";
+import { WorkflowDefinition } from "@kie-tools/runtime-tools-swf-gateway-api/dist/types";
+
+const mockGetWorkflowDefinitionsQuery = jest.fn();
+const mockSetWorkflowDefinitionList = jest.fn();
+const mockOpenWorkflowForm = jest.fn();
+const mockOpenTriggerCloudEvent = jest.fn();
+const mockSetWorkflowDefinitionFilter = jest.fn();
+const mockGetWorkflowDefinitionFilter = jest.fn();
+
+const mockDriver = {
+  getWorkflowDefinitionsQuery: mockGetWorkflowDefinitionsQuery,

Review Comment:
   to make the code more clear you can simply declare:
   `getWorkflowDefinitionsQuery: jest.fn(),`
   
   Then in the tests you refer to the mock function with:
   `mockDriver.getWorkflowDefinitionsQuery`
   
   The same for the other mocks in `mockDriver`



##########
packages/runtime-tools-swf-enveloped-components/tests/components/WorkflowDefinitionList.test.tsx:
##########
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import * as React from "react";
+import { render, waitFor, screen, fireEvent, act } from "@testing-library/react";
+import "@testing-library/jest-dom";
+import WorkflowDefinitionList from "@kie-tools/runtime-tools-swf-enveloped-components/dist/workflowDefinitions/envelope/components/WorkflowDefinitionList/WorkflowDefinitionList";
+import { WorkflowDefinition } from "@kie-tools/runtime-tools-swf-gateway-api/dist/types";
+
+const mockGetWorkflowDefinitionsQuery = jest.fn();
+const mockSetWorkflowDefinitionList = jest.fn();
+const mockOpenWorkflowForm = jest.fn();
+const mockOpenTriggerCloudEvent = jest.fn();
+const mockSetWorkflowDefinitionFilter = jest.fn();
+const mockGetWorkflowDefinitionFilter = jest.fn();
+
+const mockDriver = {
+  getWorkflowDefinitionsQuery: mockGetWorkflowDefinitionsQuery,
+  openWorkflowForm: mockOpenWorkflowForm,
+  openTriggerCloudEvent: mockOpenTriggerCloudEvent,
+  setWorkflowDefinitionFilter: mockSetWorkflowDefinitionFilter,
+  getWorkflowDefinitionFilter: mockGetWorkflowDefinitionFilter,
+};
+
+const sampleWorkflowDefinitions = [
+  { workflowName: "Test Workflow 1", endpoint: "/endpoint1", serviceUrl: "http://example.com/1" },
+  { workflowName: "Test Workflow 2", endpoint: "/endpoint2", serviceUrl: "http://example.com/2" },
+];
+
+const doQuery = async (): Promise<void> => {
+  const response: WorkflowDefinition[] = await mockDriver.getWorkflowDefinitionsQuery();
+  mockSetWorkflowDefinitionList(response);
+};
+
+describe("doQuery", () => {
+  beforeEach(() => {
+    jest.clearAllMocks();
+  });
+
+  test("should call setWorkflowDefinitionList and setIsLoading correctly on success", async () => {
+    const mockResponse: WorkflowDefinition[] = [
+      { workflowName: "Test Workflow 1", endpoint: "/endpoint1", serviceUrl: "http://example.com/1" },
+    ];
+    mockGetWorkflowDefinitionsQuery.mockResolvedValue(mockResponse);
+    await doQuery();
+    expect(mockSetWorkflowDefinitionList).toHaveBeenCalledWith(mockResponse);
+  });
+});
+
+describe("WorkflowDefinitionList component", () => {
+  beforeEach(() => {
+    jest.clearAllMocks();
+  });
+
+  test("should fetch and set workflow definitions correctly", async () => {
+    mockGetWorkflowDefinitionsQuery.mockResolvedValue(sampleWorkflowDefinitions);
+    render(
+      <WorkflowDefinitionList
+        isEnvelopeConnectedToChannel={true}
+        driver={mockDriver}
+        ouiaId="test-ouia-id"
+        ouiaSafe={true}
+      />
+    );
+
+    await waitFor(() => {
+      expect(mockGetWorkflowDefinitionsQuery).toHaveBeenCalled();
+    });
+  });
+});
+
+describe("WorkflowDefinitionList component", () => {
+  beforeEach(() => {
+    jest.clearAllMocks();
+  });
+  test("should maintain filter after refresh", async () => {
+    mockGetWorkflowDefinitionsQuery.mockResolvedValue(sampleWorkflowDefinitions);
+
+    const component = render(
+      <WorkflowDefinitionList
+        isEnvelopeConnectedToChannel={true}
+        driver={mockDriver}
+        ouiaId="test-ouia-id"
+        ouiaSafe={true}
+      />
+    );
+
+    mockGetWorkflowDefinitionFilter.mockResolvedValue(["Test Workflow 1"]);
+    await act(async () => {
+      await mockDriver.setWorkflowDefinitionFilter(["Test Workflow 1"]);
+    });
+
+    expect(mockDriver.setWorkflowDefinitionFilter).toHaveBeenCalledWith(["Test Workflow 1"]);
+    await (() => {
+      const filteredElement = component.getByTestId("workflow-definition-list-with-filter");
+      expect(filteredElement).toBeInTheDocument();
+    });
+
+    mockGetWorkflowDefinitionsQuery.mockResolvedValue(sampleWorkflowDefinitions);
+    await act(async () => {
+      await mockDriver.getWorkflowDefinitionsQuery();
+    });
+
+    expect(mockDriver.setWorkflowDefinitionFilter).toHaveBeenCalledWith(["Test Workflow 1"]);
+    await (() => {

Review Comment:
   This part of code is also not executed like in my previous comment.



##########
packages/runtime-tools-swf-enveloped-components/tests/components/WorkflowDefinitionList.test.tsx:
##########
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import * as React from "react";
+import { render, waitFor, screen, fireEvent, act } from "@testing-library/react";
+import "@testing-library/jest-dom";
+import WorkflowDefinitionList from "@kie-tools/runtime-tools-swf-enveloped-components/dist/workflowDefinitions/envelope/components/WorkflowDefinitionList/WorkflowDefinitionList";
+import { WorkflowDefinition } from "@kie-tools/runtime-tools-swf-gateway-api/dist/types";
+
+const mockGetWorkflowDefinitionsQuery = jest.fn();
+const mockSetWorkflowDefinitionList = jest.fn();
+const mockOpenWorkflowForm = jest.fn();
+const mockOpenTriggerCloudEvent = jest.fn();
+const mockSetWorkflowDefinitionFilter = jest.fn();
+const mockGetWorkflowDefinitionFilter = jest.fn();
+
+const mockDriver = {
+  getWorkflowDefinitionsQuery: mockGetWorkflowDefinitionsQuery,
+  openWorkflowForm: mockOpenWorkflowForm,
+  openTriggerCloudEvent: mockOpenTriggerCloudEvent,
+  setWorkflowDefinitionFilter: mockSetWorkflowDefinitionFilter,
+  getWorkflowDefinitionFilter: mockGetWorkflowDefinitionFilter,
+};
+
+const sampleWorkflowDefinitions = [
+  { workflowName: "Test Workflow 1", endpoint: "/endpoint1", serviceUrl: "http://example.com/1" },
+  { workflowName: "Test Workflow 2", endpoint: "/endpoint2", serviceUrl: "http://example.com/2" },
+];
+
+const doQuery = async (): Promise<void> => {
+  const response: WorkflowDefinition[] = await mockDriver.getWorkflowDefinitionsQuery();
+  mockSetWorkflowDefinitionList(response);
+};
+
+describe("doQuery", () => {
+  beforeEach(() => {
+    jest.clearAllMocks();
+  });
+
+  test("should call setWorkflowDefinitionList and setIsLoading correctly on success", async () => {
+    const mockResponse: WorkflowDefinition[] = [
+      { workflowName: "Test Workflow 1", endpoint: "/endpoint1", serviceUrl: "http://example.com/1" },
+    ];
+    mockGetWorkflowDefinitionsQuery.mockResolvedValue(mockResponse);
+    await doQuery();
+    expect(mockSetWorkflowDefinitionList).toHaveBeenCalledWith(mockResponse);
+  });
+});
+
+describe("WorkflowDefinitionList component", () => {
+  beforeEach(() => {
+    jest.clearAllMocks();
+  });
+
+  test("should fetch and set workflow definitions correctly", async () => {
+    mockGetWorkflowDefinitionsQuery.mockResolvedValue(sampleWorkflowDefinitions);
+    render(
+      <WorkflowDefinitionList
+        isEnvelopeConnectedToChannel={true}
+        driver={mockDriver}
+        ouiaId="test-ouia-id"
+        ouiaSafe={true}
+      />
+    );
+
+    await waitFor(() => {
+      expect(mockGetWorkflowDefinitionsQuery).toHaveBeenCalled();
+    });
+  });
+});
+
+describe("WorkflowDefinitionList component", () => {
+  beforeEach(() => {
+    jest.clearAllMocks();
+  });
+  test("should maintain filter after refresh", async () => {
+    mockGetWorkflowDefinitionsQuery.mockResolvedValue(sampleWorkflowDefinitions);
+
+    const component = render(
+      <WorkflowDefinitionList
+        isEnvelopeConnectedToChannel={true}
+        driver={mockDriver}
+        ouiaId="test-ouia-id"
+        ouiaSafe={true}
+      />
+    );
+
+    mockGetWorkflowDefinitionFilter.mockResolvedValue(["Test Workflow 1"]);
+    await act(async () => {
+      await mockDriver.setWorkflowDefinitionFilter(["Test Workflow 1"]);
+    });
+
+    expect(mockDriver.setWorkflowDefinitionFilter).toHaveBeenCalledWith(["Test Workflow 1"]);
+    await (() => {

Review Comment:
   This part of code is not executed.
   If you add, for instance, the code below the tests are still green
   `expect(0).toBe(2);` 



##########
packages/runtime-tools-swf-enveloped-components/tests/components/WorkflowDefinitionList.test.tsx:
##########
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import * as React from "react";
+import { render, waitFor, screen, fireEvent, act } from "@testing-library/react";
+import "@testing-library/jest-dom";
+import WorkflowDefinitionList from "@kie-tools/runtime-tools-swf-enveloped-components/dist/workflowDefinitions/envelope/components/WorkflowDefinitionList/WorkflowDefinitionList";
+import { WorkflowDefinition } from "@kie-tools/runtime-tools-swf-gateway-api/dist/types";
+
+const mockGetWorkflowDefinitionsQuery = jest.fn();
+const mockSetWorkflowDefinitionList = jest.fn();
+const mockOpenWorkflowForm = jest.fn();
+const mockOpenTriggerCloudEvent = jest.fn();
+const mockSetWorkflowDefinitionFilter = jest.fn();
+const mockGetWorkflowDefinitionFilter = jest.fn();
+
+const mockDriver = {
+  getWorkflowDefinitionsQuery: mockGetWorkflowDefinitionsQuery,
+  openWorkflowForm: mockOpenWorkflowForm,
+  openTriggerCloudEvent: mockOpenTriggerCloudEvent,
+  setWorkflowDefinitionFilter: mockSetWorkflowDefinitionFilter,
+  getWorkflowDefinitionFilter: mockGetWorkflowDefinitionFilter,
+};
+
+const sampleWorkflowDefinitions = [
+  { workflowName: "Test Workflow 1", endpoint: "/endpoint1", serviceUrl: "http://example.com/1" },
+  { workflowName: "Test Workflow 2", endpoint: "/endpoint2", serviceUrl: "http://example.com/2" },
+];
+
+const doQuery = async (): Promise<void> => {
+  const response: WorkflowDefinition[] = await mockDriver.getWorkflowDefinitionsQuery();
+  mockSetWorkflowDefinitionList(response);
+};
+
+describe("doQuery", () => {
+  beforeEach(() => {
+    jest.clearAllMocks();
+  });
+
+  test("should call setWorkflowDefinitionList and setIsLoading correctly on success", async () => {
+    const mockResponse: WorkflowDefinition[] = [
+      { workflowName: "Test Workflow 1", endpoint: "/endpoint1", serviceUrl: "http://example.com/1" },
+    ];
+    mockGetWorkflowDefinitionsQuery.mockResolvedValue(mockResponse);
+    await doQuery();
+    expect(mockSetWorkflowDefinitionList).toHaveBeenCalledWith(mockResponse);
+  });
+});
+
+describe("WorkflowDefinitionList component", () => {
+  beforeEach(() => {
+    jest.clearAllMocks();
+  });

Review Comment:
   We can remove these lines and merge the 2 describes
   
   ```suggestion
   
   ```



##########
packages/runtime-tools-swf-enveloped-components/src/workflowDefinitions/envelope/components/WorkflowDefinitionList/WorkflowDefinitionList.tsx:
##########
@@ -84,6 +89,12 @@ const WorkflowDefinitionList: React.FC<WorkflowDefinitionListProps & OUIAProps>
     await driver.setWorkflowDefinitionFilter(filterWorkflowNames);
   };
 
+  const doRefresh = async (): Promise<void> => {
+    setIsLoading(true);
+    setFilterWorkflowNames([...filterWorkflowNames]);

Review Comment:
   I guess this doesn't do much and we can remove it
   ```suggestion
       setFilterWorkflowNames([...filterWorkflowNames]);
   ```



##########
packages/runtime-tools-swf-enveloped-components/tests/components/WorkflowDefinitionList.test.tsx:
##########
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import * as React from "react";
+import { render, waitFor, screen, fireEvent, act } from "@testing-library/react";
+import "@testing-library/jest-dom";
+import WorkflowDefinitionList from "@kie-tools/runtime-tools-swf-enveloped-components/dist/workflowDefinitions/envelope/components/WorkflowDefinitionList/WorkflowDefinitionList";
+import { WorkflowDefinition } from "@kie-tools/runtime-tools-swf-gateway-api/dist/types";
+
+const mockGetWorkflowDefinitionsQuery = jest.fn();
+const mockSetWorkflowDefinitionList = jest.fn();
+const mockOpenWorkflowForm = jest.fn();
+const mockOpenTriggerCloudEvent = jest.fn();
+const mockSetWorkflowDefinitionFilter = jest.fn();
+const mockGetWorkflowDefinitionFilter = jest.fn();
+
+const mockDriver = {
+  getWorkflowDefinitionsQuery: mockGetWorkflowDefinitionsQuery,
+  openWorkflowForm: mockOpenWorkflowForm,
+  openTriggerCloudEvent: mockOpenTriggerCloudEvent,
+  setWorkflowDefinitionFilter: mockSetWorkflowDefinitionFilter,
+  getWorkflowDefinitionFilter: mockGetWorkflowDefinitionFilter,
+};
+
+const sampleWorkflowDefinitions = [
+  { workflowName: "Test Workflow 1", endpoint: "/endpoint1", serviceUrl: "http://example.com/1" },
+  { workflowName: "Test Workflow 2", endpoint: "/endpoint2", serviceUrl: "http://example.com/2" },
+];
+
+const doQuery = async (): Promise<void> => {
+  const response: WorkflowDefinition[] = await mockDriver.getWorkflowDefinitionsQuery();
+  mockSetWorkflowDefinitionList(response);
+};
+
+describe("doQuery", () => {

Review Comment:
   We can remove this block of describe as we cannot test the real `doQuery` inside the component and also the `doQuery()` implementation in this file.



##########
packages/runtime-tools-swf-enveloped-components/tests/components/WorkflowDefinitionList.test.tsx:
##########
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import * as React from "react";
+import { render, waitFor, screen, fireEvent, act } from "@testing-library/react";
+import "@testing-library/jest-dom";
+import WorkflowDefinitionList from "@kie-tools/runtime-tools-swf-enveloped-components/dist/workflowDefinitions/envelope/components/WorkflowDefinitionList/WorkflowDefinitionList";
+import { WorkflowDefinition } from "@kie-tools/runtime-tools-swf-gateway-api/dist/types";
+
+const mockGetWorkflowDefinitionsQuery = jest.fn();
+const mockSetWorkflowDefinitionList = jest.fn();
+const mockOpenWorkflowForm = jest.fn();
+const mockOpenTriggerCloudEvent = jest.fn();
+const mockSetWorkflowDefinitionFilter = jest.fn();
+const mockGetWorkflowDefinitionFilter = jest.fn();
+
+const mockDriver = {
+  getWorkflowDefinitionsQuery: mockGetWorkflowDefinitionsQuery,
+  openWorkflowForm: mockOpenWorkflowForm,
+  openTriggerCloudEvent: mockOpenTriggerCloudEvent,
+  setWorkflowDefinitionFilter: mockSetWorkflowDefinitionFilter,
+  getWorkflowDefinitionFilter: mockGetWorkflowDefinitionFilter,
+};
+
+const sampleWorkflowDefinitions = [
+  { workflowName: "Test Workflow 1", endpoint: "/endpoint1", serviceUrl: "http://example.com/1" },
+  { workflowName: "Test Workflow 2", endpoint: "/endpoint2", serviceUrl: "http://example.com/2" },
+];
+
+const doQuery = async (): Promise<void> => {
+  const response: WorkflowDefinition[] = await mockDriver.getWorkflowDefinitionsQuery();
+  mockSetWorkflowDefinitionList(response);
+};
+
+describe("doQuery", () => {
+  beforeEach(() => {
+    jest.clearAllMocks();
+  });
+
+  test("should call setWorkflowDefinitionList and setIsLoading correctly on success", async () => {
+    const mockResponse: WorkflowDefinition[] = [
+      { workflowName: "Test Workflow 1", endpoint: "/endpoint1", serviceUrl: "http://example.com/1" },
+    ];
+    mockGetWorkflowDefinitionsQuery.mockResolvedValue(mockResponse);
+    await doQuery();
+    expect(mockSetWorkflowDefinitionList).toHaveBeenCalledWith(mockResponse);
+  });
+});
+
+describe("WorkflowDefinitionList component", () => {
+  beforeEach(() => {
+    jest.clearAllMocks();
+  });
+
+  test("should fetch and set workflow definitions correctly", async () => {
+    mockGetWorkflowDefinitionsQuery.mockResolvedValue(sampleWorkflowDefinitions);
+    render(
+      <WorkflowDefinitionList
+        isEnvelopeConnectedToChannel={true}
+        driver={mockDriver}
+        ouiaId="test-ouia-id"
+        ouiaSafe={true}
+      />
+    );
+
+    await waitFor(() => {
+      expect(mockGetWorkflowDefinitionsQuery).toHaveBeenCalled();
+    });
+  });
+});
+
+describe("WorkflowDefinitionList component", () => {
+  beforeEach(() => {
+    jest.clearAllMocks();
+  });
+  test("should maintain filter after refresh", async () => {

Review Comment:
   In this test I would do these actions to test:
   - verify "Test Workflow 1" is in the document
     `      expect(component.queryByText("Test Workflow 1")).toBeInTheDocument();`
   - verify "Test Workflow 2" is in the document
   - set the filter to "Test Workflow 1" (if you need you can add the `data-testid` in the real component)
     example: https://github.com/apache/incubator-kie-tools/blob/6697b9d6be9320d54a92d9c5d72c71f22e922493/packages/uniforms-patternfly/tests/DateField.test.tsx#L96
   - click on "Apply filter" (data-testid: "apply-filter")
   - verify "Test Workflow 2" is NOT in the document
   `      expect(component.queryByText("Test Workflow 2")).not.toBeInTheDocument();`
   - click on refresh button (data-testid: "refresh")
   - verify "Test Workflow 2" is NOT in the document
   
   In the next comments, I review the single parts of the code.



##########
packages/runtime-tools-swf-enveloped-components/tests/components/WorkflowDefinitionList.test.tsx:
##########
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import * as React from "react";
+import { render, waitFor, screen, fireEvent, act } from "@testing-library/react";
+import "@testing-library/jest-dom";
+import WorkflowDefinitionList from "@kie-tools/runtime-tools-swf-enveloped-components/dist/workflowDefinitions/envelope/components/WorkflowDefinitionList/WorkflowDefinitionList";
+import { WorkflowDefinition } from "@kie-tools/runtime-tools-swf-gateway-api/dist/types";
+
+const mockGetWorkflowDefinitionsQuery = jest.fn();
+const mockSetWorkflowDefinitionList = jest.fn();
+const mockOpenWorkflowForm = jest.fn();
+const mockOpenTriggerCloudEvent = jest.fn();
+const mockSetWorkflowDefinitionFilter = jest.fn();
+const mockGetWorkflowDefinitionFilter = jest.fn();
+
+const mockDriver = {
+  getWorkflowDefinitionsQuery: mockGetWorkflowDefinitionsQuery,
+  openWorkflowForm: mockOpenWorkflowForm,
+  openTriggerCloudEvent: mockOpenTriggerCloudEvent,
+  setWorkflowDefinitionFilter: mockSetWorkflowDefinitionFilter,
+  getWorkflowDefinitionFilter: mockGetWorkflowDefinitionFilter,
+};
+
+const sampleWorkflowDefinitions = [
+  { workflowName: "Test Workflow 1", endpoint: "/endpoint1", serviceUrl: "http://example.com/1" },
+  { workflowName: "Test Workflow 2", endpoint: "/endpoint2", serviceUrl: "http://example.com/2" },
+];
+
+const doQuery = async (): Promise<void> => {
+  const response: WorkflowDefinition[] = await mockDriver.getWorkflowDefinitionsQuery();
+  mockSetWorkflowDefinitionList(response);
+};
+
+describe("doQuery", () => {
+  beforeEach(() => {
+    jest.clearAllMocks();
+  });
+
+  test("should call setWorkflowDefinitionList and setIsLoading correctly on success", async () => {
+    const mockResponse: WorkflowDefinition[] = [
+      { workflowName: "Test Workflow 1", endpoint: "/endpoint1", serviceUrl: "http://example.com/1" },
+    ];
+    mockGetWorkflowDefinitionsQuery.mockResolvedValue(mockResponse);
+    await doQuery();
+    expect(mockSetWorkflowDefinitionList).toHaveBeenCalledWith(mockResponse);
+  });
+});
+
+describe("WorkflowDefinitionList component", () => {
+  beforeEach(() => {
+    jest.clearAllMocks();
+  });
+
+  test("should fetch and set workflow definitions correctly", async () => {
+    mockGetWorkflowDefinitionsQuery.mockResolvedValue(sampleWorkflowDefinitions);
+    render(
+      <WorkflowDefinitionList
+        isEnvelopeConnectedToChannel={true}
+        driver={mockDriver}
+        ouiaId="test-ouia-id"
+        ouiaSafe={true}
+      />
+    );
+
+    await waitFor(() => {
+      expect(mockGetWorkflowDefinitionsQuery).toHaveBeenCalled();

Review Comment:
   We can add this to verify all the workflows are showed
   ```suggestion
         expect(mockGetWorkflowDefinitionsQuery).toHaveBeenCalled();
         expect(component.queryByText("Test Workflow 2")).toBeInTheDocument();
   ```



##########
packages/runtime-tools-swf-enveloped-components/tests/components/WorkflowDefinitionList.test.tsx:
##########
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import * as React from "react";
+import { render, waitFor, screen, fireEvent, act } from "@testing-library/react";
+import "@testing-library/jest-dom";
+import WorkflowDefinitionList from "@kie-tools/runtime-tools-swf-enveloped-components/dist/workflowDefinitions/envelope/components/WorkflowDefinitionList/WorkflowDefinitionList";
+import { WorkflowDefinition } from "@kie-tools/runtime-tools-swf-gateway-api/dist/types";
+
+const mockGetWorkflowDefinitionsQuery = jest.fn();
+const mockSetWorkflowDefinitionList = jest.fn();
+const mockOpenWorkflowForm = jest.fn();
+const mockOpenTriggerCloudEvent = jest.fn();
+const mockSetWorkflowDefinitionFilter = jest.fn();
+const mockGetWorkflowDefinitionFilter = jest.fn();
+
+const mockDriver = {
+  getWorkflowDefinitionsQuery: mockGetWorkflowDefinitionsQuery,
+  openWorkflowForm: mockOpenWorkflowForm,
+  openTriggerCloudEvent: mockOpenTriggerCloudEvent,
+  setWorkflowDefinitionFilter: mockSetWorkflowDefinitionFilter,
+  getWorkflowDefinitionFilter: mockGetWorkflowDefinitionFilter,
+};
+
+const sampleWorkflowDefinitions = [
+  { workflowName: "Test Workflow 1", endpoint: "/endpoint1", serviceUrl: "http://example.com/1" },
+  { workflowName: "Test Workflow 2", endpoint: "/endpoint2", serviceUrl: "http://example.com/2" },
+];
+
+const doQuery = async (): Promise<void> => {
+  const response: WorkflowDefinition[] = await mockDriver.getWorkflowDefinitionsQuery();
+  mockSetWorkflowDefinitionList(response);
+};
+
+describe("doQuery", () => {
+  beforeEach(() => {
+    jest.clearAllMocks();
+  });
+
+  test("should call setWorkflowDefinitionList and setIsLoading correctly on success", async () => {
+    const mockResponse: WorkflowDefinition[] = [
+      { workflowName: "Test Workflow 1", endpoint: "/endpoint1", serviceUrl: "http://example.com/1" },
+    ];
+    mockGetWorkflowDefinitionsQuery.mockResolvedValue(mockResponse);
+    await doQuery();
+    expect(mockSetWorkflowDefinitionList).toHaveBeenCalledWith(mockResponse);
+  });
+});
+
+describe("WorkflowDefinitionList component", () => {
+  beforeEach(() => {
+    jest.clearAllMocks();
+  });
+
+  test("should fetch and set workflow definitions correctly", async () => {
+    mockGetWorkflowDefinitionsQuery.mockResolvedValue(sampleWorkflowDefinitions);
+    render(
+      <WorkflowDefinitionList
+        isEnvelopeConnectedToChannel={true}
+        driver={mockDriver}
+        ouiaId="test-ouia-id"
+        ouiaSafe={true}
+      />
+    );
+
+    await waitFor(() => {
+      expect(mockGetWorkflowDefinitionsQuery).toHaveBeenCalled();
+    });
+  });
+});
+
+describe("WorkflowDefinitionList component", () => {
+  beforeEach(() => {
+    jest.clearAllMocks();
+  });
+  test("should maintain filter after refresh", async () => {
+    mockGetWorkflowDefinitionsQuery.mockResolvedValue(sampleWorkflowDefinitions);
+
+    const component = render(
+      <WorkflowDefinitionList
+        isEnvelopeConnectedToChannel={true}
+        driver={mockDriver}
+        ouiaId="test-ouia-id"
+        ouiaSafe={true}
+      />
+    );
+
+    mockGetWorkflowDefinitionFilter.mockResolvedValue(["Test Workflow 1"]);
+    await act(async () => {
+      await mockDriver.setWorkflowDefinitionFilter(["Test Workflow 1"]);

Review Comment:
   This has no effect on the page as the workflows definition list is filtered by the filterWorkflowNames state.
   I think we can remove all the calls and expect to `setWorkflowDefinitionFilter` from the test.
   Please correct me if I'm wrong.



##########
packages/runtime-tools-swf-enveloped-components/tests/components/WorkflowDefinitionList.test.tsx:
##########
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import * as React from "react";
+import { render, waitFor, screen, fireEvent, act } from "@testing-library/react";
+import "@testing-library/jest-dom";
+import WorkflowDefinitionList from "@kie-tools/runtime-tools-swf-enveloped-components/dist/workflowDefinitions/envelope/components/WorkflowDefinitionList/WorkflowDefinitionList";
+import { WorkflowDefinition } from "@kie-tools/runtime-tools-swf-gateway-api/dist/types";
+
+const mockGetWorkflowDefinitionsQuery = jest.fn();
+const mockSetWorkflowDefinitionList = jest.fn();
+const mockOpenWorkflowForm = jest.fn();
+const mockOpenTriggerCloudEvent = jest.fn();
+const mockSetWorkflowDefinitionFilter = jest.fn();
+const mockGetWorkflowDefinitionFilter = jest.fn();
+
+const mockDriver = {
+  getWorkflowDefinitionsQuery: mockGetWorkflowDefinitionsQuery,
+  openWorkflowForm: mockOpenWorkflowForm,
+  openTriggerCloudEvent: mockOpenTriggerCloudEvent,
+  setWorkflowDefinitionFilter: mockSetWorkflowDefinitionFilter,
+  getWorkflowDefinitionFilter: mockGetWorkflowDefinitionFilter,
+};
+
+const sampleWorkflowDefinitions = [
+  { workflowName: "Test Workflow 1", endpoint: "/endpoint1", serviceUrl: "http://example.com/1" },
+  { workflowName: "Test Workflow 2", endpoint: "/endpoint2", serviceUrl: "http://example.com/2" },
+];
+
+const doQuery = async (): Promise<void> => {
+  const response: WorkflowDefinition[] = await mockDriver.getWorkflowDefinitionsQuery();
+  mockSetWorkflowDefinitionList(response);
+};
+
+describe("doQuery", () => {
+  beforeEach(() => {
+    jest.clearAllMocks();
+  });
+
+  test("should call setWorkflowDefinitionList and setIsLoading correctly on success", async () => {
+    const mockResponse: WorkflowDefinition[] = [
+      { workflowName: "Test Workflow 1", endpoint: "/endpoint1", serviceUrl: "http://example.com/1" },
+    ];
+    mockGetWorkflowDefinitionsQuery.mockResolvedValue(mockResponse);
+    await doQuery();
+    expect(mockSetWorkflowDefinitionList).toHaveBeenCalledWith(mockResponse);
+  });
+});
+
+describe("WorkflowDefinitionList component", () => {
+  beforeEach(() => {
+    jest.clearAllMocks();
+  });
+
+  test("should fetch and set workflow definitions correctly", async () => {
+    mockGetWorkflowDefinitionsQuery.mockResolvedValue(sampleWorkflowDefinitions);
+    render(
+      <WorkflowDefinitionList
+        isEnvelopeConnectedToChannel={true}
+        driver={mockDriver}
+        ouiaId="test-ouia-id"
+        ouiaSafe={true}
+      />
+    );
+
+    await waitFor(() => {
+      expect(mockGetWorkflowDefinitionsQuery).toHaveBeenCalled();
+    });
+  });
+});
+
+describe("WorkflowDefinitionList component", () => {
+  beforeEach(() => {
+    jest.clearAllMocks();
+  });
+  test("should maintain filter after refresh", async () => {
+    mockGetWorkflowDefinitionsQuery.mockResolvedValue(sampleWorkflowDefinitions);
+
+    const component = render(
+      <WorkflowDefinitionList
+        isEnvelopeConnectedToChannel={true}
+        driver={mockDriver}
+        ouiaId="test-ouia-id"
+        ouiaSafe={true}
+      />
+    );
+
+    mockGetWorkflowDefinitionFilter.mockResolvedValue(["Test Workflow 1"]);

Review Comment:
   In the current logic of the page `driver.getWorkflowDefinitionsQuery()` always returns all the elements and then they are filtered client-side.
   I think it's better to use `sampleWorkflowDefinitions` as a resolved value, to keep the test following the real logic.
   ```suggestion
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] kie-tools-issues#2428: [serverless-workflow-dev-ui-webapp] The reload button doesn't fetch data [incubator-kie-tools]

Posted by "kumaradityaraj (via GitHub)" <gi...@apache.org>.
kumaradityaraj commented on PR #2478:
URL: https://github.com/apache/incubator-kie-tools/pull/2478#issuecomment-2244469504

   @fantonangeli 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] kie-tools-issues#2428: [serverless-workflow-dev-ui-webapp] The reload button doesn't fetch data [incubator-kie-tools]

Posted by "fantonangeli (via GitHub)" <gi...@apache.org>.
fantonangeli commented on code in PR #2478:
URL: https://github.com/apache/incubator-kie-tools/pull/2478#discussion_r1688052320


##########
packages/runtime-tools-swf-enveloped-components/src/workflowDefinitions/envelope/components/WorkflowDefinitionList/WorkflowDefinitionList.tsx:
##########
@@ -44,6 +44,31 @@ const WorkflowDefinitionList: React.FC<WorkflowDefinitionListProps & OUIAProps>
   const [isLoading, setIsLoading] = useState<boolean>(true);
   const [filterWorkflowNames, setFilterWorkflowNames] = useState<string[]>([]);
   const [error, setError] = useState<string>();
+  const [defaultPageSize] = useState<number>(10);
+  const [isLoadingMore, setIsLoadingMore] = useState<boolean>(false);
+  // const [selectableInstances, setSelectableInstances] = useState<number>(0);
+  const [limit, setLimit] = useState<number>(defaultPageSize);

Review Comment:
   I still can see these variables in the code but they are not used in `WorkflowDefinitionList`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] kie-tools-issues#2428: [serverless-workflow-dev-ui-webapp] The reload button doesn't fetch data [incubator-kie-tools]

Posted by "domhanak (via GitHub)" <gi...@apache.org>.
domhanak commented on code in PR #2478:
URL: https://github.com/apache/incubator-kie-tools/pull/2478#discussion_r1687601624


##########
packages/runtime-tools-swf-enveloped-components/src/workflowDefinitions/envelope/components/WorkflowDefinitionList/WorkflowDefinitionList.tsx:
##########
@@ -44,6 +44,31 @@ const WorkflowDefinitionList: React.FC<WorkflowDefinitionListProps & OUIAProps>
   const [isLoading, setIsLoading] = useState<boolean>(true);
   const [filterWorkflowNames, setFilterWorkflowNames] = useState<string[]>([]);
   const [error, setError] = useState<string>();
+  const [defaultPageSize] = useState<number>(10);
+  const [isLoadingMore, setIsLoadingMore] = useState<boolean>(false);
+  // const [selectableInstances, setSelectableInstances] = useState<number>(0);
+  const [limit, setLimit] = useState<number>(defaultPageSize);
+
+  const doQuery = async (
+    _offset: number,
+    _limit: number,
+    _resetWorkflows: boolean,
+    _resetPagination: boolean = false,
+    _loadMore: boolean = false
+  ): Promise<void> => {
+    setIsLoadingMore(_loadMore);
+    // setSelectableInstances(0);

Review Comment:
   commented code



##########
packages/sonataflow-operator/config/manager/kustomization.yaml:
##########
@@ -41,7 +41,7 @@ kind: Kustomization
 images:
   - name: controller
     newName: docker.io/apache/incubator-kie-sonataflow-operator
-    newTag: main
+    newTag: 0.0.0

Review Comment:
   Not sure if this shouldn't be left as `main`. See - https://hub.docker.com/r/apache/incubator-kie-sonataflow-operator/tags



##########
packages/runtime-tools-swf-enveloped-components/src/workflowDefinitions/envelope/components/WorkflowDefinitionList/WorkflowDefinitionList.tsx:
##########
@@ -44,6 +44,31 @@ const WorkflowDefinitionList: React.FC<WorkflowDefinitionListProps & OUIAProps>
   const [isLoading, setIsLoading] = useState<boolean>(true);
   const [filterWorkflowNames, setFilterWorkflowNames] = useState<string[]>([]);
   const [error, setError] = useState<string>();
+  const [defaultPageSize] = useState<number>(10);
+  const [isLoadingMore, setIsLoadingMore] = useState<boolean>(false);
+  // const [selectableInstances, setSelectableInstances] = useState<number>(0);

Review Comment:
   commented code



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] kie-tools-issues#2428: [serverless-workflow-dev-ui-webapp] The reload button doesn't fetch data [incubator-kie-tools]

Posted by "kumaradityaraj (via GitHub)" <gi...@apache.org>.
kumaradityaraj commented on PR #2478:
URL: https://github.com/apache/incubator-kie-tools/pull/2478#issuecomment-2245081264

   @fantonangeli  please review it once again; implemented all the changes as mentioned in the comments.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] kie-tools-issues#2428: [serverless-workflow-dev-ui-webapp] The reload button doesn't fetch data [incubator-kie-tools]

Posted by "kumaradityaraj (via GitHub)" <gi...@apache.org>.
kumaradityaraj commented on code in PR #2478:
URL: https://github.com/apache/incubator-kie-tools/pull/2478#discussion_r1687714349


##########
packages/runtime-tools-swf-enveloped-components/src/workflowDefinitions/envelope/components/WorkflowDefinitionList/WorkflowDefinitionList.tsx:
##########
@@ -44,6 +44,31 @@ const WorkflowDefinitionList: React.FC<WorkflowDefinitionListProps & OUIAProps>
   const [isLoading, setIsLoading] = useState<boolean>(true);
   const [filterWorkflowNames, setFilterWorkflowNames] = useState<string[]>([]);
   const [error, setError] = useState<string>();
+  const [defaultPageSize] = useState<number>(10);
+  const [isLoadingMore, setIsLoadingMore] = useState<boolean>(false);
+  // const [selectableInstances, setSelectableInstances] = useState<number>(0);
+  const [limit, setLimit] = useState<number>(defaultPageSize);
+
+  const doQuery = async (
+    _offset: number,
+    _limit: number,
+    _resetWorkflows: boolean,
+    _resetPagination: boolean = false,
+    _loadMore: boolean = false
+  ): Promise<void> => {
+    setIsLoadingMore(_loadMore);
+    // setSelectableInstances(0);

Review Comment:
   Removed it.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org