Skip to content

Commit

Permalink
chore(SLB-218): update storybook tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chindris committed Mar 27, 2024
1 parent a678784 commit e8fcb1a
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions packages/ui/src/components/Molecules/ContactForm.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,37 @@ export const WithValidationErrors: StoryObj<{ exec: ContactFormExecutor }> = {
await userEvent.click(submitButton);
},
}

export const WithSuccessfulSubmission: StoryObj<{ exec: ContactFormExecutor }> = {
args: {
exec: async () => {
return {
createWebformSubmission: {
error: null,
submission: "{\"submissionId\": \"1\"}"
}
};
}
},
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
const nameInput = canvas.getByPlaceholderText('Name');
await userEvent.type(nameInput, 'John doe', {
delay: 5,
});
const emailInput = canvas.getByPlaceholderText('Email');
await userEvent.type(emailInput, '[email protected]', {
delay: 5,
});
const subjectInput = canvas.getByPlaceholderText('Subject');
await userEvent.type(subjectInput, 'Lorem ipsum', {
delay: 5,
});
const messageInput = canvas.getByPlaceholderText('Message');
await userEvent.type(messageInput, 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', {
delay: 5,
});
const submitButton = canvas.getByRole('button');
await userEvent.click(submitButton);
},
}

0 comments on commit e8fcb1a

Please sign in to comment.