Getbydisplayvalue - React Testing Library !free!

// Assert initial display value expect(screen.getByDisplayValue('Alice')).toBeInTheDocument();

// Edit the value await userEvent.clear(nameInput); await userEvent.type(nameInput, 'Bob'); getbydisplayvalue react testing library

const nameInput = screen.getByLabelText(/name/i); // Assert initial display value expect(screen

// Assert updated display value expect(screen.getByDisplayValue('Bob')).toBeInTheDocument(); ); // Edit the value await userEvent.clear(nameInput)

test('select element by display value', () => render(<RoleSelect defaultValue="Admin" />);