title: How can I test inner text of a div element
body: <p>I'm trying to find the best practice to test textContent for a div element here, using react testing library.</p>
  
  <p>Say I'd like to test this simple react component to see if <code>{props.text}</code> is rendered properly on the HTML DOM. </p>
  
  <pre><code>const Simple = props =&gt; (
    &lt;&gt;
      &lt;div&gt; {props.text} &lt;/div&gt;
      &lt;div&gt; test text &lt;/div&gt;
    &lt;/&gt;
  );
  </code></pre>
  
  <p>I've tried to use <code>getByText</code>, then test <code>expect(getByText('text passed as prop')).toBeDefined()</code> but it didn't seem to work properly. </p>
  
  <p>It must be much easier if I add a className or id for the first <code>&lt;div /&gt;</code> then probably I can just go for <code>querySelector</code>, but what if I didn't want to add any HTML attribute here? How can I locate this element properly?</p>
  
  <p>Is there any solution to find the first  element that has no attribute and test its inner text?</p>