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

Strange behavior

yields but if I change the expect to: yields

thumbsup
0
message-simple
1

How do I test my custom dropdown component with react-testing library…

I am using a third party component called react-dropdown (https://github.com/fraserxu/react-dropdown) I want to test in my application that it renders seven values. Which it does as shown in this demo: https://codesandbox.io/s/pj938w2640 …

thumbsup
0
message-simple
6

Testing functional component methods + typescript

Quite new to writing tests, and have to also jump in the deep end with doing it in Typescript on a project I have some functional component methods placed inside the function that I want to spy on to check if they are called with correct props after a user has performed an…

thumbsup
0
message-simple
9

Has anyone successfully used RTL to test change events on a draftJS text box?

The fireEvent.change() just doesn't work. It says there are no setters on the element. …

thumbsup
0
message-simple
28

findAllByTestId that starts with common prefix

I have a list of items, which I loop over. Each item has a wrapper then the content: In my test, I am verifying the content of the companyName-* items. So I would like to use the findAllByTestId, then loop through those and verify the inner text is the company.name value. …

thumbsup
0
message-simple
0

Testing different timezone behaviours?

Does anyone have any ideas on how to go about testing for different timezones? My UI changes for different timezones and it would be great to be able to test. I've tried some mocking libraries (e.g. MockDate, timezone-mock) but they break in different ways.

thumbsup
0
message-simple
0

Test code inside requestIdleCallback

Hello folks, Is there any way to test the code inside requestIdleCallback and to prove that requestIdleCallback is called? For me it doesn't seem to go into it. Do you have any idea why that might be? Thanks!

thumbsup
0
message-simple
1

Configure storyshots of Storybook with react-testing-library

I'm trying to add snapshots using storybook v5.0.5 and react-testing-library v6.0.3 to do structural testing of all my stories. I'm trying to follow the docs: https://github.com/infinitered/addon-storyshots/blob/master/README.md#serializer …

thumbsup
1
message-simple
3

How do I click "confirm" or "cancel" in a dialog stemming from window.confirm?

thumbsup
0
message-simple
2

TypeError: activeElement.detachEvent is not a function

Hey guys, I'm having trouble with a form component that I'm testing that looks like this: And the test: It passes, so we are really happy but in the test runner console I get the next error: …

thumbsup
1
message-simple
3