jeudi 1 juin 2017

Can you simulate a click on a hidden element with React TestUtils or Enzyme?

I've been looking into whether or not to use Selenium when testing an application built with React. It seems like the general answer is "no why would you do that when we have nice things like React TestUtils or AirBnB's enzyme?". All of the examples I've seen so far seem to call the onClick method of the component directly to simulate a click. It even says so right here in the "Common Gotchas" section of the documentation.

My question is, can you simulate a click on a DOM element even if the element is obscured by another element, hidden with CSS or just plain not visible to the user? If you can, then wouldn't testing with TestUtils or Enzyme be insufficient for ui tests since you can't be sure the user will actually be able to interact with the component?

Aucun commentaire:

Enregistrer un commentaire