Skip to content

Conversation

ankitakinger
Copy link
Contributor

@ankitakinger ankitakinger commented Apr 30, 2025

Description

Fixing cypress tests that are failing due to the change from executeOnLoad to runBehavior

Fixes #39833

Automation

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

🔍 Cypress test results

Warning

Tests have not run on the HEAD d9d2419 yet


Wed, 30 Apr 2025 14:37:22 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

  • New Features

    • Introduced a "Run behavior" dropdown for APIs, queries, and JS functions, allowing users to select between "On page load" and "Manual" execution modes.
    • Enhanced settings UI with descriptive labels and subtexts for run behavior options.
  • Improvements

    • Replaced the simple "Run on page load" switch with a flexible dropdown across the platform for better control and clarity.
    • Updated terminology and UI across app settings, plugin configurations, and test suites to reflect the new run behavior model.
  • Bug Fixes

    • Adjusted automated tests and UI interactions to align with the new run behavior selection, ensuring consistent behavior and reliability.
  • Documentation

    • Updated labels, tooltips, and instructional text to guide users on the new run behavior options.
  • Refactor

    • Unified internal logic and configuration to support the new run behavior property, replacing legacy boolean flags.

@ankitakinger ankitakinger added the ok-to-test Required label for CI label Apr 30, 2025
Copy link
Contributor

coderabbitai bot commented Apr 30, 2025

Walkthrough

This change comprehensively refactors the execution control for actions, queries, and JS functions from a boolean executeOnLoad flag to a more expressive runBehavior property. The update affects both client and server code, including TypeScript interfaces, Redux actions, sagas, plugin configurations, test fixtures, and Cypress tests. UI components and settings now use a dropdown to select between "On page load" and "Manual" behaviors instead of a switch. The backend introduces a new RunBehaviorEnum, updates DTOs, adds new endpoints and service methods for run behavior, and ensures backward compatibility by synchronizing the deprecated flag and the new enum. All relevant tests and mocks are updated to align with the new property.

Changes

Files / Areas Change Summary
Cypress tests, support, and fixtures All occurrences of boolean-based on-page-load toggles (true/false) are replaced with string-based run behavior modes ("On page load"/"Manual"). Selectors and helper methods are updated to interact with dropdowns instead of switches. Test assertions and utility methods are refactored accordingly.
Client-side TypeScript: Redux, actions, sagas, reducers, selectors, utils, types, and configs All references to executeOnLoad are replaced with runBehavior of type ActionRunBehaviourType. Redux action types, creators, reducers, and sagas are renamed and refactored for run behavior. UI and form configs use dropdowns for run behavior selection. Test fixtures and utilities are updated. Type definitions for navigation data are centralized.
Editor and Plugin UI components (JSFunctionSettings, DropDownControl, etc.) UI controls for execution mode are changed from switches to dropdowns with descriptive labels and subtexts. Components, styles, and test cases are updated to reflect the new dropdown-based selection.
Server: Java DTOs, enums, controllers, services, plugin settings, and tests The executeOnLoad Boolean is deprecated and replaced by a new runBehavior enum (RunBehaviorEnum). New service methods and endpoints are introduced for run behavior, ensuring bidirectional synchronization with the deprecated flag. Plugin settings JSONs are updated to use dropdowns for run behavior. New and updated tests verify correct behavior and migration logic.
Test data, factories, and mock states All action, query, and JS function mocks and factories now use the runBehavior property with appropriate values instead of executeOnLoad.
Type imports and navigation data Navigation data types are centralized in dataTreeTypes.ts and all imports are updated accordingly.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI (Dropdown)
    participant Redux/Saga
    participant API
    participant Server
    participant DB

    User->>UI (Dropdown): Selects run behavior ("On page load"/"Manual")
    UI (Dropdown)->>Redux/Saga: Dispatch SET_*_RUN_BEHAVIOR action
    Redux/Saga->>API: Call updateActionRunBehavior(actionId, runBehavior)
    API->>Server: PUT /runBehavior/{actionId} { behavior: runBehavior }
    Server->>DB: Update action.runBehavior & sync executeOnLoad
    Server-->>API: Return updated ActionDTO
    API-->>Redux/Saga: Updated action data
    Redux/Saga-->>UI (Dropdown): Update state/UI to reflect new run behavior
Loading

Assessment against linked issues

Objective (Issue #) Addressed Explanation
Update all Cypress and unit tests to use runBehavior instead of executeOnLoad (#39833)
Refactor codebase to replace executeOnLoad with runBehavior dropdown (#39833)
Ensure backend and API changes for new run behavior property (#39833)
Migrate all mocks, factories, and configs to use runBehavior (#39833)

Possibly related PRs

Suggested reviewers

  • ApekshaBhosale
  • ayushpahwa

Poem

Dropdowns now dance where switches once lay,
"On page load" or "Manual"—clear as day!
Booleans retire, enums take the stage,
With backend and frontend both all the rage.
Tests and mocks in harmony run,
This refactor’s finished—onward, well done!
🎭✨


🪧 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 generate sequence diagram to generate a sequence diagram of the changes in this 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 Core Query Execution Issues related to the execution of all queries IDE Pod Issues that new developers face while exploring the IDE IDE Product Issues related to the IDE Product Integrations Product Issues related to a specific integration potential-duplicate This label marks issues that are potential duplicates of already open issues Query Settings Issues related to the settings of all queries Query Widgets & IDE Pod All issues related to Query, JS, Eval, Widgets & IDE Task A simple Todo labels Apr 30, 2025
@github-actions github-actions bot added skip-changelog Adding this label to a PR prevents it from being listed in the changelog CI labels Apr 30, 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

🔭 Outside diff range comments (7)
app/client/cypress/e2e/Regression/ClientSide/SetProperty/WidgetPropertySetters2_spec.ts (2)

108-108: ⚠️ Potential issue

Avoid using Sleep() in Cypress tests.

According to the coding guidelines for Cypress tests, agHelper.Sleep() should be avoided. Consider using Cypress's built-in retry and wait mechanisms that automatically wait for elements to appear.

Replace with appropriate Cypress commands that wait for specific conditions rather than using explicit sleep:

-agHelper.Sleep(3000); //for the Api to run & new value to be set, for CI runs
+agHelper.WaitUntilAllToastsDisappear(); // Wait for API completion
+agHelper.WaitUntilElementHasValue(locators._widgetInDeployed(draggableWidgets.INPUT_V2) + " " + locators._input);

217-217: ⚠️ Potential issue

Avoid using Sleep() in Cypress tests.

Another instance of agHelper.Sleep() which should be avoided according to the coding guidelines.

Replace with appropriate waiting mechanism:

-agHelper.Sleep(3000); //for the Api to run & button to disappear, for CI runs
+agHelper.WaitUntilAllToastsDisappear(); // Wait for API completion
+agHelper.WaitUntilElementDisappear(locators._widgetInDeployed(draggableWidgets.BUTTON));
app/client/cypress/e2e/Regression/ClientSide/SetProperty/SetOptions_Spec.ts (1)

371-371: ⚠️ Potential issue

Replace explicit sleep with better waiting mechanism.

Using agHelper.Sleep() is against the coding guidelines. Replace this with a more reliable waiting mechanism such as waiting for a specific element state or condition.

- agHelper.Sleep(); //settimeout timer, hence sleep needed here!
+ agHelper.WaitForCondition(() => {
+   // Wait for the expected condition after setTimeout executes
+   return agHelper.GetElement(locators._widgetInDeployed(draggableWidgets.INPUT_V2) + " " + locators._input)
+     .then($ele => {
+       return cy.wrap($ele).should("include.value", "local");
+     });
+ });
app/client/cypress/e2e/Regression/ServerSide/JsFunctionExecution/JSFunctionExecution_spec.ts (4)

175-175: ⚠️ Potential issue

Avoid using agHelper.Sleep() in tests.

The use of agHelper.Sleep(2000) violates the coding guidelines which specify to avoid using Sleep(). Consider using conditional waiting instead.

-      agHelper.Sleep(2000); // Giving more time for parsing to reduce flakiness!
+      // Wait for specific condition instead of using Sleep
+      agHelper.WaitUntilAllToastsDisappear();
+      // OR wait for a specific element or condition that indicates parsing is complete

258-259: ⚠️ Potential issue

Replace Sleep with conditional waiting.

Avoid using agHelper.Sleep() as it makes tests flaky and violates coding guidelines.

-      // wait for 3 secs and assert that App doesn't crash
-      agHelper.Sleep(3000);
+      // Wait for specific condition that confirms the app didn't crash
+      agHelper.WaitUntilAllToastsDisappear();
+      // OR wait for an element that should be present if app didn't crash

461-463: ⚠️ Potential issue

Remove multiple Sleep calls.

Multiple consecutive Sleep calls indicate a need for better conditional waiting.

-      agHelper.Sleep();
-      agHelper.WaitUntilAllToastsDisappear();
-      agHelper.Sleep();
+      // Wait for a specific condition that indicates the clone operation is complete
+      agHelper.WaitUntilAllToastsDisappear();
+      // Wait for additional elements or conditions if needed

472-472: ⚠️ Potential issue

Replace arbitrary Sleep with conditional waiting.

Using Sleep with arbitrary times makes tests unreliable and violates coding guidelines.

-      agHelper.Sleep(3000);
+      // Wait for a specific condition that indicates the JS object has been processed
+      // For example, wait for an element to be visible or enabled
♻️ Duplicate comments (1)
app/server/appsmith-plugins/anthropicPlugin/src/main/resources/setting.json (1)

8-23: Changes mirror OpenAI plugin; apply the same feedback
This block replaces executeOnLoad with runBehavior identically to the OpenAI plugin. Please ensure the same verifications, tooltip addition, and shared constants/i18n refactors are applied here.

🧹 Nitpick comments (6)
app/client/src/utils/JSPaneUtils.test.ts (1)

44-44: Consider using enum value for consistency

While the changes work correctly, consider using the ActionRunBehaviour enum value (like in editorComponents/utils.test.ts) instead of string literals for better type safety and consistency.

-      runBehavior: "MANUAL",
+      runBehavior: ActionRunBehaviour.MANUAL,

Also applies to: 86-86, 154-154, 196-196, 280-280, 361-361, 472-472, 552-552, 627-627, 702-702, 757-757

app/server/appsmith-plugins/openAiPlugin/src/main/resources/setting.json (2)

8-11: Consider adding a tooltip for consistency
Other settings here include a tooltipText for guidance. Adding for example

"tooltipText": "Select when this query should run"

would improve discoverability.


12-23: Extract option definitions to shared constants/i18n
The option labels and subText strings repeat across multiple plugins. To avoid drift and simplify translations, consider centralizing these values in a shared constants or localization resource.

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

312-328: Updated enablement method for dropdown interaction.

The method correctly implements the interaction flow for setting run behavior through a dropdown UI.

However, be cautious with the hardcoded index 0 in the GetNClickByContains call. If the dropdown options order changes in the future, this might break.

- this.agHelper.GetNClickByContains(
-   this._dropdownOption,
-   runBehavior,
-   0,
-   true,
- );
+ // Use a more resilient approach that doesn't depend on option order
+ this.agHelper.GetNClickByContains(
+   this._dropdownOption,
+   runBehavior,
+   undefined,
+   true,
+ );
app/client/src/ce/sagas/PageSagas.tsx (2)

542-544: Consider using Object.hasOwn() instead of hasOwnProperty.

Direct use of hasOwnProperty method on objects is discouraged as it can be overridden or undefined.

- const jsActions = actionUpdates.filter((d) =>
-   d.hasOwnProperty("collectionId"),
- );
+ const jsActions = actionUpdates.filter((d) =>
+   Object.hasOwn(d, "collectionId"),
+ );
🧰 Tools
🪛 Biome (1.9.4)

[error] 543-543: Do not access Object.prototype method 'hasOwnProperty' from target object.

It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.

(lint/suspicious/noPrototypeBuiltins)


546-548: Updated JS actions dispatch to use the renamed action creator.

The code now dispatches the setJSActionsRunBehavior action instead of setJSActionsToExecuteOnPageLoad, maintaining the same functionality but with the updated naming pattern.

Consider using optional chaining for better readability and safety:

- if (jsActions && jsActions.length) {
+ if (jsActions?.length) {
    yield put(setJSActionsRunBehavior(jsActions));
  }
🧰 Tools
🪛 Biome (1.9.4)

[error] 546-546: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 352e68b and 79e1c0a.

📒 Files selected for processing (81)
  • app/client/cypress/e2e/Regression/ClientSide/BugTests/Bug20275_Spec.js (1 hunks)
  • app/client/cypress/e2e/Regression/ClientSide/JSObject/JSObject_Tests_spec.ts (1 hunks)
  • app/client/cypress/e2e/Regression/ClientSide/SetProperty/SetOptions_Spec.ts (4 hunks)
  • app/client/cypress/e2e/Regression/ClientSide/SetProperty/WidgetPropertySetters2_spec.ts (2 hunks)
  • app/client/cypress/e2e/Regression/ServerSide/JsFunctionExecution/JSFunctionExecution_spec.ts (6 hunks)
  • app/client/cypress/e2e/Regression/ServerSide/JsFunctionExecution/SetTimeout_spec.ts (1 hunks)
  • app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/JSOnLoad2_Spec.ts (1 hunks)
  • app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/JSOnLoad4_Spec.ts (1 hunks)
  • app/client/cypress/support/Pages/JSEditor.ts (3 hunks)
  • app/client/src/PluginActionEditor/components/PluginActionSettings/SettingsPopover.tsx (1 hunks)
  • app/client/src/PluginActionEditor/constants/PluginActionConstants.ts (0 hunks)
  • app/client/src/PluginActionEditor/transformers/RestActionTransformers.test.ts (1 hunks)
  • app/client/src/PluginActionEditor/types/PluginActionTypes.ts (1 hunks)
  • app/client/src/actions/pluginActionActions.ts (2 hunks)
  • app/client/src/api/ActionAPI.tsx (2 hunks)
  • app/client/src/api/PageApi.tsx (2 hunks)
  • app/client/src/ce/components/editorComponents/GPT/index.tsx (1 hunks)
  • app/client/src/ce/constants/ReduxActionConstants.tsx (4 hunks)
  • app/client/src/ce/constants/messages.ts (1 hunks)
  • app/client/src/ce/entities/DataTree/dataTreeJSAction.test.ts (4 hunks)
  • app/client/src/ce/reducers/entityReducers/actionsReducer.tsx (3 hunks)
  • app/client/src/ce/reducers/entityReducers/jsActionsReducer.tsx (4 hunks)
  • app/client/src/ce/sagas/PageSagas.tsx (2 hunks)
  • app/client/src/ce/utils/autocomplete/EntityDefinitions.test.ts (2 hunks)
  • app/client/src/ce/utils/moduleInstanceNavigationData.ts (1 hunks)
  • app/client/src/components/editorComponents/CodeEditor/EditorConfig.ts (1 hunks)
  • app/client/src/components/editorComponents/CodeEditor/MarkHelpers/entityMarker.ts (1 hunks)
  • app/client/src/components/editorComponents/CodeEditor/commandsHelper.ts (1 hunks)
  • app/client/src/components/editorComponents/CodeEditor/generateQuickCommands.tsx (1 hunks)
  • app/client/src/components/editorComponents/CodeEditor/index.tsx (1 hunks)
  • app/client/src/components/editorComponents/PartialImportExport/PartialExportModal/unitTestUtils.ts (10 hunks)
  • app/client/src/components/editorComponents/utils.test.ts (2 hunks)
  • app/client/src/components/formControls/DropDownControl.tsx (4 hunks)
  • app/client/src/constants/AppsmithActionConstants/formConfig/ApiSettingsConfig.ts (1 hunks)
  • app/client/src/constants/AppsmithActionConstants/formConfig/GoogleSheetsSettingsConfig.ts (1 hunks)
  • app/client/src/constants/AppsmithActionConstants/formConfig/QuerySettingsConfig.ts (1 hunks)
  • app/client/src/entities/Action/actionProperties.test.ts (1 hunks)
  • app/client/src/entities/Action/index.ts (2 hunks)
  • app/client/src/entities/DataTree/dataTreeTypes.ts (2 hunks)
  • app/client/src/pages/Editor/EntityNavigation/JSObjectsPane/index.ts (1 hunks)
  • app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionSettings.test.tsx (5 hunks)
  • app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionSettings.tsx (3 hunks)
  • app/client/src/pages/Editor/JSEditor/JSEditorToolbar/types.ts (1 hunks)
  • app/client/src/pages/Editor/JSEditor/utils.test.ts (2 hunks)
  • app/client/src/pages/Editor/SaaSEditor/__data__/FinalState.json (8 hunks)
  • app/client/src/pages/Editor/SaaSEditor/__data__/InitialState.json (8 hunks)
  • app/client/src/sagas/ActionExecution/PluginActionSaga.ts (2 hunks)
  • app/client/src/sagas/ActionSagas.ts (4 hunks)
  • app/client/src/sagas/BuildingBlockSagas/tests/fixtures.ts (1 hunks)
  • app/client/src/sagas/JSPaneSagas.ts (4 hunks)
  • app/client/src/selectors/navigationSelectors.ts (1 hunks)
  • app/client/src/utils/DynamicBindingUtils.test.ts (1 hunks)
  • app/client/src/utils/FilterInternalProperties/JsAction.ts (2 hunks)
  • app/client/src/utils/JSPaneUtils.test.ts (11 hunks)
  • app/client/src/utils/JSPaneUtils.tsx (5 hunks)
  • app/client/src/utils/NavigationSelector/JsChildren.ts (1 hunks)
  • app/client/src/utils/NavigationSelector/WidgetChildren.ts (1 hunks)
  • app/client/src/utils/NavigationSelector/common.ts (1 hunks)
  • app/client/test/factories/Actions/API.ts (1 hunks)
  • app/client/test/factories/Actions/GoogleSheetFactory.ts (1 hunks)
  • app/client/test/factories/Actions/JSObject.ts (2 hunks)
  • app/client/test/factories/Actions/Postgres.ts (1 hunks)
  • app/client/test/factories/MockPluginsState.ts (4 hunks)
  • app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/RunBehaviorEnum.java (1 hunks)
  • app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/ce/ActionCE_DTO.java (2 hunks)
  • app/server/appsmith-plugins/amazons3Plugin/src/main/resources/setting.json (1 hunks)
  • app/server/appsmith-plugins/anthropicPlugin/src/main/resources/setting.json (1 hunks)
  • app/server/appsmith-plugins/appsmithAiPlugin/src/main/resources/setting.json (1 hunks)
  • app/server/appsmith-plugins/firestorePlugin/src/main/resources/setting.json (1 hunks)
  • app/server/appsmith-plugins/googleAiPlugin/src/main/resources/setting.json (1 hunks)
  • app/server/appsmith-plugins/googleSheetsPlugin/src/main/resources/setting.json (1 hunks)
  • app/server/appsmith-plugins/mongoPlugin/src/main/resources/setting.json (1 hunks)
  • app/server/appsmith-plugins/mssqlPlugin/src/main/resources/setting.json (1 hunks)
  • app/server/appsmith-plugins/mysqlPlugin/src/main/resources/setting.json (1 hunks)
  • app/server/appsmith-plugins/openAiPlugin/src/main/resources/setting.json (1 hunks)
  • app/server/appsmith-plugins/oraclePlugin/src/main/resources/setting.json (1 hunks)
  • app/server/appsmith-plugins/postgresPlugin/src/main/resources/setting.json (1 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ActionControllerCE.java (2 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCE.java (2 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCEImpl.java (3 hunks)
  • app/server/appsmith-server/src/test/java/com/appsmith/server/services/LayoutActionServiceTest.java (2 hunks)
💤 Files with no reviewable changes (1)
  • app/client/src/PluginActionEditor/constants/PluginActionConstants.ts
🧰 Additional context used
📓 Path-based instructions (1)
`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. ...

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/JSObject_Tests_spec.ts
  • app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/JSOnLoad4_Spec.ts
  • app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/JSOnLoad2_Spec.ts
  • app/client/cypress/e2e/Regression/ClientSide/SetProperty/WidgetPropertySetters2_spec.ts
  • app/client/cypress/e2e/Regression/ClientSide/BugTests/Bug20275_Spec.js
  • app/client/cypress/e2e/Regression/ServerSide/JsFunctionExecution/SetTimeout_spec.ts
  • app/client/cypress/e2e/Regression/ClientSide/SetProperty/SetOptions_Spec.ts
  • app/client/cypress/e2e/Regression/ServerSide/JsFunctionExecution/JSFunctionExecution_spec.ts
  • app/client/cypress/support/Pages/JSEditor.ts
🧬 Code Graph Analysis (16)
app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/JSOnLoad2_Spec.ts (1)
app/client/cypress/e2e/Regression/ClientSide/BugTests/Bug20275_Spec.js (1)
  • jsEditor (7-12)
app/client/cypress/e2e/Regression/ClientSide/SetProperty/WidgetPropertySetters2_spec.ts (1)
app/client/cypress/e2e/Regression/ClientSide/BugTests/Bug20275_Spec.js (1)
  • jsEditor (7-12)
app/client/src/constants/AppsmithActionConstants/formConfig/ApiSettingsConfig.ts (1)
app/client/src/PluginActionEditor/types/PluginActionTypes.ts (2)
  • RUN_BEHAVIOR (10-23)
  • RUN_BEHAVIOR_VALUES (25-25)
app/client/src/entities/Action/index.ts (1)
app/client/src/PluginActionEditor/types/PluginActionTypes.ts (1)
  • ActionRunBehaviourType (27-27)
app/client/src/pages/Editor/JSEditor/JSEditorToolbar/types.ts (1)
app/client/src/PluginActionEditor/types/PluginActionTypes.ts (1)
  • ActionRunBehaviourType (27-27)
app/client/src/constants/AppsmithActionConstants/formConfig/QuerySettingsConfig.ts (1)
app/client/src/PluginActionEditor/types/PluginActionTypes.ts (2)
  • RUN_BEHAVIOR (10-23)
  • RUN_BEHAVIOR_VALUES (25-25)
app/client/src/sagas/ActionExecution/PluginActionSaga.ts (2)
app/client/src/ce/reducers/entityReducers/actionsReducer.tsx (1)
  • ActionData (18-22)
app/client/src/ce/selectors/entitiesSelector.ts (1)
  • getCurrentActions (694-702)
app/client/src/api/ActionAPI.tsx (1)
app/client/src/PluginActionEditor/types/PluginActionTypes.ts (1)
  • ActionRunBehaviourType (27-27)
app/client/src/entities/DataTree/dataTreeTypes.ts (1)
app/client/src/ce/entities/DataTree/types.ts (1)
  • EntityTypeValue (37-37)
app/client/src/ce/reducers/entityReducers/actionsReducer.tsx (2)
app/client/src/ce/constants/ReduxActionConstants.tsx (1)
  • ReduxActionTypes (1281-1324)
app/client/src/PluginActionEditor/types/PluginActionTypes.ts (1)
  • ActionRunBehaviourType (27-27)
app/client/src/constants/AppsmithActionConstants/formConfig/GoogleSheetsSettingsConfig.ts (1)
app/client/src/PluginActionEditor/types/PluginActionTypes.ts (2)
  • RUN_BEHAVIOR (10-23)
  • RUN_BEHAVIOR_VALUES (25-25)
app/client/cypress/e2e/Regression/ClientSide/SetProperty/SetOptions_Spec.ts (1)
app/client/cypress/e2e/Regression/ClientSide/BugTests/Bug20275_Spec.js (1)
  • jsEditor (7-12)
app/client/src/ce/reducers/entityReducers/jsActionsReducer.tsx (2)
app/client/src/ce/constants/ReduxActionConstants.tsx (1)
  • ReduxActionTypes (1281-1324)
app/client/src/PluginActionEditor/types/PluginActionTypes.ts (1)
  • ActionRunBehaviourType (27-27)
app/client/src/components/formControls/DropDownControl.tsx (1)
app/client/packages/design-system/widgets/src/components/Text/src/Text.tsx (1)
  • Text (66-66)
app/client/src/api/PageApi.tsx (1)
app/client/src/PluginActionEditor/types/PluginActionTypes.ts (1)
  • ActionRunBehaviourType (27-27)
app/client/src/actions/pluginActionActions.ts (2)
app/client/src/PluginActionEditor/types/PluginActionTypes.ts (1)
  • ActionRunBehaviourType (27-27)
app/client/src/ce/constants/ReduxActionConstants.tsx (1)
  • ReduxActionTypes (1281-1324)
🪛 Biome (1.9.4)
app/client/src/ce/sagas/PageSagas.tsx

[error] 543-543: Do not access Object.prototype method 'hasOwnProperty' from target object.

It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.

(lint/suspicious/noPrototypeBuiltins)


[error] 546-546: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: perform-test / client-build / client-build
  • GitHub Check: client-lint / client-lint
  • GitHub Check: server-unit-tests / server-unit-tests
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-build / client-build
🔇 Additional comments (152)
app/client/src/ce/utils/moduleInstanceNavigationData.ts (1)

2-2: Centralize EntityNavigationData import
The import has been correctly updated to source EntityNavigationData from the unified dataTreeTypes module.

app/client/src/components/editorComponents/CodeEditor/MarkHelpers/entityMarker.ts (1)

4-4: Standardize navigation types import
Good update to import EntityNavigationData and NavigationData from the centralized dataTreeTypes.

app/client/src/utils/NavigationSelector/common.ts (1)

5-5: Sync NavigationData import path
The EntityNavigationData and NavigationData types now consistently come from dataTreeTypes, improving maintainability.

app/client/src/utils/NavigationSelector/JsChildren.ts (1)

10-10: Align JS children navigation types
Importing EntityNavigationData and NavigationData from dataTreeTypes keeps navigation typings centralized.

app/client/src/ce/components/editorComponents/GPT/index.tsx (1)

6-6: Update EntityNavigationData import
Switching to the shared dataTreeTypes module for EntityNavigationData ensures type consistency across AI editor components.

app/client/src/utils/NavigationSelector/WidgetChildren.ts (1)

5-5: Import path updated correctly for EntityNavigationData.

The import path for EntityNavigationData has been updated from "selectors/navigationSelectors" to "entities/DataTree/dataTreeTypes" as part of the broader type centralization effort.

app/client/src/PluginActionEditor/components/PluginActionSettings/SettingsPopover.tsx (1)

16-16: THEME import path correctly updated.

The import for THEME constant has been properly updated from "../../constants/PluginActionConstants" to "../../types/PluginActionTypes" as part of the migration from executeOnLoad to runBehavior.

app/client/src/components/editorComponents/CodeEditor/generateQuickCommands.tsx (1)

17-17: NavigationData import path updated correctly.

The import path for NavigationData has been updated from "selectors/navigationSelectors" to "entities/DataTree/dataTreeTypes" as part of the centralization of navigation-related types.

app/client/src/components/editorComponents/CodeEditor/commandsHelper.ts (1)

19-21: Navigation-related types import paths updated correctly.

The import paths for EntityNavigationData and NavigationData have been updated from "selectors/navigationSelectors" to "entities/DataTree/dataTreeTypes" for better type organization.

app/client/src/utils/DynamicBindingUtils.test.ts (1)

123-123: Update aligns with the executeOnLoad to runBehavior refactor

This change correctly replaces the old boolean executeOnLoad property with the new string-based runBehavior: "MANUAL" approach, which matches the broader codebase refactor mentioned in the PR description.

app/client/cypress/e2e/Regression/ClientSide/JSObject/JSObject_Tests_spec.ts (1)

36-36: Updated test to use the new runBehavior parameter

The EnableDisableAsyncFuncSettings method now accepts a second parameter "On page load" to align with the change from boolean executeOnLoad to string-based runBehavior property.

app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/JSOnLoad4_Spec.ts (1)

37-42: Updated assertion to use string-based run behavior values

The change correctly replaces the boolean assertions with string-based values ("Manual") for all function settings, aligning with the new runBehavior property model.

app/client/src/components/editorComponents/CodeEditor/index.tsx (1)

125-125: Import path updated to reflect type centralization

The EntityNavigationData type import has been moved from 'selectors/navigationSelectors' to 'entities/DataTree/dataTreeTypes', indicating a proper reorganization of types into a more centralized location.

app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/JSOnLoad2_Spec.ts (1)

97-97: Updated EnableDisableAsyncFuncSettings call to use the new string-based run behavior.

The parameter has been updated from a boolean to a string value "On page load", aligning with the refactored API that now uses descriptive string values instead of boolean flags for execution behavior.

app/client/src/ce/constants/messages.ts (1)

2592-2592: UI text updated to reflect the new run behavior model.

Changed from "Choose the functions to run on page load" to "Choose functions run behavior" to accommodate the more flexible string-based run behavior options that replace the boolean toggle.

app/client/src/ce/utils/autocomplete/EntityDefinitions.test.ts (1)

47-47: Updated test fixtures to use the new runBehavior property.

Test data now uses runBehavior: "MANUAL" instead of the previous boolean executeOnLoad: false. This keeps test mocks in sync with the actual implementation changes.

Also applies to: 89-89

app/client/cypress/e2e/Regression/ServerSide/JsFunctionExecution/SetTimeout_spec.ts (1)

230-230: Updated EnableDisableAsyncFuncSettings call with string-based run behavior.

The function call has been updated to use "On page load" instead of a boolean value, consistent with the codebase migration from boolean flags to string-based run behaviors.

app/client/src/PluginActionEditor/transformers/RestActionTransformers.test.ts (1)

18-18: Property update correctly aligns with the codebase change.

The change from executeOnLoad: false to runBehavior: "MANUAL" is consistent with the PR objective of fixing tests related to this property update across the codebase. This ensures the test fixture matches the updated implementation.

app/client/test/factories/Actions/GoogleSheetFactory.ts (1)

66-66: Property update correctly implemented.

The change from executeOnLoad: false to runBehavior: "MANUAL" properly reflects the migration pattern being implemented across the codebase, ensuring test factories will produce objects with the correct structure.

app/client/test/factories/Actions/Postgres.ts (1)

34-34:

✅ Verification successful

Verify intended behavior change.

The change from executeOnLoad: true to runBehavior: "MANUAL" appears to modify the semantic meaning from automatic execution to manual triggering. If this was intentional as part of the refactoring, this is correct.


🏁 Script executed:

#!/bin/bash
# Check if other test files or implementations reference this factory and expect a particular behavior
rg -A 3 -B 3 "PostgresFactory" --glob "*.{ts,tsx,js,jsx}"

Length of output: 10864


PostgresFactory default runBehavior change verified

I checked all usages of PostgresFactory.build() across the test suite (DataSidePane, SnipingModeSaga, QueryRender, ApiCallerSaga, etc.) and none of the tests override or assert on runBehavior. Switching from the old executeOnLoad: true flag to the new default

runBehavior: "MANUAL"

doesn’t break any existing tests and aligns with the intended refactoring to manual triggering.
– No remaining references to executeOnLoad in the codebase
– All tests now inherit the new runBehavior default without failures

app/client/test/factories/Actions/JSObject.ts (1)

33-34: Properties correctly updated in both action configurations.

The change from executeOnLoad: false to runBehavior: "MANUAL" is consistently applied to both JavaScript actions in the factory. This maintains the intended manual execution behavior while aligning with the new property structure.

Also applies to: 73-74

app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCE.java (2)

4-4: Added necessary import for new run behavior enum

The import for RunBehaviorEnum supports the new run behavior functionality replacing the boolean executeOnLoad.


21-21:

✅ Verification successful

New method properly implements run behavior functionality

This method addition complements the existing setExecuteOnLoad method, providing a more descriptive way to control when actions run.


🏁 Script executed:

#!/bin/bash
# Check for corresponding implementation in LayoutActionServiceCEImpl.java
rg -A 10 "setRunBehavior.*RunBehaviorEnum" --type java

Length of output: 11200


Verified run behavior method implementation and tests

The setRunBehavior declaration in LayoutActionServiceCE.java is backed by a full implementation in LayoutActionServiceCEImpl.java and covered by unit tests.

  • app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCEImpl.java: contains public Mono<ActionDTO> setRunBehavior(...) with correct logic and backward-compatibility handling.
  • app/server/appsmith-server/src/test/java/com/appsmith/server/services/LayoutActionServiceTest.java: exercises both ON_PAGE_LOAD and MANUAL cases and asserts persistence.
app/client/src/pages/Editor/JSEditor/utils.test.ts (2)

9-9: Added import for ActionRunBehaviour enum

Correctly imports the enum needed for the test fixtures.


48-48: Replaced executeOnLoad boolean with runBehavior enum

The test fixture properly uses the new runBehavior property with ActionRunBehaviour.MANUAL instead of the deprecated executeOnLoad: false.

app/client/src/ce/entities/DataTree/dataTreeJSAction.test.ts (1)

47-47:

✅ Verification successful

Replaced executeOnLoad with runBehavior in test fixtures

All test fixtures consistently use string literal "MANUAL" for run behavior instead of the deprecated boolean flag.

Also applies to: 94-94, 242-242, 289-289


🏁 Script executed:

#!/bin/bash
# Verify consistent usage of runBehavior across test files
rg -A 1 -B 1 "runBehavior.*MANUAL" --type ts

Length of output: 9319


Consistent runBehavior usage verified

All test fixtures now uniformly use "MANUAL" (or ActionRunBehaviour.MANUAL) in place of the deprecated executeOnLoad. No further changes needed.

app/client/src/sagas/BuildingBlockSagas/tests/fixtures.ts (1)

132-132:

✅ Verification successful

Updated to use ON_PAGE_LOAD run behavior

The fixture correctly uses "ON_PAGE_LOAD" string instead of boolean true for the executeOnLoad property, representing the auto-execution setting.


🏁 Script executed:

#!/bin/bash
# Check for consistent use of ON_PAGE_LOAD in the codebase
rg "runBehavior.*ON_PAGE_LOAD" --type ts

Length of output: 971


Approve: Consistent ON_PAGE_LOAD runBehavior Usage
The fixture now uses the runBehavior property set to "ON_PAGE_LOAD" (string) instead of the old boolean executeOnLoad flag, aligning with the auto-execution pattern used across the codebase (e.g. ActionRunBehaviour.ON_PAGE_LOAD).

app/client/src/entities/Action/actionProperties.test.ts (1)

13-13: Updated property to use runBehavior instead of executeOnLoad

This change correctly updates the DEFAULT_ACTION fixture to use the new runBehavior: "MANUAL" property instead of the deprecated executeOnLoad: false boolean flag.

app/client/src/components/editorComponents/utils.test.ts (2)

2-2: Proper import of ActionRunBehaviour enum

Good addition of the import for the ActionRunBehaviour enum, which is used to provide a type-safe value for the runBehavior property.


34-34: Updated to use ActionRunBehaviour enum

Correctly replaced executeOnLoad: false with runBehavior: ActionRunBehaviour.MANUAL to align with the new behavior model.

app/client/src/utils/JSPaneUtils.test.ts (3)

44-44: Test fixture updates for runBehavior

Successfully updated the JSObject test fixtures to use runBehavior: "MANUAL" instead of the legacy executeOnLoad: false property.

Also applies to: 86-86, 154-154, 196-196


280-280: Updated expected result objects

Correctly updated all the expected result objects to use the new runBehavior: "MANUAL" property, ensuring test comparisons will pass with the new property model.

Also applies to: 361-361, 472-472, 552-552, 627-627, 702-702


757-757: Updated resultAddedAction with runBehavior

Properly updated the resultAddedAction fixture to include the new runBehavior: "MANUAL" property for new actions.

app/client/test/factories/Actions/API.ts (1)

66-66: Updated API factory with runBehavior

Successfully replaced executeOnLoad: false with runBehavior: "MANUAL" in the API factory.

Similar to the JSPaneUtils.test.ts file, consider using the ActionRunBehaviour enum value for better type safety and consistency.

app/client/src/entities/Action/index.ts (2)

13-13: Import aligns with the rest of the codebase

This import brings in the ActionRunBehaviourType type which replaces the boolean flag with a more semantic string type, improving code clarity and future extensibility.


143-143: Property type update correctly reflects the new behavior model

Changed from executeOnLoad: boolean to runBehavior: ActionRunBehaviourType which enables more descriptive run behaviors beyond simple true/false values.

app/client/src/pages/Editor/JSEditor/JSEditorToolbar/types.ts (2)

3-3: New import consistent with type system changes

Correctly imports the ActionRunBehaviourType type needed for the property type update below.


6-6: Type definition update properly aligns with codebase refactor

Changed from value: boolean | number to value: ActionRunBehaviourType to ensure type safety and consistency with the new run behavior model.

app/client/cypress/e2e/Regression/ClientSide/BugTests/Bug20275_Spec.js (1)

33-33: Parameter updated to use the new run behavior string value

Changed from a boolean value to the string "On page load" to align with the new action execution model. This correctly ensures that the JS function will execute when the page loads.

app/client/src/components/editorComponents/CodeEditor/EditorConfig.ts (1)

3-6: Import consolidation improves organization

Consolidated imports by removing the separate import of EntityNavigationData and importing both DataTree and EntityNavigationData from the same source module. This reduces import scattering and improves maintainability.

app/client/src/api/PageApi.tsx (2)

12-12: Added required import for new run behavior type.

The addition of ActionRunBehaviourType import supports the transition from boolean executeOnLoad to the more expressive string-based run behavior model.


73-73: Updated interface to use runBehavior instead of executeOnLoad.

This properly updates the SavePageResponseData interface to use the new runBehavior property of type ActionRunBehaviourType, aligning with the broader refactor across the codebase.

app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/RunBehaviorEnum.java (1)

1-9: Well-structured enum with clear documentation.

Good implementation of the RunBehaviorEnum with clear documentation for each value. This enum provides a more expressive way to define action run behavior compared to the previous boolean flag.

app/client/src/sagas/ActionExecution/PluginActionSaga.ts (2)

172-172: Added import for new ActionRunBehaviour type.

This import is necessary to support the transition from boolean executeOnLoad to the new string-based run behavior model.


1557-1566: Updated condition to use new runBehavior property.

The function clearTriggerActionResponse has been updated to check for action.config.runBehavior !== ActionRunBehaviour.ON_PAGE_LOAD instead of the previous boolean check. This correctly implements the new run behavior model.

app/client/cypress/e2e/Regression/ClientSide/SetProperty/WidgetPropertySetters2_spec.ts (2)

180-180: Updated EnableDisableAsyncFuncSettings to use the new string-based run behavior model.

Changed from boolean true to string "On page load" to align with the new run behavior model being implemented across the codebase.

Make sure to verify there are no calls to cy.wait() or other deprecated patterns in the test suite.


239-239: Updated EnableDisableAsyncFuncSettings to use the new string-based run behavior model.

Changed from boolean false to string "Manual" to align with the new run behavior model being implemented across the codebase.

app/client/src/pages/Editor/EntityNavigation/JSObjectsPane/index.ts (1)

84-84: Property reference updated correctly.

The change from executeOnLoad to runBehavior aligns with the broader refactoring in the codebase. This ensures the settings tab is correctly selected when editing run behavior properties.

app/client/src/constants/AppsmithActionConstants/formConfig/QuerySettingsConfig.ts (2)

1-5: Proper imports added for run behavior constants.

The import of RUN_BEHAVIOR and RUN_BEHAVIOR_VALUES from PluginActionEditor types is necessary for the refactored form configuration.


12-16: Configuration updated to use dropdown for run behavior.

The control type has been correctly changed from a switch to a dropdown, and the configuration now uses the runBehavior property instead of executeOnLoad. This is in line with the broader refactoring to provide more descriptive execution options.

app/client/src/constants/AppsmithActionConstants/formConfig/ApiSettingsConfig.ts (2)

9-12: Proper imports added for run behavior constants.

The import of RUN_BEHAVIOR and RUN_BEHAVIOR_VALUES is consistent with the refactoring approach.


20-24: API settings updated to use dropdown for run behavior.

The control has been correctly changed from a boolean switch to a dropdown with appropriate options from RUN_BEHAVIOR_VALUES. The configuration now uses the runBehavior property instead of executeOnLoad.

app/client/cypress/e2e/Regression/ClientSide/SetProperty/SetOptions_Spec.ts (4)

212-212: Updated to use string-based run behavior value.

The call to EnableDisableAsyncFuncSettings has been correctly updated to use the string literal "On page load" instead of a boolean value, aligning with the API changes.


271-271: Updated to use string-based run behavior value.

The call to EnableDisableAsyncFuncSettings has been correctly updated to use the string literal "On page load" instead of a boolean value.


316-316: Updated to use string-based run behavior value.

The call to EnableDisableAsyncFuncSettings has been correctly updated to use the string literal "On page load" instead of a boolean value.


358-358: Updated to use string-based run behavior value.

The call to EnableDisableAsyncFuncSettings has been correctly updated to use the string literal "Manual" instead of a boolean value.

app/client/src/utils/FilterInternalProperties/JsAction.ts (2)

4-4: New import for ActionRunBehaviour added correctly.

This import is required to support the transition from boolean executeOnLoad to enum-based runBehavior.


19-22: Condition updated to use the new enum-based run behavior.

The previous boolean check for executeOnLoad is now replaced with the more descriptive runBehavior === ActionRunBehaviour.ON_PAGE_LOAD. This improves code clarity by making the execution trigger explicit.

app/server/appsmith-plugins/googleSheetsPlugin/src/main/resources/setting.json (1)

8-23: Switch control replaced with dropdown for better run behavior selection.

Good replacement of the boolean switch with a more descriptive dropdown that clearly communicates when the query will run. The labels and subtexts provide clear guidance to users.

app/server/appsmith-plugins/googleAiPlugin/src/main/resources/setting.json (1)

8-23: Switch control replaced with dropdown for better run behavior selection.

Good replacement of the boolean switch with a more descriptive dropdown that clearly communicates when the query will run. The labels and subtexts provide clear guidance to users.

app/server/appsmith-plugins/postgresPlugin/src/main/resources/setting.json (1)

8-23: Good implementation of the dropdown-based run behavior control.

The change from a boolean executeOnLoad to a string-based runBehavior with dropdown options is well-structured. The labels and subtext for each option clearly explain when queries will execute, which improves the user experience.

app/server/appsmith-plugins/mysqlPlugin/src/main/resources/setting.json (1)

8-23: Consistent implementation across plugins.

The implementation follows the same pattern as in the PostgreSQL plugin, maintaining consistency across the platform. The dropdown options are clearly labeled with helpful explanatory text.

app/server/appsmith-plugins/firestorePlugin/src/main/resources/setting.json (1)

8-23: Properly aligned with the platform-wide refactoring.

The dropdown implementation for run behavior is correctly configured with the same options and initial value as the other plugins. This consistency will help ensure a uniform user experience.

app/client/src/api/ActionAPI.tsx (2)

13-13: Appropriate type import for the new run behavior type.

The import of ActionRunBehaviourType aligns with the platform-wide transition from boolean flags to enumerated behaviors.


305-312:

✅ Verification successful

Well-implemented API method update for the new run behavior paradigm.

The method has been properly renamed from toggleActionExecuteOnLoad to updateActionRunBehavior and updated to use the new typing and endpoint. This change correctly implements the client-side API for the new run behavior feature.


🏁 Script executed:

#!/bin/bash
# Verify that all usages of the old method have been updated to use the new method
rg -l "toggleActionExecuteOnLoad" --type=tsx --type=ts

Length of output: 82


The previous RipGrep invocation used incorrect flags. Let’s re-run the search using -t for TypeScript files:


🏁 Script executed:

#!/bin/bash
# Search for any remaining references to the old method in .ts/.tsx files
rg -l "toggleActionExecuteOnLoad" -t ts -t tsx

Length of output: 74


RipGrep isn’t recognizing built-in TSX types in this sandbox. Let’s explicitly glob the file extensions:


🏁 Script executed:

#!/bin/bash
# Search for any remaining references to the old method in .ts/.tsx files
rg -l "toggleActionExecuteOnLoad" -g "*.ts" -g "*.tsx"

Length of output: 54


✅ No remaining toggleActionExecuteOnLoad references

I searched all .ts/.tsx files for the old method name and found zero hits—every usage has been updated to updateActionRunBehavior.

app/server/appsmith-plugins/appsmithAiPlugin/src/main/resources/setting.json (1)

8-23: Run behavior dropdown configuration is accurate.
The new runBehavior dropdown (with its options and default value) correctly replaces the old boolean switch and aligns with the updated execution-on-load model.

app/server/appsmith-plugins/oraclePlugin/src/main/resources/setting.json (1)

8-23: Run behavior dropdown configuration is accurate.
The runBehavior dropdown and its options properly supersede the legacy boolean flag, matching the standardized execution model across plugins.

app/server/appsmith-plugins/amazons3Plugin/src/main/resources/setting.json (1)

8-23: Run behavior dropdown configuration is accurate.
The introduction of runBehavior as a dropdown with the correct labels and default reflects the updated execution semantics.

app/server/appsmith-plugins/mssqlPlugin/src/main/resources/setting.json (1)

8-23: Run behavior dropdown configuration is accurate.
The runBehavior dropdown control and its defined options properly replace the former boolean setting, adhering to the new execution model.

app/server/appsmith-plugins/mongoPlugin/src/main/resources/setting.json (1)

8-23: Run behavior dropdown configuration is accurate.
The new runBehavior dropdown (with “On page load” and “Manual” options) correctly replaces the boolean toggle and aligns with the platform-wide refactor.

app/server/appsmith-plugins/openAiPlugin/src/main/resources/setting.json (1)

8-11:

❓ Verification inconclusive

runBehavior control definition is correct
The new dropdown replaces the old boolean switch, with configProperty: "runBehavior", controlType: "DROP_DOWN" and default "MANUAL". Ensure the plugin’s Java DTOs and UI renderer are updated to consume this field instead of executeOnLoad.

Run this script to confirm RunBehaviorEnum is referenced in the OpenAI plugin’s code:


🏁 Script executed:

#!/bin/bash
# Verify RunBehaviorEnum usage in OpenAI plugin
rg -n "RunBehaviorEnum" -C2 -- app/server/appsmith-plugins/openAiPlugin/src/main

Length of output: 80


🏁 Script executed:

#!/bin/bash
# Search for RunBehaviorEnum in Java code
rg -n "RunBehaviorEnum" -C2 -- app/server/appsmith-plugins/openAiPlugin/src/main/java

# Search for runBehavior references in Java code and resources
rg -n "\"runBehavior\"" -C2 -- app/server/appsmith-plugins/openAiPlugin/src/main

# Check if executeOnLoad is still referenced anywhere
rg -n "executeOnLoad" -C2 -- app/server/appsmith-plugins/openAiPlugin/src/main

Length of output: 784


Verify Java DTO and Enum implementation for runBehavior
Our search didn’t find any RunBehaviorEnum or runBehavior references in the Java code, nor any remaining executeOnLoad uses. Please confirm (or add) the following before merging:

  • A RunBehaviorEnum enum under src/main/java/...
  • A runBehavior field (defaulting to MANUAL) in your plugin’s settings DTO
  • Replacement of all executeOnLoad logic with runBehavior handling
app/client/test/factories/MockPluginsState.ts (1)

7034-7053: Appropriate refactor from boolean to string-based configuration.

These changes replace the old executeOnLoad boolean property with a more descriptive runBehavior string enum property, ensuring the mock plugin state configurations align with the main codebase changes. The dropdown options provide clear descriptive text for each behavior option.

Also applies to: 7114-7133, 7158-7177

app/client/src/pages/Editor/SaaSEditor/__data__/InitialState.json (3)

85-85: Appropriate default value for runBehavior.

The action configuration now uses "MANUAL" as the default value for runBehavior, which is consistent with the migration from executeOnLoad.


2545-2560: Good UI improvement for action execution settings.

Replacing the simple boolean toggle with a dropdown provides more descriptive options and better UX. The subtext explanations for each option help users understand the behavior differences clearly.


2591-2606: Consistent implementation across all plugin settings.

The same dropdown pattern with identical options has been applied consistently across all plugin settings sections, ensuring a uniform user experience.

Also applies to: 2637-2652, 2689-2743, 2774-2789, 2820-2835

app/client/src/utils/JSPaneUtils.tsx (2)

6-6: Appropriate import added for the new enum.

Import for ActionRunBehaviour from PluginActionEditor/types/PluginActionTypes has been correctly added.


134-134: Proper replacement of boolean flag with enum value.

All instances of executeOnLoad: false have been consistently replaced with runBehavior: ActionRunBehaviour.MANUAL, improving code clarity and type safety.

Also applies to: 233-233, 285-285

app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/ce/ActionCE_DTO.java (2)

18-18: Appropriate import for the new enum.

RunBehaviorEnum has been correctly imported.


104-113: Well-documented deprecation with proper replacement.

The executeOnLoad field has been properly deprecated with clear Javadoc explaining the rationale and the alternative to use. The new runBehavior field is added with appropriate annotations and a sensible default value.

This approach maintains backward compatibility while encouraging migration to the new property.

app/client/src/ce/reducers/entityReducers/actionsReducer.tsx (2)

16-16: Appropriate type import added.

Import for ActionRunBehaviourType has been correctly added.


314-332: Properly updated Redux action handler.

The action handler has been updated from SET_ACTION_TO_EXECUTE_ON_PAGELOAD to SET_ACTION_RUN_BEHAVIOR with the appropriate payload type change. The property update inside the handler correctly sets runBehavior instead of executeOnLoad.

app/client/src/selectors/navigationSelectors.ts (1)

36-36: Centralized type import improves code maintainability.

Good change - importing the EntityNavigationData type from a central location instead of defining it locally reduces duplication and makes type management more consistent across the codebase.

app/client/src/constants/AppsmithActionConstants/formConfig/GoogleSheetsSettingsConfig.ts (2)

1-4: Import of run behavior constants aligns with new execution model.

These imports support the transition from boolean executeOnLoad to the more descriptive string-based runBehavior property.


12-16: Enhanced UX with dropdown replacing boolean toggle.

The change from a boolean switch to a dropdown with descriptive options improves clarity for users, allowing them to better understand the execution behavior options.

app/client/src/components/formControls/DropDownControl.tsx (4)

23-23: Required imports for new dropdown UI.

Adding Flex and Text components to support the enhanced dropdown rendering.


32-43: Styled components for consistent dropdown option styling.

The addition of styled components for option labels and subtexts provides a consistent visual hierarchy that improves readability.


477-477: Fixed list height improves dropdown usability.

Setting a consistent height prevents excessive scrolling and provides a better user experience.


511-540: Enhanced option rendering with support for descriptive subtexts.

The conditional rendering based on the presence of subText property improves the dropdown UI while maintaining backward compatibility with simpler options.

app/client/cypress/e2e/Regression/ServerSide/JsFunctionExecution/JSFunctionExecution_spec.ts (4)

18-24: Updated interface to use string-based run behavior.

The change from boolean onPageLoad to string-based runBehavior aligns with the new execution model and improves code clarity.


36-66: Test data updated to use new run behavior strings.

Test data properly updated to use the new string values "On page load" and "Manual" instead of boolean flags.


361-363: Updated filter condition for run behavior.

Filter logic correctly updated to check for the new string-based property.


403-410: Updated function calls to use new run behavior parameter.

EnableDisableAsyncFuncSettings calls correctly updated to pass string values.

app/client/src/components/editorComponents/PartialImportExport/PartialExportModal/unitTestUtils.ts (10)

2310-2310: Property replacement correctly implemented.

The replacement of executeOnLoad: true with runBehavior: "ON_PAGE_LOAD" is correctly implemented, aligning with the PR objective to fix Cypress tests by updating to the new behavior configuration pattern.


2394-2394: Property replacement correctly implemented.

The replacement of executeOnLoad: false with runBehavior: "MANUAL" is correctly implemented, maintaining the original functionality while adapting to the new enum-based system.


10041-10058: UI control updated appropriately.

The switch control for executeOnLoad has been properly replaced with a dropdown for runBehavior that provides clear options and helpful descriptions for users. The configuration is correctly structured with appropriate labels and values.


10092-10109: Duplicate dropdown configuration correctly implemented.

This implementation mirrors the previous dropdown configuration, maintaining consistency across different sections of the application.


10143-10160: API configuration properly updated.

The dropdown configuration for API settings has been updated consistently with the query settings, using appropriate labels and descriptive text that clearly explains the behavior difference between options.


10223-10240: Second API configuration properly updated.

Another instance of the API configuration correctly implements the dropdown replacement with consistent naming and behavior descriptions.


10415-10415: JS function configuration updated.

The JS function configuration has been updated to use runBehavior: "MANUAL" instead of the previous boolean flag, correctly implementing the new pattern.


10465-10465: JS function configuration consistently updated.

This instance of JS function configuration maintains consistency with the pattern established in previous changes.


10549-10549: JS function configuration properly converted.

The configuration correctly implements the new runBehavior enum property with the "MANUAL" value, replacing the previous boolean property.


10599-10599: JS function configuration conversion completed.

The final instance of JS function configuration has been properly updated to use the new enum-based system.

app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ActionControllerCE.java (3)

5-5: New import added for RunBehaviorEnum

Clean addition of the required enum import for the new endpoint.


119-127: Well-structured new endpoint implementation

The new setRunBehavior endpoint is properly implemented with appropriate logging, parameter validation, and response handling. This aligns with the PR's objective of transitioning from executeOnLoad to runBehavior.


129-133: Properly deprecated legacy endpoint

Good practice to mark the old endpoint as deprecated with proper Javadoc comment directing users to the new endpoint. The @Deprecated annotation ensures proper tooling support.

app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionSettings.test.tsx (5)

6-6: Added import for ActionRunBehaviour enum

Correctly importing the enum type needed for the updated tests.


19-19: Updated test descriptions to match new UI paradigm

The test descriptions have been properly updated to reflect that we're now testing dropdowns instead of switches, aligning with the UI changes.

Also applies to: 31-31, 43-43


47-47: Updated test fixtures with enum values

Test fixtures now correctly use the ActionRunBehaviour enum values instead of boolean flags, maintaining consistency with the implementation.

Also applies to: 51-51


63-71: Updated assertions to verify dropdown UI

Test assertions now correctly verify the dropdown selection UI elements instead of switches. The selectors are specific and include the function name in the class, which is good practice for preventing selector conflicts.


40-40: Use of combobox role for querying Select components

Correctly updated to use the standard combobox role to query the dropdown elements, which aligns with accessibility standards.

app/client/src/entities/DataTree/dataTreeTypes.ts (3)

6-6: Added import for EntityTypeValue

Properly imported the type needed for the new interface.


46-46: Added EntityNavigationData type

Simple type alias that creates a record mapping string keys to NavigationData objects, providing a convenient way to represent collections of navigation data.


28-44:

✅ Verification successful

Added NavigationData interface

This interface defines a comprehensive structure for navigation data with all necessary properties. While this appears unrelated to the PR's main focus on executeOnLoad to runBehavior changes, it seems to be part of a related refactoring effort.


🏁 Script executed:

#!/bin/bash
# Check if this interface is used in files related to the runBehavior changes
grep -r "NavigationData" --include="*.ts" --include="*.tsx" app/client/src/

Length of output: 6623


NavigationData interface usage confirmed; no action needed

The NavigationData interface is referenced across numerous files—including editor components, utilities, and selectors—indicating it’s part of the broader navigation refactoring rather than an unrelated change.

app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionSettings.tsx (6)

2-8: Updated imports for new UI components and types

Properly imported the necessary UI components and types to support the new dropdown-based UI. The imports are organized and grouped logically.

Also applies to: 17-21


23-36: Added styled components for dropdown UI

Well-structured styled components for the dropdown UI elements with appropriate styling using design system variables. This maintains consistency with the application's design language.


49-51: Updated state management for runBehavior

Correctly replaced the boolean state with an enum-based state for run behavior. Also added proper handling of options and selected value.


53-68: Updated callback for handling dropdown selection

The callback function has been properly updated to handle the enum-based selection instead of boolean toggle. Analytics event is also updated to track the new value format.


73-73: Updated CSS class name to be more descriptive

The class name now includes "run-behavior-setting" which is more descriptive of the actual functionality compared to the previous name.


83-107: Replaced Switch with Select dropdown

The UI has been properly updated from a Switch toggle to a Select dropdown with styled options that include labels and descriptive subtexts. This provides better UX by making the options more self-explanatory.

app/client/src/pages/Editor/SaaSEditor/__data__/FinalState.json (3)

86-86: Added runBehavior property consistently with value "MANUAL".

This change introduces the new string-based runBehavior property to the action configuration with a default value of "MANUAL". This aligns with the transition from the boolean executeOnLoad to a more descriptive run behavior model.


2546-2562: Replaced executeOnLoad switch with runBehavior dropdown.

Good implementation of the UI control change from a boolean switch to a dropdown with clear options. The dropdown provides better user context with helpful subtext descriptions for each option.


2592-2608: Consistent implementation across multiple plugin configurations.

The same runBehavior dropdown control is consistently implemented across all plugin configurations, ensuring a uniform user experience regardless of the plugin type.

Also applies to: 2638-2654, 2689-2706, 2729-2745, 2775-2791, 2821-2837

app/client/src/PluginActionEditor/types/PluginActionTypes.ts (1)

1-28: Well-structured type definitions for the new run behavior model.

This new module provides a solid foundation for the run behavior refactoring:

  • Clear enum definition with meaningful values
  • Well-structured metadata for UI controls
  • Proper TypeScript template literal type for type safety

The approach allows for potential future extension of run behaviors beyond the initial two options.

app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCEImpl.java (4)

9-9: Added import for RunBehaviorEnum.

Added necessary import for the new enum type to support the run behavior functionality.


304-319: Updated setExecuteOnLoad to maintain backward compatibility.

Good implementation that ensures backward compatibility by synchronizing the new runBehavior property with the legacy executeOnLoad boolean when the latter is updated.


322-349: Added new setRunBehavior method for the updated property.

This method properly handles setting the new runBehavior enum while maintaining synchronization with the legacy executeOnLoad property for backward compatibility.


427-435: Updated action creation logic to set runBehavior.

Ensures that newly created actions have the appropriate runBehavior value set, either "MANUAL" by default or "ON_PAGE_LOAD" for cloned actions where executeOnLoad is true.

app/client/src/actions/pluginActionActions.ts (3)

23-23: Added import for ActionRunBehaviourType.

Correctly imports the new type for type safety in the action creator parameters.


355-366: Renamed action creator and updated payload type.

The function setActionsToExecuteOnPageLoad has been appropriately renamed to setActionsRunBehavior with updated payload using the new runBehavior property instead of executeOnLoad. The Redux action type has also been updated accordingly.


368-380: Similar update for JS actions.

Consistent renaming and payload updates for the JS actions counterpart, maintaining the same pattern as the regular actions.

app/server/appsmith-server/src/test/java/com/appsmith/server/services/LayoutActionServiceTest.java (2)

1356-1402: Comprehensive test for runBehavior and executeOnLoad synchronization.

The test checks that setting runBehavior correctly updates the legacy executeOnLoad flag and vice versa, ensuring backward compatibility is maintained while supporting the new behavior model.


1404-1441: Good bidirectional compatibility test for legacy flag.

This test ensures the backward compatibility path is working correctly, verifying that toggling the legacy executeOnLoad property properly updates the new runBehavior enum.

app/client/src/ce/reducers/entityReducers/jsActionsReducer.tsx (3)

11-11: Appropriate import of the new type.

The import ensures type safety when working with the new run behavior values.


364-392: Renamed handler and updated payload type correctly.

The action handler now works with the new runBehavior property instead of the boolean executeOnLoad.


393-420: Good implementation of bulk update for run behavior.

The handler efficiently processes multiple action updates using the immutable pattern with create from the mutative library.

app/client/cypress/support/Pages/JSEditor.ts (3)

53-58: Updated selectors for the new UI component.

Selectors have been appropriately updated to target a combobox input instead of a toggle switch.


98-98: Added selector for dropdown options.

This enables interaction with the new dropdown component.


300-310: Updated verification method with proper typing.

Method now verifies string run behavior values instead of booleans, improving test readability.

app/client/src/sagas/JSPaneSagas.ts (4)

104-104: Appropriate import for type safety.

The proper import ensures type safety when dealing with run behavior values.


786-797: Updated property name check and action dispatch.

Function now correctly dispatches the new action type with the appropriate payload structure.


850-882: Well-refactored saga function.

The function has been properly renamed and updated to work with the new run behavior paradigm, maintaining all necessary error handling.


947-949: Updated saga listener for the new action type.

Ensures the saga reacts to the correct action type after the refactoring.

app/client/src/sagas/ActionSagas.ts (4)

150-150: Added import for ActionRunBehaviourType is appropriate.

This import of the type definition is necessary for the refactoring from boolean executeOnLoad to string-based runBehavior property.


1042-1052: Property check updated correctly to use runBehavior instead of executeOnLoad.

The condition check was properly modified to handle the new runBehavior property, with the appropriate type casting to ActionRunBehaviourType. This ensures type safety when dispatching the action.


1064-1089: Function renamed and updated to handle runBehavior instead of executeOnLoad.

The function was correctly renamed from toggleActionExecuteOnLoadSaga to updateActionRunBehaviorSaga with proper updates to:

  1. Parameter types (now accepting ActionRunBehaviourType instead of boolean)
  2. API call (updateActionRunBehavior instead of toggleActionExecuteOnLoad)
  3. Success/error action types

This change properly aligns with the transition from a toggle to a more expressive behavior selection.


1269-1271: Watcher saga properly updated to listen for the new action type.

The takeLatest call has been updated to listen for the new UPDATE_ACTION_RUN_BEHAVIOR_INIT action type and call the appropriate handler function.

app/client/src/ce/constants/ReduxActionConstants.tsx (4)

69-73: JSEditorActionTypes constants updated for run behavior pattern.

The constants have been appropriately renamed from executeOnLoad-related names to runBehavior-related names, maintaining consistency with the new pattern across the codebase.


87-87: Error type constant updated to match new action naming.

The error constant was properly renamed to maintain consistency with the updated action types.


808-810: ActionActionTypes constants updated for run behavior.

These constants have been correctly updated to use the new runBehavior terminology, maintaining consistency across the Redux action system.


824-824: Error type for action run behavior updated.

This update matches the naming pattern of its corresponding action types and maintains consistency throughout the error handling system.

app/client/src/ce/sagas/PageSagas.tsx (2)

91-92: Updated import names to match the new runBehavior pattern.

The import of action creators has been renamed from setActionsToExecuteOnPageLoad and setJSActionsToExecuteOnPageLoad to setActionsRunBehavior and setJSActionsRunBehavior respectively. This aligns with the broader refactoring from boolean executeOnLoad to string-based runBehavior.


539-540: Updated action dispatch to use the renamed action creator.

The code now dispatches the setActionsRunBehavior action instead of setActionsToExecuteOnPageLoad, maintaining the same functionality but with the updated action creator naming pattern.

@ankitakinger ankitakinger removed the ok-to-test Required label for CI label Apr 30, 2025
@ankitakinger
Copy link
Contributor Author

/ci-limit-test

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

🔭 Outside diff range comments (1)
app/client/cypress/e2e/Regression/ClientSide/BugTests/Bug14987_spec.js (1)

34-59: 🛠️ Refactor suggestion

Extract selectors into locator variables.

The test uses repeated string selectors. Define locator variables for reusable selectors at the top of the test file.

import {
  dataSources,
  agHelper,
  entityItems,
} from "../../../../support/Objects/ObjectsCore";
import { PluginActionForm } from "../../../../support/Pages/PluginActionForm";

+// Define locators
+const SELECTORS = {
+  SETTINGS_LABEL: ".label-icon-wrapper",
+  RUN_BEHAVIOR_TEXT: "Run behavior",
+  REQUEST_CONFIRMATION_TEXT: "Request confirmation before running this query"
+};

describe(
  "Verify setting tab form controls not to have tooltip and tooltip (underline) styles",
  // ...rest of the test...

  // Then replace occurrences:
-cy.get(".label-icon-wrapper")
-  .contains("Run behavior")
+cy.get(SELECTORS.SETTINGS_LABEL)
+  .contains(SELECTORS.RUN_BEHAVIOR_TEXT)

-cy.get(".label-icon-wrapper")
-  .contains("Request confirmation before running this query")
+cy.get(SELECTORS.SETTINGS_LABEL)
+  .contains(SELECTORS.REQUEST_CONFIRMATION_TEXT)
🧹 Nitpick comments (1)
app/client/cypress/e2e/Regression/ClientSide/BugTests/Bug14987_spec.js (1)

22-27: Move datasource creation to beforeEach() for better test isolation.

Using before() for setting up test data means state can leak between tests if more tests are added. Consider using beforeEach() for better test isolation.

-before("Creates a new Mongo datasource", () => {
+beforeEach("Creates a new Mongo datasource", () => {
  dataSources.CreateDataSource("Mongo");
  cy.get("@dsName").then(($dsName) => {
    datasourceName = $dsName;
  });
});
📜 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 79e1c0a and dc3c9b3.

📒 Files selected for processing (2)
  • app/client/cypress/e2e/Regression/ClientSide/BugTests/Bug14987_spec.js (1 hunks)
  • app/client/cypress/limited-tests.txt (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • app/client/cypress/limited-tests.txt
🧰 Additional context used
📓 Path-based instructions (1)
`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. ...

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/BugTests/Bug14987_spec.js
⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
  • GitHub Check: client-build / client-build
  • GitHub Check: server-unit-tests / server-unit-tests
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-lint / client-lint
  • GitHub Check: server-spotless / spotless-check
  • GitHub Check: client-prettier / prettier-check
🔇 Additional comments (2)
app/client/cypress/e2e/Regression/ClientSide/BugTests/Bug14987_spec.js (2)

34-36: Label text change correctly reflects the UI update.

The change from "Run the query on page load" to "Run behavior" correctly matches the new UI after the refactoring from executeOnLoad to runBehavior.


34-36:

✅ Verification successful

Use data- attributes for selectors instead of classes and text.*

Instead of using .label-icon-wrapper and text content for selecting elements, use data-* attributes which are more resilient to UI changes.

-cy.get(".label-icon-wrapper")
-  .contains("Run behavior")
+cy.get("[data-cy='run-behavior-label']")

🌐 Web query:

What are the best practices for Cypress selectors?

💡 Result:

Best Practices for Cypress Selectors

Use Dedicated Data Attributes for Selectors

  • Use custom data-* attributes (such as data-cy, data-test, or data-test-id) specifically for identifying elements in your tests. This makes your selectors robust against changes in CSS, JavaScript, or layout, which can frequently break tests that rely on class names, IDs, or tag names[1][3][6].
  • Example:
    cy.get('[data-cy="submit-btn"]')

Avoid Brittle or Dynamic Selectors

  • Do not use selectors tied to implementation details, such as classes, IDs, or tag names, which may change as the application's design evolves[1][3][5].
  • Avoid selectors based on dynamic text content, as the content may change or be translated[1][5].

Prioritize Readability and Maintainability

  • Write selectors (and names for your data attributes) that are easy to understand by anyone reading your test code[2].
  • Structuring selectors for clarity helps future-proof your tests and makes maintenance easier[2].

Leverage Cypress and Testing Library

  • Cypress integrates well with the Testing Library and follows similar philosophies—favoring readable queries that reflect user interaction like findByRole, findByLabelText, or cy.contains() for content-based assertions[1].
  • Consider using the Cypress Testing Library for more accessible and intention-revealing selectors, especially when testing for accessibility[1].

Encapsulate Selector Logic with Custom Commands

  • Abstract frequently used selectors in custom Cypress commands to simplify and standardize usage across multiple tests[2].
  • Example:
    Cypress.Commands.add('getSubmitButton', () => {
      return cy.get('[data-cy="submit-btn"]');
    });

Use Aliases for Reusable Elements

  • Assign aliases to elements that will be referenced multiple times, reducing duplication and improving test clarity[2].

Avoid Assigning Cypress Command Return Values

  • Cypress commands are asynchronous and should not be assigned to variables for later use[5][6]. Always chain your commands.
  • Use .then() if you need to work with values from a Cypress command.

Balance Specificity and Robustness

  • While overly generic selectors (e.g., button) are not recommended, extreme specificity can also cause brittleness. Choose selectors that uniquely identify elements but remain resilient to minor changes[2][5].

Avoid Using force: true Unnecessarily

  • The { force: true } option bypasses Cypress’s actionable checks (like visibility). Avoid it unless necessary, as it may mask real user issues[6].

Summary Table: Recommended vs. Discouraged Selector Patterns

Recommended Pattern Discouraged Pattern Reason
[data-cy="selector"] .class-name Unstable, changes with CSS updates
[data-test-id="selector"] #element-id May be dynamic or reused
cy.contains('unique text') button, input Too generic; not resilient to change
Custom command for .get() usage Direct class/id usage Centralizes selector logic for updates
Testing Library queries (findBy*) Hardcoded DOM queries More readable, simulates user behavior

Key Takeaways

  • Always use dedicated test-specific data-* attributes for selector stability.
  • Avoid selectors based on CSS, JavaScript, or dynamic content.
  • Write selectors with maintainability and clarity in mind.
  • Encapsulate common selector patterns as custom commands or use aliases.
  • Prefer Testing Library queries for accessibility and user-centric testing.

Following these best practices will make your Cypress test suites more reliable, maintainable, and resistant to UI or implementation changes[1][2][3][5][6].

Citations:


Use dedicated data-cy attributes for Cypress selectors

To make your tests more resilient and maintainable, replace class- and text-based selectors with a dedicated data-cy attribute, per Cypress best practices.

• File: app/client/cypress/e2e/Regression/ClientSide/BugTests/Bug14987_spec.js
Lines: 34–36

Suggested change:

- cy.get(".label-icon-wrapper")
-   .contains("Run behavior")
-   .parent()
+ cy.get('[data-cy="run-behavior-label"]')

@ankitakinger
Copy link
Contributor Author

/ci-test-limit

Copy link

Copy link

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/14754011655.
Cypress dashboard url: Click here!
All cypress tests have passed 🎉🎉🎉

@ankitakinger ankitakinger added the ok-to-test Required label for CI label Apr 30, 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/cypress/e2e/Regression/ServerSide/Datasources/Snowflake_Basic_Spec.ts (1)

94-94: Consider removing sleep usage per coding guidelines.

The test file has agHelper.Sleep() usage on line 94 which is discouraged according to the coding guidelines. While not directly related to this PR, consider replacing it with proper assertions or wait conditions.

- _.agHelper.Sleep(2000);
+ _.agHelper.WaitUntilToastDisappear();
📜 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 dc3c9b3 and 8c931fc.

📒 Files selected for processing (8)
  • app/client/cypress/e2e/Regression/ClientSide/PublishedApps/PublishedModeToastToggle_Spec.ts (1 hunks)
  • app/client/cypress/e2e/Regression/ServerSide/ApiTests/API_MultiPart_Spec.ts (1 hunks)
  • app/client/cypress/e2e/Regression/ServerSide/Datasources/Oracle_Spec.ts (1 hunks)
  • app/client/cypress/e2e/Regression/ServerSide/Datasources/Snowflake_Basic_Spec.ts (1 hunks)
  • app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/APIOnLoad_Spec.ts (1 hunks)
  • app/client/cypress/e2e/Regression/ServerSide/Params/PassingParams_Spec.ts (1 hunks)
  • app/client/cypress/limited-tests.txt (1 hunks)
  • app/client/cypress/support/Pages/ApiPage.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/client/cypress/limited-tests.txt
🧰 Additional context used
📓 Path-based instructions (1)
`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. ...

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/ServerSide/ApiTests/API_MultiPart_Spec.ts
  • app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/APIOnLoad_Spec.ts
  • app/client/cypress/e2e/Regression/ClientSide/PublishedApps/PublishedModeToastToggle_Spec.ts
  • app/client/cypress/e2e/Regression/ServerSide/Datasources/Snowflake_Basic_Spec.ts
  • app/client/cypress/e2e/Regression/ServerSide/Datasources/Oracle_Spec.ts
  • app/client/cypress/e2e/Regression/ServerSide/Params/PassingParams_Spec.ts
  • app/client/cypress/support/Pages/ApiPage.ts
⏰ Context from checks skipped due to timeout of 90000ms (9)
  • 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-lint / client-lint
  • GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
  • GitHub Check: client-build / client-build
  • GitHub Check: server-unit-tests / server-unit-tests
  • GitHub Check: server-spotless / spotless-check
  • GitHub Check: client-prettier / prettier-check
🔇 Additional comments (9)
app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/APIOnLoad_Spec.ts (1)

53-53: Update from boolean to string parameter looks good.

This change correctly updates the ToggleOnPageLoadRun method to use the new string-based runBehavior parameter "On page load" instead of the boolean executeOnLoad. This aligns with the codebase refactor.

app/client/cypress/e2e/Regression/ClientSide/PublishedApps/PublishedModeToastToggle_Spec.ts (2)

25-25: Correctly updated to use string parameter.

Changed from boolean to string parameter "On page load" to match the new API design.


32-32: Correctly updated to use string parameter.

Changed from boolean to string parameter "On page load" to match the new API design.

app/client/cypress/e2e/Regression/ServerSide/ApiTests/API_MultiPart_Spec.ts (1)

145-145: Correctly updated from boolean false to "Manual" string parameter.

This change appropriately uses "Manual" instead of the previous boolean false value, maintaining the same behavior while aligning with the new API design.

app/client/cypress/e2e/Regression/ServerSide/Datasources/Snowflake_Basic_Spec.ts (1)

168-168: Updated boolean to string parameter correctly.

Changed from boolean to string parameter "On page load" to align with the codebase refactor from executeOnLoad to runBehavior.

app/client/cypress/e2e/Regression/ServerSide/Params/PassingParams_Spec.ts (1)

79-79: Updated parameter from boolean to string value

The code correctly changes from using a boolean value to a string value "Manual", aligning with the broader codebase refactoring from executeOnLoad to runBehavior.

app/client/cypress/e2e/Regression/ServerSide/Datasources/Oracle_Spec.ts (1)

470-470:

✅ Verification successful

Updated parameter from boolean to string value

The change from a boolean to "Manual" string value is correct and consistent with the codebase transition from executeOnLoad to runBehavior.

Note that this file contains multiple instances of agHelper.Sleep() that should be refactored according to the coding guidelines. Consider replacing these with proper waiting strategies.


🏁 Script executed:

#!/bin/bash
# Count instances of agHelper.Sleep() in this file
grep -n "agHelper.Sleep" app/client/cypress/e2e/Regression/ServerSide/Datasources/Oracle_Spec.ts

Length of output: 96


Confirm runBehavior parameter update
The change from a boolean to "Manual" is correct and aligns with the executeOnLoad → runBehavior transition. A search shows no agHelper.Sleep() calls in this spec, so there are no sleep-based waits to refactor here.

app/client/cypress/support/Pages/ApiPage.ts (2)

109-110: Added locators for the new dropdown UI elements

These locators properly use data-testid and class selectors for UI interactions.


279-289:

✅ Verification successful

Refactored method to use dropdown instead of checkbox

The method has been correctly updated to interact with a dropdown control rather than a checkbox, accepting string values ("On page load" or "Manual") instead of booleans.

Let's verify that dropdown options match what's expected in the application UI:


🏁 Script executed:

#!/bin/bash
# Search for the dropdown implementation to verify available options
rg -A 10 "dropdown.*runBehavior" --type ts --glob !*cypress*

Length of output: 64


🏁 Script executed:

#!/bin/bash
# Locate the dropdown selector definitions in ApiPage.ts
rg -n "_runBehaviorDropdown" app/client/cypress/support/Pages/ApiPage.ts
rg -n "_runBehaviorOption" app/client/cypress/support/Pages/ApiPage.ts

Length of output: 385


🏁 Script executed:

#!/bin/bash
# Locate the dropdown definition in the UI code to inspect available options
rg -A5 -B5 "data-testid=['\"]t--dropdown-runBehavior['\"]" --glob "*.tsx"

Length of output: 79


🏁 Script executed:

#!/bin/bash
# Search for option definitions by literal labels in the codebase
rg -n '"On page load"' .
rg -n '"Manual"' .

Length of output: 14813


Verification complete: ToggleOnPageLoadRun uses the correct dropdown options

  • Confirms use of [data-testid='t--dropdown-runBehavior'] and .rc-select-item-option-content.
  • Labels "On page load" and "Manual" are defined in app/client/src/PluginActionEditor/types/PluginActionTypes.ts.

LGTM!

@ankitakinger ankitakinger removed the ok-to-test Required label for CI label Apr 30, 2025
@ankitakinger ankitakinger changed the base branch from release to feat/reactive-actions-run-behaviour April 30, 2025 14:37
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/cypress/e2e/Regression/ClientSide/ActionExecution/FrameworkFunctions_ShowCloseModalFunctions_spec.ts (1)

1-202: The test follows most Cypress best practices but could benefit from some improvements.

While the file generally follows good practices with page objects and proper assertions, I noticed a few areas that could be improved to better align with the provided coding guidelines:

  1. The test relies on multiple instances of agHelper.CypressReload() (lines 61, 70, 84, 146, 152, 189, 195) which can make tests less reliable
  2. There are sequential waits with assertHelper.AssertNetworkStatus("@getConsolidatedData") followed by agHelper.WaitUntilEleAppear(locators._modalWrapper) which could be optimized

Consider intercept-based waits instead of page reloads where possible. For example:

- agHelper.CypressReload();
+ cy.intercept('GET', '**/api/v1/pages*').as('pageLoad');
+ // Trigger the action that would cause page navigation/refresh
+ cy.wait('@pageLoad');
📜 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 dedecdf and d9d2419.

📒 Files selected for processing (4)
  • app/client/cypress/e2e/Regression/ClientSide/ActionExecution/FrameworkFunctions_ShowCloseModalFunctions_spec.ts (1 hunks)
  • app/client/cypress/support/Pages/ApiPage.ts (3 hunks)
  • app/client/cypress/support/Pages/JSEditor.ts (3 hunks)
  • app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionSettings.tsx (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionSettings.tsx
  • app/client/cypress/support/Pages/JSEditor.ts
  • app/client/cypress/support/Pages/ApiPage.ts
🧰 Additional context used
📓 Path-based instructions (1)
`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. ...

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/ActionExecution/FrameworkFunctions_ShowCloseModalFunctions_spec.ts
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: server-unit-tests / server-unit-tests
  • GitHub Check: client-build / client-build
🔇 Additional comments (1)
app/client/cypress/e2e/Regression/ClientSide/ActionExecution/FrameworkFunctions_ShowCloseModalFunctions_spec.ts (1)

49-49: The change from boolean to string parameter looks good.

The update to pass "On page load" instead of a boolean to apiPage.clickSettingIcon correctly aligns with the codebase refactor from executeOnLoad (boolean) to runBehavior (string enum). This change maintains proper test functionality while reflecting the updated UI which now uses a dropdown instead of a toggle switch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI Core Query Execution Issues related to the execution of all queries IDE Pod Issues that new developers face while exploring the IDE IDE Product Issues related to the IDE Product Integrations Product Issues related to a specific integration potential-duplicate This label marks issues that are potential duplicates of already open issues Query Settings Issues related to the settings of all queries Query Widgets & IDE Pod All issues related to Query, JS, Eval, Widgets & IDE 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]: Fix any cypress or unit test cases that fail with update of references
2 participants