Skip to content

change event not firing on email input in React 16 #816

@chodorowicz

Description

@chodorowicz
  • Operating System: MacOS
  • Cypress Version: 1.0.2
  • Browser Version: Electron / Chrome 61

Is this a Feature or Bug?

Bug

Current behavior:

When running test via headless Electron change event is not fired for email type input. For text input it works correctly. Also text and input work correctly in standard Chrome.

Desired behavior:

Cypress should fire change event.

How to reproduce:

Run test cypress run on following app: https://stackblitz.com/edit/react-eadssh?file=index.js (need to export it and run locally, embedding doesn't seem to work)

import React, { Component } from 'react';
import { render } from 'react-dom';

class App extends Component {
  state = {
    inputValue: '',
    message: ''
  };

  handleChange = (event) => {
    this.setState({ 
      inputValue: event.currentTarget.value,
    });
  }

  handleSubmit = (event) => {
    event.preventDefault();
    this.setState({
      message: this.state.inputValue === ''
        ? 'Error'
        : 'All good'
    });
  }

  render() {
    return (
      <div>
        input value: {this.state.inputValue}
        <form onSubmit={this.handleSubmit}>
          <input onChange={this.handleChange} value={this.state.inputValue} id="input" type="email" />
          <button>submit</button>
        </form>
        {this.state.message}
      </div>
    );
  }
}

render(<App />, document.getElementById('root'));

Test code:

describe('app', () => {
  it('should work with input email type', () => {
    cy.visit('http://localhost:3000/');
    cy.get('#input').type('user@example.com');
    cy.contains('submit').click();
    cy.contains('All good');
  });
});

Additional Info (images, stack traces, etc)

related tickets:

failing with input type email
input-email

all good with text input type
input-text

Metadata

Metadata

Assignees

No one assigned

    Labels

    browser: electronpkg/driverThis is due to an issue in the packages/driver directory

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions