title: How to get a the data-testid from a DOM component?
body: <p>In my React project, sometimes a dynamically generated UUID needs to be added to the a <code>data-testid</code> value to ensure uniqueness amongst duplicate components in the DOM.</p>
  <p>I have a test situation where I can grab the element I want.  Now I want to get the dynamically generated data-testid from it. I've tried this but it doesn't work:</p>
  <pre><code>const questionDropdown = queryAllByText('Free Text')[0];
  console.log(questionDropdown.getAttribute('data-testid'));
  </code></pre>
  <p>Any suggestions how to get it?</p>