Repository navigation
Conversation
JeremyYao
force-pushed
the
jy/playwright-e2e-tests
branch
from
October 31, 2026 16:58
bebc643 to
5e47dbc
Compare
Add an E2E suite in e2e/ that starts a real VS Code and uses the extension
the way a person would, including the contents of its webviews. It covers
opening a file in the Data Editor, saving an edited byte to disk, and pausing
a debug session on entry. The suite is separate from the existing tests, which
are unchanged.
- Add test:e2e, test:e2e:ui, test:e2e:debug and test:e2e:report scripts
- Add an e2e CI job that uploads the HTML report when tests fail
- Add a testId prop to Button, used by the Data Editor's save buttons
- Cover e2e in yarn lint, and exclude its output from the RAT check
- Document the suite in DEVELOPMENT.md
- Remove vscode-extension-tester, which was never used
- Remove @types/glob, which described an older glob API than the installed
version and broke the build once vscode-extension-tester was removed
The debugger test also found that the Daffodil CLI could run on the wrong
Java. Its launcher scripts ignore JAVA_HOME and run the first java on the
PATH, and Vite replaces process.env with {} when bundling, so on Linux and
macOS the CLI had no PATH at all. Run it with the real environment, with the
chosen JDK first on the PATH.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
JeremyYao
force-pushed
the
jy/playwright-e2e-tests
branch
from
October 31, 2026 17:47
5e47dbc to
34cec45
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1462
Description
Adds Playwright end-to-end (E2E) tests. They start a real VS Code and use the extension the way a person would, including inside webviews like the Data Editor. The existing tests can't reach inside webviews, so that UI has only been checked by hand, using the checklist in
src/tests/README.md.The new tests are in their own
e2efolder, and the existing tests aren't changed. There are 3 tests so far:Why Playwright
#1462 asks for vscode-extension-tester, so this PR is a change of direction. Playwright was chosen for these reasons:
StaleElementReferenceError, andextestwas hard to configure. An earlier UI test effort also needed delays that varied between machines. Playwright waits for elements automatically, so these tests contain no fixed sleeps.yarn installon our Node 20 CI jobs. It also tests only the latest 3 VS Code versions, and treats 1.90, our minimum, as best-effort. Playwright installs on Node 20 and isn't tied to VS Code releases.__dirnameerror, its docs were less thorough, and it would add a second test runner and a third-party service while still using WebDriver._electronAPI, and so does Confluent's VS Code extension.Downsides
Playwright's Electron support is officially experimental.
[Task]: Set up vscode-extension-tester Correctly #1462 asks for vscode-extension-tester, so this PR is a change of direction. Playwright was chosen for these reasons:
It reaches inside webviews. Most of the manual checklist is Data Editor behaviour, like drag selection, tooltips and scrolling. Playwright can reach into VS Code's nested webview iframes directly. The earlier discussion noted that neither vscode-extension-tester nor WebdriverIO handles webviews well.
It avoids problems we've already hit. In Exploratory: Create simple integration/end-to-end (e2e) tests using vscode-extension-tester #1290, vscode-extension-tester tests passed and failed inconsistently, hit
StaleElementReferenceEro configure. An earlier UI test effort also needed delays that varied between machines. Playwright waits for elements automatically, so these tests s approach.** VS Code's own smoke tests launch through Playwright's_electron` API, and so does Confluent's VS Code extension.Downsides
e2e/pages/workbench.tsto limit that.#1462 acceptance criteria
The debugger test found that a valid schema could fail with "Schema compilation failed. Fix the schema and try again." The real error was an
UnsupportedClassVersionError, because the CLI was running on a Java version that was too old. There were two causes:JAVA_HOMEand run the firstjavaon thePATH.process.envwith{}when bundling, so on Linux and macOS the CLI ran with noPATHand picked up the system Java.The CLI now runs with the real environment, with the chosen JDK first on the
PATH.Other changes
test:e2e,test:e2e:ui,test:e2e:debugandtest:e2e:reportscriptse2eCI job on Windows, macOS and Linux, which uploads the HTML report when tests failtestIdprop toButton, used by the Data Editor's save buttonse2einyarn lint, and excludes its output from the RAT checkvscode-extension-tester, which was never used@types/glob, which described an olderglobAPI and broke the build oncevscode-extension-testerwas removedKnown issues not fixed here
The debugger start uses a fixed 5-second wait. After starting the debugger,
runScriptwaits 5 seconds and assumes it's ready. A slow start fails withconnect ECONNREFUSED, and a fast start waits longer than it needs to. The wait dates back to at least May 2022 (c24daf3).From
src/utils.ts:The debugger always takes the first branch, because
runDebuggerpasses the type'daffodil'and no port. Switching it towait_portis untested, and the port check might look like aclient connecting to the debugger.
process.envis empty in the rest of the bundle.getJavaHomecan't seeJAVA_HOME, and environment variables likeOMEGA_EDIT_SERVER_LOG_LEVELhave no effect.Daffodil jar downloads can be slow or stall. Each debugger test downloads the jars again, because every test gets a new user data folder. The extension sets no timeout on the download. It also only checks that the folder exists, so an interrupted download may leave a partial folder that later runs reuse.
Wiki
I have determined that no documentation updates are needed for these changes
I have added the following documentation for these changes
Added an "End-to-End Tests" section to
DEVELOPMENT.mdReview Instructions including Screenshots
You'll need Node 22 or newer, JDK 17 and sbt. Run
yarn installfirst.Each test opens its own VS Code window, so windows will open and close during a run. Tests use port 9100 for the Data Editor server, so they won'te open.
To explore the tests:
Confirmation Testing
Already tested
e2eCI job passes on Windows, macOS and Linux with VS Code stable, and on Linux with VS Code 1.90.0Try it yourself
Run the tests on the oldest supported VS Code, which is the default. All 3 should pass.
Run them on the latest VS Code. All 3 should pass again.
Check that a test can really fail. In
e2e/dataEditor.spec.ts, change the expected'54'to'55', then run:shows the bytes of the opened fileshould fail, and its trace should show the first byte as54. Undo the edit withgit checkout -- e2e/dataEditor.spec.ts.Check that the tests stay isolated. Open a Data Editor in your normal VS Code, run
yarn test:e2e dataEditor, and check that your editor still works.git statusshould show no new files afterwards.The debugger test can fail with
connect ECONNREFUSED 127.0.0.1:4711, or stall while downloading the Daffodil jars (see known issues). This happened 4 times in one set of 8 local runs. CI retries failed tests but local runs don't, so re-run it if you see either.Try the Java fix
This needs Linux, with JDK 17 or newer first on the
PATHand an older Java at/usr/bin/java. The bug was found on theubuntu-22.04CI runners.The second run should fail after about 2 minutes, and its trace should show "Schema compilation failed. Fix the schema and try again."
Regression Testing
Already tested
src/testswere changedBuild, Test, and Packagejobs passedwindows-2022, Node 20.19.4, Java 17, VS Code 1.90.0) is an existing flake: the Daffodil Debuggerbefore allhook timed out, on retry.mainfailed the same way at360290c(run 40520441064)yarn install --frozen-lockfilepasses on Node 20.19.4, so the Node 20 CI jobs still installsbt ratCheckpassTry it yourself
Confirm the existing tests are unchanged. This should print nothing:
Run the existing sbt, Vitest and Mocha tests. All should pass, apart from the flake above if it occurs.
yarn testRun the repo checks:
On a Windows checkout with
core.autocrlf=true, useyarn prettier src e2e -c --end-of-line autoinstead ofyarn lint.On Node 20, confirm that the dependency changes still install:
Check the production code changes by hand. Press F5 to start the extension, as described under "Debugging the Extension" in
DEVELOPMENT.md, tButton,FileMetrics): runDaffodil Debug: Data Editor, open a copy of a file, and change a byte.Save…should revealSaveandSave As, and both should work.validateSchemaWithDaffodilCLI): add a deliberate error to a copy of a schema and runDaffodil Debug: Debug File. It should still show "Schema compilation failed. Fix the schema and try again."Made with assistance from Claude Code