test: new test case for renaming JS Object#38361
Conversation
WalkthroughThis pull request introduces a new method Changes
Sequence DiagramsequenceDiagram
participant User
participant JSEditor
participant ContextMenu
User->>JSEditor: Trigger context menu
JSEditor->>ContextMenu: Open rename option
User->>ContextMenu: Input new name
ContextMenu->>JSEditor: Update object name
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Tip CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
app/client/cypress/e2e/Regression/ClientSide/JSObject/renameJSObjectIssue38207.ts (1)
33-38: Renaming the object and verifying.
- Well done on verifying the renamed object with a direct assertion.
- Consider adding a second assertion (e.g., confirming the previous name is absent) to strengthen the test.
app/client/cypress/support/Pages/JSEditor.ts (1)
39-39: Selector uses a data-testid but also includes a CSS path.
Consider refining the selector to rely strictly on a single data attribute if possible. This avoids more complex child selectors and aligns better with the recommended Cypress best practices of using stable data attributes.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
app/client/cypress/e2e/Regression/ClientSide/JSObject/renameJSObjectIssue38207.ts(1 hunks)app/client/cypress/support/Pages/JSEditor.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
app/client/cypress/support/Pages/JSEditor.ts (1)
Pattern app/client/cypress/**/**.*: Review the following e2e test code written using the Cypress test library. Ensure that:
- Follow best practices for Cypress code and e2e automation.
- Avoid using cy.wait in code.
- Avoid using cy.pause in code.
- Avoid using agHelper.sleep().
- Use locator variables for locators and do not use plain strings.
- Use data-* attributes for selectors.
- Avoid Xpaths, Attributes and CSS path.
- Avoid selectors like .btn.submit or button[type=submit].
- Perform logins via API with LoginFromAPI.
- Perform logout via API with LogOutviaAPI.
- Perform signup via API with SignupFromAPI.
- Avoid using it.only.
- Avoid using after and aftereach in test cases.
- Use multiple assertions for expect statements.
- Avoid using strings for assertions.
- Do not use duplicate filenames even with different paths.
- Avoid using agHelper.Sleep, this.Sleep in any file in code.
app/client/cypress/e2e/Regression/ClientSide/JSObject/renameJSObjectIssue38207.ts (1)
Pattern app/client/cypress/**/**.*: Review the following e2e test code written using the Cypress test library. Ensure that:
- Follow best practices for Cypress code and e2e automation.
- Avoid using cy.wait in code.
- Avoid using cy.pause in code.
- Avoid using agHelper.sleep().
- Use locator variables for locators and do not use plain strings.
- Use data-* attributes for selectors.
- Avoid Xpaths, Attributes and CSS path.
- Avoid selectors like .btn.submit or button[type=submit].
- Perform logins via API with LoginFromAPI.
- Perform logout via API with LogOutviaAPI.
- Perform signup via API with SignupFromAPI.
- Avoid using it.only.
- Avoid using after and aftereach in test cases.
- Use multiple assertions for expect statements.
- Avoid using strings for assertions.
- Do not use duplicate filenames even with different paths.
- Avoid using agHelper.Sleep, this.Sleep in any file in code.
🔇 Additional comments (6)
app/client/cypress/e2e/Regression/ClientSide/JSObject/renameJSObjectIssue38207.ts (6)
1-2: Everything looks good for the import statement.
3-6: Descriptive test title.
Good job providing a clear, user-focused description in the describe block.
7-8: Single test is well-scoped.
The it block name is direct and matches the intent of the test.
9-28: Creation of the first JS Object.
No issues here. The code uses the recommended approach for generating an object in the editor.
30-31: Second JS object creation.
All good.
39-40: Test closure.
Looks neat and organized with no extraneous statements.
|
/ci-test-limit-count run_count=20 update_snapshot=true specs_to_run=cypress/e2e/Regression/ClientSide/JSObject/renameJSObjectIssue38207.ts |
|
Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/12490547379. |
|
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/12490547379. |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
app/client/cypress/support/Pages/JSEditor.ts (2)
39-39: Consider making the selector more specificThe selector could be more specific to avoid potential conflicts. Consider using a dedicated data-testid for the list container itself rather than relying on nested elements.
- public listOfJsObjects = "[data-testid='t--tabs-container']>div>span"; + public listOfJsObjects = "[data-testid='t--js-objects-list']";
234-239: Enhance error handling and verificationThe method could be improved with better error handling and verification:
- Use constants for menu items
- Add error handling for element not found
- Verify the rename operation success
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); + const RENAME_MENU_ITEM = "Rename"; + cy.get(this.contextMenuTriggerLocator) + .should("exist") + .click(); + cy.contains(RENAME_MENU_ITEM) + .should("be.visible") + .click(); + cy.get(this._jsObjTxt) + .should("exist") + .clear() + .type(renameVal, { force: true }) + .should("have.value", renameVal) + .blur(); + // Verify rename in both editor and left pane + cy.get(this._jsObjName).should("have.text", renameVal); + PageLeftPane.assertPresence(renameVal); }
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
app/client/cypress/e2e/Regression/ClientSide/JSObject/renameJSObjectIssue38207.ts(1 hunks)app/client/cypress/support/Pages/JSEditor.ts(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- app/client/cypress/e2e/Regression/ClientSide/JSObject/renameJSObjectIssue38207.ts
🧰 Additional context used
📓 Path-based instructions (1)
app/client/cypress/support/Pages/JSEditor.ts (1)
Pattern app/client/cypress/**/**.*: Review the following e2e test code written using the Cypress test library. Ensure that:
- Follow best practices for Cypress code and e2e automation.
- Avoid using cy.wait in code.
- Avoid using cy.pause in code.
- Avoid using agHelper.sleep().
- Use locator variables for locators and do not use plain strings.
- Use data-* attributes for selectors.
- Avoid Xpaths, Attributes and CSS path.
- Avoid selectors like .btn.submit or button[type=submit].
- Perform logins via API with LoginFromAPI.
- Perform logout via API with LogOutviaAPI.
- Perform signup via API with SignupFromAPI.
- Avoid using it.only.
- Avoid using after and aftereach in test cases.
- Use multiple assertions for expect statements.
- Avoid using strings for assertions.
- Do not use duplicate filenames even with different paths.
- Avoid using agHelper.Sleep, this.Sleep in any file in code.
|
/ci-test-limit-count run_count=20 update_snapshot=true specs_to_run=cypress/e2e/Regression/ClientSide/JSObject/RenameJSObjectIssue38207.ts |
|
Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/12491412689. |
|
/ci-test-limit-count run_count=20 update_snapshot=true specs_to_run=cypress/e2e/Regression/ClientSide/JSObject/RenameJSObjectBug38207_spec.ts runId=12491412689 |
|
Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/12492200618. |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
app/client/cypress/e2e/Regression/ClientSide/JSObject/RenameJSObjectBug38207_spec.ts (2)
7-28: Consider splitting the test scenario into smaller tests.The single
itblock contains multiple actions: creating multiple JS objects and renaming them. Splitting these steps into different test blocks can make the tests easier to read, isolate failures more effectively, and simplify maintenance.
26-26: Minor typo in comment.Spelling error in the comment: "3rd JS Objcte" should be "3rd JS Object".
- // Validate the new name of the 3rd JS Objcte + // Validate the new name of the 3rd JS Object
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
app/client/cypress/e2e/Regression/ClientSide/JSObject/RenameJSObjectBug38207_spec.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
app/client/cypress/e2e/Regression/ClientSide/JSObject/RenameJSObjectBug38207_spec.ts (1)
Pattern app/client/cypress/**/**.*: Review the following e2e test code written using the Cypress test library. Ensure that:
- Follow best practices for Cypress code and e2e automation.
- Avoid using cy.wait in code.
- Avoid using cy.pause in code.
- Avoid using agHelper.sleep().
- Use locator variables for locators and do not use plain strings.
- Use data-* attributes for selectors.
- Avoid Xpaths, Attributes and CSS path.
- Avoid selectors like .btn.submit or button[type=submit].
- Perform logins via API with LoginFromAPI.
- Perform logout via API with LogOutviaAPI.
- Perform signup via API with SignupFromAPI.
- Avoid using it.only.
- Avoid using after and aftereach in test cases.
- Use multiple assertions for expect statements.
- Avoid using strings for assertions.
- Do not use duplicate filenames even with different paths.
- Avoid using agHelper.Sleep, this.Sleep in any file in code.
🔇 Additional comments (1)
app/client/cypress/e2e/Regression/ClientSide/JSObject/RenameJSObjectBug38207_spec.ts (1)
1-2: Looks good!
The import statement follows the recommended structure and references the shared objects module appropriately.
|
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/12492200618. |
## Description This PR adds a test case for the bug: #38207 This PR tests the issue where renaming a JS Object via the context menu caused the focus to shift to another tab in the editor. Changes: - Added test cases to validate that focus remains on the current tab while renaming JS Objects. - Verified the functionality by renaming multiple JS Objects and ensuring the changes are reflected without altering tab focus. ## Automation /ok-to-test tags="@tag.JS" ### 🔍 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/12492186342> > Commit: 5611d13 > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=12492186342&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.JS` > Spec: > <hr>Wed, 25 Dec 2024 11:16:53 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a method to rename JavaScript objects via the context menu in the JSEditor. - Added a property for referencing the list of JavaScript objects. - **Tests** - Implemented a new test suite to validate the renaming functionality and ensure focus remains on the correct tab during the process. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
## Description This PR adds a test case for the bug: appsmithorg#38207 This PR tests the issue where renaming a JS Object via the context menu caused the focus to shift to another tab in the editor. Changes: - Added test cases to validate that focus remains on the current tab while renaming JS Objects. - Verified the functionality by renaming multiple JS Objects and ensuring the changes are reflected without altering tab focus. ## Automation /ok-to-test tags="@tag.JS" ### 🔍 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/12492186342> > Commit: 5611d13 > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=12492186342&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.JS` > Spec: > <hr>Wed, 25 Dec 2024 11:16:53 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a method to rename JavaScript objects via the context menu in the JSEditor. - Added a property for referencing the list of JavaScript objects. - **Tests** - Implemented a new test suite to validate the renaming functionality and ensure focus remains on the correct tab during the process. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Description
This PR adds a test case for the bug: #38207
This PR tests the issue where renaming a JS Object via the context menu caused the focus to shift to another tab in the editor.
Changes:
Automation
/ok-to-test tags="@tag.JS"
🔍 Cypress test results
Tip
🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/12492186342
Commit: 5611d13
Cypress dashboard.
Tags:
@tag.JSSpec:
Wed, 25 Dec 2024 11:16:53 UTC
Communication
Should the DevRel and Marketing teams inform users about this change?
Summary by CodeRabbit
New Features
Tests