testing-library / dom-testing-library

🐙 Simple and complete DOM testing utilities that encourage good testing practices.
https://testing-library.com/dom
MIT License
3.25k stars 463 forks source link

Image and combobox are not being detected by the getByRole. #1238

Closed lakshman0369 closed 1 year ago

lakshman0369 commented 1 year ago

Describe the bug

Image tagged element and combobox are not being detected by the getByRole query.

Aria-query previous working version - 5.1.3 Aria-query upgraded version version - 5.2.1 "@testing-library/react": "12.0.0"

<img src="/rcore/static/media/AccessDenied_Icon.db53e967.svg" alt="" class="sc-lmJFLr hLGeOl sc-jRBLiq ghkJEk" id="">

Previously before the 'aria-query' upgrade, getByRole query will detect the above element. But after the upgrade this query is not able to detect the above element.

We have many test cases that are breaking due to above issue . This behavior is happening since v5.2.1. Please fix the issue above issue.

botoxparty commented 1 year ago

I'm experiencing the same behaviour here.

For example I get this message:

    TestingLibraryElementError: Unable to find an accessible element with the role "img"

    Here are the accessible roles:

      presentation:

      Name "AD_TITLE":
      <img
        alt="AD_TITLE"
        class="jsx-2547541157"
        src="test-file-stub"
      />

So there is definitely an img element there, but it's not detecting it. I am currently upgrading from 12 to 14.

MatanBobi commented 1 year ago

This might be related to https://github.com/testing-library/dom-testing-library/issues/1235, we'll need to look into it. Can you please add more info about the queries you're running and the elements you're trying to query? Thank you.