Skip to content

Commit 7a4fbef

Browse files
committed
test(io-intelligence): add a visual snapshot of the provider settings
1 parent 57170b8 commit 7a4fbef

3 files changed

Lines changed: 46 additions & 0 deletions

File tree

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

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,39 @@ export const stories: Record<string, Story> = {
7373
</AppProviders>
7474
)
7575
},
76+
"io-intelligence-settings": async () => {
77+
const [{ AppProviders }, { IOIntelligence }, { providerIdentifiers }] = await Promise.all([
78+
import("../AppProviders"),
79+
import("@/components/settings/providers/IOIntelligence"),
80+
import("@roo-code/types"),
81+
])
82+
type ProviderSettings = React.ComponentProps<typeof IOIntelligence>["apiConfiguration"]
83+
84+
function IOIntelligenceSettingsStory() {
85+
const [apiConfiguration, setApiConfiguration] = useState<ProviderSettings>({
86+
apiProvider: providerIdentifiers.ioIntelligence,
87+
})
88+
return (
89+
<div className="w-full p-4 bg-vscode-editor-background" data-testid="io-intelligence-settings-story">
90+
<div className="flex flex-col gap-3">
91+
<IOIntelligence
92+
apiConfiguration={apiConfiguration}
93+
setApiConfigurationField={(field, value) =>
94+
setApiConfiguration((current) => ({ ...current, [field]: value }))
95+
}
96+
organizationAllowList={{ allowAll: true, providers: {} }}
97+
/>
98+
</div>
99+
</div>
100+
)
101+
}
102+
103+
return (
104+
<AppProviders initialState={{ apiConfiguration: { apiProvider: providerIdentifiers.ioIntelligence } }}>
105+
<IOIntelligenceSettingsStory />
106+
</AppProviders>
107+
)
108+
},
76109
"layout-clipped-text": () => (
77110
<div className="w-40">
78111
<span data-testid="clipped-direct-text" className="block w-8 overflow-hidden whitespace-nowrap">
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { expect, test } from "../../../../../playwright/coverage-fixture"
2+
import { mountedStory } from "../../../../../playwright/mounted-story"
3+
4+
test("renders the IO Intelligence settings for an unconfigured profile", async ({ mount, page }) => {
5+
await page.setViewportSize({ width: 480, height: 480 })
6+
const component = mountedStory(await mount("io-intelligence-settings"))
7+
const story = component.getByTestId("io-intelligence-settings-story")
8+
9+
await expect(story.getByText("IO Intelligence API Key", { exact: true })).toBeVisible()
10+
await expect(story.getByRole("button", { name: "Get IO Intelligence API Key" })).toBeVisible()
11+
await expect(story.getByTestId("model-picker-button")).toHaveText("meta-llama/Llama-3.3-70B-Instruct")
12+
await expect(story).toHaveScreenshot("io-intelligence-settings.png")
13+
})
21.4 KB
Loading

0 commit comments

Comments
 (0)