Skip to content

Commit 332d30f

Browse files
easonLiangWorldedtecheasonliang28easonLiangWorldedtechlead
authored
feat(settings): dynamic thinking effort experimental toggle (DTE-1) (Zoo-Code-Org#1521)
* feat(settings): dynamic thinking effort experimental toggle (DTE-1) * feat(settings): dynamic thinking effort experimental toggle (DTE-1) * test(settings): assert false and unset dynamicThinkingEffort persistence in the updateSettings payload * test(settings): restore the blanket auto-deny specs to their upstream text Out of Scope Changes: the two blanket auto-deny tests in SettingsView.spec.tsx had been reformatted - comments and blank lines dropped, the Save click inlined, and the updatedSettings assertion collapsed onto one line. None of that has anything to do with dynamicThinkingEffort, and it made unrelated behaviour look like part of this change. The whole describe block is now byte-identical to upstream/main again, so the diff for this file contains only what the feature needs: the imports the new experimental-settings tests use, the new Experimental Settings round-trip tests, and the openAiStrictToolSchemas save round-trip tests. No changed line in the diff mentions auto-deny any more. Local: syntax gate clean (0 TS1xxx). The restored block is upstream's own text against an unchanged renderSettingsView helper, so its behaviour is what upstream CI already covers. * style(webview): drop the duplicated blank line the merge left behind * style(webview): drop the duplicated blank line the merge left between describes * chore: empty commit to re-trigger the pre-merge checks after the linked-issue body fix * chore: empty commit to re-trigger the pre-merge checks after the closing-reference body fix * style: apply repo Prettier to the merge resolution * chore: re-trigger CI after a vitest environment-teardown flake The webview suites all passed (2106/2106) but vitest exited 1 on two EnvironmentTeardownError unhandled rejections originating from ModelSelector.spec.tsx, a file this PR does not touch. Re-run the lanes. * fix(i18n): describe the dynamic-thinking toggle as preparing a later feature * test(webview): give the experimental settings fixture the required apiConfiguration prop * build(stryker): drop the comment-only mutation-gate hunks Both stryker-diff hunks in this PR rewrote comments only: the extension entry already carries vitestRelated: true / discoverRelatedTests: false on main (scripts/stryker-diff.mjs:69-70 of a15ba8c), and the assertions in scripts/stryker-diff.test.mjs already match main. Restore both files to the merge base so the mutation-gate settings and their explanatory comments stay in one place; this unit is the dynamicThinkingEffort flag. * test(webview): regenerate the experimental settings visual baselines The four baselines were measured against the pre-refresh gallery rendering. Upstream main renders the real @vscode/webview-ui-toolkit in the gallery (the toolkit mock is gone), so the story is 46 px taller and CI's required webview-visual check failed all four themes. Reproduced first, in the image pinned by visual-regression.yml (mcr.microsoft.com/playwright:v1.64.1-noble@sha256:47b510dd9..., chromium build 1248, tree = this branch merged with a15ba8c - the same content as the PR merge ref): Error: expect(locator).toHaveScreenshot(expected) failed Expected an image 488px by 543px, received 488px by 589px. 37618 pixels (ratio 0.14 of all image pixels) are different. with 16638 / 40967 / 16740 differing pixels for light / high-contrast / high-contrast-light - byte-for-byte the same diff counts CI reported for head 301c1c5, which is the evidence that this container reproduces the CI rendering. Then regenerated with test:visual:docker:update scoped to the story (--grep "renders the experimental settings" --update-snapshots), which re-wrote exactly these four files: sha256 of every other __screenshots__/*.png is identical before and after. All four are 488x589, matching the measured CI height; no dimensions were hand-edited. * test(dte): make the saved-false projection answer a real edit, and stop promising an in-chat control The description of settings.experimental.DYNAMIC_THINKING_EFFORT promised a manual in-chat control that this PR does not ship. The second sentence is dropped from every locale file that carries the key (all 18), so the copy fix is locale-complete: the first sentence and the (experimental) tag stay. check-translations runs node scripts/find-missing-translations.js, which checks key parity rather than prose, and that script exits 0 in this tree with these files in place. ClineProvider.spec.ts: the saved-false getStateToPostToWebview test now stores a second enabled experiment next to the false flag, so a projection that fell back to experimentDefault whenever the flag was false can no longer pass while discarding an enabled experiment. SettingsView.spec.tsx: the toggle test asserts that no updateSettings message reaches the extension host before Save, and a new test hydrates an explicit false and edits a different experiment, so the save payload has to carry the hydrated false back. Gate accounting: packageForPath() in scripts/stryker-diff.mjs returns null for webview-ui/src/i18n/locales/en/settings.json (a .json path) and for every path in this commit that is a test file, so the mutation-diff leg charges 0 changed lines for it, even though executableChangedLines() counts 957 executable lines in the en locale file alone (of 1,127 total). A null package cancels that leg; it does not make these paths green. This answers the copy ask. It does not implement the control: implementing the in-chat control is the charged route (webview-ui/**/*.tsx maps to the webview package), which is the route the blocker accounting priced. Copy here is documentation, not the control. * test(webview): regenerate the four experimental settings visual baselines The previous commit on this PR replaced the experimental-mode setting copy in 18 locales, and the ExperimentalSettings visual story renders that copy, so the four committed baselines went stale: the advisory webview-visual leg failed on exactly experimental-settings-dark.png, -light.png, -high-contrast.png and -high-contrast-light.png at the merge shape while all six required arms stayed green. Reproduced locally at CI's merge shape: a scratch branch merging main (e487cd7) with this PR's head c48ac56 02d2a7cf72fd6790d2 (merge commit 45595b9bbad54f3b699379e42942e475de019f8d), copied into the pinned image mcr.microsoft.com/playwright:v1.64.1-noble@ sha256:47b510dd9230bf0b9bfc9b20102241e577ea7a99334ab4c3ca19f19770e9b8ea with a container-side frozen install. The check run at CI's worker count printed 'Running 101 tests using 2 workers' and 4 failed | 97 passed, naming those four snapshots (504, 584, 590 and 535 pixels different). At the container default of 16 workers the same tree printed 8 failed, the extra four being RenderedContentContrast.parallelism artifacts, so only the 2-worker run is quoted. The update run (same image, --workers=2 --update-snapshots=all, restricted to ExperimentalSettings.visual.tsx) re-generated those four files and passed; nothing else in the tree changed. Tooling finding for whoever owns webview-ui/playwright: run-docker.mjs bind-mounts the host tree, so from a Windows-pnpm host the container dies before any assertion with "Cannot find module '/work/webview-ui/node_modules/@playwright/test/cli.js' (MODULE_NOT_FOUND, ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL, exit 1 in ~4 s) because the mounted node_modules are Windows junctions; it also needs a pnpm shim on PATH for the config's webServer command. The regeneration above therefore ran from a container-side install of a copy, with the host tree mounted read-only. Gate accounting: packageForPath() maps these paths to the webview package, but the files are binary so parseChangedLines sees no added or removed lines and executableChangedLines charges 0 lines for them - a binary asset is not executable source. Disclosed: this is the second and last push on this PR in the current cycle, spent on a leg the unit's own commit broke rather than on freshness. --------- Co-authored-by: Eason Liang <[email protected]> Co-authored-by: easonLiangWorldedtech <[email protected]> Co-authored-by: lead <lead@local>
1 parent d3d9cd4 commit 332d30f

33 files changed

Lines changed: 428 additions & 2 deletions
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { experimentIds, experimentIdsSchema, experimentsSchema } from "../experiment.js"
2+
3+
describe("dynamicThinkingEffort experiment", () => {
4+
it("is part of the experiment id enum", () => {
5+
expect(experimentIds).toContain("dynamicThinkingEffort")
6+
expect(experimentIdsSchema.safeParse("dynamicThinkingEffort").success).toBe(true)
7+
})
8+
9+
it("parses enabled and disabled states", () => {
10+
expect(experimentsSchema.parse({ dynamicThinkingEffort: true })).toEqual({ dynamicThinkingEffort: true })
11+
expect(experimentsSchema.parse({ dynamicThinkingEffort: false })).toEqual({ dynamicThinkingEffort: false })
12+
expect(experimentsSchema.parse({})).toEqual({})
13+
})
14+
15+
it("rejects non-boolean values", () => {
16+
expect(experimentsSchema.safeParse({ dynamicThinkingEffort: "yes" }).success).toBe(false)
17+
expect(experimentIdsSchema.safeParse("dynamic-thinking-effort").success).toBe(false)
18+
})
19+
})

‎packages/types/src/experiment.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export const experimentIds = [
1212
"runSlashCommand",
1313
"customTools",
1414
"parallelToolExecution",
15+
"dynamicThinkingEffort",
1516
] as const
1617

1718
export const experimentIdsSchema = z.enum(experimentIds)
@@ -28,6 +29,7 @@ export const experimentsSchema = z.object({
2829
runSlashCommand: z.boolean().optional(),
2930
customTools: z.boolean().optional(),
3031
parallelToolExecution: z.boolean().optional(),
32+
dynamicThinkingEffort: z.boolean().optional(),
3133
})
3234

3335
export type Experiments = z.infer<typeof experimentsSchema>

‎src/core/webview/__tests__/ClineProvider.spec.ts‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4308,6 +4308,47 @@ describe("ClineProvider", () => {
43084308
expect(state.destructiveCommandGuardEnabled).toBe(false)
43094309
})
43104310

4311+
test("getStateToPostToWebview returns the saved dynamicThinkingEffort experiment when enabled", async () => {
4312+
await provider.resolveWebviewView(mockWebviewView)
4313+
await provider.contextProxy.setValue("experiments", {
4314+
...experimentDefault,
4315+
dynamicThinkingEffort: true,
4316+
})
4317+
4318+
const state = await provider.getStateToPostToWebview()
4319+
4320+
expect(state.experiments).toEqual({ ...experimentDefault, dynamicThinkingEffort: true })
4321+
})
4322+
4323+
test("getStateToPostToWebview returns the saved dynamicThinkingEffort experiment when explicitly disabled", async () => {
4324+
await provider.resolveWebviewView(mockWebviewView)
4325+
// A second experiment is enabled on purpose: a projection that fell back to
4326+
// experimentDefault whenever the flag was false would still satisfy a
4327+
// fixture-equals-default assertion, and it would discard this enabled
4328+
// experiment on the way.
4329+
await provider.contextProxy.setValue("experiments", {
4330+
...experimentDefault,
4331+
preventFocusDisruption: true,
4332+
dynamicThinkingEffort: false,
4333+
})
4334+
4335+
const state = await provider.getStateToPostToWebview()
4336+
4337+
expect(state.experiments).toEqual({
4338+
...experimentDefault,
4339+
preventFocusDisruption: true,
4340+
dynamicThinkingEffort: false,
4341+
})
4342+
})
4343+
4344+
test("getStateToPostToWebview defaults dynamicThinkingEffort to false when experiments are unset", async () => {
4345+
await provider.resolveWebviewView(mockWebviewView)
4346+
4347+
const state = await provider.getStateToPostToWebview()
4348+
4349+
expect(state.experiments).toEqual({ ...experimentDefault, dynamicThinkingEffort: false })
4350+
})
4351+
43114352
test("getStateToPostToWebview returns the saved blanket auto-deny setting", async () => {
43124353
await provider.resolveWebviewView(mockWebviewView)
43134354
await provider.contextProxy.setValue("alwaysDenyUnapprovedCommands", true)

‎src/core/webview/__tests__/webviewMessageHandler.spec.ts‎

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ import * as copilotProvider from "../../../api/providers/github-copilot"
8484
import { webviewMessageHandler } from "../webviewMessageHandler"
8585
import { registerCopilotModelBroadcast } from "../../../services/language-models/copilotModelBroadcast"
8686
import type { ClineProvider } from "../ClineProvider"
87+
import { experimentDefault } from "../../../shared/experiments"
8788
import { flushModels, getModels } from "../../../api/providers/fetchers/modelCache"
8889
import { getLMStudioModels } from "../../../api/providers/fetchers/lmstudio"
8990
import { getCommands } from "../../../services/command/commands"
@@ -2973,6 +2974,60 @@ describe("webviewMessageHandler - telemetrySetting", () => {
29732974
})
29742975
})
29752976

2977+
describe("webviewMessageHandler - experiments", () => {
2978+
beforeEach(() => {
2979+
vi.clearAllMocks()
2980+
})
2981+
2982+
it("persists dynamicThinkingEffort true merged with the saved experiments", async () => {
2983+
vi.mocked(mockClineProvider.contextProxy.getValue).mockImplementation((key: string) =>
2984+
key === "experiments" ? { preventFocusDisruption: true } : undefined,
2985+
)
2986+
2987+
await webviewMessageHandler(mockClineProvider, {
2988+
type: "updateSettings",
2989+
updatedSettings: { experiments: { dynamicThinkingEffort: true } },
2990+
})
2991+
2992+
expect(mockClineProvider.contextProxy.setValue).toHaveBeenCalledWith("experiments", {
2993+
preventFocusDisruption: true,
2994+
dynamicThinkingEffort: true,
2995+
})
2996+
expect(mockClineProvider.postStateToWebview).toHaveBeenCalledTimes(1)
2997+
})
2998+
2999+
it("persists dynamicThinkingEffort false over a previously enabled value", async () => {
3000+
vi.mocked(mockClineProvider.contextProxy.getValue).mockImplementation((key: string) =>
3001+
key === "experiments" ? { dynamicThinkingEffort: true } : undefined,
3002+
)
3003+
3004+
await webviewMessageHandler(mockClineProvider, {
3005+
type: "updateSettings",
3006+
updatedSettings: { experiments: { dynamicThinkingEffort: false } },
3007+
})
3008+
3009+
expect(mockClineProvider.contextProxy.setValue).toHaveBeenCalledWith("experiments", {
3010+
dynamicThinkingEffort: false,
3011+
})
3012+
expect(mockClineProvider.postStateToWebview).toHaveBeenCalledTimes(1)
3013+
})
3014+
3015+
it("persists the experiment defaults when no experiments are saved yet", async () => {
3016+
vi.mocked(mockClineProvider.contextProxy.getValue).mockReturnValue(undefined)
3017+
3018+
await webviewMessageHandler(mockClineProvider, {
3019+
type: "updateSettings",
3020+
updatedSettings: { experiments: {} },
3021+
})
3022+
3023+
expect(mockClineProvider.contextProxy.setValue).toHaveBeenCalledWith("experiments", {
3024+
...experimentDefault,
3025+
dynamicThinkingEffort: false,
3026+
})
3027+
expect(mockClineProvider.postStateToWebview).toHaveBeenCalledTimes(1)
3028+
})
3029+
})
3030+
29763031
describe("webviewMessageHandler - collapseCommandOutputByDefault", () => {
29773032
beforeEach(() => {
29783033
vi.clearAllMocks()

‎src/shared/__tests__/experiments.spec.ts‎

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import type { ExperimentId } from "@roo-code/types"
44

5-
import { EXPERIMENT_IDS, experimentConfigsMap, experiments as Experiments } from "../experiments"
5+
import { EXPERIMENT_IDS, experimentConfigsMap, experimentDefault, experiments as Experiments } from "../experiments"
66

77
describe("experiments", () => {
88
describe("PREVENT_FOCUS_DISRUPTION", () => {
@@ -22,6 +22,7 @@ describe("experiments", () => {
2222
runSlashCommand: false,
2323
customTools: false,
2424
parallelToolExecution: false,
25+
dynamicThinkingEffort: false,
2526
}
2627
expect(Experiments.isEnabled(experiments, EXPERIMENT_IDS.PREVENT_FOCUS_DISRUPTION)).toBe(false)
2728
})
@@ -33,6 +34,7 @@ describe("experiments", () => {
3334
runSlashCommand: false,
3435
customTools: false,
3536
parallelToolExecution: false,
37+
dynamicThinkingEffort: false,
3638
}
3739
expect(Experiments.isEnabled(experiments, EXPERIMENT_IDS.PREVENT_FOCUS_DISRUPTION)).toBe(true)
3840
})
@@ -44,6 +46,7 @@ describe("experiments", () => {
4446
runSlashCommand: false,
4547
customTools: false,
4648
parallelToolExecution: false,
49+
dynamicThinkingEffort: false,
4750
}
4851
expect(Experiments.isEnabled(experiments, EXPERIMENT_IDS.PREVENT_FOCUS_DISRUPTION)).toBe(false)
4952
})
@@ -66,4 +69,28 @@ describe("experiments", () => {
6669
expect(Experiments.isEnabled({ parallelToolExecution: true }, "parallelToolExecution")).toBe(true)
6770
})
6871
})
72+
73+
describe("DYNAMIC_THINKING_EFFORT", () => {
74+
it("is configured correctly", () => {
75+
expect(EXPERIMENT_IDS.DYNAMIC_THINKING_EFFORT).toBe("dynamicThinkingEffort")
76+
expect(experimentConfigsMap.DYNAMIC_THINKING_EFFORT).toMatchObject({
77+
enabled: false,
78+
})
79+
// Visible in the Settings panel (showInSettings defaults to true).
80+
expect(experimentConfigsMap.DYNAMIC_THINKING_EFFORT.showInSettings).toBeUndefined()
81+
})
82+
83+
it("is disabled by default", () => {
84+
expect(experimentDefault.dynamicThinkingEffort).toBe(false)
85+
expect(Experiments.isEnabled({}, "dynamicThinkingEffort")).toBe(false)
86+
})
87+
88+
it("returns true when enabled", () => {
89+
expect(Experiments.isEnabled({ dynamicThinkingEffort: true }, "dynamicThinkingEffort")).toBe(true)
90+
})
91+
92+
it("returns false when explicitly disabled", () => {
93+
expect(Experiments.isEnabled({ dynamicThinkingEffort: false }, "dynamicThinkingEffort")).toBe(false)
94+
})
95+
})
6996
})

‎src/shared/experiments.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export const EXPERIMENT_IDS = {
66
RUN_SLASH_COMMAND: "runSlashCommand",
77
CUSTOM_TOOLS: "customTools",
88
PARALLEL_TOOL_EXECUTION: "parallelToolExecution",
9+
DYNAMIC_THINKING_EFFORT: "dynamicThinkingEffort",
910
} as const satisfies Record<string, ExperimentId>
1011

1112
type _AssertExperimentIds = AssertEqual<Equals<ExperimentId, Values<typeof EXPERIMENT_IDS>>>
@@ -25,6 +26,7 @@ export const experimentConfigsMap: Record<ExperimentKey, ExperimentConfig> = {
2526
CUSTOM_TOOLS: { enabled: false },
2627
// TODO: add i18n keys (settings:experimental.PARALLEL_TOOL_EXECUTION.name/.description) in the same PR that sets showInSettings: true
2728
PARALLEL_TOOL_EXECUTION: { enabled: false, showInSettings: false },
29+
DYNAMIC_THINKING_EFFORT: { enabled: false },
2830
}
2931

3032
export const experimentDefault = Object.fromEntries(

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,11 @@ export const stories: Record<string, Story> = {
468468
const { UISettingsStory } = await import("@/components/settings/__tests__/UISettings.visual.fixture")
469469
return <UISettingsStory />
470470
},
471+
"experimental-settings": async () => {
472+
const { ExperimentalSettingsStory } =
473+
await import("@/components/settings/__tests__/ExperimentalSettings.visual.fixture")
474+
return <ExperimentalSettingsStory />
475+
},
471476
"ui-settings-long-locale": async () => {
472477
const { UISettingsStory } = await import("@/components/settings/__tests__/UISettings.visual.fixture")
473478
return <UISettingsStory initialState={{ language: "ru" }} />

‎webview-ui/src/components/settings/__tests__/ExperimentalSettings.spec.tsx‎

Lines changed: 75 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { render, screen } from "@testing-library/react"
1+
import { fireEvent, render, screen } from "@testing-library/react"
22

33
import { experimentDefault } from "@roo/experiments"
44

@@ -33,4 +33,78 @@ describe("ExperimentalSettings", () => {
3333
expect(screen.getByText("settings:experimental.CUSTOM_TOOLS.name")).toBeInTheDocument()
3434
expect(screen.queryByText("settings:experimental.PARALLEL_TOOL_EXECUTION.name")).not.toBeInTheDocument()
3535
})
36+
37+
it("renders the dynamic thinking effort toggle", () => {
38+
render(<ExperimentalSettings {...defaultProps} />)
39+
40+
expect(screen.getByText("settings:experimental.DYNAMIC_THINKING_EFFORT.name")).toBeInTheDocument()
41+
})
42+
43+
it("leaves the dynamic thinking effort toggle unchecked when the value is false or omitted", () => {
44+
const getCheckbox = () => {
45+
const label = screen.getByText("settings:experimental.DYNAMIC_THINKING_EFFORT.name").closest("label")
46+
return label?.querySelector("input[type='checkbox']")
47+
}
48+
49+
// Explicit false
50+
let result = render(
51+
<ExperimentalSettings
52+
{...defaultProps}
53+
experiments={{ ...experimentDefault, dynamicThinkingEffort: false }}
54+
/>,
55+
)
56+
expect(getCheckbox()).not.toBeNull()
57+
expect(getCheckbox()).not.toBeChecked()
58+
result.unmount()
59+
60+
// Omitted (absent from the persisted config)
61+
const omitted: Record<string, boolean> = { ...experimentDefault }
62+
delete omitted.dynamicThinkingEffort
63+
result = render(<ExperimentalSettings {...defaultProps} experiments={omitted} />)
64+
expect(getCheckbox()).not.toBeNull()
65+
expect(getCheckbox()).not.toBeChecked()
66+
result.unmount()
67+
})
68+
69+
it("binds the dynamic thinking effort toggle to setExperimentEnabled", () => {
70+
const setExperimentEnabled = vi.fn()
71+
render(
72+
<ExperimentalSettings
73+
{...defaultProps}
74+
experiments={{ ...experimentDefault, dynamicThinkingEffort: true }}
75+
setExperimentEnabled={setExperimentEnabled}
76+
/>,
77+
)
78+
79+
const label = screen.getByText("settings:experimental.DYNAMIC_THINKING_EFFORT.name").closest("label")
80+
const checkbox = label?.querySelector("input[type='checkbox']")
81+
expect(checkbox).not.toBeNull()
82+
expect(checkbox).toBeChecked()
83+
84+
fireEvent.click(checkbox!)
85+
86+
expect(setExperimentEnabled).toHaveBeenCalledTimes(1)
87+
expect(setExperimentEnabled).toHaveBeenCalledWith("dynamicThinkingEffort", false)
88+
})
89+
90+
it("toggles the dynamic thinking effort on when clicked from the unchecked state", () => {
91+
const setExperimentEnabled = vi.fn()
92+
render(
93+
<ExperimentalSettings
94+
{...defaultProps}
95+
experiments={{ ...experimentDefault, dynamicThinkingEffort: false }}
96+
setExperimentEnabled={setExperimentEnabled}
97+
/>,
98+
)
99+
100+
const label = screen.getByText("settings:experimental.DYNAMIC_THINKING_EFFORT.name").closest("label")
101+
const checkbox = label?.querySelector("input[type='checkbox']")
102+
expect(checkbox).not.toBeNull()
103+
expect(checkbox).not.toBeChecked()
104+
105+
fireEvent.click(checkbox!)
106+
107+
expect(setExperimentEnabled).toHaveBeenCalledTimes(1)
108+
expect(setExperimentEnabled).toHaveBeenCalledWith("dynamicThinkingEffort", true)
109+
})
36110
})
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { useState } from "react"
2+
3+
import type { Experiments } from "@roo-code/types"
4+
5+
import { EXPERIMENT_IDS, experimentDefault } from "@roo/experiments"
6+
7+
import { ExperimentalSettings } from "../ExperimentalSettings"
8+
import { AppProviders } from "../../../../playwright/AppProviders"
9+
10+
export function ExperimentalSettingsStory() {
11+
const [experiments, setExperiments] = useState<Experiments>({
12+
...experimentDefault,
13+
[EXPERIMENT_IDS.DYNAMIC_THINKING_EFFORT]: true,
14+
})
15+
16+
return (
17+
<AppProviders>
18+
<div
19+
data-testid="experimental-settings-story"
20+
className="w-[488px] max-w-full rounded-lg border border-vscode-panel-border bg-vscode-editor-background p-4 text-vscode-editor-foreground">
21+
<ExperimentalSettings
22+
experiments={experiments}
23+
apiConfiguration={{}}
24+
setExperimentEnabled={(id, enabled) => setExperiments((current) => ({ ...current, [id]: enabled }))}
25+
/>
26+
</div>
27+
</AppProviders>
28+
)
29+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { expect, test } from "../../../../playwright/coverage-fixture"
2+
import { mountedStory } from "../../../../playwright/mounted-story"
3+
import { applyVisualTheme, visualThemes } from "../../../../playwright/themes"
4+
5+
for (const theme of visualThemes) {
6+
test(`renders the experimental settings section in the VS Code ${theme.name} theme`, async ({ mount, page }) => {
7+
const component = mountedStory(await mount("experimental-settings"))
8+
await applyVisualTheme(page, theme)
9+
const story = component.getByTestId("experimental-settings-story")
10+
await expect(story).toHaveScreenshot(`experimental-settings-${theme.name}.png`)
11+
})
12+
}

0 commit comments

Comments
 (0)