Runs one Playwright spec, found by its file name or a part of it, on the browsers chosen, optionally only the tests whose title matches. Also ./build.sh --playwright-spec <spec> [chromium|firefox|webkit|all] [filter]. A WeKan already answering on :3000 is used as it is. Otherwise a fresh bundle is built and the test server started the way the whole-suite runs start it (Meteor's mongod on :3001, the bundle on :3000), and both are stopped afterwards, so a single spec does not pass or fail on a stale bundle. In build.sh each browser runs natively when it can launch and in the Playwright container when it cannot; Chromium in the VSCodium Flatpak on arm64 runs natively without Docker. Logs go to .tools/log/test-playwright-spec/<datetime>/. Thanks to xet7 !
Secure Sandbox: VSCodium at Debian 13 amd64
Related files at this repo .vscode at this commit.
1) Install Debian
Install Debian with username wekan, so that WeKan repo here, only directory where VSCodium will have access:
/home/wekan/repos/wekan
2) Install Flatpak and VSCodium
sudo apt install flatpak
sudo apt install gnome-software-plugin-flatpak
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
sudo reboot
flatpak install flathub com.vscodium.codium
3) Edit VSCodium desktop icon
nano ~/.local/share/applications/wekan-vscodium.desktop
Content:
[Desktop Entry]
Name=WeKan - VS Codium
Comment=Open the WeKan project with Flatpak
Exec=flatpak run com.vscodium.codium /home/wekan/repos/wekan
Icon=com.vscodium.codium
Terminal=false
Type=Application
Categories=Development;IDE;
StartupWMClass=code
4) Force VS Codium to use the internal (isolated) browser
This setting is also added as git commit to VSCodium settings.
This is the most important step. If this is "native", it will use the operating system window that sees everything.
- Open VS Codium.
- Press
Ctrl + ,(options). - Type in search: Dialogs: Custom
- Change the
Files: Simple Dialogsetting to on (check the box). - Restart VS Codium.
5) Set the strictest sandbox possible (in Terminal)
Run these two commands (the first clears everything, the second sets limits):
# Reset previous attempts
sudo flatpak override --reset com.vscodium.codium
# Block EVERYTHING except the display and the wekan folder
sudo flatpak override com.vscodium.codium \
--nofilesystem=home \
--nofilesystem=host \
--nofilesystem=xdg-run/gvfs \
--nofilesystem=xdg-run/gvfsd \
--filesystem=~/repos/wekan:rw \
--device=all \
--socket=wayland \
--socket=x11 \
--share=network
If you have already set wrong Chrome sandbox env earlier, remove it:
sudo flatpak override --unset-env=CHROME_DEVEL_SANDBOX com.vscodium.codium
Why: inside this Flatpak, /usr/sbin/chrome-devel-sandbox does not exist, and Chromium aborts immediately if that env points there.
6) Test "File -> Open Folder"
Now when you go to File -> Open Folder:
- You will no longer see the fancy system file window, but VS Codium's own, simple list.
- If you try to go to the parent folder or somewhere else, the list is empty or it only shows
~/repos/wekan.
7) Where existing binaries are (verified)
These were found already present in this sandboxed setup:
- Node.js:
/home/wekan/repos/wekan/.tools/node-v26.9.0-linux-x64/bin/node - npm:
/home/wekan/repos/wekan/.tools/node-v26.9.0-linux-x64/bin/npm - npx:
/home/wekan/repos/wekan/.tools/node-v26.9.0-linux-x64/bin/npx - Meteor CLI symlink:
/home/wekan/.meteor/meteor - Playwright Chromium binary:
/home/wekan/.var/app/com.vscodium.codium/cache/ms-playwright/chromium-1223/chrome-linux64/chrome - Flatpak-provided chrome-sandbox binary (not SUID in this runtime):
/app/extra/vscode/chrome-sandbox
8) Reuse same in-sandbox toolchain (tested)
Open VS Codium integrated terminal and run:
cd /home/wekan/repos/wekan
# 1) Use repo-local Node/npm/npx
export PATH="$PWD/.tools/node-v26.9.0-linux-x64/bin:$PATH"
# 2) Use Meteor CLI installed at ~/.meteor (if present)
export PATH="/home/wekan/.meteor:$PATH"
# 3) IMPORTANT: avoid bad host path inherited from old overrides
unset CHROME_DEVEL_SANDBOX
# 4) Keep Playwright browsers in Flatpak-private cache
export PLAYWRIGHT_BROWSERS_PATH="/home/wekan/.var/app/com.vscodium.codium/cache/ms-playwright"
Quick checks:
node -v
npm -v
npx playwright --version
meteor --version
If meteor is missing first time, bootstrap it from local Node:
cd /home/wekan/repos/wekan
export PATH="$PWD/.tools/node-v26.9.0-linux-x64/bin:$PATH"
npx -y meteor
export PATH="/home/wekan/.meteor:$PATH"
If you keep --nofilesystem=home, allow Meteor directory explicitly:
sudo flatpak override com.vscodium.codium --filesystem=~/.meteor:rw
9) Run tests fully inside sandbox (headless)
Install Playwright deps and run Chromium-only tests:
cd /home/wekan/repos/wekan/tests/playwright
export PATH="/home/wekan/repos/wekan/.tools/node-v26.9.0-linux-x64/bin:$PATH"
unset CHROME_DEVEL_SANDBOX
export PLAYWRIGHT_BROWSERS_PATH="/home/wekan/.var/app/com.vscodium.codium/cache/ms-playwright"
npm install
npx playwright test --project=chromium
This runs headless browser tests inside Flatpak sandboxed VS Codium terminal (no external/native browser window needed).
Run Firefox/WebKit too
By default this repo runs only the chromium Playwright project.
To enable firefox and webkit projects, set:
export WEKAN_PLAYWRIGHT_ALL=1
Then run for example:
cd /home/wekan/repos/wekan/tests/playwright
export HOME="/home/wekan/repos/wekan/.tools"
unset CHROME_DEVEL_SANDBOX
export PLAYWRIGHT_BROWSERS_PATH="/home/wekan/.var/app/com.vscodium.codium/cache/ms-playwright"
export WEKAN_PLAYWRIGHT_ALL=1
/home/wekan/repos/wekan/.tools/.meteor/meteor npm exec playwright test -- --project=firefox
/home/wekan/repos/wekan/.tools/.meteor/meteor npm exec playwright test -- --project=webkit
Without WEKAN_PLAYWRIGHT_ALL=1, Playwright config exposes only chromium, and --project=firefox/--project=webkit will fail with "Project not found".
If playwright install-deps fails because of unrelated apt repo keys
On some hosts, this command can fail even when browser deps are already installed:
sudo npx playwright install-deps
Example failure:
NO_PUBKEY ...The repository ... is not signed
This is usually caused by a third-party apt source (PPA/repo), not by Playwright itself.
Use either of these approaches:
- Install required packages directly (recommended fallback):
sudo apt install -y \
libgtk-4-1 \
libxml2 \
libevent-2.1-7t64 \
libflite1 \
libjpeg-turbo8 \
libmanette-0.2-0 \
libenchant-2-2 \
libwoff1
- Or temporarily disable the broken third-party apt source, run
install-deps, then re-enable it.
In this sandbox workflow, manual apt package install is enough and avoids failures caused by unrelated repositories.
Verified WebKit status in this setup
After applying the sandbox env settings from this document and running with:
cd /home/wekan/repos/wekan/tests/playwright
export HOME="/home/wekan/repos/wekan/.tools"
unset CHROME_DEVEL_SANDBOX
export PLAYWRIGHT_BROWSERS_PATH="/home/wekan/.var/app/com.vscodium.codium/cache/ms-playwright"
export WEKAN_PLAYWRIGHT_ALL=1
/home/wekan/repos/wekan/.tools/.meteor/meteor npm exec playwright test -- --project=webkit
validated result:
105 passed(WebKit project)
10) Optional smoke test for headless Chromium in sandbox
cd /home/wekan/repos/wekan/tests/playwright
export PATH="/home/wekan/repos/wekan/.tools/node-v26.9.0-linux-x64/bin:$PATH"
unset CHROME_DEVEL_SANDBOX
node -e "(async()=>{const {chromium}=require('playwright');const b=await chromium.launch({headless:true,args:['--no-sandbox']});const p=await b.newPage();await p.goto('about:blank');console.log('PW_OK');await b.close();})().catch(e=>{console.error(e);process.exit(1);});"
If output is PW_OK, headless Chromium launch is working inside sandbox.
11) Additional findings from real test runs (important)
These were verified while running the full Playwright suite in this exact sandbox setup.
A) Wekan app startup for tests requires WRITABLE_PATH
If WRITABLE_PATH is missing, app startup can fail with:
WRITABLE_PATH environment variable missing and/or unset
Use a local writable test directory before starting app:
cd /home/wekan/repos/wekan
export WRITABLE_PATH="$PWD/.test-writable"
mkdir -p "$WRITABLE_PATH/files/attachments" "$WRITABLE_PATH/files/avatars"
Then run app:
/home/wekan/.meteor/meteor --port 3000
B) Playwright seed helpers require mongosh
Playwright fixtures seed test data via tests/playwright/helpers/db.js, which calls mongosh.
If missing, tests fail early with:
Error: spawnSync mongosh ENOENT
Install mongosh as a dependency in Playwright test project:
cd /home/wekan/repos/wekan
/home/wekan/.meteor/meteor npm --prefix tests/playwright install mongosh
The helper now also searches tests/playwright/node_modules/.bin so this works in sandbox without system-wide mongosh.
C) If repo-local .tools/node... does not exist
In some sandboxes the .tools Node path is missing. You can still run commands via Meteor wrapper:
/home/wekan/.meteor/meteor npm -v
/home/wekan/.meteor/meteor npm exec playwright --version
D) Proven working execution order
Terminal 1 (start app):
cd /home/wekan/repos/wekan
export WRITABLE_PATH="$PWD/.test-writable"
mkdir -p "$WRITABLE_PATH/files/attachments" "$WRITABLE_PATH/files/avatars"
unset CHROME_DEVEL_SANDBOX
/home/wekan/.meteor/meteor --port 3000
Terminal 2 (run tests):
cd /home/wekan/repos/wekan/tests/playwright
unset CHROME_DEVEL_SANDBOX
export PLAYWRIGHT_BROWSERS_PATH="/home/wekan/.var/app/com.vscodium.codium/cache/ms-playwright"
/home/wekan/.meteor/meteor npm exec playwright test -- --project=chromium
Expected result from this validated setup:
105 passed(Chromium project)
12) About meteor test in this sandbox
meteor test --driver-package meteortesting:mocha can start successfully but still report 0 passing in this environment due to test discovery/driver behavior.
For reliable headless validation inside this sandbox, prefer Playwright run described above.
If you get EROFS errors writing to ~/.meteor/packages (read-only home mount), run Meteor from the repo-local copy and point HOME to .tools:
cd /home/wekan/repos/wekan
export HOME="$PWD/.tools"
unset METEOR_WAREHOUSE_DIR
export WRITABLE_PATH="$PWD/.test-writable"
mkdir -p "$WRITABLE_PATH/files/attachments" "$WRITABLE_PATH/files/avatars"
unset CHROME_DEVEL_SANDBOX
"$PWD/.tools/.meteor/meteor" test --once --driver-package meteortesting:mocha --full-app --test server/lib/tests/attachmentApi.authContext.tests.js
13) Quick copy-paste: prepare + run Chromium tests
Just one spec? build.sh does all of the below for you, server included:
./build.sh --playwright-spec feature-profiles # Chromium
./build.sh --playwright-spec rest-card-list-fields all # all three browsers
./build.sh --playwright-spec feature-profiles chromium "team" # titles containing "team"
The same is Tests -> Playwright single spec in the build.sh and
build.bat menus. The spec is a file under tests/playwright/specs or a part of
its name. A WeKan already answering on :3000 is used as it is; otherwise a
fresh bundle is built and the test server started exactly as the whole-suite
runs do (mongod on :3001, the bundle on :3000), and both are stopped when
the spec is done. In this sandbox Chromium runs natively; Firefox and WebKit
need the Playwright container, so they are skipped when Docker is unavailable.
Logs: .tools/log/test-playwright-spec/<datetime>/.
Use this when you want one command block that prepares required paths/dependencies and runs Playwright Chromium tests.
Note: this assumes Wekan app is already running at http://localhost:3000 in another terminal.
cd /home/wekan/repos/wekan
# Ensure test writable directories exist
export WRITABLE_PATH="$PWD/.test-writable"
mkdir -p "$WRITABLE_PATH/files/attachments" "$WRITABLE_PATH/files/avatars"
# Sandbox-safe browser env
unset CHROME_DEVEL_SANDBOX
export PLAYWRIGHT_BROWSERS_PATH="/home/wekan/.var/app/com.vscodium.codium/cache/ms-playwright"
# Ensure Playwright-side mongosh exists for DB seeding
/home/wekan/.meteor/meteor npm --prefix tests/playwright install mongosh
# Run Chromium tests
cd tests/playwright
/home/wekan/.meteor/meteor npm exec playwright test -- --project=chromium
If you also need to start app in a separate terminal:
cd /home/wekan/repos/wekan
export WRITABLE_PATH="$PWD/.test-writable"
mkdir -p "$WRITABLE_PATH/files/attachments" "$WRITABLE_PATH/files/avatars"
unset CHROME_DEVEL_SANDBOX
/home/wekan/.meteor/meteor --port 3000
14) Minimal copy-paste only (no explanations)
Terminal 1:
cd /home/wekan/repos/wekan
export WRITABLE_PATH="$PWD/.test-writable"
mkdir -p "$WRITABLE_PATH/files/attachments" "$WRITABLE_PATH/files/avatars"
unset CHROME_DEVEL_SANDBOX
/home/wekan/.meteor/meteor --port 3000
Terminal 2:
cd /home/wekan/repos/wekan
unset CHROME_DEVEL_SANDBOX
export PLAYWRIGHT_BROWSERS_PATH="/home/wekan/.var/app/com.vscodium.codium/cache/ms-playwright"
/home/wekan/.meteor/meteor npm --prefix tests/playwright install mongosh
/home/wekan/.meteor/meteor npm --prefix tests/playwright exec playwright test -- --project=chromium
15) From-scratch toolchain in .tools/ — VERSION-MATCHED build + test (verified)
When a sandbox has NO pre-installed .tools/ Node and no ~/.meteor (a bare box, any
Linux arch), install everything into the repo-local .tools/ directory yourself. Both
.tools/ and .build* are in .gitignore, so nothing here is ever committed.
IMPORTANT — use the SAME versions WeKan/FerretDB use, not whatever is newest:
- Node.js: the exact
NODE_VERSIONfromDockerfile(currentlyv26.9.0). - npm: the
NPM_VERSIONfromDockerfile(currently12.0.2; the npm bundled with the pinned Node is acceptable if pinning fails). - Meteor: the release in
.meteor/release(currentlyMETEOR@3.6.1). - Go (for FerretDB ONLY): the NEWEST Go release (
https://go.dev/VERSION?m=text) — this is intentionally newer thanFerretDB/build.sh's pinnedGO_VERSION.
Detect the arch (uname -m → x86_64=x64/amd64, aarch64=arm64) and pick the
matching tarballs.
cd /home/wekan/repos/wekan # your repo path
mkdir -p .tools && cd .tools
A=arm64 # or x64 for Node / amd64 for Go on x86_64
# Node — EXACT Dockerfile NODE_VERSION:
curl -fsSL -o node.tar.xz "https://nodejs.org/dist/v26.9.0/node-v26.9.0-linux-$A.tar.xz"
tar xf node.tar.xz && rm node.tar.xz
# Go — NEWEST release, for building FerretDB:
curl -fsSL -o go.tar.gz "https://go.dev/dl/$(curl -fsSL https://go.dev/VERSION?m=text|head -1).linux-$A.tar.gz"
tar xf go.tar.gz && rm go.tar.gz
cd ..
export PATH="$PWD/.tools/node-v26.9.0-linux-$A/bin:$PWD/.tools/go/bin:$PATH"
node -v && go version
npm install -g npm@12.0.2
# Meteor — the release from .meteor/release, installed under HOME=.tools so it never
# touches a read-only ~/.meteor:
HOME="$PWD/.tools" sh -c 'curl -fsSL "https://install.meteor.com/?release=3.6-beta.1" | sh'
export PATH="$PWD/.tools/.meteor:$PATH"
Build FerretDB + run its full unit test suite (verified: all pass)
cd /home/wekan/repos/wekan/FerretDB
export GOROOT="$PWD/../.tools/go" GOPATH="$PWD/../.tools/gopath" \
GOCACHE="$PWD/../.tools/gocache" GOMODCACHE="$PWD/../.tools/gomodcache" \
GOFLAGS=-mod=mod PATH="$PWD/../.tools/go/bin:$PATH"
( cd build/version && go run generate.go ) # stamps the version (or --version panics)
go build -o bin/ferretdb ./cmd/ferretdb # -> FerretDB/bin/ferretdb
go test -short -tags=ferretdb_debug ./internal/... ./cmd/... # all packages: ok
Build the WeKan bundle to .build/bundle (verified)
cd /home/wekan/repos/wekan
export HOME="$PWD/.tools" PATH="$PWD/.tools/node-v26.9.0-linux-arm64/bin:$PWD/.tools/.meteor:$PATH"
export TOOL_NODE_FLAGS="--max-old-space-size=8192" NODE_OPTIONS="--max-old-space-size=8192"
meteor npm install
meteor build .build --directory # -> .build/bundle/main.js
npm install --prefix .build/bundle/programs/server # server deps, needed to RUN the bundle
Run the WeKan unit tests (verified)
cd /home/wekan/repos/wekan
export PATH="$PWD/.tools/node-v26.9.0-linux-arm64/bin:$PATH"
npm run test:unit:node # plain-node .cjs unit + negative tests (no DB/browser)
npm run test:unit:node -- board # only the suites whose path contains "board"
node tests/run-node-suites.cjs --list # what would run
tests/run-node-suites.cjs is what that script is: it DISCOVERS every
tests/*.test.cjs|js and tests/unit/*, runs each in its own node process, and
runs all of them even when one fails — the failures are listed together at the
end. (It used to be an && chain, where the first failing suite stopped the run
and the rest silently never happened.) --bail restores the stop-at-first
behaviour when that is what you want.
For the Playwright UI tests, follow sections 9–14 above (they need a running WeKan app +
mongosh for DB seeding).
Run the built bundle against FerretDB (what the Docker image does)
cd /home/wekan/repos/wekan; T="$PWD/.tools"; D="$PWD/.test-writable"
mkdir -p "$D/db" "$D/files/attachments" "$D/files/avatars"
# 1) FerretDB first (SQLite, replica-set so the OpLog exists):
DO_NOT_TRACK=1 ./FerretDB/bin/ferretdb --handler=sqlite --sqlite-url="file:$D/db/" \
--listen-addr=127.0.0.1:27017 --repl-set-name=rs0 --state-dir="$D" \
--telemetry=disable --log-level=error &
# 2) THEN WeKan (starting it before FerretDB is ready crashes on the users index —
# "Topology is closed" — see #6500):
PATH="$T/node-v26.9.0-linux-arm64/bin:$PATH" MONGO_URL="mongodb://127.0.0.1:27017/wekan" \
METEOR_REACTIVITY_ORDER="oplog,polling" \
MONGO_OPLOG_URL="mongodb://127.0.0.1:27017/local?replicaSet=rs0" \
PORT=8080 ROOT_URL="http://localhost:8080" WRITABLE_PATH="$D" \
node .build/bundle/main.js
# -> http://localhost:8080 serves once startup finishes (~10-30s).
Docker: the host's, through flatpak-spawn --host
docker / docker-compose / podman are not installed inside the VSCodium Flatpak
sandbox. vscodium-sandbox.sh grants --talk-name=org.freedesktop.Flatpak, so the
HOST's Docker can be reached as flatpak-spawn --host docker .... build.sh's
docker_available and docker_exec use exactly that when docker is not in PATH,
which is how Playwright Firefox and WebKit run in the official Playwright image when
they cannot start inside the sandbox (Firefox needs user namespaces the sandbox
refuses; WebKit needs libgtk-4):
flatpak-spawn --host docker version # check: the host's Docker answers
WEKAN_PLAYWRIGHT_DOCKER=1 ./build.sh # all browsers in the Playwright image
Docker must be installed on the host, and the host user must be in the docker
group (sudo usermod -aG docker $USER, then log in again).
This is a hole in the sandbox, on purpose. flatpak-spawn --host runs ANY
command on the host, outside every restriction above, and the Docker socket is
root-equivalent on the host. An AI assistant's own permission settings should
therefore allow only flatpak-spawn --host docker ..., never flatpak-spawn --host in general. To keep the sandbox closed, launch it with
WEKAN_SANDBOX_HOST_DOCKER=0 ./vscodium-sandbox.sh; then flatpak-spawn --host
fails, and the browsers that need Docker have to be run on the host.
Without Docker, reproduce a docker-compose.yml-style setup by running FerretDB and
the bundle manually as shown above (the compose ferretdb service just downloads and
runs the same ferretdb-<arch> binary; the wekan service just runs the same
bundle). The Docker-only startup race in #6500 (WeKan starting before FerretDB is
ready) is fixed in docker-compose.yml with a ferretdb healthcheck + depends_on: condition: service_healthy; when running manually, always start FerretDB first.
macOS Firefox: missing profile despite a writable temporary directory
On macOS 27, Playwright Firefox can exit with Could not find profile folder
because it also opens Firefox's shared application-data directory, which macOS
may protect independently of the temporary profile passed with -profile.
See Playwright issue 42768
and Mozilla's nsXREDirProvider::GetUserDataDirectory implementation.
The shared tests/playwright/helpers/browser-launch.cjs now supplies
MOZ_APP_DATA and MOZ_LOCAL_APP_DATA for native macOS Firefox. Each invocation
gets separate directories beneath .tools/tmp, removed at process exit. Explicit
values for either variable remain respected. Other browsers and platforms keep
their existing launch options. This leaves the user's Firefox data and HOME
unchanged and does not disable browser sandboxes or require Full Disk Access.
Both build.sh's native-browser probe and the Playwright configuration use this
helper, so probing and the actual tests agree. To verify the launch independently:
export TMPDIR="$PWD/.tools/tmp"
export PLAYWRIGHT_BROWSERS_PATH="$PWD/.tools/ms-playwright"
node tests/playwright/helpers/browser-launch.cjs firefox
The ordinary build-menu Firefox option and direct Playwright runs use the fix automatically; no special launch flags are needed.