From 923e34fbde2ec42bd3e35c90d5446fbf1087d62c Mon Sep 17 00:00:00 2001 From: Druthi Polisetty Date: Mon, 6 Feb 2023 13:08:09 +0530 Subject: [PATCH] fix: Objects that start with an underscore `_JSObject1` fail to be navigated from the debugger (#20020) ## Description fix: Objects that start with an underscore `_JSObject1` fail to be navigated from the debugger Fixes #19115 Media image ## Type of change - Bug fix (non-breaking change which fixes an issue) ## How Has This Been Tested? - Cypress ### Test Plan ### Issues raised during DP testing ## Checklist: ### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test --------- Co-authored-by: Aishwarya UR --- .../OtherUIFeatures/Logs_spec.ts | 29 +++++++++++++++++++ .../cypress/support/Pages/DebuggerHelper.ts | 5 ++++ .../editorComponents/Debugger/EntityLink.tsx | 5 +++- app/client/src/sagas/PostLintingSagas.ts | 3 +- 4 files changed, 40 insertions(+), 2 deletions(-) diff --git a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/OtherUIFeatures/Logs_spec.ts b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/OtherUIFeatures/Logs_spec.ts index 9ad9732ac3..eb7ec2a91a 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/OtherUIFeatures/Logs_spec.ts +++ b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/OtherUIFeatures/Logs_spec.ts @@ -1,6 +1,8 @@ const commonlocators = require("../../../../locators/commonlocators.json"); import { ObjectsRegistry } from "../../../../support/Objects/Registry"; +const locator = ObjectsRegistry.CommonLocators; + const { AggregateHelper: agHelper, ApiPage: apiPage, @@ -417,4 +419,31 @@ describe("Debugger logs", function() { debuggerHelper.DoesConsoleLogExist("start: []"); debuggerHelper.DoesConsoleLogExist("end: [0,1,2,3,4]"); }); + + it("6. Bug #19115 - Objects that start with an underscore `_JSObject1` fail to be navigated from the debugger", function() { + const JSOBJECT_WITH_UNNECCESARY_SEMICOLON = `export default { + myFun1: () => { + //write code here + if (1) { + return true;; + }; + } + } + `; + + jsEditor.CreateJSObject(JSOBJECT_WITH_UNNECCESARY_SEMICOLON, { + paste: true, + completeReplace: true, + toRun: false, + shouldCreateNewJSObj: true, + }); + + ee.SelectEntityByName("Page1", "Pages"); + agHelper.GetNClick(".t--debugger"); + agHelper.GetNClick(locator._errorTab); + + debuggerHelper.ClicklogEntityLink(0); + + cy.get(".t--js-action-name-edit-field").should("exist"); + }); }); diff --git a/app/client/cypress/support/Pages/DebuggerHelper.ts b/app/client/cypress/support/Pages/DebuggerHelper.ts index c6e3e776af..4edaa48ae6 100644 --- a/app/client/cypress/support/Pages/DebuggerHelper.ts +++ b/app/client/cypress/support/Pages/DebuggerHelper.ts @@ -21,6 +21,7 @@ export class DebuggerHelper { _tabsContainer: ".t--debugger-tabs-container", _closeButton: ".t--close-debugger", _logMessage: ".t--debugger-log-message", + _logEntityLink: ".t--debugger-log-entity-link", _logState: ".t--debugger-log-state", _errorCount: ".t--debugger-count", _clearLogs: ".t--debugger-clear-logs", @@ -164,6 +165,10 @@ export class DebuggerHelper { this.agHelper.GetNClick(this.locators._debuggerMessage, index); } + ClicklogEntityLink(index?: number) { + this.agHelper.GetNClick(this.locators._logEntityLink, index); + } + AssertContextMenuItemVisible() { this.agHelper.AssertElementVisible(this.locators._contextMenuItem); } diff --git a/app/client/src/components/editorComponents/Debugger/EntityLink.tsx b/app/client/src/components/editorComponents/Debugger/EntityLink.tsx index 61377d1392..037c2f3072 100644 --- a/app/client/src/components/editorComponents/Debugger/EntityLink.tsx +++ b/app/client/src/components/editorComponents/Debugger/EntityLink.tsx @@ -163,7 +163,10 @@ function Link(props: { ? props.name : props.name + "." + props.entityType.toLowerCase(); return ( - + {link} ); diff --git a/app/client/src/sagas/PostLintingSagas.ts b/app/client/src/sagas/PostLintingSagas.ts index ae9f64ee3e..35e0458cf3 100644 --- a/app/client/src/sagas/PostLintingSagas.ts +++ b/app/client/src/sagas/PostLintingSagas.ts @@ -50,7 +50,7 @@ export function* logLatestLintPropertyErrors({ text: createMessage(JS_OBJECT_BODY_INVALID), messages: lintErrorMessagesInPath, source: { - id: path, + id: entity.actionId, name: entityName, type: ENTITY_TYPE.JSACTION, propertyPath, @@ -58,6 +58,7 @@ export function* logLatestLintPropertyErrors({ }, }); } + AppsmithConsole.addErrors(errorsToAdd); AppsmithConsole.deleteErrors(errorsToRemove); }