mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-09-24 16:02:55 +08:00
chore: reduce error details screenshot tests to 2 stories
All error types render the same JSON dump, so only collapsed and expanded states need visual coverage.
This commit is contained in:
@@ -18,6 +18,26 @@ const i18nValue = {
|
||||
t: (key: UiI18nKey, _params?: UiI18nParams) => labels[key] ?? key,
|
||||
}
|
||||
|
||||
const apiError: ErrorType = {
|
||||
name: "APIError",
|
||||
data: {
|
||||
message: "Request failed: 429 Too Many Requests",
|
||||
statusCode: 429,
|
||||
isRetryable: true,
|
||||
responseBody: JSON.stringify(
|
||||
{
|
||||
error: {
|
||||
type: "rate_limit_error",
|
||||
message: "You have exceeded the rate limit. Please try again in 30 seconds.",
|
||||
},
|
||||
},
|
||||
null,
|
||||
2,
|
||||
),
|
||||
metadata: { "x-request-id": "req_01abc123", region: "us-east-1" },
|
||||
},
|
||||
}
|
||||
|
||||
function ErrorCard(props: { error: ErrorType; defaultOpen?: boolean }) {
|
||||
const message =
|
||||
"data" in props.error && typeof props.error.data === "object" && "message" in props.error.data
|
||||
@@ -52,109 +72,12 @@ const meta: Meta = {
|
||||
export default meta
|
||||
type Story = StoryObj
|
||||
|
||||
export const ApiErrorExpanded: Story = {
|
||||
name: "API Error (expanded)",
|
||||
render: () => (
|
||||
<ErrorCard
|
||||
defaultOpen
|
||||
error={{
|
||||
name: "APIError",
|
||||
data: {
|
||||
message: "Request failed: 429 Too Many Requests",
|
||||
statusCode: 429,
|
||||
isRetryable: true,
|
||||
responseBody: JSON.stringify(
|
||||
{
|
||||
error: {
|
||||
type: "rate_limit_error",
|
||||
message: "You have exceeded the rate limit. Please try again in 30 seconds.",
|
||||
},
|
||||
},
|
||||
null,
|
||||
2,
|
||||
),
|
||||
metadata: { "x-request-id": "req_01abc123", region: "us-east-1" },
|
||||
},
|
||||
}}
|
||||
/>
|
||||
),
|
||||
export const Collapsed: Story = {
|
||||
name: "Collapsed",
|
||||
render: () => <ErrorCard error={apiError} />,
|
||||
}
|
||||
|
||||
export const ApiErrorCollapsed: Story = {
|
||||
name: "API Error (collapsed)",
|
||||
render: () => (
|
||||
<ErrorCard
|
||||
error={{
|
||||
name: "APIError",
|
||||
data: {
|
||||
message: "Internal server error",
|
||||
statusCode: 500,
|
||||
isRetryable: false,
|
||||
},
|
||||
}}
|
||||
/>
|
||||
),
|
||||
}
|
||||
|
||||
export const ProviderAuthErrorExpanded: Story = {
|
||||
name: "Provider Auth Error (expanded)",
|
||||
render: () => (
|
||||
<ErrorCard
|
||||
defaultOpen
|
||||
error={{
|
||||
name: "ProviderAuthError",
|
||||
data: {
|
||||
message: "Invalid API key provided. Please check your credentials.",
|
||||
providerID: "anthropic",
|
||||
},
|
||||
}}
|
||||
/>
|
||||
),
|
||||
}
|
||||
|
||||
export const ContextOverflowExpanded: Story = {
|
||||
name: "Context Overflow (expanded)",
|
||||
render: () => (
|
||||
<ErrorCard
|
||||
defaultOpen
|
||||
error={{
|
||||
name: "ContextOverflowError",
|
||||
data: {
|
||||
message: "Context window exceeded: 210,000 tokens used out of 200,000 maximum.",
|
||||
responseBody: "The conversation has exceeded the model's context window. Please start a new session.",
|
||||
},
|
||||
}}
|
||||
/>
|
||||
),
|
||||
}
|
||||
|
||||
export const StructuredOutputExpanded: Story = {
|
||||
name: "Structured Output Error (expanded)",
|
||||
render: () => (
|
||||
<ErrorCard
|
||||
defaultOpen
|
||||
error={{
|
||||
name: "StructuredOutputError",
|
||||
data: {
|
||||
message: "Failed to parse model output as valid JSON after multiple attempts.",
|
||||
retries: 3,
|
||||
},
|
||||
}}
|
||||
/>
|
||||
),
|
||||
}
|
||||
|
||||
export const UnknownErrorExpanded: Story = {
|
||||
name: "Unknown Error (expanded)",
|
||||
render: () => (
|
||||
<ErrorCard
|
||||
defaultOpen
|
||||
error={{
|
||||
name: "UnknownError",
|
||||
data: {
|
||||
message: "An unexpected error occurred. Please try again.",
|
||||
},
|
||||
}}
|
||||
/>
|
||||
),
|
||||
export const Expanded: Story = {
|
||||
name: "Expanded",
|
||||
render: () => <ErrorCard defaultOpen error={apiError} />,
|
||||
}
|
||||
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:b38fa83e9aa24303091218ceeecc32421ed6ccd300520c09eea8abd38710bc99
|
||||
size 6847
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:25031a4f5b3a20048e229dc98b7a0269ddc8bc8a7bd1c9827979654c8ab58b02
|
||||
size 2170
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:56c0455a53e4e8311f768143dc862ddcb688bcaffda0772ed386b7635d1b8ec6
|
||||
size 11774
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:529a529ce3087227306ac82ec4338a3a4b7992fdd3444137e564c8a612dd5770
|
||||
size 5571
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:80e6364122bb97f22829b78c6ba82deac4256e711dad49dae28c2ee215315ff8
|
||||
size 7408
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:1760cb7553954acf434f58e0e09a3e67296e7bde1ef2bebe8984d999d57b2646
|
||||
size 12545
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:cce450c2c0ed90eb5c18b83b8841c78bb4998503dba6b30c85d4d16e07db791d
|
||||
size 6995
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:b16b7c753c88412b42181bd25d1e34e05e0ac72d8f682af96ba7d70a69471b82
|
||||
size 9917
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:4fef8a26da04ba932cbfd35e751fc865c326af0e248c455b362840c84c67b923
|
||||
size 7337
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f95509f72f3520993a532921af81891bd3cf55a9dac955787b8ff7172a417e56
|
||||
size 9903
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:d0d20bdab32aa105ab9aa12ef273773b711126a32582ad20c156e723ef765679
|
||||
size 5887
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:cff843aca987e8374f0540d7fdf6490dce10956ab993a164dfb3dcc21ea3603b
|
||||
size 8060
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:72d6e40cb954773f3b4dcffbbe1d1180713514b7e44b14d0866d0884d40adb58
|
||||
size 2368
|
||||
Reference in New Issue
Block a user