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: Adding specs/tests for space distribution and copy paste sagas #34063

Merged
merged 9 commits into from
Jun 10, 2024

Conversation

marks0351
Copy link
Contributor

@marks0351 marks0351 commented Jun 7, 2024

workerB

Description

  • Adding additional specs for space distribution and section deletion.
  • Adding unit tests for anvil pasting.

Fixes #33739
or
Fixes Issue URL

Warning

If no issue exists, please create an issue first, and check with the maintainers if the issue is valid.

Automation

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

🔍 Cypress test results

Tip

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

Communication

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

  • Yes
  • No

Summary by CodeRabbit

  • New Features

    • Added new test cases for verifying section removal and visual aspects of background-less zones in the Anvil layout system.
    • Introduced methods to handle mouse events for space distribution within sections.
    • Added mock data generation functionality for widgets, sections, zones, and layouts.
  • Tests

    • Implemented tests for paste operations in the Anvil layout system, including various mock functions and scenarios.

Copy link
Contributor

coderabbitai bot commented Jun 7, 2024

Walkthrough

The changes introduce new test cases and functionalities related to Anvil Sections and Zones, including verifying section removal and visual aspects of background-less zones. Additional utility functions for handling space distribution and mock data generation are also included. Import paths have been updated in various files to ensure correct references.

Changes

File Path Change Summary
.../AnvilSectionsAndZones_spec.ts Added propPane to imports and introduced a test case for section removal via the property pane.
.../AnvilSpaceDistribution_spec.ts Added propPane to imports and introduced a test for visual aspects of background-less zones and resize indicators.
.../AnvilSectionsZonesHelper.ts Added methods mouseDownSpaceDistributionHandle and mouseUpSpaceDistributionHandle for handling space distribution handles.
.../pasteSagas/index.ts Updated import paths for utility functions and types; made pasteWidgetSagas function exportable.
.../pasteSagas/pasteSagas.test.ts Added test cases for paste operations, including mocks for various functions and selectors.
.../destinationUtils/index.ts Adjusted import paths for types and reorganized import structure.
.../destinationUtils/mockData.helper.ts Introduced generateMockDataWithSectionAndZone function for creating mock data structures.

Sequence Diagram(s) (Beta)

Silently ignoring this section as the changes are too varied for a cohesive diagram.

Assessment against linked issues

Objective Addressed Explanation
Implement E2E/Integration tests for Anvil Sections and Zones (#33739)
Test for DnD sagas: New Widget DnD (#33981) The changes do not include tests for dragging and dropping new widgets.
Test for DnD sagas: Move Existing Widgets DnD (#33981) The changes do not include tests for moving existing widgets.

Possibly related issues

Poem

In the realm of Anvil's code,
Sections shift and zones unload,
PropPane guides the tests anew,
Ensuring layouts stay in view.
Mock data dances, handles glide,
In Anvil's world, where changes bide.


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 skip-changelog Adding this label to a PR prevents it from being listed in the changelog Anvil Pod Issue related to Anvil project Task A simple Todo labels Jun 7, 2024
@marks0351 marks0351 added the ok-to-test Required label for CI label Jun 7, 2024
@marks0351 marks0351 requested a review from riodeuno June 7, 2024 08:04
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 and nitpick comments (1)
app/client/src/layoutSystems/anvil/utils/paste/destinationUtils/index.ts (1)

Line range hint 11-57: Remove generator syntax if yield is not intended.

- export function* getDestinedParent(
+ export function getDestinedParent(
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 3177a4d and 7a9bffe.

Files selected for processing (8)
  • app/client/cypress/e2e/Regression/ClientSide/Anvil/AnvilSectionsAndZones_spec.ts (2 hunks)
  • app/client/cypress/e2e/Regression/ClientSide/Anvil/AnvilSpaceDistribution_spec.ts (2 hunks)
  • app/client/cypress/support/Pages/Anvil/AnvilSectionsZonesHelper.ts (1 hunks)
  • app/client/src/layoutSystems/anvil/integrations/sagas/pasteSagas/index.ts (5 hunks)
  • app/client/src/layoutSystems/anvil/integrations/sagas/pasteSagas/pasteSagas.test.ts (1 hunks)
  • app/client/src/layoutSystems/anvil/utils/paste/destinationUtils/destinationUtils.test.ts (1 hunks)
  • app/client/src/layoutSystems/anvil/utils/paste/destinationUtils/index.ts (1 hunks)
  • app/client/src/layoutSystems/anvil/utils/paste/destinationUtils/mockData.helper.ts (1 hunks)
Files not reviewed due to errors (2)
  • app/client/src/layoutSystems/anvil/utils/paste/destinationUtils/destinationUtils.test.ts (no review received)
  • app/client/src/layoutSystems/anvil/utils/paste/destinationUtils/mockData.helper.ts (no review received)
Additional context used
Biome
app/client/src/layoutSystems/anvil/utils/paste/destinationUtils/index.ts

[error] 11-57: This generator function doesn't contain yield. (lint/correctness/useYield)

Additional comments not posted (8)
app/client/cypress/e2e/Regression/ClientSide/Anvil/AnvilSectionsAndZones_spec.ts (1)

86-98: The test case for removing a section through the property pane is clear and concise. It correctly uses the propPane object for interacting with the UI, aligning with the changes noted in the PR summary.

app/client/cypress/support/Pages/Anvil/AnvilSectionsZonesHelper.ts (1)

32-46: The addition of mouseDownSpaceDistributionHandle and mouseUpSpaceDistributionHandle methods enhances the granularity of interaction tests by allowing precise control over mouse events on distribution handles. Ensure these methods are used in relevant test scenarios to fully leverage their functionality.

Verification successful

The new methods mouseDownSpaceDistributionHandle and mouseUpSpaceDistributionHandle are properly integrated into the test scenarios, as evidenced by their usage in AnvilSpaceDistribution_spec.ts.

  • app/client/cypress/e2e/Regression/ClientSide/Anvil/AnvilSpaceDistribution_spec.ts
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the usage of mouse event handlers in tests.

# Test: Search for the usage of the new methods in test files. Expect: Proper integration in test scenarios.
rg --type typescript $'mouseDownSpaceDistributionHandle|mouseUpSpaceDistributionHandle'

Length of output: 123



Script:

#!/bin/bash
# Description: Verify the usage of mouse event handlers in tests.

# Test: Search for the usage of the new methods in test files. Expect: Proper integration in test scenarios.
rg --type ts $'mouseDownSpaceDistributionHandle|mouseUpSpaceDistributionHandle'

Length of output: 770

app/client/src/layoutSystems/anvil/utils/paste/destinationUtils/index.ts (1)

7-9: Update import paths to reflect new file structure.

app/client/src/layoutSystems/anvil/integrations/sagas/pasteSagas/index.ts (3)

Line range hint 6-21: Update import paths to reflect new file structure.


53-53: Exporting pasteWidgetSagas enhances modularity and testability.


27-27: Ensure the updated selector path is correct and accessible.

Verification successful

The updated selector path is correct and accessible.

  • The getIsAnvilLayout selector is correctly imported from "../../selectors" in the file app/client/src/layoutSystems/anvil/integrations/sagas/pasteSagas/index.ts.
  • The selector is defined in app/client/src/layoutSystems/anvil/integrations/selectors.ts.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the updated selector path is correct.

# Test: Search for the selector usage. Expect: Only occurances of the new path.
rg --type python $'getIsAnvilLayout'

Length of output: 66



Script:

#!/bin/bash
# Description: Verify the updated selector path is correct.

# Test: Search for the selector usage. Expect: Only occurrences of the new path.
rg --type ts 'getIsAnvilLayout'

Length of output: 5786

app/client/cypress/e2e/Regression/ClientSide/Anvil/AnvilSpaceDistribution_spec.ts (1)

154-199: New test case added for verifying visual aspects of background-less zones and resize indicators.

app/client/src/layoutSystems/anvil/integrations/sagas/pasteSagas/pasteSagas.test.ts (1)

20-228: Comprehensive tests added for pasteWidgetSagas to ensure functionality across various scenarios.

@marks0351 marks0351 requested a review from jsartisan June 7, 2024 08:05
@marks0351 marks0351 added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Jun 10, 2024
@marks0351 marks0351 merged commit 99fa93d into release Jun 10, 2024
43 checks passed
@marks0351 marks0351 deleted the anvil-specs-space-distribution branch June 10, 2024 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Anvil Pod Issue related to Anvil project ok-to-test Required label for CI 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]: Test cases for Anvil Sections and Zones
2 participants