8000 chore(site): Try to fix flake test by BrunoQuaresma · Pull Request #6848 · coder/coder · GitHub
[go: up one dir, main page]

Skip to content

chore(site): Try to fix flake test #6848

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Mar 29, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix stories
  • Loading branch information
BrunoQuaresma committed Mar 28, 2023
commit 3cc5a58ed8f25d9be9f99c794cf230fe618ed325
77 changes: 16 additions & 61 deletions site/src/components/SignInForm/SignInForm.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Story } from "@storybook/react"
import { makeMockApiError } from "testHelpers/entities"
import { LoginErrors, SignInForm, SignInFormProps } from "./SignInForm"
import { SignInForm, SignInFormProps } from "./SignInForm"

export default {
title: "components/SignInForm",
Expand All @@ -17,85 +17,40 @@ const Template: Story<SignInFormProps> = (args: SignInFormProps) => (

export const SignedOut = Template.bind({})
SignedOut.args = {
isLoading: false,
loginErrors: {},
isSigningIn: false,
onSubmit: () => {
return Promise.resolve()
},
}

export const Loading = Template.bind({})
Loading.args = {
export const SigningIn = Template.bind({})
SigningIn.args = {
...SignedOut.args,
isLoading: true,
isSigningIn: true,
authMethods: {
password: { enabled: true },
github: { enabled: true },
oidc: { enabled: false, signInText: "", iconUrl: "" },
},
}

export const WithLoginError = Template.bind({})
WithLoginError.args = {
export const WithError = Template.bind({})
WithError.args = {
...SignedOut.args,
loginErrors: {
[LoginErrors.AUTH_ERROR]: makeMockApiError({
message: "Email or password was invalid",
validations: [
{
field: "password",
detail: "Password is invalid.",
},
],
}),
},
error: makeMockApiError({
message: "Email or password was invalid",
validations: [
{
field: "password",
detail: "Password is invalid.",
},
],
}),
initialTouched: {
password: true,
},
}

export const WithGetUserError = Template.bind({})
WithGetUserError.args = {
...SignedOut.args,
loginErrors: {
[LoginErrors.GET_USER_ERROR]: makeMockApiError({
message: "You are logged out. Please log in to continue.",
detail: "API Key is invalid.",
}),
},
}

export const WithCheckPermissionsError = Template.bind({})
WithCheckPermissionsError.args = {
...SignedOut.args,
loginErrors: {
[LoginErrors.CHECK_PERMISSIONS_ERROR]: makeMockApiError({
message: "Unable to fetch user permissions",
detail: "Resource not found or you do not have access to this resource.",
}),
},
}

export const WithAuthMethodsError = Template.bind({})
WithAuthMethodsError.args = {
...SignedOut.args,
loginErrors: {
[LoginErrors.GET_METHODS_ERROR]: new Error("Failed to fetch auth methods"),
},
}

export const WithGetUserAndAuthMethodsError = Template.bind({})
WithGetUserAndAuthMethodsError.args = {
...SignedOut.args,
loginErrors: {
[LoginErrors.GET_USER_ERROR]: makeMockApiError({
message: "You are logged out. Please log in to continue.",
detail: "API Key is invalid.",
}),
[LoginErrors.GET_METHODS_ERROR]: new Error("Failed to fetch auth methods"),
},
}

export const WithGithub = Template.bind({})
WithGithub.args = {
...SignedOut.args,
Expand Down
0