-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(SLB-218): update storybook tests
- Loading branch information
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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); | ||
}, | ||
} |