Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add snapshots for text widgets #34546

Closed
wants to merge 1 commit into from

Conversation

jsartisan
Copy link
Contributor

@jsartisan jsartisan commented Jun 27, 2024

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

Summary by CodeRabbit

  • Tests
    • Added new test cases for Anvil's Heading Widget, covering Canvas, Preview, and Deploy modes.
    • Introduced test cases for Anvil's Paragraph Widget in Canvas Mode, Preview Mode, and Deploy Mode.

Caution

🔴 🔴 🔴 Some tests have failed.
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/9696369218
Commit: 5201281
Cypress dashboard.
Tags: @tag.Anvil
The following are new failures, please fix them before merging the PR:

  1. cypress/e2e/Regression/ClientSide/Anvil/Widgets/AnvilCurrencyInputWidgetSnapshot_spec.ts
  2. cypress/e2e/Regression/ClientSide/Anvil/Widgets/AnvilHeadingWidgetSnapshot_spec.ts
  3. cypress/e2e/Regression/ClientSide/Anvil/Widgets/AnvilInputWidgetSnapshot_spec.ts
  4. cypress/e2e/Regression/ClientSide/Anvil/Widgets/AnvilParagraphWidgetSnapshot_spec.ts
  5. cypress/e2e/Regression/ClientSide/Anvil/Widgets/AnvilPhoneInputWidgetSnapshot_spec.ts
List of identified flaky tests.

Copy link
Contributor

coderabbitai bot commented Jun 27, 2024

Walkthrough

The recent updates introduce Cypress end-to-end test cases for Anvil's Heading and Paragraph Widgets. These tests verify the functionalities of the widgets in Canvas, Preview, and Deploy modes, ensuring consistency across different environments.

Changes

File Path Change Summary
.../AnvilHeadingWidgetSnapshot_spec.ts Added tests for Anvil Heading Widget covering Canvas, Preview, and Deploy modes.
.../AnvilParagraphWidgetSnapshot_spec.ts Introduced tests for Anvil Paragraph Widget focusing on Canvas Mode, Preview Mode, and Deploy Mode.
../../../../../support/Objects/ObjectsCore.ts Added agHelper and anvilSnapshot for test setup and verification.

Possibly related issues

Poem

In the land of code, with tests we tread,
For Anvil widgets, now they are led.
Heading and Paragraph in modes they sway,
Canvas, Preview, Deploy, they find their way.
With helpers in place and snapshots to see,
Our widget world blooms, flawlessly free. ✨


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 Jun 27, 2024
@jsartisan jsartisan added the ok-to-test Required label for CI label Jun 27, 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 0747702 and 5201281.

Files ignored due to path filters (12)
  • app/client/cypress/snapshots/AnvilHeadingWidgetSnapshot_spec.ts/anvilHeadingWidgetCanvas.snap.png is excluded by !**/*.png
  • app/client/cypress/snapshots/AnvilHeadingWidgetSnapshot_spec.ts/anvilHeadingWidgetCanvasDark.snap.png is excluded by !**/*.png
  • app/client/cypress/snapshots/AnvilHeadingWidgetSnapshot_spec.ts/anvilHeadingWidgetDeployipad-2.snap.png is excluded by !**/*.png
  • app/client/cypress/snapshots/AnvilHeadingWidgetSnapshot_spec.ts/anvilHeadingWidgetDeployiphone-6.snap.png is excluded by !**/*.png
  • app/client/cypress/snapshots/AnvilHeadingWidgetSnapshot_spec.ts/anvilHeadingWidgetDeploymacbook-13.snap.png is excluded by !**/*.png
  • app/client/cypress/snapshots/AnvilHeadingWidgetSnapshot_spec.ts/anvilHeadingWidgetPreview.snap.png is excluded by !**/*.png
  • app/client/cypress/snapshots/AnvilParagraphWidgetSnapshot_spec.ts/anvilParagraphWidgetCanvas.snap.png is excluded by !**/*.png
  • app/client/cypress/snapshots/AnvilParagraphWidgetSnapshot_spec.ts/anvilParagraphWidgetCanvasDark.snap.png is excluded by !**/*.png
  • app/client/cypress/snapshots/AnvilParagraphWidgetSnapshot_spec.ts/anvilParagraphWidgetDeployipad-2.snap.png is excluded by !**/*.png
  • app/client/cypress/snapshots/AnvilParagraphWidgetSnapshot_spec.ts/anvilParagraphWidgetDeployiphone-6.snap.png is excluded by !**/*.png
  • app/client/cypress/snapshots/AnvilParagraphWidgetSnapshot_spec.ts/anvilParagraphWidgetDeploymacbook-13.snap.png is excluded by !**/*.png
  • app/client/cypress/snapshots/AnvilParagraphWidgetSnapshot_spec.ts/anvilParagraphWidgetPreview.snap.png is excluded by !**/*.png
Files selected for processing (4)
  • app/client/cypress/e2e/Regression/ClientSide/Anvil/Widgets/AnvilHeadingWidgetSnapshot_spec.ts (1 hunks)
  • app/client/cypress/e2e/Regression/ClientSide/Anvil/Widgets/AnvilParagraphWidgetSnapshot_spec.ts (1 hunks)
  • app/client/cypress/fixtures/anvilHeadingWidget.json (1 hunks)
  • app/client/cypress/fixtures/anvilParagraphWidget.json (1 hunks)
Files not summarized due to errors (2)
  • app/client/cypress/fixtures/anvilHeadingWidget.json: Error: Message exceeds token limit
  • app/client/cypress/fixtures/anvilParagraphWidget.json: Error: Message exceeds token limit
Additional comments not posted (6)
app/client/cypress/e2e/Regression/ClientSide/Anvil/Widgets/AnvilHeadingWidgetSnapshot_spec.ts (2)

1-5: Ensure correct and optimized imports.

The imports are correctly structured, but ensure that agHelper and anvilSnapshot are used in the file, which they are. Also, check if the path to these imports is correct and optimized.


7-27: Comprehensive testing of widget modes.

The test suite covers Canvas, Preview, and Deploy modes for the Heading Widget, which is excellent for ensuring widget functionality across different states.

app/client/cypress/e2e/Regression/ClientSide/Anvil/Widgets/AnvilParagraphWidgetSnapshot_spec.ts (2)

1-5: Ensure correct and optimized imports.

The imports are correctly structured, but ensure that agHelper and anvilSnapshot are used in the file, which they are. Also, check if the path to these imports is correct and optimized.


7-27: Comprehensive testing of widget modes.

The test suite covers Canvas, Preview, and Deploy modes for the Paragraph Widget, which is excellent for ensuring widget functionality across different states.

app/client/cypress/fixtures/anvilParagraphWidget.json (1)

1-2525: Comprehensive Review of JSON Structure for UI Testing

The JSON structure is well-formed and appears consistent across different sections. Each widget and section is defined with appropriate properties that are crucial for rendering and interaction within the UI. Here are some specific observations and suggestions:

  1. Consistency and Clarity: The property names like widgetId, widgetType, isVisible, and textColor are consistently used, which is good for maintainability. However, it might be beneficial to add comments or documentation within the JSON or accompanying files to explain the purpose of less intuitive properties like dynamicTriggerPathList and dynamicBindingPathList.

  2. Testing Readiness: The structure includes isVisible, textColor, and fontSize properties which are essential for visual testing. Ensure these properties are leveraged in snapshot tests to validate visual consistency across different states and environments.

  3. Optimization Suggestion: There are repeated sections with similar properties (widgetId, widgetType, etc.). If these sections are meant to represent similar UI elements under different conditions or states, consider abstracting common properties into reusable components or templates to reduce redundancy and improve test maintenance.

  4. Error Handling and Validation: The properties like needsErrorInfo and isDeprecated are crucial for understanding component states during testing. Ensure that tests explicitly check these states to prevent deprecated or error-prone components from affecting user experience.

  5. Layout and Responsiveness: The properties related to layout and responsiveness (mobileTopRow, mobileLeftColumn, responsiveBehavior) are crucial for ensuring the UI adapts correctly to different screen sizes. It's recommended to include specific tests that simulate various device sizes to verify responsiveness.

Overall, the JSON file is well-prepared for integration with snapshot tests for the text widgets. Make sure to keep the structure updated in line with any UI changes to maintain the accuracy of tests.

app/client/cypress/fixtures/anvilHeadingWidget.json (1)

1-2591: JSON structure and content validation:

  • The JSON file structure appears to be correct and well-formed.
  • The dsl key contains a complex nested structure representing the layout, which is expected in the context of this file.
  • The id is correctly formatted as a string.
  • The userPermissions array is empty, which might be intentional depending on the test setup.
  • No syntax errors or misplaced keys/values were detected.

Overall, the JSON file meets the expected standards for a configuration file used in Cypress testing for UI layouts.

@jsartisan jsartisan requested a review from KelvinOm June 27, 2024 07:57
@jsartisan jsartisan added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Jun 27, 2024
Copy link

github-actions bot commented Jul 4, 2024

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

@github-actions github-actions bot added the Stale label Jul 4, 2024
@jsartisan jsartisan requested a review from KelvinOm July 8, 2024 10:09
@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>
@hetunandu hetunandu mentioned this pull request Jul 23, 2024
2 tasks
hetunandu added a commit that referenced this pull request Jul 31, 2024
## Description

By re organising the panels in the IDE, we are creating a new Code
Editor only panel which is separate from the main / canvas and the
explorer panel. This ensures that the Code Editor is not remounted when
switching between Split screen and Full screen. This PR is also
improving the Preview mode by not changing urls when entering and
exiting preview modes.

EE PR: appsmithorg/appsmith-ee#4760

Fixes #31707
Fixes #31387
Fixes #34545
Fixes #34546

## Automation

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

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/10177085462>
> Commit: 26688b0
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=10177085462&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.All`
> Spec:
> <hr>Wed, 31 Jul 2024 09:42:50 UTC
<!-- end of auto-generated comment: Cypress test results  -->


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


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

## Summary by CodeRabbit

- **New Features**
- Introduced `EditorPaneExplorer` and `QueryExplorer` components for
enhanced navigation and query management within the IDE.
- Added visual enhancements to `ListJSObjects` and `AddWidgets`
components with new style properties.

- **Improvements**
- Implemented clamping in the `useDynamicAppLayout` hook to prevent
negative width values, enhancing layout stability.
- Updated layout management to ensure a responsive user experience based
on IDE view modes.

- **Style**
- Enhanced visual clarity by adding borders to various components,
improving UI separation and organization.

- **Bug Fixes**
- Streamlined test cases in the `Postgres2_Spec.ts` to maintain coherent
sequencing after removing unnecessary tests.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
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 Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants