storybooks second release

This commit is contained in:
Nima Shkouhfar
2024-10-19 17:24:29 -04:00
parent c9d7fc1b6e
commit 0cf8caa53b
20 changed files with 1015 additions and 13 deletions

View File

@ -16,3 +16,72 @@ type Story = StoryObj<typeof meta>;
export const Default: Story = {
render: () => <KcPageStory />
};
/**
* WithRetryAvailable:
* - Purpose: Tests when the user can retry the WebAuthn authentication after an error.
* - Scenario: The component renders with a "Try Again" button to allow retrying the authentication process.
* - Key Aspect: Ensures the retry button functionality is visible and the user can retry authentication.
*/
export const WithRetryAvailable: Story = {
render: () => (
<KcPageStory
kcContext={{
url: {
loginAction: "/mock-login-action"
},
isAppInitiatedAction: false,
message: {
summary: "WebAuthn authentication failed. Please try again.",
type: "error"
}
}}
/>
)
};
/**
* WithAppInitiatedAction:
* - Purpose: Tests when the WebAuthn error form is part of an application-initiated action.
* - Scenario: The component renders with both a "Try Again" button and a "Cancel" button for app-initiated actions.
* - Key Aspect: Ensures the form renders correctly with both "Try Again" and "Cancel" options.
*/
export const WithAppInitiatedAction: Story = {
render: () => (
<KcPageStory
kcContext={{
url: {
loginAction: "/mock-login-action"
},
isAppInitiatedAction: true,
message: {
summary: "WebAuthn authentication failed. You can try again or cancel.",
type: "error"
}
}}
/>
)
};
/**
* WithJavaScriptDisabled:
* - Purpose: Tests the behavior when JavaScript is disabled or not functioning.
* - Scenario: The component renders with a message prompting the user to retry manually without JavaScript.
* - Key Aspect: Ensures the retry mechanism works properly when JavaScript is disabled or unavailable.
*/
export const WithJavaScriptDisabled: Story = {
render: () => (
<KcPageStory
kcContext={{
url: {
loginAction: "/mock-login-action"
},
isAppInitiatedAction: false,
message: {
summary: "JavaScript is disabled or not working. Please retry manually.",
type: "warning"
}
}}
/>
)
};