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: cy.type('{enter}') on <input> elements submits the form correctly after Firefox 98. #21042

Merged
merged 2 commits into from Apr 14, 2022

Conversation

sainthkh
Copy link
Contributor

@sainthkh sainthkh commented Apr 12, 2022

User facing changelog

cy.type('{enter}') submits the form correctly after Firefox 98.

Additional details

  • Why was this change necessary? => Enter event behavior change in Firefox 98 caused cy.type('{enter}') to not submit the <form>s.
  • What is affected by this change? => N/A
  • Any implementation details to explain? => N/A

How has the user experience changed?

<form> is submitted correctly with cy.type('{enter}').

PR Tasks

  • Have tests been added/updated?
  • Has the original issue (or this PR, if no issue exists) been tagged with a release in ZenHub? (user-facing changes only)
  • [na] Has a PR for user-facing changes been opened in cypress-documentation?
  • [na] Have API changes been updated in the type definitions?
  • [na] Have new configuration options been added to the cypress.schema.json?

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Apr 12, 2022

Thanks for taking the time to open a PR!

@sainthkh
Copy link
Contributor Author

Note

Our CI uses Firefox 93. This PR should be tested manually.

@sainthkh sainthkh marked this pull request as ready for review April 12, 2022 08:01
@sainthkh sainthkh requested a review from a team as a code owner April 12, 2022 08:01
@sainthkh sainthkh requested review from jennifer-shehane and removed request for a team April 12, 2022 08:01
@jennifer-shehane jennifer-shehane removed their request for review April 12, 2022 13:36
@jennifer-shehane
Copy link
Member

@sainthkh Thanks for looking into this again!

@@ -235,7 +237,8 @@ export default function (Commands, Cypress, cy, state, config) {
// when we send {Enter} KeyboardEvent to the input fields.
// Because of that, we don't have to click the submit buttons.
// Otherwise, we trigger submit events twice.
if (!Cypress.isBrowser('firefox')) {
// But after Firefox 98, submit event isn't automatically fired.
if (!isFirefoxBefore98 || !Cypress.isBrowser('firefox')) {
Copy link
Contributor

@BlueWinds BlueWinds Apr 12, 2022

Choose a reason for hiding this comment

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

The second part of this conditional is redundant. Three cases:
FF 97: (!true || !true) == false
FF 98: (!false || !true) == true
Chromium: (!false || !false) == true

In every case, !Cypress.isBrowser('firefox') has no effect on the outcome (because it's already part of the "is FF before 98" check).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right.

isFirefoxBefore98 is isFirefox && version < 98.

!isFirefoxBefore98 || !isFirefox is !isFirefox || !(version < 98) || !isFirefox.

I fixed it.

Copy link
Contributor

@tbiethman tbiethman left a comment

Choose a reason for hiding this comment

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

Tested against local FF98, the related tests pass after changes 👍

@BlueWinds BlueWinds merged commit e5002f0 into cypress-io:develop Apr 14, 2022
tgriesser added a commit that referenced this pull request Apr 20, 2022
…e-config

* 10.0-release:
  fix: make error on integration folder point to e2e (#20853)
  fix(unify): Update Cypress Dashboard Service Link in Login Modal (#21084)
  chore: fix windows node_modules install step (#21098)
  fix: webpack integration tests for app w webpack-dev-server-fresh (#21093)
  fix: move non spec files on migration (#21054)
  Bumping electron version in root
  chore(deps): Bumping electron dependency to 15.5.1 (#21072)
  fix: resolves correctly specPattern (#21057)
  feat: replace reconfigure button on settings page with link to config doc (#21077)
  feat(launchpad): update CT setup and config scaffolding (#20893)
  fix: cy.type('{enter}') on <input> elements submits the form correctly after Firefox 98. (#21042)
  chore: making the npm deps for vue, react, and vue2 use 0.0.0-dev (#21081)
  fix(cli): show additional mitigation steps for max path length error (#21047)
  fix: Plugin error when sending on disconnected IPC channel (#21011)
  chore: add internal types for cy.session command (#21028)
  chore: Update Chrome (stable) to 100.0.4896.88 (#21043)
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Apr 25, 2022

Released in 9.6.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v9.6.0, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Apr 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

{enter} not working in Firefox 99 and 100
4 participants