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
<img width="616" alt="image"
src="https://user-images.githubusercontent.com/20187542/214258877-797fc095-e523-486e-8674-b9a06f3cc8f8.png">



## 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 <aishwarya@appsmith.com>
This commit is contained in:
Druthi Polisetty 2023-02-06 13:08:09 +05:30 committed by GitHub
parent bab8e6be8d
commit 923e34fbde
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 40 additions and 2 deletions

View File

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

View File

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

View File

@ -163,7 +163,10 @@ function Link(props: {
? props.name
: props.name + "." + props.entityType.toLowerCase();
return (
<span className="debugger-entity-link" onClick={onClick}>
<span
className="debugger-entity-link t--debugger-log-entity-link"
onClick={onClick}
>
{link}
</span>
);

View File

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