Skip to content

chore: AI Chat e2e tests#39490

Merged
jsartisan merged 5 commits intoreleasefrom
chore/ai-chat-e2e-tests
Mar 7, 2025
Merged

chore: AI Chat e2e tests#39490
jsartisan merged 5 commits intoreleasefrom
chore/ai-chat-e2e-tests

Conversation

@jsartisan
Copy link
Contributor

@jsartisan jsartisan commented Feb 28, 2025

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

Summary by CodeRabbit

  • New Features

    • Introduced an AI Agents integration tag, broadening the available options for future enhancements.
    • Added new public methods for retrieving widget, datasource, and action states, improving testability and state management.
  • Tests

    • The text input component now supports a new testing identifier attribute, greatly improving targeting in automated tests.
    • Enhanced testing commands provide more reliable state tracking and feature flag management, contributing to a more stable application experience.

Tip

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


Fri, 07 Mar 2025 11:14:32 UTC

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 28, 2025

Walkthrough

The pull request introduces several testing-related enhancements. A new tag (@tag.AIAgents) and constant (AI_AGENTS_TEST) have been added, with related command logic updated to check for these values. The TextArea component now accepts a data-testid prop, with its interface adjusted to include this new property. Additionally, three helper methods have been added to AggregateHelper for retrieving widget, datasource, and action states from the application store using Cypress commands.

Changes

File(s) Summary of Changes
app/client/cypress/tags.js
app/client/cypress/support/Constants.js
app/client/cypress/support/commands.js
Added new tag @tag.AIAgents, introduced constant AI_AGENTS_TEST, and updated conditional logic in commands to check for test title inclusion of the new constant.
app/client/packages/design-system/widgets/src/components/TextArea/src/TextArea.tsx
app/client/packages/design-system/widgets/src/components/TextArea/src/types.ts
Added data-testid prop to the TextArea component; updated the props interface by adding "data-testid"?: string.
app/client/cypress/support/Pages/AggregateHelper.ts Added three helper methods in AggregateHelper to retrieve canvas widget, datasource, and action state information via Cypress’s asynchronous state retrieval pattern.

Sequence Diagram(s)

sequenceDiagram
    participant T as Cypress Test
    participant A as AggregateHelper
    participant W as Window Object
    participant S as Store
    T->>A: Call getCanvasWidgetStateByWidgetName(widgetName)
    A->>W: cy.window()
    W->>S: Access store property
    S->>A: Return state via invoke("getState")
    A->>T: Return widget state (or null)
Loading
sequenceDiagram
    participant TR as Test Runner
    participant CS as startServerAndRoutes Command
    participant FF as featureFlagIntercept
    TR->>CS: Initiate server and route setup
    CS->>CS: Check test title for ANVIL_EDITOR_TEST/AI_AGENTS_TEST
    alt Title includes test flag
        CS->>FF: Call featureFlagIntercept with feature config enabled
    else Title does not include flag
        CS->>FF: Call featureFlagIntercept with empty config
    end
    FF-->>CS: Return execution result
Loading

Suggested labels

Task, Test, Anvil Pod, Integrations Pod General

Suggested reviewers

  • ApekshaBhosale
  • NandanAnantharamu
  • sagar-qa007

Poem

In lines of code, a tag takes flight,
A constant shines in the testing light.
TextArea’s newfound ID stands tall,
While helper methods fetch state for all.
Our tests rejoice in this refined art—
Code and tests, a vibrant heart!
🚀 Happy coding!


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between eaa782e and d7fc099.

📒 Files selected for processing (1)
  • app/client/packages/design-system/widgets/src/components/TextArea/src/types.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/client/packages/design-system/widgets/src/components/TextArea/src/types.ts
⏰ Context from checks skipped due to timeout of 90000ms (10)
  • GitHub Check: perform-test / server-build / server-unit-tests
  • GitHub Check: perform-test / rts-build / build
  • GitHub Check: perform-test / client-build / client-build
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-prettier / prettier-check
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-build / client-build
  • GitHub Check: storybook-tests
  • GitHub Check: chromatic-deployment
  • GitHub Check: chromatic-deployment

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

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

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

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

Other keywords and placeholders

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

Documentation and Community

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

@github-actions github-actions bot added the skip-changelog Adding this label to a PR prevents it from being listed in the changelog label Feb 28, 2025
@jsartisan jsartisan added the ok-to-test Required label for CI label Feb 28, 2025
ichik
ichik previously approved these changes Feb 28, 2025
KelvinOm
KelvinOm previously approved these changes Feb 28, 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/support/Pages/AggregateHelper.ts (1)

2098-2116: Helper method for retrieving widget state looks good.

This method provides a useful way to access canvas widget state by name from the Redux store.

Consider refactoring the find callback to use a direct return statement for cleaner code:

-const widgetId = Object.keys(widgets).find((widgetId) => {
-  if (widgets[widgetId].widgetName === widgetName) {
-    return widgets[widgetId];
-  }
-});
+const widgetId = Object.keys(widgets).find((widgetId) => 
+  widgets[widgetId].widgetName === widgetName
+);
📜 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 1c4a62d and eaa782e.

📒 Files selected for processing (6)
  • app/client/cypress/support/Constants.js (1 hunks)
  • app/client/cypress/support/Pages/AggregateHelper.ts (1 hunks)
  • app/client/cypress/support/commands.js (2 hunks)
  • app/client/cypress/tags.js (1 hunks)
  • app/client/packages/design-system/widgets/src/components/TextArea/src/TextArea.tsx (2 hunks)
  • app/client/packages/design-system/widgets/src/components/TextArea/src/types.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • app/client/cypress/support/Constants.js
  • app/client/cypress/tags.js
  • app/client/packages/design-system/widgets/src/components/TextArea/src/types.ts
  • app/client/packages/design-system/widgets/src/components/TextArea/src/TextArea.tsx
🧰 Additional context used
📓 Path-based instructions (1)
`app/client/cypress/**/**.*`: Review the following e2e test ...

app/client/cypress/**/**.*: Review the following e2e test code written using the Cypress test library. Ensure that:

  • Follow best practices for Cypress code and e2e automation.
  • Avoid using cy.wait in code.
  • Avoid using cy.pause in code.
  • Avoid using agHelper.sleep().
  • Use locator variables for locators and do not use plain strings.
  • Use data-* attributes for selectors.
  • Avoid Xpaths, Attributes and CSS path.
  • Avoid selectors like .btn.submit or button[type=submit].
  • Perform logins via API with LoginFromAPI.
  • Perform logout via API with LogOutviaAPI.
  • Perform signup via API with SignupFromAPI.
  • Avoid using it.only.
  • Avoid using after and aftereach in test cases.
  • Use multiple assertions for expect statements.
  • Avoid using strings for assertions.
  • Do not use duplicate filenames even with different paths.
  • Avoid using agHelper.Sleep, this.Sleep in any file in code.
  • app/client/cypress/support/commands.js
  • app/client/cypress/support/Pages/AggregateHelper.ts
⏰ Context from checks skipped due to timeout of 90000ms (9)
  • GitHub Check: perform-test / rts-build / build
  • GitHub Check: perform-test / server-build / server-unit-tests
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-build / client-build
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-prettier / prettier-check
  • GitHub Check: chromatic-deployment
  • GitHub Check: chromatic-deployment
  • GitHub Check: storybook-tests
🔇 Additional comments (4)
app/client/cypress/support/commands.js (2)

4-4: Import statement updated correctly.

The import statement now includes AI_AGENTS_TEST, which is properly used in the conditional logic.


744-747: Clean conditional logic extension.

The condition has been expanded to check for AI agents tests, maintaining the same feature flag behavior when either condition is met.

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

2118-2134: Datasource state retrieval method looks clean.

The implementation provides a straightforward way to look up datasource state by name. Good null handling when datasource is not found.


2136-2152: Action state retrieval method looks good.

This method follows the same pattern as the other helper methods, maintaining consistency in the API.

One observation: the method assumes actions follow a structure where name is at action.config.name. If this structure changes, this method would break silently.

Consider verifying this access pattern across various action types to ensure it's robust, or adding safeguards:

-const action = actions.find(
-  (action: any) => action.config.name === actionName,
-);
+const action = actions.find(
+  (action: any) => action.config?.name === actionName,
+);

@jsartisan jsartisan merged commit c027e93 into release Mar 7, 2025
52 checks passed
@jsartisan jsartisan deleted the chore/ai-chat-e2e-tests branch March 7, 2025 12:03
github-actions bot pushed a commit to Zeral-Zhang/appsmith that referenced this pull request Apr 12, 2025
/ok-to-test tags="@tag.Anvil"

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

- **New Features**
- Introduced an AI Agents integration tag, broadening the available
options for future enhancements.
- Added new public methods for retrieving widget, datasource, and action
states, improving testability and state management.

- **Tests**
- The text input component now supports a new testing identifier
attribute, greatly improving targeting in automated tests.
- Enhanced testing commands provide more reliable state tracking and
feature flag management, contributing to a more stable application
experience.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/13719108635>
> Commit: d7fc099
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=13719108635&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Anvil`
> Spec:
> <hr>Fri, 07 Mar 2025 11:14:32 UTC
<!-- end of auto-generated comment: Cypress test results  -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok-to-test Required label for CI skip-changelog Adding this label to a PR prevents it from being listed in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants