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
Members
Info

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

thumbsup
0
message-simple
13

Which selector to use when multiple components have the same text?

This seems like a simple question and I'm just missing something, but I have a login form that looks something like this: I want to simulate a click on the login button. As far as I can tell my only options for selecting the button are: 1. Use getAllByText('Login')[1] …

thumbsup
0
message-simple
9

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

Noob: Testing component with nested async hooks

My component <ExInput /> contains a hook …

thumbsup
0
message-simple
4

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

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

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

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

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

Async Functional Component Mocking

I'm trying to test my top level functional component (<App />) my app.test.js file has: I import the component functions with: …

thumbsup
0
message-simple
11