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: no warning when editing a comment to an empty comment #3411 #3502

Merged
merged 16 commits into from
May 22, 2024

Conversation

V24039
Copy link
Contributor

@V24039 V24039 commented May 7, 2024

PR Checklist

PR Type

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Developer experience (improves developer workflows for contributing to the project)

Description

Fixes the issue #3411 with the changes a error message "Comment cannot be blank" is displayed and the save is disabled until the user enters the comment for Edit Comment.

Git Issues

Closes #3411

Screenshots/Videos

If useful, provide screenshot or capture to highlight main changes


What happens next?

Thanks for the contribution! We try to make sure all PRs are reviewed ahead of our monthly maintainers call (first Monday of the month)

If the PR is working as intended it'll be merged and included in the next platform release, if not changes will be requested and re-reviewed once updated.

If you need more immediate feedback you can try reaching out on Discord in the Community Platform development channel.

@V24039 V24039 requested a review from a team as a code owner May 7, 2024 04:26
Copy link

cypress bot commented May 7, 2024

1 flaky test on run #5660 ↗︎

0 81 1 0 Flakiness 1

Details:

Merge branch 'master' into master
Project: onearmy-community-platform Commit: ea1d4eb00b
Status: Passed Duration: 04:38 💡
Started: May 22, 2024 10:32 AM Ended: May 22, 2024 10:37 AM
Flakiness  src/integration/research/write.spec.ts • 1 flaky test • ci-chrome

View Output Video

Test Artifacts
[Research] > [Create research article] > [By Authenticated] Test Replay Screenshots Video

Review all test suite changes for PR #3502 ↗︎

@benfurber
Copy link
Member

Thanks @V24039! Can you think what tests could cover this fix? I'm thinking in both the component library and the e2e cypress tests.

Copy link

codecov bot commented May 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.33%. Comparing base (4dec129) to head (ea1d4eb).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3502      +/-   ##
==========================================
+ Coverage   68.17%   68.33%   +0.15%     
==========================================
  Files         442      442              
  Lines       14001    14037      +36     
  Branches     2509     2521      +12     
==========================================
+ Hits         9545     9592      +47     
+ Misses       4407     4396      -11     
  Partials       49       49              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@V24039
Copy link
Contributor Author

V24039 commented May 8, 2024

@benfurber I am sorry I don't know how to write test cases, from what I know test case for input field might cover it.

Again sorry for not writing test cases.

@benfurber
Copy link
Member

@V24039 So if you look at EditComment.test.tsx, the test we want to setup is what you've coded.

  1. EditComment has a valid comment.
  2. The text is removed.
  3. User clicks save.
  4. The 'Comment cannot be blank' message appears.

If you have a look at CreateComment.test.tsx you'll see similar tests using fireEvent.change and fireEvent.click.

Happy to give it a go?

@benfurber benfurber added the 🤝 Awaiting author Waiting on action from the author label May 13, 2024
@V24039
Copy link
Contributor Author

V24039 commented May 13, 2024

@benfurber Sure I can give it try and try complete it

@benfurber
Copy link
Member

@V24039 Nice work on this. I can see that the linter is still failing. If you run yarn format you should get all the issues in one go.

@V24039
Copy link
Contributor Author

V24039 commented May 15, 2024

@benfurber I am sorry I tried but two of test cases are failing, if possible can some please help me with this.

@benfurber
Copy link
Member

Hey @V24039, apologies for not getting back to you yet. I've run out of time this week but if another maintainer doesn't get back to you over the weekend, I can give you a hand next week.

@V24039
Copy link
Contributor Author

V24039 commented May 17, 2024

@benfurber thank you for the response.
Sure no issues, I will also try on side to find a solution

@benfurber
Copy link
Member

Hey @V24039 I can see from the test fails that:


EditComment > disables save button when comment is empty: Received element is not disabled. I think that's because getByText('Save') is getting the span element on the button rather than the button itself.

To fix that, on the component find data-cy="edit-comment-submit", add a line below data-testid="edit-comment-submit". Then on the test use getByTestId("edit-comment-submit"). I think that might fix it.


EditComment > should dispaly error message when the comment is empty: TestingLibraryElementError: Unable to find an element with the text: Comment cannot be blank. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.

The message 'Comment cannot be blank` is only going to be called on submit, so don't you need to click the button?

@V24039
Copy link
Contributor Author

V24039 commented May 21, 2024

@benfurber thank you for the help
The test case for button disable is now passing

The error message the validation on textarea blur, hence no submit is required to show the error message. Still trying to figure out the solution will push the code once it passes.

@V24039
Copy link
Contributor Author

V24039 commented May 21, 2024

@benfurber test cases related to edit comment are now getting passed

@benfurber
Copy link
Member

Awesome! Thank you @V24039! What did you fancy picking up next?

@benfurber
Copy link
Member

@all-contributors please add @V24039 for code

Copy link
Contributor

@benfurber

I've put up a pull request to add @V24039! 🎉

@V24039
Copy link
Contributor Author

V24039 commented May 22, 2024

Awesome! Thank you @V24039! What did you fancy picking up next?

@benfurber Thank you for the support and approving my PR(finally my first os contribution)

Will go through the issues and try pick-up something which I am capable of.

It will my contribution to project kamp😅😅

@benfurber benfurber merged commit 6bf511f into ONEARMY:master May 22, 2024
20 checks passed
@onearmy-bot
Copy link
Collaborator

🎉 This PR is included in version 1.183.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@onearmy-bot
Copy link
Collaborator

🎉 This PR is included in version 1.185.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤝 Awaiting author Waiting on action from the author released
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[bug] No warning when editing a comment to an empty comment
4 participants