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

fix: Fix datepicker issue with aghelper #36325

Merged
merged 2 commits into from
Sep 16, 2024
Merged

Conversation

sagar-qa007
Copy link
Contributor

@sagar-qa007 sagar-qa007 commented Sep 16, 2024

Description

Root Cause Analysis (RCA):
In the local environment, the minDate field was consistently cleared as expected, but this behavior was not replicated in the CI pipeline. Updating the existing flow to address this issue could introduce other problems. The minDate text area having js date function in the CI pipeline, leading to repeated test failures. Multiple function attempts to resolve this issue were unsuccessful.

Solution:
I tried using the agHelper utility and updated the test flow with adding a new test case.

EE PR: https://github.com/appsmithorg/appsmith-ee/pull/5139

Fixes #36329

Automation

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

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/10878662752
Commit: 0985fc5
Cypress dashboard.
Tags: @tag.ImportExport
Spec:


Mon, 16 Sep 2024 06:53:39 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

  • New Features

    • Enhanced Datepicker widget functionality with new locators for improved user interaction.
  • Bug Fixes

    • Improved test cases for the Datepicker widget, ensuring accurate validation of display data and date formats.
  • Documentation

    • Updated test specifications to reflect a shift in focus towards the Datepicker widget.

@sagar-qa007 sagar-qa007 added the ok-to-test Required label for CI label Sep 16, 2024
Copy link
Contributor

coderabbitai bot commented Sep 16, 2024

Walkthrough

The pull request introduces several changes primarily focused on the Datepicker widget's test cases. It reorganizes and renumbers existing tests in the DatePickerV2_spec.js file, enhances helper functions for improved clarity, and modifies test specifications in limited-tests.txt to prioritize Datepicker testing. Additionally, new locators related to date input handling are added to FormWidgets.json, expanding the widget's capabilities for user interactions.

Changes

File Path Change Summary
app/client/cypress/e2e/Regression/ClientSide/Widgets/Datepicker/DatePickerV2_spec.js Reorganized and renumbered test cases; removed and replaced a test case with the same functionality; enhanced helper functions for UI interactions.
app/client/cypress/limited-tests.txt Changed the test file path from Fork_Template_spec.js to DatePickerV2_spec.js, indicating a shift in testing focus.
app/client/cypress/locators/FormWidgets.json Added new locators: minDateTextArea, minDateInput, datePickerInput, and dayPickerNextButton, enhancing date input handling capabilities.

Possibly related PRs

Suggested labels

Bug, Task, Widgets Product, Stability Pod, Integrations Pod General

Poem

In the realm of dates and time,
Our tests now dance in perfect rhyme.
With helpers strong and cases bright,
The Datepicker shines, a true delight!
So let us cheer for code so fine,
In the world of widgets, it will shine! 🌟


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 generate interesting stats about this repository and render them as a table.
    -- @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.

@sagar-qa007
Copy link
Contributor Author

/ci-test-limit-count run_count=20

@github-actions github-actions bot added the Bug Something isn't working label Sep 16, 2024
Copy link

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: 1

Outside diff range and nitpick comments (1)
app/client/cypress/e2e/Regression/ClientSide/Widgets/Datepicker/DatePickerV2_spec.js (1)

165-203: Excellent test case! Just one small suggestion.

This test case does a great job of ensuring that the Datepicker doesn't change the display date unless the user selects a date. It covers various scenarios like changing the min date, changing the date format, and clicking on the Datepicker.

One small improvement: Instead of hardcoding the date string "2020-02-01" on line 186, consider using a relative date (e.g., cy.clock() and Cypress.moment()) to make the test more robust to future date changes.

Otherwise, this is a very thorough and well-structured test case. Good job!

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between ba6fd9b and d7ed694.

Files selected for processing (3)
  • app/client/cypress/e2e/Regression/ClientSide/Widgets/Datepicker/DatePickerV2_spec.js (3 hunks)
  • app/client/cypress/limited-tests.txt (1 hunks)
  • app/client/cypress/locators/FormWidgets.json (1 hunks)
Additional context used
Path-based instructions (3)
app/client/cypress/limited-tests.txt (1)

Pattern 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/locators/FormWidgets.json (1)

Pattern 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/e2e/Regression/ClientSide/Widgets/Datepicker/DatePickerV2_spec.js (1)

Pattern 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.
Additional comments not posted (8)
app/client/cypress/limited-tests.txt (1)

2-2: Good work on updating the limited tests file! 👍

The change in the test file path from cypress/e2e/Regression/ClientSide/Templates/Fork_Template_spec.js to cypress/e2e/Regression/ClientSide/Widgets/Datepicker/DatePickerV2_spec.js is a clear indication of the shift in testing focus towards the DatePicker widget. This is a great way to prioritize and streamline the testing efforts.

Remember, class, it's important to keep this file up-to-date as the testing priorities evolve. Whenever you add new critical tests or decide to focus on specific areas, make sure to update the paths here accordingly. This will ensure that the limited test suite remains relevant and effective in catching potential issues early on.

Also, don't forget that you can always run the entire test suite by uncommenting the line #cypress/e2e/**/**/*. However, use this option judiciously, as running all specs might be time-consuming and resource-intensive, especially in a CI environment.

Keep up the good work, and happy testing! 🚀

app/client/cypress/locators/FormWidgets.json (5)

77-77: Great work, class!

The new locator for the button variant toggle looks perfect. The CSS selector is spot-on, and the name clearly describes its purpose. Keep up the excellent work!


78-78: Excellent addition, everyone!

The new locator for the min date text area is a great addition. The CSS selector targets the CodeMirror textarea precisely, and the name clearly conveys its purpose. Fantastic job!


79-79: Wonderful work, class!

The new locator for the min date input is spot-on. The CSS selector targets the input section precisely, and the name clearly describes its purpose. You're all doing an amazing job!


80-80: Fantastic addition, everyone!

The new locator for the date picker input is perfect. The CSS selector targets the input element precisely, and the name clearly conveys its purpose. You're all doing a terrific job!


81-81: Excellent work, class!

The new locator for the day picker next button is a great addition. The CSS selector targets the button precisely, and the name clearly describes its purpose. You're all doing an outstanding job!

app/client/cypress/e2e/Regression/ClientSide/Widgets/Datepicker/DatePickerV2_spec.js (2)

Line range hint 86-112: Great work on this test case!

The test case thoroughly covers the Datepicker input value changes with different date formats. It also tests the out-of-range scenario, which is important for ensuring the Datepicker behaves correctly in edge cases.

Keep up the good work!


Line range hint 113-159: Excellent test case for the isDirty meta property!

This test case does a great job of verifying the behavior of the isDirty meta property. It checks the initial value, the value after interaction, and the value after changing the default date.

This is a comprehensive test that ensures the isDirty property works as expected in different scenarios. Well done!

Copy link

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/10877689623.
Cypress dashboard: Click here!
The following are new failures, please fix them before merging the PR:
To know the list of identified flaky tests - Refer here

***** Repeat Run Summary ***** Total Tests with repeat: 180 Total Passed: 180 Total Failed: 0 Total Skipped: 0 *****************************

@yatinappsmith yatinappsmith self-requested a review September 16, 2024 08:03
@sagar-qa007 sagar-qa007 merged commit 996e26b into release Sep 16, 2024
46 checks passed
@sagar-qa007 sagar-qa007 deleted the fix/datepickercaseflow branch September 16, 2024 08:03
Shivam-z pushed a commit to Shivam-z/appsmith that referenced this pull request Sep 26, 2024
## Description

**Root Cause Analysis (RCA):**
In the local environment, the minDate field was consistently cleared as
expected, but this behavior was not replicated in the CI pipeline.
Updating the existing flow to address this issue could introduce other
problems. The minDate text area having js date function in the CI
pipeline, leading to repeated test failures. Multiple function attempts
to resolve this issue were unsuccessful.

**Solution**:
I tried using the `agHelper` utility and updated the test flow with
adding a new test case.

EE PR: https://github.com/appsmithorg/appsmith-ee/pull/5139

Fixes #`36329`  

## Automation

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

### 🔍 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/10878662752>
> Commit: 0985fc5
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=10878662752&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.ImportExport`
> Spec:
> <hr>Mon, 16 Sep 2024 06:53:39 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**
- Enhanced Datepicker widget functionality with new locators for
improved user interaction.
  
- **Bug Fixes**
- Improved test cases for the Datepicker widget, ensuring accurate
validation of display data and date formats.

- **Documentation**
- Updated test specifications to reflect a shift in focus towards the
Datepicker widget.

<!-- 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
Bug Something isn't working ok-to-test Required label for CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants