diff --git a/app/client/src/pages/Editor/QueryEditor/QueryResponseTab.test.tsx b/app/client/src/pages/Editor/QueryEditor/QueryResponseTab.test.tsx
index 2ddca2cbc9bf..33141b35f1a2 100644
--- a/app/client/src/pages/Editor/QueryEditor/QueryResponseTab.test.tsx
+++ b/app/client/src/pages/Editor/QueryEditor/QueryResponseTab.test.tsx
@@ -1,5 +1,6 @@
import React from "react";
-import { render } from "@testing-library/react";
+import { render, screen } from "@testing-library/react";
+import '@testing-library/jest-dom/extend-expect';
import { Provider } from "react-redux";
import configureStore from "redux-mock-store";
import QueryResponseTab from "./QueryResponseTab";
@@ -194,4 +195,30 @@ describe("QueryResponseTab", () => {
container.querySelector("[data-testid='t--prepared-statement-warning']"),
).toBeNull();
});
+ it("6. Check if run button is disabled when query is empty", () => {
+ const propsWithEmptyQuery = {
+ ...defaultProps,
+ isRunDisabled: true,
+ currentActionConfig: {
+ ...defaultProps.currentActionConfig,
+ actionConfiguration: {
+ ...defaultProps.currentActionConfig.actionConfiguration,
+ body: "",
+ },
+ },
+ };
+
+ render(
+
+
+
+
+
+
+ ,
+ );
+
+ const runButton = screen.getByRole('button');
+ expect(runButton).toBeDisabled();
+ });
});
diff --git a/app/client/src/pages/Editor/QueryEditor/QueryResponseTab.tsx b/app/client/src/pages/Editor/QueryEditor/QueryResponseTab.tsx
index fa73e1ae1ef2..27d741fb550b 100644
--- a/app/client/src/pages/Editor/QueryEditor/QueryResponseTab.tsx
+++ b/app/client/src/pages/Editor/QueryEditor/QueryResponseTab.tsx
@@ -96,6 +96,7 @@ const QueryResponseTab = (props: Props) => {
isFeatureEnabled,
currentActionConfig?.userPermissions,
);
+ const isQueryEmpty = !currentActionConfig?.actionConfiguration?.body;
const actionResponse = useSelector((state) =>
getActionData(state, currentActionConfig.id),
@@ -345,7 +346,7 @@ const QueryResponseTab = (props: Props) => {
)}
{!output && !error && (