title: How to get the value of H1 tag and test it using Jest and RTL
body: <p>I'm trying to test my component if it displays the right value in my h1.</p>
  <p>Below is my component that will be tested.</p>
  <pre><code>  const Title = () =&gt; {
    return (
      &lt;&gt;
        &lt;h1 aria-label='Title of the project'&gt;MY RTL PROJECT&lt;/h1&gt;
      &lt;/&gt;
    );
  };
  
  export default Title;
  </code></pre>
  <p>and here is my test file that tries to check if my component displays &quot;MY RTL PROJECT&quot;.</p>
  <pre><code>import { render, } from '@testing-library/react';
  import Title from '../Title';
  
  
      describe('Checks the title component', () =&gt; {
      
          it('checks the value of the Title component', () =&gt; {
              const { getByText } = render(&lt;Title /&gt;);
              const titleValue = getByText('MY RTL PROJECT')
              expect(titleValue).toBe('MY RTL PROJECT')
          })
      })
  </code></pre>
  <p>and here is the error:   <strong>&quot;messageParent&quot; can only be used inside a worker</strong></p>
  <pre><code>  ● Checks the title component › checks the value of the Title component
  
  expect(received).toBe(expected) // Object.is equality
  
  Expected: &quot;MY RTL PROJECT&quot;
  Received: &lt;h1 aria-label=&quot;Title of the project&quot;&gt;MY RTL PROJECT&lt;/h1&gt;
  </code></pre>