TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Example of Using React Testing Library with 3rd Party Component

1 pointsby eviltesterover 3 years ago

1 comment

eviltesterover 3 years ago
I used React Testing Library for the first time and blogged about it for AG Grid.<p>I used more querySelector and querySelectorAll, than the Testing Library documentation suggests because when working with a 3rd Part component I don&#x27;t have access to add data-testid attributes.<p>My previous experience with WebDriver helped because I was able to write CSS selectors fairly easily and add synchronisation code to handle the asynchronous nature of the grid rendering.<p>There are Github links in the post, but the code is here in case anyone wants to look at it: <a href="https:&#x2F;&#x2F;github.com&#x2F;ag-grid&#x2F;react-data-grid&#x2F;tree&#x2F;main&#x2F;podcast-player&#x2F;v8" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;ag-grid&#x2F;react-data-grid&#x2F;tree&#x2F;main&#x2F;podcast...</a><p>I only have a few tests so I haven&#x27;t really attempted to make the abstraction layers complete or very isolated, but if I added more automated execution code then I would refactor the abstraction layers into something more manageable.