Testcafe: t.typeText() not working with React's new version (15.6.1)

Created on 22 Jun 2017  路  6Comments  路  Source: DevExpress/testcafe

Are you requesting a feature or reporting a bug?

It can be a bug or a feature request, depends on the way you look at it :stuck_out_tongue:

What is the current behavior?

For some reason t.typeText() is not triggering the onChange handler within a text input element.

What is the expected behavior?

t.typeText() should trigger onChange event when typing each character so we can react on it.

How would you reproduce the current behavior (if this is a bug)?

  1. Create an application with React latest version (15.6.1)
  2. Create a component with a text input element and setup any handler for the onChange prop
  3. Add a console.log() in the handler
  4. Create a test that types into that text input
  5. Run the tests and assert that no logs were emitted

Provide the test code and the tested page URL (if applicable)

Test code

Component:

class LoginForm extends PureComponent {
  constructor(props) {
    super(props);

    this.state = {
      email: ''
    };

    this.handleEmailChange = this.handleEmailChange.bind(this);
  }

  handleEmailChange({ target }) {
    console.log(target.value);

    this.setState({ email: target.value });
  }

  render() {
    return (
      <input
        id="loginField"
        type="text"
        value={this.state.value}
        onChange={this.handleEmailChange}
      />
    );
  }
}

Test

test('Should be able to type into login input', async (t) => {
  await t
    // Will show as if it's working, but nothing will be logged in the console
    .typeText(loginField, 'This will not be logged')
    // Although this will pass
    .expect(loginField.value, 'This will not be logged');

    // So you can can open console and see output
  await t.wait(1000000);
});

Specify your

  • operating system: Ubuntu 16.04 LTS
  • testcafe version: 0.16.1
  • node.js version: 6.11.0
!IMPORTANT! client Auto-locked automations bug

Most helpful comment

I can confirm that with the version 0.16.2 this works fine.

All 6 comments

Hi @m4n3z40,

We've reproduced the issue and will investigate it.

Thank you for your assistance. We have found a problem that persists since version 15.6.0 of the聽react-dom聽package. We will fix it ASAP.

I can confirm that with the version 0.16.2 this works fine.

Awesome. Thanks Team.
Really good work.

Thanks! =)

This thread has been automatically locked since it is closed and there has not been any recent activity. Please open a new issue for related bugs or feature requests. We recommend you ask TestCafe API, usage and configuration inquiries on StackOverflow.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

madroneropaulo picture madroneropaulo  路  3Comments

Lukas-Kullmann picture Lukas-Kullmann  路  3Comments

jvanoostveen picture jvanoostveen  路  4Comments

chebum picture chebum  路  3Comments

devmondo picture devmondo  路  3Comments