Created
December 9, 2020 19:25
-
-
Save skovy/be19e1349c9ff634b2daa4b5c87a2ed1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 userEvent.click(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