title: How to query by text string which contains html tags using React Testing Library?
body: <h2>Current Working Solution</h2>
  
  <p>Using this html:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;p data-testid="foo"&gt;Name: &lt;strong&gt;Bob&lt;/strong&gt; &lt;em&gt;(special guest)&lt;/em&gt;&lt;/p&gt;
  </code></pre>
  
  <p>I can use the <a href="https://github.com/kentcdodds/react-testing-library" rel="noreferrer">React Testing Library</a> <code>getByTestId</code> method to find the <code>textContent</code>:</p>
  
  <pre><code>expect(getByTestId('foo').textContent).toEqual('Name: Bob (special guest)')
  
  </code></pre>
  
  <h2>Is there a better way?</h2>
  
  <p>I would like to simply use this html:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;p&gt;Name: &lt;strong&gt;Bob&lt;/strong&gt; &lt;em&gt;(special guest)&lt;/em&gt;&lt;/p&gt;
  </code></pre>
  
  <p>And use <a href="https://github.com/kentcdodds/react-testing-library" rel="noreferrer">React Testing Library</a>'s <code>getByText</code> method like this:</p>
  
  <pre><code>expect(getByText('Name: Bob (special guest)')).toBeTruthy()
  </code></pre>
  
  <p>But this does not work.</p>
  
  <h2>So, the question…</h2>
  
  <p>Is there a simpler way to use React Testing Library to find strings of text content with the tags striped out?</p>