Skip to content

Instantly share code, notes, and snippets.

Created December 9, 2020 19:25
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
// actions/name.ts
import { screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
export function canPerform() {
try {
return !!screen.getByLabelText(/first name/i) && !!screen.getByLabelText(/last name/i);
} catch (error) {
return false;
export async function perform() {
try {
await userEvent.type(await screen.findByLabelText(/first name/i), 'Wealth');
await userEvent.type(await screen.findByLabelText(/last name/i), 'Front');
await screen.findByText('Next'));
} catch (error) {
// handle the error
export const name = 'Fill Name & Next';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment