From a49c9efd4edaf8d4ca77f256c0854621e73f0158 Mon Sep 17 00:00:00 2001 From: Aman Agarwal Date: Wed, 8 May 2024 12:11:03 +0530 Subject: [PATCH 1/8] fix: allowing bottom tabs to be selectable as text --- .../src/components/editorComponents/ApiResponseView.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/client/src/components/editorComponents/ApiResponseView.tsx b/app/client/src/components/editorComponents/ApiResponseView.tsx index 0c3530f7762d..040a0adac167 100644 --- a/app/client/src/components/editorComponents/ApiResponseView.tsx +++ b/app/client/src/components/editorComponents/ApiResponseView.tsx @@ -546,7 +546,10 @@ function ApiResponseView(props: Props) { if (!open) return null; return ( - + { From a6fb06e525b7cb5b74930a217b7b5f14ecb3e42d Mon Sep 17 00:00:00 2001 From: Aman Agarwal Date: Wed, 8 May 2024 12:49:49 +0530 Subject: [PATCH 2/8] fix: allowing bottom tabs to be selectable as text --- app/client/src/components/editorComponents/JSResponseView.tsx | 2 +- app/client/src/pages/Editor/DataSourceEditor/Debugger.tsx | 2 +- app/client/src/pages/Editor/QueryEditor/QueryDebuggerTabs.tsx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/client/src/components/editorComponents/JSResponseView.tsx b/app/client/src/components/editorComponents/JSResponseView.tsx index 3659f2c471cc..2e8580edf879 100644 --- a/app/client/src/components/editorComponents/JSResponseView.tsx +++ b/app/client/src/components/editorComponents/JSResponseView.tsx @@ -336,7 +336,7 @@ function JSResponseView(props: Props) { // Do not render if header tab is selected in the bottom bar. return open && selectedTab ? ( Date: Thu, 9 May 2024 17:02:21 +0530 Subject: [PATCH 3/8] fix: added tag debugger in tags.js --- app/client/cypress/tags.js | 1 + 1 file changed, 1 insertion(+) diff --git a/app/client/cypress/tags.js b/app/client/cypress/tags.js index 8c613c9ba391..c4636c716309 100644 --- a/app/client/cypress/tags.js +++ b/app/client/cypress/tags.js @@ -68,5 +68,6 @@ module.exports = { "@tag.Visual", "@tag.Module", "@tag.Workflows", + "@tag.Debugger", ], }; From fbc599aec3f7719b6c0994c9215bedeba86deacb Mon Sep 17 00:00:00 2001 From: Aman Agarwal Date: Fri, 10 May 2024 01:12:18 +0530 Subject: [PATCH 4/8] fix: jest test cases for debugger views --- .../editorComponents/ApiResponseView.test.tsx | 76 ++++++++++++++++ .../editorComponents/JSResponseView.test.tsx | 32 +++++++ .../Editor/DataSourceEditor/Debugger.test.tsx | 77 ++++++++++++++++ .../QueryEditor/QueryDebuggerTabs.test.tsx | 88 +++++++++++++++++++ 4 files changed, 273 insertions(+) create mode 100644 app/client/src/components/editorComponents/ApiResponseView.test.tsx create mode 100644 app/client/src/pages/Editor/DataSourceEditor/Debugger.test.tsx create mode 100644 app/client/src/pages/Editor/QueryEditor/QueryDebuggerTabs.test.tsx diff --git a/app/client/src/components/editorComponents/ApiResponseView.test.tsx b/app/client/src/components/editorComponents/ApiResponseView.test.tsx new file mode 100644 index 000000000000..17133d4d5fb0 --- /dev/null +++ b/app/client/src/components/editorComponents/ApiResponseView.test.tsx @@ -0,0 +1,76 @@ +import React from "react"; +import { render } from "@testing-library/react"; +import ApiResponseView from "./ApiResponseView"; +import configureStore from "redux-mock-store"; +import { Provider } from "react-redux"; +import { ThemeProvider } from "styled-components"; +import { unitTestBaseMockStore } from "layoutSystems/common/dropTarget/unitTestUtils"; +import { lightTheme } from "selectors/themeSelectors"; +import { BrowserRouter as Router } from "react-router-dom"; +import { EditorViewMode } from "@appsmith/entities/IDE/constants"; +import "@testing-library/jest-dom/extend-expect"; + +const mockStore = configureStore([]); + +const storeState = { + ...unitTestBaseMockStore, + evaluations: { + tree: {}, + }, + ui: { + ...unitTestBaseMockStore.ui, + users: { + featureFlag: { + data: {}, + overriddenFlags: {}, + }, + }, + ide: { + view: EditorViewMode.FullScreen, + }, + debugger: { + context: { + errorCount: 0, + }, + }, + apiPane: { + debugger: { + open: true, + responseTabHeight: 200, + selectedTab: "response", + }, + }, + }, +}; + +describe("ApiResponseView", () => { + let store: any; + + beforeEach(() => { + store = mockStore(storeState); + }); + + it("the container should have class select-text to enable the selection of text for user", () => { + const { container } = render( + + + + {}} + responseDataTypes={[]} + responseDisplayFormat={{ title: "JSON", value: "JSON" }} + /> + + + , + ); + + expect( + container + .querySelector(".t--api-bottom-pane-container") + ?.classList.contains("select-text"), + ).toBe(true); + }); +}); diff --git a/app/client/src/components/editorComponents/JSResponseView.test.tsx b/app/client/src/components/editorComponents/JSResponseView.test.tsx index 1c3973e28e1a..f1a3499e58fa 100644 --- a/app/client/src/components/editorComponents/JSResponseView.test.tsx +++ b/app/client/src/components/editorComponents/JSResponseView.test.tsx @@ -141,4 +141,36 @@ describe("JSResponseView", () => { // nothing should be rendered here since the implementation for component is in EE code expect(queryByText(document.body, EMPTY_RESPONSE_LAST_HALF())).toBeNull(); }); + + it("the container should have class select-text to enable the selection of text for user", () => { + // mock the return value of isBrowserExecutionAllowed + ( + actionExecutionUtils.isBrowserExecutionAllowed as jest.Mock + ).mockImplementation(() => false); + + const { container } = render( + + + + + + + , + ); + + expect( + container + .querySelector(".t--js-editor-bottom-pane-container") + ?.classList.contains("select-text"), + ).toBe(true); + }); }); diff --git a/app/client/src/pages/Editor/DataSourceEditor/Debugger.test.tsx b/app/client/src/pages/Editor/DataSourceEditor/Debugger.test.tsx new file mode 100644 index 000000000000..5a6dc3b93abd --- /dev/null +++ b/app/client/src/pages/Editor/DataSourceEditor/Debugger.test.tsx @@ -0,0 +1,77 @@ +import React from "react"; +import { render } from "@testing-library/react"; +import configureStore from "redux-mock-store"; +import { Provider } from "react-redux"; +import { ThemeProvider } from "styled-components"; +import { unitTestBaseMockStore } from "layoutSystems/common/dropTarget/unitTestUtils"; +import { lightTheme } from "selectors/themeSelectors"; +import { BrowserRouter as Router } from "react-router-dom"; +import { EditorViewMode } from "@appsmith/entities/IDE/constants"; +import "@testing-library/jest-dom/extend-expect"; +import Debugger from "./Debugger"; + +jest.mock("components/editorComponents/Debugger/ErrorLogs/ErrorLog", () => ({ + __esModule: true, + default: () =>
, +})); + +const mockStore = configureStore([]); + +const storeState = { + ...unitTestBaseMockStore, + evaluations: { + tree: {}, + }, + ui: { + ...unitTestBaseMockStore.ui, + users: { + featureFlag: { + data: {}, + overriddenFlags: {}, + }, + }, + ide: { + view: EditorViewMode.FullScreen, + }, + debugger: { + isOpen: true, + errors: {}, + expandId: "", + hideErrors: false, + context: { + scrollPosition: 0, + selectedDebuggerTab: "ERROR", + responseTabHeight: 252.1953125, + errorCount: 0, + selectedDebuggerFilter: "error", + }, + logs: [], + }, + }, +}; + +describe("ApiResponseView", () => { + let store: any; + + beforeEach(() => { + store = mockStore(storeState); + }); + + it("the container should have class select-text to enable the selection of text for user", () => { + const { container } = render( + + + + + + + , + ); + + expect( + container + .querySelector(".t--datasource-bottom-pane-container") + ?.classList.contains("select-text"), + ).toBe(true); + }); +}); diff --git a/app/client/src/pages/Editor/QueryEditor/QueryDebuggerTabs.test.tsx b/app/client/src/pages/Editor/QueryEditor/QueryDebuggerTabs.test.tsx new file mode 100644 index 000000000000..f0589e3f8252 --- /dev/null +++ b/app/client/src/pages/Editor/QueryEditor/QueryDebuggerTabs.test.tsx @@ -0,0 +1,88 @@ +import React from "react"; +import { render } from "@testing-library/react"; +import configureStore from "redux-mock-store"; +import { Provider } from "react-redux"; +import { ThemeProvider } from "styled-components"; +import { unitTestBaseMockStore } from "layoutSystems/common/dropTarget/unitTestUtils"; +import { lightTheme } from "selectors/themeSelectors"; +import { BrowserRouter as Router } from "react-router-dom"; +import { EditorViewMode } from "@appsmith/entities/IDE/constants"; +import "@testing-library/jest-dom/extend-expect"; +import QueryDebuggerTabs from "./QueryDebuggerTabs"; +import { ENTITY_TYPE } from "@appsmith/entities/AppsmithConsole/utils"; + +const mockStore = configureStore([]); + +const storeState = { + ...unitTestBaseMockStore, + evaluations: { + tree: {}, + }, + entities: { + plugins: { + list: [], + }, + datasources: { + structure: {}, + }, + }, + ui: { + ...unitTestBaseMockStore.ui, + users: { + featureFlag: { + data: {}, + overriddenFlags: {}, + }, + }, + ide: { + view: EditorViewMode.FullScreen, + }, + debugger: { + context: { + errorCount: 0, + }, + }, + queryPane: { + debugger: { + open: true, + responseTabHeight: 200, + selectedTab: "response", + }, + }, + }, +}; + +describe("ApiResponseView", () => { + let store: any; + + beforeEach(() => { + store = mockStore(storeState); + }); + + it("the container should have class select-text to enable the selection of text for user", () => { + const { container } = render( + + + + {}} + /> + + + , + ); + + expect( + container + .querySelector(".t--query-bottom-pane-container") + ?.classList.contains("select-text"), + ).toBe(true); + }); +}); From 6143bd88f702c4471e2262b408e141f1cdb70756 Mon Sep 17 00:00:00 2001 From: Aman Agarwal Date: Fri, 10 May 2024 12:14:23 +0530 Subject: [PATCH 5/8] fix: jest test cases --- .../src/components/editorComponents/ApiResponseView.test.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/client/src/components/editorComponents/ApiResponseView.test.tsx b/app/client/src/components/editorComponents/ApiResponseView.test.tsx index 17133d4d5fb0..2029b14eab84 100644 --- a/app/client/src/components/editorComponents/ApiResponseView.test.tsx +++ b/app/client/src/components/editorComponents/ApiResponseView.test.tsx @@ -19,6 +19,9 @@ const storeState = { }, ui: { ...unitTestBaseMockStore.ui, + editor: { + isPreviewMode: false, + }, users: { featureFlag: { data: {}, From 091adb592220c22d51cbc9d99a0730c3b8036f85 Mon Sep 17 00:00:00 2001 From: Aman Agarwal Date: Fri, 10 May 2024 14:42:29 +0530 Subject: [PATCH 6/8] fix: jest test cases --- .../src/components/editorComponents/ApiResponseView.test.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/client/src/components/editorComponents/ApiResponseView.test.tsx b/app/client/src/components/editorComponents/ApiResponseView.test.tsx index 2029b14eab84..6bb065835e51 100644 --- a/app/client/src/components/editorComponents/ApiResponseView.test.tsx +++ b/app/client/src/components/editorComponents/ApiResponseView.test.tsx @@ -10,6 +10,11 @@ import { BrowserRouter as Router } from "react-router-dom"; import { EditorViewMode } from "@appsmith/entities/IDE/constants"; import "@testing-library/jest-dom/extend-expect"; +jest.mock("./EntityBottomTabs", () => ({ + __esModule: true, + default: () =>
, +})); + const mockStore = configureStore([]); const storeState = { From 98313f228d81bc1cb65cea59853c24cec6c4a478 Mon Sep 17 00:00:00 2001 From: Aman Agarwal Date: Fri, 10 May 2024 16:05:35 +0530 Subject: [PATCH 7/8] fix: jest test cases --- .../components/editorComponents/ApiResponseView.test.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/client/src/components/editorComponents/ApiResponseView.test.tsx b/app/client/src/components/editorComponents/ApiResponseView.test.tsx index 6bb065835e51..43825bb60280 100644 --- a/app/client/src/components/editorComponents/ApiResponseView.test.tsx +++ b/app/client/src/components/editorComponents/ApiResponseView.test.tsx @@ -24,6 +24,13 @@ const storeState = { }, ui: { ...unitTestBaseMockStore.ui, + gitSync: { + branches: [], + fetchingBranches: false, + isDeploying: false, + protectedBranchesLoading: false, + protectedBranches: [], + }, editor: { isPreviewMode: false, }, From 140378605a5d60fe33b72d48fe3535cfce713c81 Mon Sep 17 00:00:00 2001 From: Aman Agarwal Date: Mon, 13 May 2024 21:01:35 +0530 Subject: [PATCH 8/8] fix: removed debugger tag from tags.json --- app/client/cypress/tags.js | 1 - 1 file changed, 1 deletion(-) diff --git a/app/client/cypress/tags.js b/app/client/cypress/tags.js index c4636c716309..8c613c9ba391 100644 --- a/app/client/cypress/tags.js +++ b/app/client/cypress/tags.js @@ -68,6 +68,5 @@ module.exports = { "@tag.Visual", "@tag.Module", "@tag.Workflows", - "@tag.Debugger", ], };