Skip to content

Commit bf128de

Browse files
committed
test(bedrock): add Playwright snapshots for the custom ARN settings
Cover the "Other" layout with manual limits (dark and light) and a listed underlying model (dark). Baselines generated in the pinned Playwright container. Refs #1968
1 parent 7d3840e commit bf128de

5 files changed

Lines changed: 74 additions & 0 deletions

File tree

‎webview-ui/playwright/gallery/stories.tsx‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,37 @@ export const stories: Record<string, Story> = {
4444
</AppProviders>
4545
)
4646
},
47+
"bedrock-custom-arn": async ({ baseModelId = "" }) => {
48+
const [{ AppProviders }, { BedrockCustomArn }, { providerIdentifiers }] = await Promise.all([
49+
import("../AppProviders"),
50+
import("@/components/settings/providers/BedrockCustomArn"),
51+
import("@roo-code/types"),
52+
])
53+
function CustomArn() {
54+
const [config, setConfig] = useState<import("@roo-code/types").ProviderSettings>({
55+
apiProvider: providerIdentifiers.bedrock,
56+
apiModelId: "custom-arn",
57+
awsRegion: "us-west-2",
58+
awsCustomArn: "arn:aws:bedrock:us-west-2:123456789012:application-inference-profile/abcd1234efgh",
59+
awsCustomArnBaseModelId: String(baseModelId),
60+
})
61+
return (
62+
<div className="w-[480px] p-4 flex flex-col gap-3 bg-vscode-editor-background text-vscode-foreground">
63+
<BedrockCustomArn
64+
apiConfiguration={config}
65+
setApiConfigurationField={(field, value) =>
66+
setConfig((previous) => ({ ...previous, [field]: value }))
67+
}
68+
/>
69+
</div>
70+
)
71+
}
72+
return (
73+
<AppProviders>
74+
<CustomArn />
75+
</AppProviders>
76+
)
77+
},
4778
"accessibility-contrast": async () => {
4879
const { AccessibilityContrastGallery } =
4980
await import("@/components/ui/__tests__/AccessibilityContrast.visual.fixture")
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import type { Page } from "@playwright/test"
2+
3+
import { expect, test } from "../../../../../playwright/coverage-fixture"
4+
import { applyVisualTheme, visualThemes } from "../../../../../playwright/themes"
5+
6+
const mountCustomArn = async (page: Page, props: { baseModelId?: string } = {}) => {
7+
await page.goto("/")
8+
await page.waitForFunction(() => typeof window.mount === "function")
9+
await page.evaluate((storyProps) => window.mount({ story: "bedrock-custom-arn", props: storyProps }), props)
10+
const component = page.locator("[data-playwright-mounted]")
11+
await expect(component.getByTestId("custom-arn-base-model")).toBeVisible()
12+
return component
13+
}
14+
15+
const settleRendering = (page: Page) =>
16+
page.evaluate(async () => {
17+
await document.fonts.ready
18+
await new Promise<void>((resolve) => requestAnimationFrame(() => resolve()))
19+
})
20+
21+
for (const theme of visualThemes.filter(({ name }) => name === "dark" || name === "light")) {
22+
test(`renders the custom ARN underlying model with Other limits in the VS Code ${theme.name} theme`, async ({
23+
page,
24+
}) => {
25+
const component = await mountCustomArn(page)
26+
await applyVisualTheme(page, theme)
27+
28+
await expect(component.getByTestId("custom-arn-context-window")).toBeVisible()
29+
await settleRendering(page)
30+
31+
await expect(component).toHaveScreenshot(`bedrock-custom-arn-other-${theme.name}.png`)
32+
})
33+
}
34+
35+
test("renders a custom ARN with a listed underlying model and no manual limits", async ({ page }) => {
36+
const component = await mountCustomArn(page, { baseModelId: "anthropic.claude-opus-5-5" })
37+
await applyVisualTheme(page, visualThemes[0])
38+
39+
await expect(component.getByTestId("custom-arn-context-window")).toHaveCount(0)
40+
await settleRendering(page)
41+
42+
await expect(component).toHaveScreenshot("bedrock-custom-arn-opus-5-5-dark.png")
43+
})
34.3 KB
Loading
39.3 KB
Loading
40.1 KB
Loading

0 commit comments

Comments
 (0)