How do you test a reactjs web app with selenium?

后端 未结 2 1094
感动是毒
感动是毒 2021-02-15 15:48

I have a web app using React and I\'m trying to create some tests using Selenium RC. I\'m finding though that when Selenium changes the values of fields, events are not properly

2条回答
  •  长情又很酷
    2021-02-15 16:28

    Try Simulate in the React TestUtils addon:

    React.addons.TestUtils.Simulate.change(document.getElementById('your-id-here'))
    

    See http://facebook.github.io/react/docs/test-utils.html#simulate

    It also requires that you switch to the React file containing the addons:

    "To get the add-ons, use react-with-addons.js (and its minified counterpart) rather than the common react.js." — http://facebook.github.io/react/docs/addons.html

提交回复
热议问题