title: React Test Renderer Simulating Clicks on Elements
body: <p>I'm testing a React component using Jest v16.0.1, react-test-renderer v15.4.0 and react-addons-test-utils v15.4.0.</p>
  
  <p>The component has rendered a button:</p>
  
  <pre><code>&lt;button
      type="button"
      className="btn btn-lg btn-primary btn-danger"
      disabled={this.state.cancelButtonDisabled}
      onClick={() =&gt; this.handleCancel()}
      ref="cancelButton"
  &gt;Cancel&lt;/button&gt;);
  </code></pre>
  
  <p>And in my test I'm rendering the component like so:</p>
  
  <pre><code>const component = renderer.create(
      &lt;MyComponent /&gt;
  );
  
  const instance = component.getInstance();
  // This works but is ugly
  component.toJSON().children[1].children[0].props.onClick();
  // This doesn't work
  ReactTestUtils.Simulate.click(instance.refs.cancelButton);
  
  let tree = component.toJSON();
  expect(tree).toMatchSnapshot();
  </code></pre>
  
  <p>What is the recommended way to simulate a click on this button? You can traverse the JSON representation of the component but it seems like their should be a better way. </p>
  
  <p>Before when I was using ReactTestUtils.renderIntoDocument you could pass in a reference to the component using refs to ReactTestUtils.Simulate.click</p>
  
  <p>I've seen this question - <a href="https://stackoverflow.com/questions/40688661/how-to-interact-with-components-rendered-by-reacttestrenderer-jest">How to interact with components rendered by ReactTestRenderer / Jest</a> but I assume the API has changed as my component instance has no find() method.</p>