Skip to content

chore: Stats Widget snapshot#34638

Closed
jsartisan wants to merge 1 commit intoreleasefrom
chore/statbox-snapshots
Closed

chore: Stats Widget snapshot#34638
jsartisan wants to merge 1 commit intoreleasefrom
chore/statbox-snapshots

Conversation

@jsartisan
Copy link
Contributor

@jsartisan jsartisan commented Jul 2, 2024

Summary by CodeRabbit

  • Tests
    • Introduced new test cases for the Stats Widget in the Anvil editor, ensuring functionality in Canvas, Preview, and Deploy modes.

@jsartisan jsartisan requested a review from ApekshaBhosale as a code owner July 2, 2024 10:26
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 2, 2024

Walkthrough

The new AnvilStatsWidgetSnapshot_spec.ts file introduces comprehensive test cases for the Stats Widget in the Anvil editor, ensuring the widget functions correctly in Canvas, Preview, and Deploy modes. This addition aims to increase the robustness and reliability of the Stats Widget's behavior across different usage scenarios.

Changes

File Change Summary
app/client/cypress/e2e/Regression/ClientSide/Anvil/Widgets/AnvilStatsWidgetSnapshot_spec.ts Added new test cases for the Stats Widget covering Canvas, Preview, and Deploy modes.
.../support/Objects/ObjectsCore Updated to include agHelper and anvilSnapshot imports needed for the new Stats Widget Snapshot tests.

Sequence Diagram(s)

sequenceDiagram
    participant Cypress as Cypress Test Runner
    participant Widget as Stats Widget
    participant Anvil as Anvil Editor

    Note over Cypress, Widget: Canvas Mode
    Cypress ->> Anvil: Set mode to Canvas
    Anvil ->> Widget: Render Widget
    Cypress ->> Widget: Validate Widget States

    Note over Cypress, Widget: Preview Mode
    Cypress ->> Anvil: Set mode to Preview
    Anvil ->> Widget: Render Widget
    Cypress ->> Widget: Validate Widget States

    Note over Cypress, Widget: Deploy Mode
    Cypress ->> Anvil: Set mode to Deploy
    Anvil ->> Widget: Render Widget
    Cypress ->> Widget: Validate Widget States
Loading

Possibly related issues

  • Task: Tests for DnD sagas. #33981: The new test cases for the Stats Widget include various interactions and states, which could be extended to cover the Drag-and-Drop sagas mentioned in this issue.

Poem

In the Anvil, stats do show,
Where numbers and graphs elegantly grow.
With tests on Canvas, Preview bright,
And Deployed realms, we ensure it's right.
To catch the bugs and errors unseen,
Our crafted tests keep the Anvil pristine.
Oh code, with every snapshot take,
We build a fortress, no widget shall break!

🐇✨


Tip

Early access features: enabled

We are currently testing the following features in early access:

  • OpenAI gpt-4o model for code reviews and chat: OpenAI claims that this model is better at understanding and generating code than the previous models. We seek your feedback over the next few weeks before making it generally available.

Note:

  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.
  • Please join our Discord Community to provide feedback and report issues.
  • OSS projects are currently opted into early access features by default.

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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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 Jul 2, 2024
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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 3075803 and 80091b8.

Files ignored due to path filters (6)
  • app/client/cypress/snapshots/AnvilStatsWidgetSnapshot_spec.ts/anvilStatsWidgetCanvas.snap.png is excluded by !**/*.png
  • app/client/cypress/snapshots/AnvilStatsWidgetSnapshot_spec.ts/anvilStatsWidgetCanvasDark.snap.png is excluded by !**/*.png
  • app/client/cypress/snapshots/AnvilStatsWidgetSnapshot_spec.ts/anvilStatsWidgetDeployipad-2.snap.png is excluded by !**/*.png
  • app/client/cypress/snapshots/AnvilStatsWidgetSnapshot_spec.ts/anvilStatsWidgetDeployiphone-6.snap.png is excluded by !**/*.png
  • app/client/cypress/snapshots/AnvilStatsWidgetSnapshot_spec.ts/anvilStatsWidgetDeploymacbook-13.snap.png is excluded by !**/*.png
  • app/client/cypress/snapshots/AnvilStatsWidgetSnapshot_spec.ts/anvilStatsWidgetPreview.snap.png is excluded by !**/*.png
Files selected for processing (1)
  • app/client/cypress/e2e/Regression/ClientSide/Anvil/Widgets/AnvilStatsWidgetSnapshot_spec.ts (1 hunks)
Additional comments not posted (4)
app/client/cypress/e2e/Regression/ClientSide/Anvil/Widgets/AnvilStatsWidgetSnapshot_spec.ts (4)

1-5: LGTM! The import statements are correct.

The imported constants and helper functions are necessary for the test cases.


7-13: LGTM! The describe block is correctly set up.

The describe block sets up the context for the Stats Widget tests and includes a before hook to add the necessary DSL.


15-17: LGTM! The it block for Canvas Mode is correctly set up.

The it block tests the Canvas Mode of the Stats Widget using the anvilSnapshot helper.


19-25: LGTM! The it blocks for Preview and Deploy Modes are correctly set up.

The it blocks test the Preview and Deploy Modes of the Stats Widget using the anvilSnapshot helper.

@jsartisan jsartisan requested a review from KelvinOm July 2, 2024 11:06
@KelvinOm KelvinOm mentioned this pull request Jul 8, 2024
2 tasks
KelvinOm added a commit that referenced this pull request Jul 9, 2024
## Description
1. Add scripts for local e2e testing in the docker container. 
2. Add types for cypress-image-snapshot

In this PR, I also added the following PRS as they affect screenshot
tests as well. I did this to speed up the process and unblock the team.

#34528
#34546
#34676
#34729
#34638
#34639
#34511

To run E2E tests locally in docker, you need to do the following:
1. Run FE locally and prepare the tests for local launch. See the
instructions
[here](https://github.com/appsmithorg/appsmith/blob/release/contributions/ClientSetup.md).
2. Run `yarn cypress:snapshot:docker:build` — this will create a docker
container with the necessary environment.
3. Run `yarn cypress:snapshot:docker
"./cypress/e2e/Regression/ClientSide/Anvil/Widgets/*_spec.ts"
updateSnapshots=false`. Here we can use the path to a specific file, or
set `updateSnapshots=true` flag to update the screenshots.

## Automation

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

### :mag: Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/9844579277>
> Commit: 75f2659
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=9844579277&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Anvil`
> Spec:
> <hr>Mon, 08 Jul 2024 18:37:36 UTC
<!-- end of auto-generated comment: Cypress test results  -->


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


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

- **New Features**
- Added support for image snapshot testing with the
`@types/cypress-image-snapshot` dependency.

- **Refactor**
- Updated test specifications by removing unnecessary
`triggerInputInvalidState()` calls.
- Reorganized and improved efficiency of image snapshot methods for
various devices.

- **Chores**
- Updated `Dockerfile` to configure the Cypress environment with
specific versions for dependencies.
  - Changed import paths in `e2e.js` for better module resolution. 

- **Style**
  - Fixed a comment typo in Cypress plugin configuration.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Pawan Kumar <pawankumar@Pawans-MacBook-Pro-2.local>
Co-authored-by: unknown <vadim@appsmith.com>
@KelvinOm
Copy link
Collaborator

KelvinOm commented Jul 9, 2024

Merged here.

@KelvinOm KelvinOm closed this Jul 9, 2024
Shivam-z pushed a commit to Shivam-z/appsmith that referenced this pull request Jul 10, 2024
## Description
1. Add scripts for local e2e testing in the docker container. 
2. Add types for cypress-image-snapshot

In this PR, I also added the following PRS as they affect screenshot
tests as well. I did this to speed up the process and unblock the team.

appsmithorg#34528
appsmithorg#34546
appsmithorg#34676
appsmithorg#34729
appsmithorg#34638
appsmithorg#34639
appsmithorg#34511

To run E2E tests locally in docker, you need to do the following:
1. Run FE locally and prepare the tests for local launch. See the
instructions
[here](https://github.com/appsmithorg/appsmith/blob/release/contributions/ClientSetup.md).
2. Run `yarn cypress:snapshot:docker:build` — this will create a docker
container with the necessary environment.
3. Run `yarn cypress:snapshot:docker
"./cypress/e2e/Regression/ClientSide/Anvil/Widgets/*_spec.ts"
updateSnapshots=false`. Here we can use the path to a specific file, or
set `updateSnapshots=true` flag to update the screenshots.

## Automation

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

### :mag: Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/9844579277>
> Commit: 75f2659
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=9844579277&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Anvil`
> Spec:
> <hr>Mon, 08 Jul 2024 18:37:36 UTC
<!-- end of auto-generated comment: Cypress test results  -->


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


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

- **New Features**
- Added support for image snapshot testing with the
`@types/cypress-image-snapshot` dependency.

- **Refactor**
- Updated test specifications by removing unnecessary
`triggerInputInvalidState()` calls.
- Reorganized and improved efficiency of image snapshot methods for
various devices.

- **Chores**
- Updated `Dockerfile` to configure the Cypress environment with
specific versions for dependencies.
  - Changed import paths in `e2e.js` for better module resolution. 

- **Style**
  - Fixed a comment typo in Cypress plugin configuration.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Pawan Kumar <pawankumar@Pawans-MacBook-Pro-2.local>
Co-authored-by: unknown <vadim@appsmith.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

2 participants