Skip to content

Commit 3e6f5b6

Browse files
committed
feat(webview): add Playwright CT coverage ratcheting
1 parent d2b7156 commit 3e6f5b6

8 files changed

Lines changed: 97 additions & 3 deletions

File tree

.github/workflows/visual-regression.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ jobs:
3232
install-args: "--frozen-lockfile"
3333
- name: Run webview visual tests
3434
run: pnpm --filter @roo-code/vscode-webview test:visual
35+
- name: Upload visual test coverage to Codecov
36+
if: always()
37+
uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4
38+
with:
39+
files: webview-ui/coverage-ct/lcov.info
40+
disable_search: true
41+
flags: webview-ui-ct
42+
token: ${{ secrets.CODECOV_TOKEN }}
3543
- name: Upload visual test artifacts
3644
if: failure()
3745
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4

codecov.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ coverage:
1111
threshold: 0.5%
1212
flags:
1313
- webview-ui
14+
- webview-ui-ct
1415
patch:
1516
default:
1617
target: 80% # new lines must be 80% covered
@@ -20,13 +21,18 @@ coverage:
2021
threshold: 0%
2122
flags:
2223
- webview-ui
24+
- webview-ui-ct
2325

2426
flag_management:
2527
individual_flags:
2628
- name: webview-ui
2729
paths:
2830
- webview-ui/src/
2931
carryforward: true
32+
- name: webview-ui-ct
33+
paths:
34+
- webview-ui/src/
35+
carryforward: true
3036
- name: core-unit
3137
paths:
3238
- packages/core/src/

knip.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
"react-compiler-runtime",
3232
"source-map",
3333
"tailwindcss",
34-
"tailwindcss-animate"
34+
"tailwindcss-animate",
35+
"monocart-coverage-reports"
3536
]
3637
},
3738
"apps/cli": {

pnpm-lock.yaml

Lines changed: 73 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webview-ui/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@
108108
"@vitest/ui": "4.1.9",
109109
"babel-plugin-react-compiler": "1.0.0",
110110
"jsdom": "26.1.0",
111+
"monocart-coverage-reports": "^2.12.12",
111112
"vite": "8.1.0",
112113
"vitest": "4.1.9"
113114
}

webview-ui/playwright-ct.config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ export default defineConfig({
4444
"process.env.PKG_RELEASE_CHANNEL": JSON.stringify("stable"),
4545
},
4646
optimizeDeps: {
47-
include: ["@vscode/webview-ui-toolkit"],
4847
exclude: ["@vscode/codicons"],
4948
},
5049
},

webview-ui/playwright/index.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
import "./vscode-theme-dark.css"
22
import "@vscode/codicons/dist/codicon.css"
33
import "../src/index.css"
4+
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"

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ test("renders a toolkit progress indicator in the VS Code dark theme", async ({
88
const progressRing = component.locator("vscode-progress-ring")
99

1010
await progressRing.evaluate(async (element) => {
11-
await document.fonts.ready
1211
await customElements.whenDefined("vscode-progress-ring")
1312
await new Promise<void>((resolve) => requestAnimationFrame(() => resolve()))
1413

0 commit comments

Comments
 (0)