From 43d61f785f2fc3c76ac2b61ba50105b42c2ca08a Mon Sep 17 00:00:00 2001 From: Ayush Pahwa Date: Wed, 15 May 2024 13:58:49 +0530 Subject: [PATCH] chore: cypress strings replaced with var names (#33469) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description Updated cypress tests by replacing hard coded strings with variables. Also removed unused commented code from DebuggerHelper and an extra var Fixes #33256 ## Automation /ok-to-test tags="@tag.IDE" ### :mag: Cypress test results > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: > Commit: e66c44b9e17a2bedb33ecf4d84b84fc6f8860fe0 > Cypress dashboard url: Click here! ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No --- .../OtherUIFeatures/ApiError_spec.ts | 8 +++-- .../OtherUIFeatures/EntityBottomBar_spec.ts | 36 ++++++++++++++----- .../cypress/support/Pages/DebuggerHelper.ts | 21 +---------- app/client/src/ce/constants/messages.ts | 1 + .../editorComponents/ApiResponseView.tsx | 3 +- .../editorComponents/JSResponseView.tsx | 3 +- .../Editor/QueryEditor/EditorJSONtoForm.tsx | 3 +- .../Editor/QueryEditor/QueryDebuggerTabs.tsx | 3 +- 8 files changed, 43 insertions(+), 35 deletions(-) diff --git a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/ApiError_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/ApiError_spec.ts index 76fbdc5882..993674bed8 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/ApiError_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/ApiError_spec.ts @@ -16,11 +16,15 @@ describe("Api Error Debugger", { tags: ["@tag.IDE"] }, () => { }); it("it shows debug button and navigates", () => { _.apiPage.DebugError(); - _.debuggerHelper.AssertSelectedTab("Error"); + _.debuggerHelper.AssertSelectedTab( + Cypress.env("MESSAGES").DEBUGGER_ERRORS(), + ); _.debuggerHelper.AssertErrorCount(1); EditorNavigation.SwitchScreenMode(EditorViewMode.SplitScreen); _.apiPage.DebugError(); - _.debuggerHelper.AssertSelectedTab("Error"); + _.debuggerHelper.AssertSelectedTab( + Cypress.env("MESSAGES").DEBUGGER_ERRORS(), + ); _.debuggerHelper.AssertErrorCount(1); }); }); diff --git a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/EntityBottomBar_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/EntityBottomBar_spec.ts index a581b36102..fae97f66f8 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/EntityBottomBar_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/EntityBottomBar_spec.ts @@ -10,7 +10,9 @@ describe("Entity bottom bar", { tags: ["@tag.IDE"] }, () => { _.debuggerHelper.ClickDebuggerIcon(); _.debuggerHelper.AssertOpen(PageType.Canvas); //Verify if selected tab is errors in tab title. - _.debuggerHelper.AssertSelectedTab("Errors"); + _.debuggerHelper.AssertSelectedTab( + Cypress.env("MESSAGES").DEBUGGER_ERRORS(), + ); // verify if bottom bar is closed on clicking close icon in canvas. _.debuggerHelper.CloseBottomBar(); _.debuggerHelper.AssertClosed(); @@ -21,7 +23,9 @@ describe("Entity bottom bar", { tags: ["@tag.IDE"] }, () => { //Verify if bottom bar opens JSEditor. _.debuggerHelper.AssertOpen(PageType.JsEditor); // Verify if selected tab is response. - _.debuggerHelper.AssertSelectedTab("Response"); + _.debuggerHelper.AssertSelectedTab( + Cypress.env("MESSAGES").DEBUGGER_RESPONSE(), + ); //Verify if bottom bar is closed on clicking close icon in JSEditor. _.debuggerHelper.CloseBottomBar(); _.debuggerHelper.AssertClosed(); @@ -29,7 +33,9 @@ describe("Entity bottom bar", { tags: ["@tag.IDE"] }, () => { _.jsEditor.RunJSObj(); _.debuggerHelper.AssertOpen(PageType.JsEditor); //verify if response tab is selected on execution JSFunction. - _.debuggerHelper.AssertSelectedTab("Response"); + _.debuggerHelper.AssertSelectedTab( + Cypress.env("MESSAGES").DEBUGGER_RESPONSE(), + ); //verify if bottom bar is closed on switching to canvas page. EditorNavigation.ShowCanvas(); _.debuggerHelper.AssertClosed(); @@ -45,13 +51,17 @@ describe("Entity bottom bar", { tags: ["@tag.IDE"] }, () => { _.debuggerHelper.ClickDebuggerIcon(); _.debuggerHelper.AssertOpen(PageType.API); //Verify if selected tab is errors in tab title. - _.debuggerHelper.AssertSelectedTab("Errors"); + _.debuggerHelper.AssertSelectedTab( + Cypress.env("MESSAGES").DEBUGGER_ERRORS(), + ); //Verify if bottom bar is open on executing api. _.apiPage.RunAPI(); _.agHelper.Sleep(1000); _.debuggerHelper.AssertOpen(PageType.API); //verify if response tab is selected on execution api. - _.debuggerHelper.AssertSelectedTab("Response"); + _.debuggerHelper.AssertSelectedTab( + Cypress.env("MESSAGES").DEBUGGER_RESPONSE(), + ); }); it("4. Bottom bar in Datasource", () => { @@ -73,7 +83,9 @@ describe("Entity bottom bar", { tags: ["@tag.IDE"] }, () => { _.debuggerHelper.AssertOpen(PageType.DataSources); //Verify if selected tab is errors and error count is //Verify if selected tab is errors in tab title. - _.debuggerHelper.AssertSelectedTab("Errors"); + _.debuggerHelper.AssertSelectedTab( + Cypress.env("MESSAGES").DEBUGGER_ERRORS(), + ); //Verify if bottom bar is closed on clicking close icon in active datasource page. _.debuggerHelper.CloseBottomBar(); _.debuggerHelper.AssertClosed(); @@ -94,7 +106,9 @@ describe("Entity bottom bar", { tags: ["@tag.IDE"] }, () => { //Verify if bottom bar is open on executing query. _.debuggerHelper.AssertOpen(PageType.Query); //Verify if response atb is selected on executing query. - _.debuggerHelper.AssertSelectedTab("Response"); + _.debuggerHelper.AssertSelectedTab( + Cypress.env("MESSAGES").DEBUGGER_RESPONSE(), + ); // clean up _.dataSources.DeleteQuery("Query1"); _.dataSources.DeleteDatasourceFromWithinDS(dbName); @@ -108,7 +122,9 @@ describe("Entity bottom bar", { tags: ["@tag.IDE"] }, () => { _.debuggerHelper.AssertOpen(PageType.DataSources); //Verify if selected tab is errors and error count is //Verify if selected tab is errors in tab title. - _.debuggerHelper.AssertSelectedTab("Errors"); + _.debuggerHelper.AssertSelectedTab( + Cypress.env("MESSAGES").DEBUGGER_ERRORS(), + ); //Verify if bottom bar is closed on clicking close icon in active datasource page. _.debuggerHelper.CloseBottomBar(); _.debuggerHelper.AssertClosed(); @@ -125,7 +141,9 @@ describe("Entity bottom bar", { tags: ["@tag.IDE"] }, () => { //Verify if bottom bar is open on executing query. _.debuggerHelper.AssertOpen(PageType.Query); //Verify if response atb is selected on executing query. - _.debuggerHelper.AssertSelectedTab("Response"); + _.debuggerHelper.AssertSelectedTab( + Cypress.env("MESSAGES").DEBUGGER_RESPONSE(), + ); // clean up _.dataSources.DeleteQuery("Query1"); cy.get("@dsName").then(($dsName) => { diff --git a/app/client/cypress/support/Pages/DebuggerHelper.ts b/app/client/cypress/support/Pages/DebuggerHelper.ts index 6b43449909..9be4253330 100644 --- a/app/client/cypress/support/Pages/DebuggerHelper.ts +++ b/app/client/cypress/support/Pages/DebuggerHelper.ts @@ -110,21 +110,7 @@ export class DebuggerHelper { this.agHelper.AssertElementVisibility( this.locators._bottomPaneContainer[pageType], ); - // this.agHelper.AssertHeight( - // this.locators._bottomPaneContainer[pageType], - // this.bottomPaneHeight, - // ); break; - // case PageType.Query: - // case PageType.DataSources: - // this.agHelper.AssertElementVisibility( - // this.locators._bottomPaneContainer[pageType], - // ); - // // this.agHelper.AssertHeight( - // // this.locators._bottomPaneContainer[pageType], - // // this.bottomPaneHeight - 1, // -1 to offset error - // // ); - // break; } } @@ -150,12 +136,7 @@ export class DebuggerHelper { } LogStateContains(text: string, index?: number) { - this.agHelper.GetNAssertContains( - this.locators._logState, - text, - "exist", - index, - ); + this.agHelper.GetNAssertContains(this.locators._logState, text, "exist"); } AssertErrorCount(count: number) { diff --git a/app/client/src/ce/constants/messages.ts b/app/client/src/ce/constants/messages.ts index e7e310e2dd..8c66f54529 100644 --- a/app/client/src/ce/constants/messages.ts +++ b/app/client/src/ce/constants/messages.ts @@ -540,6 +540,7 @@ export const LOGS_FILTER_OPTION_SYSTEM = () => "System logs"; export const NO_LOGS = () => "No logs to show"; export const NO_ERRORS = () => "No signs of trouble here!"; export const DEBUGGER_ERRORS = () => "Errors"; +export const DEBUGGER_RESPONSE = () => "Response"; export const DEBUGGER_LOGS = () => "Logs"; export const INSPECT_ENTITY = () => "Inspect entity"; export const INSPECT_ENTITY_BLANK_STATE = () => "Select an entity to inspect"; diff --git a/app/client/src/components/editorComponents/ApiResponseView.tsx b/app/client/src/components/editorComponents/ApiResponseView.tsx index 94c6b36bbb..7d4db11998 100644 --- a/app/client/src/components/editorComponents/ApiResponseView.tsx +++ b/app/client/src/components/editorComponents/ApiResponseView.tsx @@ -14,6 +14,7 @@ import { createMessage, DEBUGGER_ERRORS, DEBUGGER_LOGS, + DEBUGGER_RESPONSE, EMPTY_RESPONSE_FIRST_HALF, EMPTY_RESPONSE_LAST_HALF, } from "@appsmith/constants/messages"; @@ -367,7 +368,7 @@ function ApiResponseView(props: Props) { const tabs: BottomTab[] = [ { key: "response", - title: "Response", + title: createMessage(DEBUGGER_RESPONSE), panelComponent: ( {(hasExecutionParseErrors || diff --git a/app/client/src/pages/Editor/QueryEditor/EditorJSONtoForm.tsx b/app/client/src/pages/Editor/QueryEditor/EditorJSONtoForm.tsx index 90000e50e4..6fdf3a78dd 100644 --- a/app/client/src/pages/Editor/QueryEditor/EditorJSONtoForm.tsx +++ b/app/client/src/pages/Editor/QueryEditor/EditorJSONtoForm.tsx @@ -11,6 +11,7 @@ import styled from "styled-components"; import FormRow from "components/editorComponents/FormRow"; import { createMessage, + DEBUGGER_RESPONSE, DOCUMENTATION, DOCUMENTATION_TOOLTIP, } from "@appsmith/constants/messages"; @@ -246,7 +247,7 @@ export function EditorJSONtoForm(props: Props) { if (currentActionConfig) { responseTabs.push({ key: "response", - title: "Response", + title: createMessage(DEBUGGER_RESPONSE), panelComponent: (