Filling in an input Element

Learn how to simulate a user filling in an input element in a test.

Starter project

The starter project contains the same ContactForm component as the previous lesson. It also includes a half-implemented test that performs checks on a successful form submission.

A copy of the code is in the code widget below. Click the “Run” button to run the tests.

export default "test-file-stub";
Half-implemented test

Completing the test

There is a keyboard function in the user-event package that simulates a user using the keyboard.

Add the following lines to the test in ContactForm.test.js after the ...