diff --git a/app/client/cypress/e2e/Regression/ClientSide/JSObject/RenameJSObjectBug38207_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/JSObject/RenameJSObjectBug38207_spec.ts new file mode 100644 index 000000000000..bb3018186fba --- /dev/null +++ b/app/client/cypress/e2e/Regression/ClientSide/JSObject/RenameJSObjectBug38207_spec.ts @@ -0,0 +1,30 @@ +import { jsEditor } from "../../../../support/Objects/ObjectsCore"; + +describe( + "To test [Bug]: Action redesign: Focus shifts to another tab when renaming a JSObject #38207", + { tags: ["@tag.JS"] }, + () => { + it("1. Validate that focus does not shift to another tab while renaming JS Objects from the context menu", () => { + // Create first JS file + jsEditor.CreateJSObject("", { prettify: false, toRun: false }); + + // Rename the first JS Object + jsEditor.RenameJSObjectFromContextMenu("ChangedName1"); + + // Validate the new name of the JS Object + cy.get(jsEditor.listOfJsObjects).eq(0).contains("ChangedName1"); + + // Create second JS file + jsEditor.CreateJSObject("", { prettify: false, toRun: false }); + + // Create third JS file + jsEditor.CreateJSObject("", { prettify: false, toRun: false }); + + // Rename the third JS Object + jsEditor.RenameJSObjectFromContextMenu("ChangedName3"); + + // Validate the new name of the 3rd JS Objcte + cy.get(jsEditor.listOfJsObjects).eq(2).contains("ChangedName3"); + }); + }, +); diff --git a/app/client/cypress/support/Pages/JSEditor.ts b/app/client/cypress/support/Pages/JSEditor.ts index a6a0eba855df..957ca929a5c4 100644 --- a/app/client/cypress/support/Pages/JSEditor.ts +++ b/app/client/cypress/support/Pages/JSEditor.ts @@ -36,6 +36,7 @@ export class JSEditor { public settingsTriggerLocator = "[data-testid='t--js-settings-trigger']"; public contextMenuTriggerLocator = "[data-testid='t--more-action-trigger']"; public runFunctionSelectLocator = "[data-testid='t--js-function-run']"; + public listOfJsObjects = "[data-testid='t--tabs-container']>div>span"; public toolbar = new PluginEditorToolbar( this.runButtonLocator, @@ -230,6 +231,13 @@ export class JSEditor { PageLeftPane.assertPresence(renameVal); } + public RenameJSObjectFromContextMenu(renameVal: string) { + cy.get(this.contextMenuTriggerLocator).click(); + cy.contains("Rename").should("be.visible").click(); + cy.get(this._jsObjTxt).clear().type(renameVal, { force: true }).blur(); + PageLeftPane.assertPresence(renameVal); + } + public RenameJSObjFromExplorer(entityName: string, renameVal: string) { this.ee.ActionContextMenuByEntityName({ entityNameinLeftSidebar: entityName,