Skip to main content

All Questions

0 votes
0 answers
47 views

How to run cypress component tests from storybook play function

I'd like to run cypress component tests from storybook play button. Is it possible? Example: export const Default: Story = { play: async ({ canvasElement }) => { cy.mount(canvasElement); ...
  MalcoreHardcore698's user avatar
-1 votes
1 answer
129 views

How do you test react-aria-components for the custom props you passed in?

The components render fine on a live local server and everythign works fine. But I can't figure out how to test the components for the react-aria-library. I know they are already tested by the ...
Domas's user avatar
  • 1
-4 votes
1 answer
67 views

Is there any way to use Cypress for unit testing functions? (React Framework) [closed]

I am trying to test helper functions of my application using cypress, but I am not sure if it is possible, or how I could make it work. I know cypress it meant to be used for e2e and component testing,...
Sam's user avatar
  • 3
1 vote
0 answers
32 views

getting some issue when I apply npm run test

I'm runnig npm test on my proyect, next js and I'm getting this issue: > npm test > [email protected] test > jest FAIL __tests__/pages/Home.test.tsx ● Test suite failed to run Jest ...
alex 's user avatar
  • 289
0 votes
0 answers
51 views

Testing component containing react-table fails

I wrote a unit test for Filter component that uses some properties from useTable hooks in react-table. Hence, I need to invoke useTable hook in the test suit. However, I face an error. What I am doing ...
Bello Shehu's user avatar
1 vote
0 answers
33 views

Cant change the value, it stucks with 1 as default, why?

I'm new in react and doing testing, I need to do an unit test that should fail but is working, type should be empty when brandId is 2, but is the same as you run it with 1, that returns model. brandId ...
PabloEmilio's user avatar
1 vote
1 answer
1k views

React Testing Library + Vitest mocking React child component

I am trying to test if a parent component renders children. I hit a wall trying to mock child component inside the test file. It seems like nothing is being mocked, and I don't understand why. I just ...
user9314872's user avatar
0 votes
0 answers
76 views

Cypress how to test the value returned by a react custom hook

I do use a custom hook to read QrCodes and i'd like to implement a Component testing with Cypress. My problem is that I don't have any DOM element to get the value from. It's just a hook which treat ...
Ashitaaka's user avatar
0 votes
0 answers
22 views

Testing React components that are composed of child components

I have a Card components that is split up into bunch of child components. Example: export function Card({ title, subtitle, details }) { return ( <div> <CardHeader title={title} ...
user9314872's user avatar
0 votes
0 answers
174 views

Cannot use import statement outside a module syntax error during unit testing using enzyme

/*` FAIL src/ApiComponent.test.js ● Test suite failed to run Jest encountered an unexpected token Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard ...
sanket borate's user avatar
0 votes
0 answers
135 views

Jest SpyOn returning undefined

I'm trying to write a jest unit test using react-testing-library and jest without the use of enzyme as from research that I've done it appears that enzyme will not be supported by react 18. Therefore ...
Olivia Bates's user avatar
0 votes
1 answer
413 views

Issue in creaating react jest test case when using chart.js

I have below test case. Please dont read entire code. (Its not necessary). what i am trying to say i wrote atleast 100times, checked with chatgpt, google bard still not able to make this test case ...
rashmi's user avatar
  • 228
1 vote
0 answers
444 views

TypeError: Cannot read properties of undefined (reading 'extend') in jest

I am using node version: v20.3.1 and jest version: 29.7.0, while running test cases getting typeError and i dont know how to solve it jest.config.js module.exports = { roots: ["<rootDir>/...
Mohammad Sohail's user avatar
0 votes
0 answers
151 views

Can't unit test a context provider? Empty div output

I have an app component that uses a context provider from my external library and I'm struggling to unit test it. import {SomeContext} from 'my-external-library'; const MyApp = ({children}) => ( ...
physicsboy's user avatar
  • 6,074
0 votes
0 answers
298 views

Mocking a config file using jest and react testing library

I have looked around and there are similar questions but none which cover this particular case. In my project, I have a useConfig() function which uses an api call to return an object containing ...
DMQuinn's user avatar
  • 61

15 30 50 per page
1
2 3 4 5
19