Skip to content

chore: Activating the feature flag in cypress for using Entity Item component from ADS templates#39093

Merged
hetunandu merged 76 commits intoreleasefrom
chore/remove-ff-entity-item-usage
Mar 14, 2025
Merged

chore: Activating the feature flag in cypress for using Entity Item component from ADS templates#39093
hetunandu merged 76 commits intoreleasefrom
chore/remove-ff-entity-item-usage

Conversation

@ankitakinger
Copy link
Contributor

@ankitakinger ankitakinger commented Feb 6, 2025

Description

Removing the feature flag for using Entity Item component from ADS templates in the Entity Explorer in App Editor.

Fixes #39067

Automation

/ok-to-test tags="@tag.All"

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/13804174182
Commit: 8a4a200
Cypress dashboard.
Tags: @tag.All
Spec:


Wed, 12 Mar 2025 06:32:35 UTC

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

  • New Features

    • Improved entity renaming: input fields now automatically clear previous text for smoother editing.
    • Enhanced page navigation: active selections are now verified more consistently, ensuring clearer context.
    • New feature flag added for enhanced entity item visibility.
    • Added new methods for improved entity selection and verification in tests.
    • Introduced parentId properties in widget definitions to enhance hierarchical structure.
    • Updated selectors for widget names and collapsible elements in tests for improved targeting.
  • Bug Fixes

    • Resolved issues with inconsistent element detection and state feedback for a more stable interface.
  • Refactor

    • Updated widget hierarchy and locator logic for improved layout rendering and overall UI consistency.
    • Modified locator strategies to enhance element targeting across various components.
    • Simplified method signatures for better clarity and maintainability.
    • Enhanced test selectors to improve reliability and maintainability.
    • Removed obsolete commands and streamlined interaction methods in tests.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 6, 2025

Walkthrough

This pull request applies widespread updates across Cypress locators, test files, and related DSL definitions. Key modifications include refactoring the _entityNameEditing method and adding new locator functions in CommonLocators, switching from XPath to CSS selectors in several files, and updating renaming and active state verifications in multiple tests. Additional changes involve improvements to asynchronous function settings, removal of deprecated commands, and adding parent-child relationships in DSL JSON files. A new feature flag has also been introduced.

Changes

Files Change Summary
app/client/cypress/support/Objects/CommonLocators.ts Updated _entityNameEditing to a static XPath selector; added _moduleInstanceEntity, _moduleInputEntity, _codeEditor, and _visualNonIdeaState; repositioned _selectionItem.
app/client/cypress/support/Pages/EditorNavigation.ts, .../EntityExplorer.ts, .../IDE/LeftPane.ts Modified element selectors (e.g., div → span) and active item verification (using data-selected); adjusted renaming logic and context menu interactions.
app/client/cypress/locators/commonlocators.json, .../CMSApplocators.js, .../apiWidgetslocator.json Removed outdated locators (e.g., widgetSection); updated locator strategies from XPath to data attribute-based CSS selectors.
Multiple e2e test files (e.g., .../Tab_rename_Delete_spec.ts, .../GitSync*.js, .../ApplicationURL_spec.js, .../PartialImportRegularApp.ts) Adjusted renaming functions by switching parameters from false to true, incorporated clear options in text input steps, and shifted verification from entity selection to current-page confirmation using data-selected.
app/client/cypress/support/queryCommands.js, .../widgetCommands.js, .../ListView.ts, .../ApiCommands.js, .../AggregateHelper.ts Removed the hoverAndClick command; updated page creation and text typing commands (including a new clear option) and refined method signatures.
app/client/src/pages/Editor/Explorer/Entity/Name.tsx, .../JSRender.test.tsx, .../QueryRender.test.tsx Changed the styled component from a div to a span and updated active state assertions from checking for an "active" class to a data-selected="true" attribute.
app/client/cypress/fixtures/chartUpdatedDsl.json, .../newFormDsl.json Added parentId properties to widget configurations to explicitly define parent-child relationships.
app/client/cypress/support/Objects/FeatureFlags.ts, app/client/test/testUtils.tsx Introduced a new feature flag release_ads_entity_item_enabled set to true.
Various other tests (e.g., .../JSLibrary/Library_spec.ts, .../Refactoring_spec.ts, .../SetOptions_Spec.ts, etc.) Streamlined entity selection calls and asynchronous function settings by removing redundant parameters and leveraging direct page verification methods.

Sequence Diagram(s)

sequenceDiagram
    participant Test as Cypress Test
    participant Helper as AggregateHelper (TypeText)
    participant Input as Entity Input Field

    Test->>Helper: Call TypeText(selector, newName, { clear: true })
    alt clear flag is true
        Helper->>Input: Execute clear()
    end
    Helper->>Input: Type newName
    Test->>Input: Verify attribute data-selected="true"
Loading

Possibly related PRs

  • test: adding tests for jsobject regression tests #38214: The changes in the main PR, specifically the modifications to the _entityNameEditing method in the CommonLocators class, are related to the updates in the RenameJSObjFromExplorer method in the retrieved PR, as both involve alterations to how entity names are handled in the context of JavaScript objects.
  • fix: Fix flaky test case for the iframe spec #38018: The changes in the main PR, which involve modifications to the CommonLocators class, are related to the updates made to the CommonLocators class in the retrieved PR, specifically regarding the alterations of properties and selectors.
  • test: GitSyncedApps_spec - multiple IA changes #33257: The changes in the main PR, specifically the modifications to the _entityNameEditing method in the CommonLocators class, are related to the updates in the GitSyncedApps_spec.js file where the method calls for renaming entities have been adjusted, indicating a direct connection in how entity names are handled across both PRs.

Suggested labels

Design System Product

Suggested reviewers

  • ApekshaBhosale
  • sagar-qa007
  • ankitakinger

Poem

In refactored lines the code sings bright,
Locators and tests now shine in light.
Clear fields and selectors set the pace,
Parent-child ties in JSON find their place.
With flags and fixes all in view,
Cheers to progress—innovation anew!
Happy coding! 🚀✨


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 68579f6 and 8a4a200.

📒 Files selected for processing (9)
  • app/client/cypress/support/Objects/FeatureFlags.ts (1 hunks)
  • app/client/src/pages/AppIDE/components/AppPluginActionEditor/loader.tsx (1 hunks)
  • app/client/src/pages/AppIDE/components/JSAdd/loader.tsx (1 hunks)
  • app/client/src/pages/AppIDE/components/QueryAdd/loader.tsx (1 hunks)
  • app/client/src/pages/AppIDE/components/QueryExplorer/QuerySegmentList.tsx (1 hunks)
  • app/client/src/pages/AppIDE/components/UIList/UIList.test.tsx (5 hunks)
  • app/client/src/pages/AppIDE/layouts/routers/JSEditor/JSRender.test.tsx (2 hunks)
  • app/client/src/pages/AppIDE/layouts/routers/QueryEditor/QueryRender.test.tsx (5 hunks)
  • app/client/src/pages/Editor/JSEditor/loader.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (3)
  • app/client/src/pages/AppIDE/components/QueryAdd/loader.tsx
  • app/client/src/pages/AppIDE/components/AppPluginActionEditor/loader.tsx
  • app/client/src/pages/AppIDE/components/JSAdd/loader.tsx
🚧 Files skipped from review as they are similar to previous changes (4)
  • app/client/cypress/support/Objects/FeatureFlags.ts
  • app/client/src/pages/AppIDE/layouts/routers/JSEditor/JSRender.test.tsx
  • app/client/src/pages/AppIDE/layouts/routers/QueryEditor/QueryRender.test.tsx
  • app/client/src/pages/AppIDE/components/UIList/UIList.test.tsx
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: perform-test / client-build / client-build
  • GitHub Check: perform-test / rts-build / build
  • GitHub Check: perform-test / server-build / server-unit-tests
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
  • GitHub Check: client-prettier / prettier-check
  • GitHub Check: client-build / client-build
🔇 Additional comments (2)
app/client/src/pages/Editor/JSEditor/loader.tsx (1)

13-13: Proper JSX component instantiation for Suspense fallback.

This change correctly wraps the Skeleton component in JSX tags, ensuring it's properly instantiated as a React element rather than passed as a component reference. React's Suspense component expects its fallback prop to receive a rendered element, not a component definition.

app/client/src/pages/AppIDE/components/QueryExplorer/QuerySegmentList.tsx (1)

92-92: Good addition of the key prop to improve React rendering.

Adding the key prop to ActionEntityItem follows React's best practices for list rendering, helping React's reconciliation process efficiently identify and update components.


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added IDE Pod Issues that new developers face while exploring the IDE IDE Product Issues related to the IDE Product Task A simple Todo labels Feb 6, 2025
@ankitakinger ankitakinger added the ok-to-test Required label for CI label Feb 6, 2025
@github-actions github-actions bot added the skip-changelog Adding this label to a PR prevents it from being listed in the changelog label Feb 6, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
app/client/src/pages/Editor/IDE/EditorPane/UI/List.tsx (1)

54-93: Consider simplifying the nested conditional rendering.

The component has multiple nested conditional renders (!widgetsExist, canManagePages, widgetsExist). Consider extracting these into separate components or using early returns to improve readability.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between afe630a and 75b36b7.

📒 Files selected for processing (11)
  • app/client/src/ce/entities/FeatureFlag.ts (0 hunks)
  • app/client/src/ce/pages/Editor/IDE/EditorPane/JS/old/ListItem.tsx (0 hunks)
  • app/client/src/ce/pages/Editor/IDE/EditorPane/Query/old/ListItem.tsx (0 hunks)
  • app/client/src/ee/pages/Editor/IDE/EditorPane/JS/old/ListItem.tsx (0 hunks)
  • app/client/src/ee/pages/Editor/IDE/EditorPane/Query/old/ListItem.tsx (0 hunks)
  • app/client/src/pages/Editor/Explorer/Widgets/OldWidgetEntityList.tsx (0 hunks)
  • app/client/src/pages/Editor/Explorer/Widgets/WidgetContextMenu.tsx (0 hunks)
  • app/client/src/pages/Editor/Explorer/Widgets/WidgetEntity.tsx (0 hunks)
  • app/client/src/pages/Editor/IDE/EditorPane/JS/List.tsx (1 hunks)
  • app/client/src/pages/Editor/IDE/EditorPane/Query/List.tsx (1 hunks)
  • app/client/src/pages/Editor/IDE/EditorPane/UI/List.tsx (1 hunks)
💤 Files with no reviewable changes (8)
  • app/client/src/ee/pages/Editor/IDE/EditorPane/JS/old/ListItem.tsx
  • app/client/src/ee/pages/Editor/IDE/EditorPane/Query/old/ListItem.tsx
  • app/client/src/pages/Editor/Explorer/Widgets/WidgetContextMenu.tsx
  • app/client/src/ce/entities/FeatureFlag.ts
  • app/client/src/ce/pages/Editor/IDE/EditorPane/Query/old/ListItem.tsx
  • app/client/src/ce/pages/Editor/IDE/EditorPane/JS/old/ListItem.tsx
  • app/client/src/pages/Editor/Explorer/Widgets/WidgetEntity.tsx
  • app/client/src/pages/Editor/Explorer/Widgets/OldWidgetEntityList.tsx
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: perform-test / client-build / client-build
  • GitHub Check: perform-test / rts-build / build
  • GitHub Check: perform-test / server-build / server-unit-tests
  • GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-prettier / prettier-check
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-build / client-build
🔇 Additional comments (3)
app/client/src/pages/Editor/IDE/EditorPane/Query/List.tsx (1)

61-72: LGTM! Clean and simplified rendering logic.

The direct rendering of EntityGroupsList with mapped groups and items improves code readability and maintainability.

app/client/src/pages/Editor/IDE/EditorPane/JS/List.tsx (1)

69-80: LGTM! Clean and simplified rendering logic.

The direct rendering of EntityGroupsList with mapped groups and items improves code readability. Good handling of the "NA" group case.

app/client/src/pages/Editor/IDE/EditorPane/UI/List.tsx (1)

22-27: Verify if the license feature flag is still required.

The component still uses FEATURE_FLAG.license_gac_enabled. Let's verify if this feature flag is still needed.

✅ Verification successful

🏁 Script executed:

#!/bin/bash
# Search for other usages of the license feature flag
rg "license_gac_enabled" -A 5

Length of output: 45237


License Feature Flag Usage Confirmed as Required

Our search confirms that FEATURE_FLAG.license_gac_enabled is widely used across the codebase, including in the List.tsx file. Its continued presence in multiple modules and permission checks indicates that it remains essential for current logic.

  • The flag is actively used in various permission and feature check contexts.
  • No redundant or obsolete usage was identified.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (4)
app/client/src/ce/pages/Editor/IDE/EditorPane/JS/utils/getJSContextMenuByIdeType.tsx (1)

11-13: Simplify the boolean condition.

The Boolean cast is redundant as the expression will be automatically coerced to a boolean.

-  if (Boolean(jsAction?.isMainJSCollection)) {
+  if (jsAction?.isMainJSCollection) {
🧰 Tools
🪛 Biome (1.9.4)

[error] 11-11: Avoid redundant Boolean call

It is not necessary to use Boolean call when a value will already be coerced to a boolean.
Unsafe fix: Remove redundant Boolean call

(lint/complexity/noExtraBooleanCast)

app/client/src/pages/Editor/IDE/EditorPane/JS/EntityItem/AppJSContextMenuItems.tsx (1)

38-40: Simplify the boolean condition.

The Boolean cast is redundant as the expression will be automatically coerced to a boolean.

-  if (Boolean(jsAction?.isMainJSCollection)) {
+  if (jsAction?.isMainJSCollection) {
🧰 Tools
🪛 Biome (1.9.4)

[error] 38-38: Avoid redundant Boolean call

It is not necessary to use Boolean call when a value will already be coerced to a boolean.
Unsafe fix: Remove redundant Boolean call

(lint/complexity/noExtraBooleanCast)

app/client/src/pages/Editor/JSEditor/AppJSEditorContextMenu.tsx (1)

31-33: Simplify the boolean condition.

The Boolean cast is redundant as the expression will be automatically coerced to a boolean.

-  if (Boolean(jsCollection?.isMainJSCollection)) {
+  if (jsCollection?.isMainJSCollection) {
🧰 Tools
🪛 Biome (1.9.4)

[error] 31-31: Avoid redundant Boolean call

It is not necessary to use Boolean call when a value will already be coerced to a boolean.
Unsafe fix: Remove redundant Boolean call

(lint/complexity/noExtraBooleanCast)

app/client/src/pages/Editor/IDE/EditorPane/JS/EntityItem/JSEntityItem.tsx (1)

51-54: Simplify the boolean condition and approve the computed property.

The computed property improves code organization, but the Boolean cast is redundant.

  const canEdit = useMemo(
-    () => canManageJSAction && !Boolean(jsAction?.isMainJSCollection),
+    () => canManageJSAction && !jsAction?.isMainJSCollection,
    [canManageJSAction, jsAction?.isMainJSCollection],
  );
🧰 Tools
🪛 Biome (1.9.4)

[error] 52-52: Avoid redundant Boolean call

It is not necessary to use Boolean call when a value will already be coerced to a boolean.
Unsafe fix: Remove redundant Boolean call

(lint/complexity/noExtraBooleanCast)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 75b36b7 and e068b56.

📒 Files selected for processing (13)
  • app/client/packages/design-system/ads/src/Templates/EditableEntityName/EditableEntityName.tsx (1 hunks)
  • app/client/packages/design-system/ads/src/Templates/EntityExplorer/EntityListTree/EntityListTree.tsx (1 hunks)
  • app/client/src/ce/entities/FeatureFlag.ts (0 hunks)
  • app/client/src/ce/pages/Editor/IDE/EditorPane/JS/utils/getJSContextMenuByIdeType.tsx (1 hunks)
  • app/client/src/pages/Editor/IDE/EditorPane/JS/EntityItem/AppJSContextMenuItems.tsx (1 hunks)
  • app/client/src/pages/Editor/IDE/EditorPane/JS/EntityItem/JSEntityItem.tsx (3 hunks)
  • app/client/src/pages/Editor/IDE/EditorPane/JS/JSRender.test.tsx (1 hunks)
  • app/client/src/pages/Editor/IDE/EditorPane/JS/List.tsx (1 hunks)
  • app/client/src/pages/Editor/IDE/EditorPane/Query/EntityItem/QueryEntityItem.tsx (1 hunks)
  • app/client/src/pages/Editor/IDE/EditorPane/Query/List.tsx (1 hunks)
  • app/client/src/pages/Editor/IDE/EditorPane/Query/QueryRender.test.tsx (3 hunks)
  • app/client/src/pages/Editor/IDE/EditorPane/components/EntityContextMenu.tsx (2 hunks)
  • app/client/src/pages/Editor/JSEditor/AppJSEditorContextMenu.tsx (1 hunks)
💤 Files with no reviewable changes (1)
  • app/client/src/ce/entities/FeatureFlag.ts
✅ Files skipped from review due to trivial changes (1)
  • app/client/packages/design-system/ads/src/Templates/EditableEntityName/EditableEntityName.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/client/src/pages/Editor/IDE/EditorPane/Query/List.tsx
🧰 Additional context used
🪛 Biome (1.9.4)
app/client/src/pages/Editor/IDE/EditorPane/JS/EntityItem/AppJSContextMenuItems.tsx

[error] 38-38: Avoid redundant Boolean call

It is not necessary to use Boolean call when a value will already be coerced to a boolean.
Unsafe fix: Remove redundant Boolean call

(lint/complexity/noExtraBooleanCast)

app/client/src/pages/Editor/JSEditor/AppJSEditorContextMenu.tsx

[error] 31-31: Avoid redundant Boolean call

It is not necessary to use Boolean call when a value will already be coerced to a boolean.
Unsafe fix: Remove redundant Boolean call

(lint/complexity/noExtraBooleanCast)

app/client/src/ce/pages/Editor/IDE/EditorPane/JS/utils/getJSContextMenuByIdeType.tsx

[error] 11-11: Avoid redundant Boolean call

It is not necessary to use Boolean call when a value will already be coerced to a boolean.
Unsafe fix: Remove redundant Boolean call

(lint/complexity/noExtraBooleanCast)

app/client/src/pages/Editor/IDE/EditorPane/JS/EntityItem/JSEntityItem.tsx

[error] 52-52: Avoid redundant Boolean call

It is not necessary to use Boolean call when a value will already be coerced to a boolean.
Unsafe fix: Remove redundant Boolean call

(lint/complexity/noExtraBooleanCast)

🔇 Additional comments (9)
app/client/src/pages/Editor/IDE/EditorPane/components/EntityContextMenu.tsx (2)

10-13: LGTM! Props interface improvements.

The changes improve type safety by making children required and enhance testability with the optional dataTestId.


28-35: LGTM! Improved Button component testability.

Good practice to make the test ID configurable through props instead of hardcoding it.

app/client/packages/design-system/ads/src/Templates/EntityExplorer/EntityListTree/EntityListTree.tsx (1)

68-71: LGTM! Added data-testid for better test stability.

The addition of the dataTestId prop follows a consistent pattern and improves test maintainability.

app/client/src/pages/Editor/IDE/EditorPane/JS/List.tsx (1)

69-80: LGTM! Simplified rendering logic by removing feature flag.

The code is now cleaner and more maintainable with the removal of conditional rendering based on feature flags.

app/client/src/pages/Editor/IDE/EditorPane/Query/EntityItem/QueryEntityItem.tsx (1)

110-112: LGTM! Improved consistency in component identification and selection.

The changes improve consistency by:

  1. Adding dataTestId following the established pattern
  2. Using item.key for selection state instead of action.id
app/client/src/pages/Editor/IDE/EditorPane/JS/JSRender.test.tsx (1)

148-149: LGTM! Updated test assertions for better reliability.

The test now uses data-selected attribute instead of class-based checks, making it more reliable and consistent with the component changes.

app/client/src/pages/Editor/IDE/EditorPane/Query/QueryRender.test.tsx (1)

159-160: LGTM! The changes align with the feature flag removal.

The test assertions have been consistently updated to check the data-selected attribute instead of using classList.contains("active"). This change reflects the new implementation after removing the feature flag for the Entity Item component.

Also applies to: 370-371, 574-575

app/client/src/pages/Editor/JSEditor/AppJSEditorContextMenu.tsx (1)

36-36: LGTM! Good addition of test ID.

Adding dataTestId improves testability.

app/client/src/pages/Editor/IDE/EditorPane/JS/EntityItem/JSEntityItem.tsx (1)

100-103: LGTM! Good improvements to component props.

The changes to className and isSelected props improve clarity and consistency.

@ankitakinger ankitakinger added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Feb 7, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🔭 Outside diff range comments (2)
app/client/cypress/support/Pages/EntityExplorer.ts (2)

83-83: Remove usage of agHelper.Sleep().

The code contains multiple instances of agHelper.Sleep() which is against the coding guidelines. Instead, use Cypress's built-in retry-ability and wait for specific elements or conditions.

Here's how to fix this:

- this.agHelper.Sleep();
+ this.agHelper.WaitUntil(() => /* specific condition */);

- this.agHelper.Sleep(1000);
+ cy.wait("@relevantAPICall");
// or
+ cy.get("selector").should("exist");

- this.agHelper.Sleep(500);
+ this.agHelper.WaitUntil(() => /* specific condition */);

Also applies to: 92-92, 115-115, 146-146, 152-152, 190-190, 241-241, 281-281


87-91: Replace force clicks with proper element assertions.

Using force: true with clicks should be avoided. Instead, ensure elements are properly visible and clickable.

Here's how to improve this:

- cy.xpath(this._contextMenu(entityNameinLeftSidebar))
-   .scrollIntoView()
-   .last()
-   .click({ force: true });
+ cy.xpath(this._contextMenu(entityNameinLeftSidebar))
+   .scrollIntoView()
+   .last()
+   .should("be.visible")
+   .should("be.enabled")
+   .click();

Also applies to: 111-114

🧹 Nitpick comments (4)
app/client/src/pages/Editor/IDE/EditorPane/JS/List.tsx (1)

69-80: LGTM! Consider extracting group title transformation.

The simplified rendering logic looks good and aligns with removing the feature flag.

Consider extracting the group title transformation to improve readability:

 <EntityGroupsList
   groups={filteredItemGroups.map(({ group, items }) => {
+    const groupTitle = group === "NA" ? "" : group;
     return {
-      groupTitle: group === "NA" ? "" : group,
+      groupTitle,
       items: items,
       className: "",
       renderList: (item: EntityItem) => {
         return <JSEntity item={item} key={item.key} />;
       },
     };
   })}
 />
app/client/src/ce/pages/Editor/IDE/EditorPane/JS/utils/getJSContextMenuByIdeType.tsx (1)

11-13: Simplify boolean expression by removing redundant Boolean cast.

-  if (Boolean(jsAction?.isMainJSCollection)) {
+  if (jsAction?.isMainJSCollection) {
🧰 Tools
🪛 Biome (1.9.4)

[error] 11-11: Avoid redundant Boolean call

It is not necessary to use Boolean call when a value will already be coerced to a boolean.
Unsafe fix: Remove redundant Boolean call

(lint/complexity/noExtraBooleanCast)

app/client/src/pages/Editor/IDE/EditorPane/JS/EntityItem/JSEntityItem.tsx (1)

51-54: Simplify boolean expression in canEdit computation.

  const canEdit = useMemo(
-    () => canManageJSAction && !Boolean(jsAction?.isMainJSCollection),
+    () => canManageJSAction && !jsAction?.isMainJSCollection,
    [canManageJSAction, jsAction?.isMainJSCollection],
  );
🧰 Tools
🪛 Biome (1.9.4)

[error] 52-52: Avoid redundant Boolean call

It is not necessary to use Boolean call when a value will already be coerced to a boolean.
Unsafe fix: Remove redundant Boolean call

(lint/complexity/noExtraBooleanCast)

app/client/cypress/support/Pages/EntityExplorer.ts (1)

168-202: Improve drag and drop implementation.

The current implementation uses low-level mouse events which can be flaky. Consider using Cypress's drag-and-drop commands or a more reliable approach.

Consider using @4tw/cypress-drag-drop plugin:

- .trigger("dragstart", { force: true })
- .trigger("mousemove", x, y, { force: true });
+ .drag(dropSelector, {
+   force: true,
+   target: { x, y }
+ });
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between edbba40 and 345fd93.

📒 Files selected for processing (13)
  • app/client/cypress/support/Objects/CommonLocators.ts (3 hunks)
  • app/client/cypress/support/Pages/EditorNavigation.ts (1 hunks)
  • app/client/cypress/support/Pages/EntityExplorer.ts (1 hunks)
  • app/client/cypress/support/Pages/IDE/LeftPane.ts (2 hunks)
  • app/client/packages/design-system/ads/src/Templates/EditableEntityName/EditableEntityName.tsx (1 hunks)
  • app/client/packages/design-system/ads/src/Templates/EntityExplorer/EntityListTree/EntityListTree.tsx (2 hunks)
  • app/client/src/ce/pages/Editor/IDE/EditorPane/JS/utils/getJSContextMenuByIdeType.tsx (1 hunks)
  • app/client/src/pages/Editor/IDE/EditorPane/JS/EntityItem/JSEntityItem.tsx (3 hunks)
  • app/client/src/pages/Editor/IDE/EditorPane/JS/JSRender.test.tsx (1 hunks)
  • app/client/src/pages/Editor/IDE/EditorPane/JS/List.tsx (1 hunks)
  • app/client/src/pages/Editor/IDE/EditorPane/Query/EntityItem/QueryEntityItem.tsx (1 hunks)
  • app/client/src/pages/Editor/IDE/EditorPane/Query/List.tsx (1 hunks)
  • app/client/src/pages/Editor/IDE/EditorPane/Query/QueryRender.test.tsx (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (6)
  • app/client/packages/design-system/ads/src/Templates/EditableEntityName/EditableEntityName.tsx
  • app/client/packages/design-system/ads/src/Templates/EntityExplorer/EntityListTree/EntityListTree.tsx
  • app/client/src/pages/Editor/IDE/EditorPane/JS/JSRender.test.tsx
  • app/client/src/pages/Editor/IDE/EditorPane/Query/QueryRender.test.tsx
  • app/client/src/pages/Editor/IDE/EditorPane/Query/EntityItem/QueryEntityItem.tsx
  • app/client/src/pages/Editor/IDE/EditorPane/Query/List.tsx
🧰 Additional context used
📓 Path-based instructions (1)
`app/client/cypress/**/**.*`: Review the following e2e test ...

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/support/Pages/EntityExplorer.ts
  • app/client/cypress/support/Pages/EditorNavigation.ts
  • app/client/cypress/support/Pages/IDE/LeftPane.ts
  • app/client/cypress/support/Objects/CommonLocators.ts
🪛 Biome (1.9.4)
app/client/src/ce/pages/Editor/IDE/EditorPane/JS/utils/getJSContextMenuByIdeType.tsx

[error] 11-11: Avoid redundant Boolean call

It is not necessary to use Boolean call when a value will already be coerced to a boolean.
Unsafe fix: Remove redundant Boolean call

(lint/complexity/noExtraBooleanCast)

app/client/src/pages/Editor/IDE/EditorPane/JS/EntityItem/JSEntityItem.tsx

[error] 52-52: Avoid redundant Boolean call

It is not necessary to use Boolean call when a value will already be coerced to a boolean.
Unsafe fix: Remove redundant Boolean call

(lint/complexity/noExtraBooleanCast)

⏰ Context from checks skipped due to timeout of 90000ms (10)
  • GitHub Check: perform-test / rts-build / build
  • GitHub Check: perform-test / client-build / client-build
  • GitHub Check: perform-test / server-build / server-unit-tests
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
  • GitHub Check: client-build / client-build
  • GitHub Check: client-prettier / prettier-check
  • GitHub Check: chromatic-deployment
  • GitHub Check: chromatic-deployment
  • GitHub Check: storybook-tests
🔇 Additional comments (4)
app/client/src/pages/Editor/IDE/EditorPane/JS/EntityItem/JSEntityItem.tsx (1)

98-112: LGTM! Clean implementation of EntityItem component.

The component properly implements conditional editing, selection state, and navigation functionality.

app/client/cypress/support/Pages/EntityExplorer.ts (1)

71-71: LGTM: New entity add button selector added.

The selector follows the data-testid pattern with a meaningful name.

app/client/cypress/support/Pages/IDE/LeftPane.ts (1)

91-98: LGTM! Well-structured method addition.

The new selectedItem method is well-typed and follows the codebase patterns.

app/client/cypress/support/Objects/CommonLocators.ts (1)

339-345: LGTM! Well-structured locators using data-testid.

The new module-related locators follow best practices by using data-testid attributes.

@sagar-qa007 sagar-qa007 added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Feb 10, 2025
@ankitakinger
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

@github-actions
Copy link

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/13257191139.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 39093.
recreate: .

@github-actions
Copy link

Deploy-Preview-URL: https://ce-39093.dp.appsmith.com

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
app/client/src/pages/AppIDE/components/UIList/UIList.test.tsx (1)

349-350: Improved test query method

Good refactoring from querySelector with ID selector to getByTestId. This follows React Testing Library best practices by:

  1. Using dedicated test IDs rather than implementation details
  2. Improving test stability against UI changes
  3. Better expressing test intent
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between c19af30 and c1a36af.

📒 Files selected for processing (1)
  • app/client/src/pages/AppIDE/components/UIList/UIList.test.tsx (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: perform-test / rts-build / build
  • GitHub Check: perform-test / server-build / server-unit-tests
  • GitHub Check: perform-test / client-build / client-build
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
  • GitHub Check: client-prettier / prettier-check
  • GitHub Check: client-build / client-build
🔇 Additional comments (1)
app/client/src/pages/AppIDE/components/UIList/UIList.test.tsx (1)

96-96: Entity name selector updated correctly

The change from div.t--entity-name to span.t--entity-name aligns with the Entity Item component structure changes after removing the feature flag.

@hetunandu hetunandu removed the Stale label Mar 7, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
app/client/cypress/support/Pages/EntityExplorer.ts (1)

287-296:

Details

❓ Verification inconclusive

Check if double PageList.ShowList() is necessary.

The code calls PageList.ShowList() twice consecutively, which seems redundant and could be problematic if the first call toggles the list open and the second toggles it closed.

    else {
      if (entityType === EntityItems.Page) {
        PageList.ShowList();
        cy.get(this.locator._entityTestId(entityName)).click();
-        PageList.ShowList();
+        // Only show list again if needed - consider adding a check here
        cy.get(this.locator._entityTestId(entityName)).dblclick();
      } else {
        cy.get(this.locator._entityTestId(entityName)).dblclick();
      }
    }

🏁 Script executed:

#!/bin/bash
# Check if PageList.ShowList() is a toggle or always shows the list
rg -A 5 "ShowList\(\)" app/client/cypress/support/

Length of output: 6001


Action Required: Verify Necessity of Double PageList.ShowList() Calls

  • In app/client/cypress/support/Pages/EntityExplorer.ts (lines 287-296), the code calls PageList.ShowList() before a click and again before a double-click.
  • The implementation in PageList.ts indicates that ShowList() checks if the list is closed (via the data-state attribute) and only opens it if necessary.
  • If the click on the entity doesn't toggle the list closed, the second call may be redundant. However, if clicking causes the list to collapse, the second call ensures the list is visible for the subsequent double-click.
  • Recommendation: Verify the actual behavior after the click event. If the list remains open post-click, consider removing or conditionally executing the second PageList.ShowList() call to streamline the test.
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 94f0fc5 and 0183f03.

📒 Files selected for processing (2)
  • app/client/cypress/support/Pages/EntityExplorer.ts (5 hunks)
  • app/client/src/pages/AppIDE/components/QueryEntityItem/QueryEntityItem.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`app/client/cypress/**/**.*`: Review the following e2e test ...

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/support/Pages/EntityExplorer.ts
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: perform-test / rts-build / build
  • GitHub Check: perform-test / client-build / client-build
  • GitHub Check: perform-test / server-build / server-unit-tests
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-prettier / prettier-check
  • GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
  • GitHub Check: client-build / client-build
  • GitHub Check: client-lint / client-lint
🔇 Additional comments (5)
app/client/src/pages/AppIDE/components/QueryEntityItem/QueryEntityItem.tsx (1)

53-56: Adding key and dataTestId to EntityContextMenu is a good practice.

Adding a unique key prop using action.id helps React efficiently update the DOM during reconciliation. The dataTestId attribute enhances testability by providing a consistent selector for automated tests.

app/client/cypress/support/Pages/EntityExplorer.ts (4)

54-57: Replace XPath selector with data- attribute.*

The selector still uses XPath with hardcoded HTML tags which violates the coding guidelines to avoid XPath selectors.

-    "//span[text()='" +
-    entityNameinLeftSidebar +
-    "']/parent::div/following-sibling::div//button";
+    `[data-cy="entity-context-menu-${entityNameinLeftSidebar}"]`;

71-71: Use data-testid for entity add button selector.

The selector uses a class which is more brittle than data attributes.

-  _entityAddButton = ".t--entity-add-btn";
+  _entityAddButton = "[data-testid='t--entity-add-btn']";

121-124: Looks good.

This change appropriately expands the tooltip validation message to include the restricted keyword scenario.


157-157: Good refactoring.

Nice extraction of the repeated logic into a separate method.

@hetunandu hetunandu merged commit e1d09b4 into release Mar 14, 2025
83 checks passed
@hetunandu hetunandu deleted the chore/remove-ff-entity-item-usage branch March 14, 2025 12:10
@ankitakinger ankitakinger changed the title chore: Removing the feature flag for using Entity Item component from ADS templates chore: Activating the feature flag in cypress for using Entity Item component from ADS templates Mar 15, 2025
github-actions bot pushed a commit to Zeral-Zhang/appsmith that referenced this pull request Apr 12, 2025
## Description

Just UI changes from appsmithorg#39093 


Fixes appsmithorg#39556

## 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/13673781581>
> Commit: b78e21d
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=13673781581&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.IDE`
> Spec:
> <hr>Wed, 05 Mar 2025 10:57:58 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Enhanced editable text components now support name normalization with
dynamic ellipsis and improved tooltip handling.
- Entity and widget list views now display names directly with updated
expand/collapse icons and refined selection behavior.
- Context menus reflect conditional interactivity by disabling options
based on permissions and item types.
- New identifiers for list items and context menus improve testing
capabilities.

- **Refactor**
- Consolidated property handling and class name assignments across
components for consistent behavior.
- Streamlined data structures and conditional rendering in entity
explorers and context menus to enhance clarity and maintainability.
- Updated components to use direct property access for improved
performance and readability.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
github-actions bot pushed a commit to Zeral-Zhang/appsmith that referenced this pull request Apr 12, 2025
… ADS templates (appsmithorg#39093)

## Description

Removing the feature flag for using Entity Item component from ADS
templates in the Entity Explorer in App Editor.

Fixes [appsmithorg#39067](appsmithorg#39067)

## Automation

/ok-to-test tags="@tag.All"

### 🔍 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/13804174182>
> Commit: 8a4a200
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=13804174182&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.All`
> Spec:
> <hr>Wed, 12 Mar 2025 06:32:35 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Improved entity renaming: input fields now automatically clear
previous text for smoother editing.
- Enhanced page navigation: active selections are now verified more
consistently, ensuring clearer context.
  - New feature flag added for enhanced entity item visibility.
- Added new methods for improved entity selection and verification in
tests.
- Introduced `parentId` properties in widget definitions to enhance
hierarchical structure.
- Updated selectors for widget names and collapsible elements in tests
for improved targeting.

- **Bug Fixes**
- Resolved issues with inconsistent element detection and state feedback
for a more stable interface.

- **Refactor**
- Updated widget hierarchy and locator logic for improved layout
rendering and overall UI consistency.
- Modified locator strategies to enhance element targeting across
various components.
  - Simplified method signatures for better clarity and maintainability.
  - Enhanced test selectors to improve reliability and maintainability.
- Removed obsolete commands and streamlined interaction methods in
tests.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Hetu Nandu <hetunandu@gmail.com>
Co-authored-by: Hetu Nandu <hetu@appsmith.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

IDE Pod Issues that new developers face while exploring the IDE IDE Product Issues related to the IDE Product ok-to-test Required label for CI skip-changelog Adding this label to a PR prevents it from being listed in the changelog Task A simple Todo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Task]: Activate feature flag for Entity Item usage from ADS templates

4 participants