Category "react-testing-library"

trying to set value to context provider for a cypress test spec

the challenge am having is explained below Am trying to set a draft_id value after the submit-recipients data-testid is clicked. The beforementioned value is pa

react testing library: can't acquire context from the given item

I have this component, which uses react-chartjs-2 to render a Doughnut chart: const CompliancyChart = ({data}): JSX.Element => { ... return ( <Cha

Testing React Component with React Router V6

I understand that React Testing Library has an example of testing with react router, but I couldn't get it to work (I think because I am using react router V6).

Jest test passes but .. has console message You are trying to access a property or method of the Jest environment after it has been torn down

My test passes but has a console refrenceError: You are trying to access a property or method of the Jest environment after it has been torn down. Test: import

Angular Ag-Grid row group empty render when querying DOM elements with angular-testing-library

I have an ag-grid that contains different columns and column groups, as well as row groups. I am trying to test the DOM elements displayed in the row group usin

How to avoid act() with sub component changes?

I'm using the Select component from patternfly and attempting to do a test that involves making changes to the selection. I feel like I'm in a catch 22 as I can

React Testing Library gives console error for ReactDOM.render in React 18

After updating to React 18 or creating a new React 18 app from create-react-app, when I run the yarn test command, it gives a console.error as a Warning for eac

warning from test with jasmine and react testing library

I started a project in react and I implemented some tests (first time I ever did test) using jasmine and react-testing-library (they are not useful for the mome

React Testing Library with userEvent.click wrong act() warning

I have several tests written with Jest and React Testing Library. They all mock fetch and use a userEvent.click call to fire a submit button which makes a fetch

How to test scrollHeight, scrollWidth, clientHeight and clientWidth with react-testing-library and jest

I just can't figure out, how I'm supposed to mock / get data from scrollHeight, scrollWidth, clientHeight and clientWidth in test. For better introduction, my t

The current testing environment is not configured to support act(...) - @testing-library/react

I'm trying to upgrade my project to React 18, everything works in dev and production mode in the browser. But after upgrading to the latest version of @testing-

How many render operations does act() support?

I am using act function from library https://testing-library.com/docs/react-testing-library/intro/. At this point I have something like this: await act(async (

Testing span appearance using testing library

I'm quite newbie for the testing library. I already find out how to test the span appearance with the element but seems there's no answer of it. I have an examp

Testing function that use useQuery @apollo/client with Jest

I am trying to unit test my function that call useQuery from @apollo/client. Here's what I have done getPixelID.ts import { useQuery } from '@apollo/client'; im

Test correct SVG component renders with jest and react-testing-library

I have an svg inside a React component that renders conditionally. <div className='avatar'> {gender === true ? <MaleAvatar /> : <FemaleAvat

window.dispatchEvent from test code does not trigger window.addEventListener

I have below listener added for which I am trying to write test using Jest. However, it seems as though the event I'm dispatching doesn't reach my code. window.

React Testing Library Not Parsing JSON

I have a TextArea component that takes JSON {"someKey": "someValue"}. When I inspect the dom, {"someKey": "someValue"} shows up just fine in the inspector. Howe

How to resolve act() in useEffect?

I have a small problem with act() error in react-testing-library. In useEffect I try to call an function that is a promise. Promise returns some data and displa

Tooltip MUI and React testing library

I'm trying to test an Info HOC on my react app : const InfoHOC = (HocComponent) => ({ message }) => ( <> <Tooltip title={message}>

How can I test the content in ag-grid using testing-library?

I am trying to write a few simple tests that the headers and data I want to render are showing up as expected. I created a repo - https://github.com/olore/ag-gr