vscode/test/smoke
Robo 01df559c18
chore: update to electron 16 (#137241)
* chore: bump electron@15.3.0

* chore: bump node@16.x

* chore: enable render process reuse

* Revert "watcher - use `type` property for crash reporter location"

This reverts commit bfa488dd8f.

* Revert "watcher - enable crash reports on linux (#136264)"

This reverts commit af261488f8.

* chore: enable crashpad on linux

* chore: bump electron@15.3.1

* chore: update api changes

* chore: bump @vscode/sqlite3@5.0.3

* spec: skip non-context aware module unittests

* chore: fix perf hook integration with node environment

* fix: adopt fs api changes

* chore: fix integration tests

* chore: bump electron@15.3.2

* chore: bump electron@16.0.0

* temp(macOS): kill test instances in OSS

* Revert "temp(macOS): kill test instances in OSS"

This reverts commit b0d796c8d64227a5ec012c060bbbee7d9da27568.

* chore: update chromium version for clang downloader

* some 💄 changes

* align with changes

* adopt more fs.rm

* 💄

* chore: bump @vscode/sqlite3@5.0.4

* fix layers check to account for duplicated types from node.js

* update todo for type casts

* smoke - fix compile issue

* chore: update module cache

* watcher - fix unhandled rejection (fix #137416)

* ci: update node version

* enable stack dumping

* update electron types to 16.x

* chore: bump @vscode/sqlite3@5.0.5

Refs https://github.com/microsoft/vscode/issues/137496

* fix layer issue

* add `AbortSignal` to core types

* chore: update linux compile flags

Refs 797723ec83

* ci: fix linux build

* ci: update github ci cache

* ci: fix remote build in github ci

* ci: better fix for remote build

* chore: bump azure cache

* chore: fix merge conflict

* :chore: update to electron@16.0.2

* chore: bump @vscode/sqlite3@5.0.7

* ci: update to gcc-4.9 for remote

Refs https://github.com/microsoft/vscode/issues/137659

* ci: switch to buster for linux arm

Refs https://github.com/microsoft/vscode/issues/137927

* ci: fix build on linux arm64

* ci: fix arm client compiler toolchain

Refs #137927

* chore: bump electron@16.0.3

* ci: fix compile flags for the c toolchain

* chore: bump electron@16.0.4

* Add experimental dark mode flag (#139109)

* Add experimental dark mode flag

* Apply PR feedback

* chore: bump electron@16.0.6

* chore: bump electron@16.0.7

Fixes https://github.com/microsoft/vscode/issues/138792
Fixes https://github.com/microsoft/vscode/issues/139300

* chore: experimental highlight API

* smoke - fix compile issue

* FIXME: custom ELECTRON_RUN_AS_NODE with node worker

* Revert "chore: bump electron@16.0.7"

This reverts commit 5fd01cf37c.

* Revert "Revert "chore: bump electron@16.0.7""

This reverts commit a7f1b73951.

* chore: fix github linux workflow

* chore: address review feedback

* chore: bump electron@16.0.8

* ci: revert to stretch distro for linux arm

Refs https://github.com/microsoft/vscode/issues/137927

* ci: force build

* chore: update yarn.lock

* address feedback

* Revert "FIXME: custom ELECTRON_RUN_AS_NODE with node worker"

This reverts commit 7b48fa3732.

* ci: fix remote folder build

* chore: fix github linux ci

* 🆙 `versionSpec`

Co-authored-by: Benjamin Pasero <benjamin.pasero@microsoft.com>
Co-authored-by: Raymond Zhao <raymondzhao@microsoft.com>
2022-02-08 20:09:00 +01:00
..
src 💄 todos 2022-02-08 18:04:54 +01:00
test smoke - 🆙 timeouts 2022-01-19 19:45:03 +01:00
.gitignore smoke: fix vscode-test cache location 2021-07-16 15:23:48 +02:00
Audit.md Fix capitalization of GitHub org 2020-09-17 11:43:03 +02:00
package.json chore: update to electron 16 (#137241) 2022-02-08 20:09:00 +01:00
README.md Cleanup package.json test scripts (#141210) 2022-01-22 13:07:14 +01:00
tsconfig.json tsconfig 💄 2019-08-30 17:56:56 +02:00
yarn.lock chore: update to electron 16 (#137241) 2022-02-08 20:09:00 +01:00

VS Code Smoke Test

Make sure you are on Node v12.x.

Quick Overview

# Build extensions in the VS Code repo (if needed)
yarn && yarn compile

# Dev (Electron)
yarn smoketest

# Dev (Web - Must be run on distro)
yarn smoketest --web --browser [chromium|webkit]

# Build (Electron)
yarn smoketest --build <path to latest version>
example: yarn smoketest --build /Applications/Visual\ Studio\ Code\ -\ Insiders.app

# Build (Web - read instructions below)
yarn smoketest --build <path to server web build (ends in -web)> --web --browser [chromium|webkit]

# Remote (Electron - Must be run on distro)
yarn smoketest --build <path to latest version> --remote

* This step is necessary only when running without --build and OSS doesn't already exist in the .build/electron directory.

Running for a release (Endgame)

You must always run the smoketest version that matches the release you are testing. So, if you want to run the smoketest for a release build (e.g. release/1.22), you need to check out that version of the smoke tests too:

git fetch
git checkout release/1.22
yarn && yarn compile
yarn --cwd test/smoke

Web

There is no support for testing an old version to a new one yet. Instead, simply configure the --build command line argument to point to the absolute path of the extracted server web build folder (e.g. <rest of path here>/vscode-server-darwin-web for macOS). The server web build is available from the builds page (see previous subsection).

macOS: if you have downloaded the server with web bits, make sure to run the following command before unzipping it to avoid security issues on startup:

xattr -d com.apple.quarantine <path to server with web folder zip>

Note: make sure to point to the server that includes the client bits!

Debug

  • --verbose logs all the low level driver calls made to Code;
  • -f PATTERN (alias -g PATTERN) filters the tests to be run. You can also use pretty much any mocha argument;
  • --headless will run playwright in headless mode when --web is used.

Note: you can enable verbose logging of playwright library by setting a DEBUG environment variable before running the tests (https://playwright.dev/docs/debug#verbose-api-logs)

Develop

cd test/smoke
yarn watch

Troubleshooting

Error: Could not get a unique tmp filename, max tries reached

On Windows, check for the folder C:\Users\<username>\AppData\Local\Temp\t. If this folder exists, the tmp module can't run properly, resulting in the error above. In this case, delete the t folder.

Pitfalls

  • Beware of workbench state. The tests within a single suite will share the same state.

  • Beware of singletons. This evil can, and will, manifest itself under the form of FS paths, TCP ports, IPC handles. Whenever writing a test, or setting up more smoke test architecture, make sure it can run simultaneously with any other tests and even itself. All test suites should be able to run many times in parallel.

  • Beware of focus. Never depend on DOM elements having focus using .focused classes or :focus pseudo-classes, since they will lose that state as soon as another window appears on top of the running VS Code window. A safe approach which avoids this problem is to use the waitForActiveElement API. Many tests use this whenever they need to wait for a specific element to have focus.

  • Beware of timing. You need to read from or write to the DOM... but is it the right time to do that? Can you 100% guarantee that input box will be visible at that point in time? Or are you just hoping that it will be so? Hope is your worst enemy in UI tests. Example: just because you triggered Quick Access with F1, it doesn't mean that it's open and you can just start typing; you must first wait for the input element to be in the DOM as well as be the current active element.

  • Beware of waiting. Never wait longer than a couple of seconds for anything, unless it's justified. Think of it as a human using Code. Would a human take 10 minutes to run through the Search viewlet smoke test? Then, the computer should even be faster. Don't use setTimeout just because. Think about what you should wait for in the DOM to be ready and wait for that instead.