menu

Testing Library

Simple and complete DOM testing utilities that encourage good testing practices.

Channels
Chat
view-forward
# All channels
view-forward
# General
view-forward
# General Help
view-forward
# Angular Help
view-forward
# Cypress Help
view-forward
# DOM Help
view-forward
# React Help
view-forward
# TestCafe Help
view-forward
# Vue Help
view-forward
Team
Posts
Chat
Members
Info
down-caret

How to get state/instance of component wrapped in HOC ?

thumbsup
0
message-simple
13

event.propertyName returns undefined when I'm using fireEvent.transitionEnd

This is my function, I'm trying to test that the callback function work in my tests: ...I'm firing this in my test: fireEvent.transitionEnd(getByTestId('sidepanel')); …

thumbsup
0
message-simple
0

getByText but on a certain element

Hi, I have a component that has a title with the text "LOGIN" and a button that has a span inside also with the text "LOGIN". I'm trying to reference the button element by doing: getByText('LOGIN').closest('button') but it fails, what is the best approach here? …

thumbsup
0
message-simple
2

Recommended way to test

Hi, guys. I am asking for your project setup to test RN (or React) with react-native-testing-library and Jest. The following things confuse me right now: 1. I have container components that receive data from Redux selectors and initialize their dumb components. Those containers…

thumbsup
0
message-simple
5

waitForDomChange times out

Hey, i'm trying to test the effects of click on particular div, after i fire the click event i call the wait for waitForDomChange method which always times out and fails my text test('it should update cell clicked with \'x\'', async () => { const { getByTestId } = render(board);…

thumbsup
0
message-simple
2

Noob: Testing component with nested async hooks

My component <ExInput /> contains a hook …

thumbsup
0
message-simple
4

Testing with Redux...

Background: I'm a junior dev (really I'm just slightly more than an intern) working at consultancy and we are working on an app for Multinational Software company. I'm not new to React, but I am new to Redux ( I always avoided it because it seem needlessly complex for the…

thumbsup
0
message-simple
17

Can't update snapshot

Hey I'm new with testing library and got stuck with some weird 'loop'. I'm running yarn run test -u to update snapshot for one of my test and everything is ok. Then I run yarn prepush which runs yarn flow + yarn lint + yarn test and I'm getting error "snapshot failed from 1 test…

thumbsup
0
message-simple
6

Beginner: How to test a component with function props?

Hi. I have a child component with 3 function props being pass by its parent component. How do I test this child component?

thumbsup
0
message-simple
14

Testing a radio button click event resulting in "checked"

I've read this post where the following example is given: But that feels kind of odd since it's not the result of a click that's being tested. But rather it's directly setting the value to a certain string. However, the click event does not work: …

thumbsup
0
message-simple
3