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

test: expand test coverage around forms #4365

Merged
merged 1 commit into from
Oct 28, 2022

Conversation

jenseng
Copy link
Contributor

@jenseng jenseng commented Oct 13, 2022

Expand test coverage around forms:

References: #4342

  • Tests

@changeset-bot
Copy link

changeset-bot bot commented Oct 13, 2022

⚠️ No Changeset found

Latest commit: 718cef5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Collaborator

@machour machour left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for that js/no-js refactoring 🙌🏼

Shouldn't the tests related to #4342 fail?

@jenseng
Copy link
Contributor Author

jenseng commented Oct 14, 2022

@machour the new tests do fail with JavaScript enabled, but they are annotated with test.fail(...) to indicate that they are supposed to fail, which makes them pass if they fail and fail if they pass 🙃. See here and here... it's the playwright equivalent of @ts-expect-error

So when we fix the behavior, we'll need to remove those annotations as well, otherwise the tests will start failing because they are passing 😆

@machour machour requested a review from mcansh October 16, 2022 18:05
@jenseng
Copy link
Contributor Author

jenseng commented Oct 17, 2022

I'm thinking it might be good to merge this PR independently of the actual fixes, since it expands coverage generally and gives us a little more flexibility in how/when we fix ... e.g. file handling fix could be separate from submitter fixes, and I have two proposals on how to fix the latter (implement the spec vs. do some temporary form DOM shenanigans)

@machour
Copy link
Collaborator

machour commented Oct 17, 2022

@jenseng agreed. I'll get eyes on this soon!

@jenseng jenseng force-pushed the add-form-and-Form-parity-tests branch 2 times, most recently from 8bd158f to ec8ce3d Compare October 22, 2022 16:48
@mcansh
Copy link
Collaborator

mcansh commented Oct 25, 2022

thank you @jenseng! 🙌

didn't realize these we were only running these with js enabled 😱

edit: looks like something went awry on dev which so all integration tests are currently failing there but they passed in the PR that was merged... i'll merge this one once we get that cleaned up

@jenseng
Copy link
Contributor Author

jenseng commented Oct 25, 2022

In light of this imminent fix I'll rebase and amend the tests, as this is one instance where <form> and <Form> should behave differently

@jenseng jenseng marked this pull request as draft October 25, 2022 20:33
* Rework all form tests to run both with and without JavaScript. This way we
  can better detect/prevent regressions or inconsistencies between how <form>
  and <Form> work.
* Dedup and expand form method tests to ensure we cover all supported Form
  methods and submitter formMethods
* Expand coverage around form serialization (tree order, image submit buttons,
  files in URL-encoded payloads)
* Conditionally mark tests as failing (via test.fail):
   * Non-get/post <Form> methods with JavaScript disabled (remix-run#4420)
   * Form serialization problems with JavaScript enabled (remix-run#4342)
@jenseng jenseng force-pushed the add-form-and-Form-parity-tests branch from 0c10a0d to 718cef5 Compare October 26, 2022 20:33
@jenseng jenseng changed the title test: expand test coverage around form submissions test: expand test coverage around forms Oct 26, 2022
@jenseng jenseng marked this pull request as ready for review October 26, 2022 20:39
@brophdawg11 brophdawg11 self-assigned this Oct 27, 2022
Copy link
Contributor

@brophdawg11 brophdawg11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great @jenseng - thank you!

@chaance chaance merged commit 8fd8ba0 into remix-run:dev Oct 28, 2022
@chaance
Copy link
Collaborator

chaance commented Oct 28, 2022

@jenseng Have you already started working on fixes to these issues or should we prepare for that internally? I'd like to prioritize these bugs for the next release if possible.

@jenseng
Copy link
Contributor Author

jenseng commented Oct 28, 2022

@chaance I've got fixes/PRs basically ready, was just holding off till this gets merged... IMO the url-encoded-files fix should probably be a separate PR from the submitter fixes, and I have two proposals/approaches for the latter

@brophdawg11
Copy link
Contributor

@jenseng Would you mind tagging me on those as well? We'll want the same changes in react-router-dom's <Form>/useSubmit so we don't lose them when RR 6.4 is migrated into Remix. I can copy your changes over there once they're good to go in Remix 👍

kentcdodds pushed a commit that referenced this pull request Dec 15, 2022
* Rework all form tests to run both with and without JavaScript. This way we
  can better detect/prevent regressions or inconsistencies between how <form>
  and <Form> work.
* Dedupe and expand form method tests to ensure we cover all supported Form
  methods and submitter formMethods
* Expand coverage around form serialization (tree order, image submit buttons,
  files in URL-encoded payloads)
* Conditionally mark tests as failing (via test.fail):
   * Non-get/post <Form> methods with JavaScript disabled (#4420)
   * Form serialization problems with JavaScript enabled (#4342)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants