appsmith icon indicating copy to clipboard operation
appsmith copied to clipboard

fix: adding new test cases for git auto-commit

Open brayn003 opened this issue 1 year ago • 5 comments

Description

Adds cypress test for checking auto-commit functionality

Fixes #33964

/test
cypress/e2e/Regression/ClientSide/Git/GitAutocommit_spec.ts

Automation

:mag: Cypress test results

[!CAUTION] 🔴 🔴 🔴 Some tests have failed. Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/10572583465 Commit: 9e3eac1c65f5ff72bdc616c3b483ef500b8d0d0e Cypress dashboard. Tags: Spec: cypress/e2e/Regression/ClientSide/Git/GitAutocommit_spec.ts

The following are new failures, please fix them before merging the PR:

  1. cypress/e2e/Regression/ClientSide/Git/GitAutocommit_spec.ts
List of identified flaky tests.
Tue, 27 Aug 2024 06:26:24 UTC

Communication

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

  • [ ] Yes
  • [ ] No

brayn003 avatar Jul 15 '24 03:07 brayn003

Walkthrough

The changes introduce a Cypress end-to-end test suite for the Git autocommit feature, enhancing the testing framework. Key modifications include the addition of a new property for tracking autocommit status, adjustments to logging levels in the server implementation, and the removal of feature flag checks in tests, indicating a shift towards always enabling auto-commit checks.

Changes

Files Change Summary
app/client/cypress/e2e/Regression/ClientSide/Git/GitAutocommit_spec.ts Added a Cypress test suite for Git autocommit, validating UI and API interactions.
app/client/cypress/support/Pages/GitSync.ts Introduced _autocommitStatusbar property for tracking autocommit status.
app/client/src/pages/Editor/gitSync/QuickGitActions/AutocommitStatusbar.tsx Added data-testid attribute to StatusbarWrapper for improved testability.
app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/helpers/AutoCommitEligibilityHelperImpl.java Removed @FeatureFlagged annotation from methods, making auto-commit checks always active.
app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/helpers/GitAutoCommitHelperFallbackImpl.java Added @Slf4j annotation for enhanced logging capabilities.
app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/helpers/GitAutoCommitHelperImpl.java Adjusted logging levels from debug to info for key auto-commit messages.
app/server/appsmith-server/src/test/java/com/appsmith/server/git/autocommit/AutoCommitServiceTest.java Modified mocking behavior for auto-commit eligibility checks, introducing AutoCommitTriggerDTO.
app/server/appsmith-server/src/test/java/com/appsmith/server/git/autocommit/helpers/AutoCommitEligibilityHelperTest.java Removed feature flag checks from tests, streamlining the test setup.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Cypress
    participant GitSync
    participant Server

    User->>Cypress: Trigger autocommit test
    Cypress->>GitSync: Enable autocommit feature
    GitSync->>Server: POST request to trigger autocommit
    Server-->>GitSync: Response with status 200
    GitSync->>Cypress: Show autocommit status bar
    Cypress->>Server: GET request for autocommit progress
    Server-->>Cypress: Response with progress status

Assessment against linked issues

Objective Addressed Explanation
Import an old repo > go to application > check for auto-commit status bar ( #33964 )
Import an old repo > go to application > check for auto-commit trigger and progress api ( #33964 )
Import an old repo > go to application > change branch when auto-commit is done ( #33964 ) No direct implementation for branch change handling.

Poem

In the realm of code, new tests arise,
Autocommit's journey, a seamless surprise.
With logs that now sing at an info's embrace,
The feature shines bright, in its rightful place.
So here's to the changes, both bold and grand,
A future of commits, all perfectly planned! 🎉


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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.

coderabbitai[bot] avatar Jul 15 '24 03:07 coderabbitai[bot]

Can we please have react testing library test for this change ?

cc : @ApekshaBhosale @yatinappsmith @sagar-qa007

rajatagrawal avatar Jul 16 '24 05:07 rajatagrawal

This PR has not seen activitiy for a while. It will be closed in 7 days unless further activity is detected.

github-actions[bot] avatar Jul 23 '24 16:07 github-actions[bot]

Can we please have react testing library test for this change ?

@rajatagrawal can you please elaborate?

brayn003 avatar Aug 02 '24 10:08 brayn003

react-testing-library is good for testing components in isolation, that is not the use case here. The intention is to test the flow for auto-commit in it's entirety. Hence, the Cypress approach

brayn003 avatar Aug 19 '24 07:08 brayn003

Failed server tests

  • com.appsmith.server.solutions.ce.ActionExecutionSolutionCETest#suggestWidget_ArrayListData_SuggestTableTextChartDropDownWidget

github-actions[bot] avatar Sep 02 '24 12:09 github-actions[bot]

/build-deploy-preview skip-tests=true

nidhi-nair avatar Sep 03 '24 17:09 nidhi-nair

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

github-actions[bot] avatar Sep 03 '24 17:09 github-actions[bot]

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

github-actions[bot] avatar Sep 03 '24 17:09 github-actions[bot]

@brayn003 spec changes LGTM

ApekshaBhosale avatar Sep 05 '24 08:09 ApekshaBhosale