chore: cypress strings replaced with var names (#33469)

## 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"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/9092019864>
> Commit: e66c44b9e17a2bedb33ecf4d84b84fc6f8860fe0
> Cypress dashboard url: <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=9092019864&attempt=1"
target="_blank">Click here!</a>

<!-- end of auto-generated comment: Cypress test results  -->






## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [x] No
This commit is contained in:
Ayush Pahwa 2024-05-15 13:58:49 +05:30 committed by GitHub
parent c4a63d7763
commit 43d61f785f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 43 additions and 35 deletions

View File

@ -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);
});
});

View File

@ -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) => {

View File

@ -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) {

View File

@ -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";

View File

@ -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: (
<ResponseTabWrapper>
<ApiResponseMeta

View File

@ -17,6 +17,7 @@ import {
createMessage,
DEBUGGER_ERRORS,
DEBUGGER_LOGS,
DEBUGGER_RESPONSE,
EXECUTING_FUNCTION,
NO_JS_FUNCTION_RETURN_VALUE,
UPDATING_JS_COLLECTION,
@ -227,7 +228,7 @@ function JSResponseView(props: Props) {
const tabs: BottomTab[] = [
{
key: "response",
title: "Response",
title: createMessage(DEBUGGER_RESPONSE),
panelComponent: (
<>
{(hasExecutionParseErrors ||

View File

@ -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: (
<QueryResponseTab
actionSource={actionSource}

View File

@ -14,6 +14,7 @@ import { DEBUGGER_TAB_KEYS } from "components/editorComponents/Debugger/helpers"
import {
DEBUGGER_ERRORS,
DEBUGGER_LOGS,
DEBUGGER_RESPONSE,
createMessage,
} from "@appsmith/constants/messages";
import DebuggerLogs from "components/editorComponents/Debugger/DebuggerLogs";
@ -216,7 +217,7 @@ function QueryDebuggerTabs({
if (currentActionConfig) {
responseTabs.unshift({
key: "response",
title: "Response",
title: createMessage(DEBUGGER_RESPONSE),
panelComponent: (
<QueryResponseTab
actionSource={actionSource}