This directory contains integration tests for verifying editor launches across different platforms.
tests/
├── docker/
│ ├── Dockerfile # Ubuntu-based test environment with all Linux editors
│ └── run-tests.sh # Script to run tests in Docker
└── integration/
└── editor_launch_tests.rs # Integration tests for editor launching
Run all editor integration tests in a containerized environment:
# Build container
docker compose build
# Run shell-based tests (recommended - no compilation needed)
docker compose exec test-env bash -c "cd /workspace/sorcery && tests/docker/run-editor-tests.sh"
# Or run interactively
docker compose run --rm test-env bash
# Inside container:
cd /workspace/sorcery && tests/docker/run-editor-tests.shTo rebuild and test from scratch:
# Rebuild container (if dependencies changed)
docker compose down
docker compose build
# Start container
docker compose up -d
# Run tests
docker compose exec test-env bash -c "cd /workspace/sorcery && tests/docker/run-editor-tests.sh"
# Stop container
docker compose downFor debugging or manual testing:
docker-compose up -d
docker-compose exec test-env bash
# Inside container:
cd /workspace/sorcery/src-tauri
cargo test --test integration --features docker-tests -- --nocaptureRun tests directly on your Mac (tests will use locally installed editors):
cd src-tauri
cargo test --test integrationThe Docker container includes:
GUI Editors:
- Visual Studio Code (with
--no-sandboxflag for Docker) - VSCodium (with
--no-sandboxflag for Docker) - Sublime Text
- Gedit
- Kate
- IntelliJ IDEA Community Edition
- PyCharm Community Edition
Terminal Editors:
- Vim
- Neovim
- Emacs
- Nano
- Micro
Terminal Emulators:
- Kitty
- GNOME Terminal
- Xterm
Test Utilities:
- Xvfb (virtual display)
- wmctrl (window management)
- xdotool (X11 automation)
- lsof (file access verification)
- pgrep/pkill (process management)
- Process Spawning: Editor processes start successfully
- Line Number Support: Editors navigate to the specified line numbers
- Column Number Support: Editors that support column positioning (VSCode, VSCodium, Sublime Text, Gedit, Kate, Micro) can navigate to specific columns
- Graceful Degradation: Editors that don't support columns still open to the correct line
--test-threads=1: Tests run sequentially to avoid window/process conflicts--nocapture: Show test output for debugging--features docker-tests: Enable Docker-specific test configurations
- Ensure the editor is installed in the Dockerfile
- Add a test function in
editor_launch_tests.rs:
#[test]
fn test_my_editor_launches() {
let (_temp_dir, test_file) = setup();
let result = Command::new("my-editor")
.arg(&test_file)
.spawn();
assert!(result.is_ok());
assert!(wait_for_process("my-editor", 10));
cleanup("my-editor");
}Docker build fails:
- Check your internet connection (downloads editors)
- Try
docker system pruneto free up space - Ensure you're using Ubuntu 24.04 (required for webkit2gtk-6.0)
Tests timeout:
- Increase timeout values in test code
- Check Docker container resources (CPU/memory)
Process not detected:
- Verify process name with
pgrep -a <name>in container - Some editors fork/daemonize, use parent process name
VSCode/VSCodium won't start:
- Ensure
--no-sandboxand--user-data-dirflags are included (required for root in Docker) - Error: "trying to start as super user" means these flags are missing
Xvfb issues:
- Ensure Xvfb is running (
ps aux | grep Xvfb) - Check
DISPLAYenvironment variable is set to:99
Tests can run in GitHub Actions or other CI systems with Docker support:
- name: Run editor integration tests
run: ./tests/docker/run-tests.sh