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
JeremyYao
removed request for
CoverRyan,
hdalsania,
scholarsmate,
shanedell and
stricklandrbls
November 1, 2026 13:52
JeremyYao
marked this pull request as draft
November 1, 2026 13:52
JeremyYao
marked this pull request as ready for review
November 1, 2026 14:40
Contributor
Author
|
I wanted real evidence for this choice, so I built the same 3 tests with vscode-extension-tester 8.28.1 on Both suites test the same extension source. I ran each one 8 times on VS Code 1.90.0 and 8 times on 1.144.0 (stable). These results are all from Windows, so macOS and Linux still need comparing. WebdriverIO wasn't part of this.
Why Playwright, despite the extra code
What vscode-extension-tester does better
How far to trust these numbers
#1462 asks for vscode-extension-tester, so this is still the maintainers' call. If you'd prefer it, the branch above shows that it's workable. |
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. All three tools can test webviews, and vscode-extension-tester can run these tests: the same 3 tests were built with it on
jy/extester-e2e-teststo compare them. Playwright was chosen because its tests are simpler to write and failures are easier to diagnose, not because the other tools can't do the job.These results are from Windows only. The full results and their limits are in the comment below.
switchToFrame()andswitchBack(), oropen()andclose(), before it can use the rest of VS Code's UI. Playwright's frame locators reach into VS Code's nested iframes directly, so there's nothing to enter or leave.StaleElementReferenceError, and an earlier UI test effort needed delays that varied between machines.package.jsonto keep our Node 20 CI jobs installing. It also tests only the latest 3 VS Code versions, and treats 1.90, our minimum, as best-effort. On Windows it has to install a packaged.vsix, because ChromeDriver lowercases--extensionDevelopmentPathand VS Code then ignores it. Playwright installs on Node 20, isn't tied to VS Code releases, and loads the extension directly from the repo.__dirnameerror. A workaround was suggested there, but it wasn't tried._electronAPI, and so does Confluent's VS Code extension.Downsides
e2e/pages/workbench.tsto limit that.Sources:
#1462 acceptance criteria
Bug fix: Daffodil CLI ran on the wrong Java
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 a client 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.md, including how a test run worksReview 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't affect a Data Editor you have 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, and not at all in a later set of 16. 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 Packagejobsbefore allhook timed out, then both 4.1.0 tests failed 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, then:Button,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