Skip to content

Commit 32b1842

Browse files
committed
fix(webview): swap visual regression target off deprecated toolkit
1 parent 3e6f5b6 commit 32b1842

6 files changed

Lines changed: 21 additions & 26 deletions

File tree

webview-ui/playwright-ct.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export default defineConfig({
4646
optimizeDeps: {
4747
exclude: ["@vscode/codicons"],
4848
},
49+
publicDir: path.resolve(dirname, "../src/assets/images"),
4950
},
5051
viewport: { width: 520, height: 360 },
5152
deviceScaleFactor: 1,

webview-ui/playwright/index.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ import "./vscode-theme-dark.css"
22
import "@vscode/codicons/dist/codicon.css"
33
import "../src/index.css"
44

5-
// Eagerly load the toolkit into the CT entry chunk so lazy component chunks
6-
// reference already-registered custom elements. Splitting the toolkit into a
7-
// separate lazy chunk triggers a Vite 8/Rolldown scope-hoist bug that leaves
8-
// `FoundationElement` in a TDZ (`FoundationElement$N is not defined`).
9-
// See vitejs/vite#22583 and vscode-webview-ui-toolkit#561 (deprecated).
10-
import "@vscode/webview-ui-toolkit/react"
5+
// Components read `window.IMAGES_BASE_URI` at mount time to resolve extension
6+
// image assets. Under Playwright CT the extension host isn't present, so seed
7+
// it to serve from the CT bundle root (mapped to src/assets/images via
8+
// `publicDir` in playwright-ct.config.ts).
9+
;(window as unknown as { IMAGES_BASE_URI: string }).IMAGES_BASE_URI = ""

webview-ui/src/components/chat/__tests__/ProgressIndicator.visual.tsx

Lines changed: 0 additions & 20 deletions
This file was deleted.
Binary file not shown.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import React from "react"
2+
import { expect, test } from "@playwright/experimental-ct-react"
3+
4+
import RooHero from "../RooHero"
5+
6+
test("renders the welcome hero in the VS Code dark theme", async ({ mount }) => {
7+
const component = await mount(<RooHero />)
8+
9+
await component.evaluate(async () => {
10+
await document.fonts.ready
11+
await new Promise<void>((resolve) => requestAnimationFrame(() => resolve()))
12+
})
13+
14+
await expect(component).toHaveScreenshot("zoo-hero-dark.png")
15+
})
20.3 KB
Loading

0 commit comments

Comments
 (0)