Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

feat(testing): add e2e test for windows and linux (#1766)

Divanshu Grover317982ce86fc
diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile
index 70764387a..ad8dd9b0e 100644
--- a/.devcontainer/Dockerfile
+++ b/.devcontainer/Dockerfile
@@ -12,6 +12,7 @@ RUN sudo apt-get update && sudo apt-get install -y \
g++ \
ffmpeg \
tesseract-ocr \
+ clang \
cmake \
libavformat-dev \
libavfilter-dev \
@@ -28,10 +29,14 @@ RUN sudo apt-get update && sudo apt-get install -y \
libxinerama-dev \
libxcursor-dev \
libxi-dev \
+ libsoup-3.0-0 \
libgl1-mesa-dev \
libasound2-dev \
libpulse-dev \
curl \
+ desktop-file-utils \
+ dbus-x11 \
+ xdg-utils \
pkg-config \
libsqlite3-dev \
sqlite3 \
@@ -45,6 +50,7 @@ RUN sudo apt-get update && sudo apt-get install -y \
libwebkit2gtk-4.1-dev \
librsvg2-dev \
patchelf \
+ webkit2gtk-driver \
xvfb \
x11-utils \
x11-xserver-utils \
@@ -64,4 +70,7 @@ RUN sudo apt-get update && sudo apt-get install -y \
# Install Bun
RUN curl -fsSL https://bun.sh/install | bash
+# Install Tauri Driver
+RUN cargo install tauri-driver
+
EXPOSE 3000 3030
diff --git a/.github/scripts/setup_display.sh b/.github/scripts/setup_display.sh
index 59fad9ceb..2761c2bf8 100755
--- a/.github/scripts/setup_display.sh
+++ b/.github/scripts/setup_display.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-Xvfb :99 -ac -screen 0 1280x1024x24 &
+Xvfb :99 -ac -screen 0 1920x1080x24 &
echo "DISPLAY=:99" >> $GITHUB_ENV
sleep 3
export DISPLAY=:99
diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml
new file mode 100644
index 000000000..1815ac6c0
--- /dev/null
+++ b/.github/workflows/e2e-test.yml
@@ -0,0 +1,383 @@
+name: E2E Tests
+
+on:
+ push:
+ branches: [ main ]
+ pull_request:
+ branches: [ main ]
+
+jobs:
+ windows-e2e-test:
+ name: Windows E2E Tests
+ runs-on: windows-latest
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Setup Bun
+ uses: oven-sh/setup-bun@v2
+ with:
+ bun-version: 1.1.43
+
+ - name: Setup Node
+ uses: actions/setup-node@v4
+ with:
+ node-version: 22
+
+ - name: Install Chocolatey
+ run: |
+ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
+ Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
+
+ - name: Install dependencies
+ shell: pwsh
+ run: |
+ choco install ffmpeg openssl
+ echo "C:\ProgramData\chocolatey\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
+
+ - name: Install Scream on Windows
+ shell: powershell
+ run: |
+ Invoke-WebRequest https://github.com/duncanthrax/scream/releases/download/4.0/Scream4.0.zip -OutFile Scream4.0.zip
+ Expand-Archive -Path Scream4.0.zip -DestinationPath Scream
+ openssl req -batch -verbose -x509 -newkey rsa -keyout ScreamCertificate.pvk -out ScreamCertificate.cer -nodes -extensions v3_req
+ openssl pkcs12 -export -nodes -in ScreamCertificate.cer -inkey ScreamCertificate.pvk -out ScreamCertificate.pfx -passout pass:
+
+ - name: Set up MSVC
+ uses: ilammy/msvc-dev-cmd@v1
+
+ - name: Sign and Install Scream Driver on Windows
+ shell: powershell
+ run: |
+ signtool sign /v /fd SHA256 /f ScreamCertificate.pfx Scream\Install\driver\x64\Scream.cat
+ Import-Certificate -FilePath ScreamCertificate.cer -CertStoreLocation Cert:\LocalMachine\root
+ Import-Certificate -FilePath ScreamCertificate.cer -CertStoreLocation Cert:\LocalMachine\TrustedPublisher
+ Scream\Install\helpers\devcon-x64.exe install Scream\Install\driver\x64\Scream.inf *Scream
+ timeout-minutes: 5
+
+ - name: Start Windows Audio Service
+ shell: powershell
+ run: net start audiosrv
+
+ - name: Install Rust
+ run: |
+ Invoke-WebRequest https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-gnu/rustup-init.exe -OutFile rustup-init.exe
+ .\rustup-init.exe -y
+
+ - name: Set up Rust
+ uses: actions-rust-lang/setup-rust-toolchain@v1
+ with:
+ toolchain: stable
+ override: true
+ cache: true
+ target: x86_64-pc-windows-msvc
+ rustflags: ""
+
+ - name: Install vcpkg
+ uses: lukka/run-vcpkg@v11
+ with:
+ vcpkgGitCommitId: "7adc2e4d49e8d0efc07a369079faa6bc3dbb90f3"
+
+ - name: Install 7zip
+ shell: powershell
+ run: |
+ $7zipUrl = "https://7-zip.org/a/7z2301-x64.exe"
+ $7zipInstaller = "7z-installer.exe"
+ Invoke-WebRequest -Uri $7zipUrl -OutFile $7zipInstaller
+ Start-Process -FilePath .\$7zipInstaller -Args "/S" -Wait
+ Remove-Item $7zipInstaller
+ echo "C:\Program Files\7-Zip" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
+ & "C:\Program Files\7-Zip\7z.exe" i
+
+ - name: Install LLVM and Clang
+ uses: KyleMayes/install-llvm-action@v2
+ with:
+ version: "10.0"
+ directory: "C:\\Program Files\\LLVM"
+
+ - name: Install pip
+ uses: actions/setup-python@v5
+ with:
+ python-version: "3.13"
+
+ - name: Copy library for MKL
+ shell: pwsh
+ run: |
+ $mkl_dir = "screenpipe-app-tauri/src-tauri/mkl"
+ New-Item -ItemType Directory -Force -Path $mkl_dir | Out-Null
+ python -m pip install --upgrade pip
+ $temp_dir = "temp_omp"
+ New-Item -ItemType Directory -Force -Path $temp_dir | Out-Null
+ Write-Host "Installing Intel OpenMP..."
+ python -m pip install intel-openmp --target $temp_dir
+ Write-Host "Copying DLL files..."
+ Get-ChildItem -Path $temp_dir -Recurse -Filter "*.dll" | ForEach-Object {
+ Write-Host "Copying $_"
+ Copy-Item $_.FullName -Destination $mkl_dir -Force
+ }
+ $dll_count = (Get-ChildItem -Path $mkl_dir -Filter "*.dll").Count
+ Write-Host "Found $dll_count DLLs in target directory"
+ if ($dll_count -eq 0) {
+ throw "No DLLs found in target directory!"
+ }
+ Remove-Item -Path $temp_dir -Recurse -Force
+
+ - name: Copy library for vcredist
+ shell: powershell
+ run: |
+ $vcredist_dir = "screenpipe-app-tauri/src-tauri/vcredist"
+ New-Item -ItemType Directory -Force -Path $vcredist_dir | Out-Null
+ Set-ExecutionPolicy Bypass -Scope Process -Force
+ [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
+ iex ((New-Object System.Net.WebClient).DownloadString('https://vcredist.com/install.ps1'))
+ Write-Host "Copying DLL files..."
+ Copy-Item C:\Windows\System32\vcruntime140.dll -Destination $vcredist_dir -Force
+ $dll_count = (Get-ChildItem -Path $vcredist_dir -Filter "*.dll").Count
+ Write-Host "Found $dll_count DLLs in target directory"
+ if ($dll_count -eq 0) {
+ throw "No DLLs found in target directory!"
+ }
+
+ - name: Build CLI on Windows
+ shell: pwsh
+ env:
+ CARGO_PROFILE_RELEASE_STRIP: symbols
+ CARGO_PROFILE_RELEASE_PANIC: abort
+ CARGO_PROFILE_RELEASE_INCREMENTAL: false
+ run: cargo build --release -p screenpipe-server --target x86_64-pc-windows-msvc
+
+ - name: Install frontend dependencies
+ working-directory: ./screenpipe-app-tauri
+ run: bun install
+
+ - name: Run pre_build.js
+ run: |
+ bun ./scripts/pre_build.js
+ working-directory: ./screenpipe-app-tauri
+
+ - name: Build
+ uses: tauri-apps/[email protected]
+ env:
+ CI: true
+ CARGO_PROFILE_RELEASE_LTO: thin
+ CARGO_PROFILE_RELEASE_OPT_LEVEL: 2
+ CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 16
+ CARGO_INCREMENTAL: true
+ CARGO_PROFILE_RELEASE_STRIP: symbols
+ CARGO_PROFILE_RELEASE_PANIC: abort
+ CARGO_PROFILE_RELEASE_INCREMENTAL: false
+ RUSTFLAGS: "-C target-feature=+crt-static -C link-arg=/LTCG"
+ VCPKG_STATIC_LINKAGE: "true"
+ KNF_STATIC_CRT: "1"
+ with:
+ args: "--target x86_64-pc-windows-msvc --no-bundle"
+ projectPath: "./screenpipe-app-tauri"
+ tauriScript: bunx tauri -v
+
+ - name: Install tauri-driver
+ shell: pwsh
+ run: |
+ if (-not (Test-Path "$env:USERPROFILE\.cargo\bin\tauri-driver.exe")) {
+ cargo install tauri-driver
+ }
+
+ - name: Remove previous Edge WebDriver
+ shell: pwsh
+ run: |
+ $folderPath = "$($env:SystemDrive)\SeleniumWebDrivers\EdgeDriver"
+
+ if (Test-Path $folderPath) {
+ Remove-Item -Path $folderPath -Recurse -Force
+ }
+
+ - name: Download matching Edge WebDriver
+ shell: pwsh
+ run: |
+ cd ./screenpipe-app-tauri
+ $edgeVersion = (bun tauri info | Select-String 'WebView2').ToString().Split(':')[1].Trim()
+ Write-Output "Detected Edge version: $edgeVersion"
+ cd ..
+ $driverUrl = "https://msedgedriver.azureedge.net/$edgeVersion/edgedriver_win64.zip"
+ Write-Output "Downloading driver from: $driverUrl"
+
+ Invoke-WebRequest -Uri $driverUrl -OutFile edgedriver.zip
+ Expand-Archive edgedriver.zip -DestinationPath edgedriver
+ $edgedriverPath = Join-Path $PWD 'edgedriver'
+ echo $edgedriverPath | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
+
+ - name: Run E2E Tests
+ shell: pwsh
+ working-directory: ./screenpipe-app-tauri
+ run: |
+ bun run test:e2e *> e2e_output.log
+
+ - name: Upload E2E Test Artifacts
+ uses: actions/upload-artifact@v4
+ if: always()
+ with:
+ name: windows-e2e-test-artifacts
+ path: |
+ ./screenpipe-app-tauri/e2e/videos/*
+ ./screenpipe-app-tauri/e2e_output.log
+
+ - name: Upload Screenpipe data
+ uses: actions/upload-artifact@v4
+ if: always()
+ with:
+ name: windows-screenpipe-data
+ include-hidden-files: true
+ path: |
+ ~/.screenpipe/*
+ linux-e2e-test:
+ name: Linux E2E Tests
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Setup Bun
+ uses: oven-sh/setup-bun@v2
+ with:
+ bun-version: 1.1.43
+
+ - name: Setup Node
+ uses: actions/setup-node@v4
+ with:
+ node-version: 22
+ - name: Install Linux dependencies
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y \
+ g++ \
+ ffmpeg \
+ tesseract-ocr \
+ cmake \
+ clang \
+ libavformat-dev \
+ libavfilter-dev \
+ libavdevice-dev \
+ libssl-dev \
+ libsoup-3.0-0 \
+ libtesseract-dev \
+ libxdo-dev \
+ libsdl2-dev \
+ libclang-dev \
+ libxtst-dev \
+ libx11-dev \
+ libxext-dev \
+ libxrandr-dev \
+ libxinerama-dev \
+ libxcursor-dev \
+ libxi-dev \
+ libgl1-mesa-dev \
+ libasound2-dev \
+ libpulse-dev \
+ curl \
+ desktop-file-utils \
+ xdg-utils \
+ dbus-x11 \
+ xvfb \
+ x11-xserver-utils \
+ pkg-config \
+ libsqlite3-dev \
+ libbz2-dev \
+ zlib1g-dev \
+ libonig-dev \
+ libayatana-appindicator3-dev \
+ libsamplerate-dev \
+ libwebrtc-audio-processing-dev \
+ libgtk-3-dev \
+ libwebkit2gtk-4.1-dev \
+ webkit2gtk-driver \
+ librsvg2-dev \
+ patchelf \
+ x11-utils \
+ x11-apps \
+ xdotool \
+ openbox \
+ xterm \
+ fonts-liberation \
+ imagemagick \
+ fonts-dejavu \
+ alsa-utils \
+ pulseaudio \
+ pulseaudio-utils
+
+ - name: Set up Rust
+ uses: actions-rust-lang/setup-rust-toolchain@v1
+ with:
+ toolchain: stable
+ override: true
+ cache: true
+ target: x86_64-unknown-linux-gnu
+ rustflags: ""
+
+ - name: Build CLI on Linux
+ run: cargo build --release -p screenpipe-server --target x86_64-unknown-linux-gnu
+
+ - name: Install frontend dependencies
+ working-directory: ./screenpipe-app-tauri
+ run: bun install
+
+ - name: Run pre_build.js
+ run: |
+ bun ./scripts/pre_build.js
+ working-directory: ./screenpipe-app-tauri
+
+ - name: Build
+ uses: tauri-apps/[email protected]
+ env:
+ CI: true
+ CARGO_PROFILE_RELEASE_LTO: false
+ CARGO_PROFILE_RELEASE_OPT_LEVEL: 3
+ CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 16
+ CARGO_INCREMENTAL: false
+ CARGO_PROFILE_RELEASE_STRIP: none
+ CARGO_PROFILE_RELEASE_PANIC: unwind
+ CARGO_PROFILE_RELEASE_INCREMENTAL: true
+ VCPKG_STATIC_LINKAGE: "true"
+ with:
+ args: "--target x86_64-unknown-linux-gnu --no-bundle"
+ projectPath: "./screenpipe-app-tauri"
+ tauriScript: bunx tauri -v
+
+ - name: Install tauri-driver
+ run: |
+ if [ ! -f "$HOME/.cargo/bin/tauri-driver" ]; then
+ cargo install tauri-driver
+ fi
+
+ - name: Set up virtual display with window manager
+ run: .github/scripts/setup_display.sh
+
+ - name: Setup audio
+ run: .github/scripts/setup_audio.sh
+
+ - name: Run E2E Tests
+ shell: bash
+ working-directory: ./screenpipe-app-tauri
+ run: |
+ export XDG_RUNTIME_DIR=/run/user/$(id -u)
+ export XDG_CONFIG_HOME="$HOME/.config"
+ export XDG_DATA_HOME="$HOME/.local/share"
+ export XDG_CACHE_HOME="$HOME/.cache"
+ export PULSE_SERVER=unix:${XDG_RUNTIME_DIR}/pulse/native
+ export DISPLAY=:99
+
+ bun run test:e2e > e2e_output.log
+
+ - name: Upload E2E Test Artifacts
+ uses: actions/upload-artifact@v4
+ if: always()
+ with:
+ name: linux-e2e-test-artifacts
+ path: |
+ ./screenpipe-app-tauri/e2e/videos/*
+ ./screenpipe-app-tauri/e2e_output.log
+
+ - name: Upload Screenpipe data
+ uses: actions/upload-artifact@v4
+ if: always()
+ with:
+ name: linux-screenpipe-data
+ include-hidden-files: true
+ path: |
+ ~/.screenpipe/*
diff --git a/.github/workflows/windows-integration-test.yml b/.github/workflows/windows-integration-test.yml
index 366226977..0a4b210da 100644
--- a/.github/workflows/windows-integration-test.yml
+++ b/.github/workflows/windows-integration-test.yml
@@ -31,7 +31,9 @@ jobs:
rustflags: ""
- name: Install Chocolatey
- run: Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
+ run: |
+ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
+ Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
- name: Install dependencies
shell: pwsh
diff --git a/screenpipe-app-tauri/.mocharc.js b/screenpipe-app-tauri/.mocharc.js
new file mode 100644
index 000000000..9a459debb
--- /dev/null
+++ b/screenpipe-app-tauri/.mocharc.js
@@ -0,0 +1,10 @@
+module.exports = {
+ spec: [
+ "./e2e/terminator-e2e/**/*.spec.js"
+ ],
+ timeout: 150000,
+ require: [
+ "./e2e/terminator-e2e/mocha.global.js"
+ ],
+ reporter: "spec",
+};
diff --git a/screenpipe-app-tauri/bun.lockb b/screenpipe-app-tauri/bun.lockb
index b31357b40..1932a1c90 100755
Binary files a/screenpipe-app-tauri/bun.lockb and b/screenpipe-app-tauri/bun.lockb differ
diff --git a/screenpipe-app-tauri/components/screenpipe-status.tsx b/screenpipe-app-tauri/components/screenpipe-status.tsx
index c8c53e168..8ff062c46 100644
--- a/screenpipe-app-tauri/components/screenpipe-status.tsx
+++ b/screenpipe-app-tauri/components/screenpipe-status.tsx
@@ -158,7 +158,7 @@ const HealthStatus = ({ className }: { className?: string }) => {
</div>
</DialogHeader>
<div className="flex-grow overflow-auto">
- <p className="text-sm mb-4 font-semibold">{statusMessage}</p>
+ <p className="text-sm mb-4 font-semibold" aria-label="status-message-text">{statusMessage}</p>
<div className="space-y-2 text-sm">
{/* Screen Recording Status */}
<div className="flex items-center justify-between">
diff --git a/screenpipe-app-tauri/components/ui/badge.tsx b/screenpipe-app-tauri/components/ui/badge.tsx
index f000e3ef5..5a5141348 100644
--- a/screenpipe-app-tauri/components/ui/badge.tsx
+++ b/screenpipe-app-tauri/components/ui/badge.tsx
@@ -29,7 +29,7 @@ export interface BadgeProps
function Badge({ className, variant, ...props }: BadgeProps) {
return (
- <div className={cn(badgeVariants({ variant }), className)} {...props} />
+ <div aria-label="health-status-badge" className={cn(badgeVariants({ variant }), className)} {...props} />
)
}
diff --git a/screenpipe-app-tauri/e2e/record.js b/screenpipe-app-tauri/e2e/record.js
new file mode 100644
index 000000000..5ae5cfb7d
--- /dev/null
+++ b/screenpipe-app-tauri/e2e/record.js
@@ -0,0 +1,146 @@
+/* eslint-disable no-console */
+const { spawn } = require('child_process');
+const path = require('node:path');
+
+function fileName(title) {
+ return encodeURIComponent(title.trim().replace(/\s+/g, '-'));
+}
+
+class TestRecorder {
+ ffmpeg;
+ isRecording = false;
+ stopPromise = null;
+ stopResolve = null;
+
+ constructor() {}
+
+ stop() {
+ if (!this.isRecording || !this.ffmpeg) {
+ return Promise.resolve();
+ }
+
+ // If we already have a stop operation in progress, return that promise
+ if (this.stopPromise) {
+ return this.stopPromise;
+ }
+
+ // Create a new promise for this stop operation
+ this.stopPromise = new Promise((resolve) => {
+ this.stopResolve = resolve;
+
+ // Set a timeout to force kill if graceful shutdown doesn't work
+ const forceKillTimeout = setTimeout(() => {
+ console.log('[ffmpeg] Force killing ffmpeg process after timeout');
+ this.ffmpeg.kill('SIGKILL');
+ }, 5000);
+
+ // Handle the close event to resolve the promise
+ this.ffmpeg.once('close', (code, signal) => {
+ clearTimeout(forceKillTimeout);
+ this.isRecording = false;
+ this.ffmpeg = null;
+ this.stopPromise = null;
+ this.stopResolve = null;
+ resolve();
+ });
+
+ // On Windows, sending 'q' to stdin is more reliable than SIGINT
+ // This tells ffmpeg to quit gracefully and finalize the output file
+ console.log('[ffmpeg] Sending quit command for graceful shutdown');
+ try {
+ this.ffmpeg.stdin.write('q');
+ } catch (err) {
+ console.log('[ffmpeg] Failed to send quit command, falling back to SIGINT');
+ this.ffmpeg.kill('SIGINT');
+ }
+ });
+
+ return this.stopPromise;
+ }
+
+ start(test, videoPath) {
+ if (!videoPath || !test) {
+ throw new Error('Cannot start recording without a test and path for the video file.');
+ }
+
+ // If we're already recording, stop the previous recording first
+ if (this.isRecording) {
+ console.log('[ffmpeg] Stopping previous recording before starting a new one');
+ this.stop().then(() => this._startRecording(test, videoPath));
+ } else {
+ this._startRecording(test, videoPath);
+ }
+ }
+
+ _startRecording(test, videoPath) {
+ const parsedPath = path.join(
+ videoPath,
+ `${fileName(test.parent)}-${fileName(test.title)}.mp4`
+ );
+
+ console.log(`[ffmpeg] Starting recording: ${parsedPath}`);
+
+ const isWindows = process.platform === 'win32';
+ const ffmpegArgs = isWindows ? [
+ '-f',
+ 'gdigrab',
+ '-framerate',
+ '30',
+ '-i',
+ 'desktop',
+ '-loglevel',
+ 'error',
+ '-y',
+ '-pix_fmt',
+ 'yuv420p',
+ '-thread_queue_size',
+ '1024',
+ parsedPath
+ ] : [
+ '-f',
+ 'x11grab',
+ '-video_size',
+ '1920x1080',
+ '-i',
+ process.env.DISPLAY || ':0.0',
+ '-loglevel',
+ 'error',
+ '-y',
+ '-pix_fmt',
+ 'yuv420p',
+ '-thread_queue_size',
+ '1024',
+ parsedPath
+ ];
+
+ this.ffmpeg = spawn('ffmpeg', ffmpegArgs);
+
+ this.isRecording = true;
+
+ function logBuffer(buffer, prefix) {
+ const lines = buffer.toString().trim().split('\n');
+ lines.forEach(function (line) {
+ console.log(prefix + line);
+ });
+ }
+
+ this.ffmpeg.stdout.on('data', (data) => {
+ logBuffer(data, '[ffmpeg:stdout] ');
+ });
+
+ this.ffmpeg.stderr.on('data', (data) => {
+ logBuffer(data, '[ffmpeg:error] ');
+ });
+
+ this.ffmpeg.on('close', (code, signal) => {
+ if (code) {
+ console.log(`[ffmpeg] exited with code ${code}: ${parsedPath}`);
+ }
+ if (signal) {
+ console.log(`[ffmpeg] received signal ${signal}: ${parsedPath}`);
+ }
+ });
+ }
+}
+
+module.exports = { TestRecorder };
\ No newline at end of file
diff --git a/screenpipe-app-tauri/e2e/terminator-e2e/mocha.global.js b/screenpipe-app-tauri/e2e/terminator-e2e/mocha.global.js
new file mode 100644
index 000000000..8228e44f5
--- /dev/null
+++ b/screenpipe-app-tauri/e2e/terminator-e2e/mocha.global.js
@@ -0,0 +1,51 @@
+const { spawn, execSync } = require('child_process');
+const fs = require('fs');
+const path = require('path');
+
+let appProcess;
+let terminatorProcess;
+
+function findExecutablePath() {
+ const paths = [
+ path.join(__dirname, '../../src-tauri/target/release/screenpipe-app.exe'),
+ path.join(__dirname, '../../src-tauri/target/x86_64-pc-windows-msvc/release/screenpipe-app.exe')
+ ];
+ for (const p of paths) {
+ if (fs.existsSync(p)) return p;
+ }
+ throw new Error('could not find screenpipe-app.exe in any of the expected locations');
+}
+
+function findTerminatorServerPath() {
+ const serverPath = path.join(__dirname, 'terminator-server-windows-x86_64', 'server.exe');
+ if (fs.existsSync(serverPath)) return serverPath;
+ throw new Error('could not find terminator server exe in expected location');
+}
+
+function killProcess(proc) {
+ if (!proc) return;
+ const pid = proc.pid;
+ if (process.platform === 'win32') {
+ try {
+ execSync(`taskkill /PID ${pid} /T /F`);
+ } catch (e) { /* ignore */ }
+ } else {
+ try {
+ process.kill(-pid);
+ } catch (e) { /* ignore */ }
+ }
+}
+
+exports.mochaHooks = {
+ async beforeAll() {
+ const exePath = findExecutablePath();
+ const terminatorPath = findTerminatorServerPath();
+ appProcess = spawn(exePath, [], { stdio: 'ignore', detached: true });
+ terminatorProcess = spawn(terminatorPath, [], { stdio: 'ignore', detached: true });
+ await new Promise(res => setTimeout(res, 4000));
+ },
+ afterAll() {
+ killProcess(appProcess);
+ killProcess(terminatorProcess);
+ }
+};
\ No newline at end of file
diff --git a/screenpipe-app-tauri/e2e/terminator-e2e/screenpipe.spec.js b/screenpipe-app-tauri/e2e/terminator-e2e/screenpipe.spec.js
new file mode 100644
index 000000000..bc9e07426
--- /dev/null
+++ b/screenpipe-app-tauri/e2e/terminator-e2e/screenpipe.spec.js
@@ -0,0 +1,66 @@
+const { DesktopUseClient, ApiError} = require('desktop-use');
+
+function delay(ms) {
+ return new Promise(resolve => setTimeout(resolve, ms));
+}
+
+describe('Screenpipe App Health Status', function() {
+ this.timeout(150000); // Models download can take a while
+
+ let client;
+
+ before(() => {
+ client = new DesktopUseClient();
+ });
+
+ it('should open Screenpipe and verify health status', async () => {
+ try {
+
+ const mainWindow = client.locator('window:Screenpipe');
+ const rootWebArea = mainWindow.locator('role:Document');
+
+ const skipOnboarding = rootWebArea.locator('Name:skip onboarding');
+ await skipOnboarding.click();
+ await delay(3000);
+
+ const closeChangelogs = rootWebArea.locator('Name:Close');
+ await closeChangelogs.click();
+ await delay(3000);
+
+ // const healthMenu = rootWebArea.locator('classname:inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent cursor-pointer bg-transparent text-foreground hover:bg-accent hover:text-accent-foreground');
+ const healthMenu = rootWebArea.locator('Name:health-status-badge');
+ await healthMenu.click();
+ await delay(3000);
+
+ async function getHealthStatusText() {
+ // const textGroup = rootWebArea.locator('Name:text-sm mb-4 font-semibold');
+ const textGroup = rootWebArea.locator('Name:status-message-text');
+ const text_element = textGroup.locator('role:Text');
+ const attributes = await text_element.getAttributes();
+ return attributes.properties?.Name || '';
+ }
+
+ const desiredText = 'STRING(screenpipe is running smoothly)';
+ let healthStatusText = null;
+ for (let i = 0; i < 30; i++) { // Try for up to 30 seconds
+ healthStatusText = await getHealthStatusText();
+ if (healthStatusText === desiredText) {
+ console.log(healthStatusText);
+ break;
+ }
+ await delay(1000);
+ }
+
+ if (healthStatusText !== desiredText) {
+ throw new Error(`Health status did not match. Got: ${healthStatusText}`);
+ }
+
+ } catch (e) {
+ if (e instanceof ApiError) {
+ throw new Error(`API Status: ${e}`);
+ } else {
+ throw new Error(`Unexpected error: ${e}`);
+ }
+ }
+ });
+});
diff --git a/screenpipe-app-tauri/e2e/tests/health-check.js b/screenpipe-app-tauri/e2e/tests/health-check.js
new file mode 100644
index 000000000..34b7561bd
--- /dev/null
+++ b/screenpipe-app-tauri/e2e/tests/health-check.js
@@ -0,0 +1,109 @@
+describe('Project', () => {
+ it('Health check', async () => {
+ // Wait for app to load
+ await browser.waitUntil(
+ async () => {
+ const readyState = await browser.execute(() => document.readyState);
+ return readyState === 'complete';
+ },
+ {
+ timeout: 10000,
+ timeoutMsg: 'app did not load in time'
+ }
+ );
+
+ // On Linux, WebdriverIO is not able to click on buttons, so we need to use JavaScript
+ const isLinux = await browser.execute(() => {
+ // Check if we're on Linux using userAgent
+ const userAgent = navigator.userAgent.toLowerCase();
+ return userAgent.includes('linux') && !userAgent.includes('android');
+ });
+
+ // Wait for the skip onboarding button to be visible
+ const button = await $('button.text-muted-foreground*=skip onboarding');
+ await button.waitForDisplayed({ timeout: 10000 });
+
+ if (isLinux) {
+ // Use JavaScript click directly with a valid CSS selector on Linux
+ await browser.execute(() => {
+ const buttons = document.querySelectorAll('button');
+ for (const btn of buttons) {
+ if (btn.textContent.includes('skip onboarding')) {
+ btn.click();
+ break;
+ }
+ }
+ });
+ } else {
+ // Use native WebdriverIO click on Windows
+ await button.waitForClickable({ timeout: 10000 });
+ await button.click();
+ }
+
+ // Add a small delay to ensure UI has time to respond
+ await browser.pause(500);
+
+ // Close the dialog - wait for the close button to be visible
+ const dialogCloseButton = await $('button.absolute.right-4.top-4 svg.lucide-x');
+ await dialogCloseButton.waitForDisplayed({ timeout: 10000 });
+
+ if (isLinux) {
+ // Use JavaScript click directly with a valid CSS selector on Linux
+ await browser.execute(() => {
+ const closeButtons = document.querySelectorAll('button svg.lucide-x');
+ for (const btn of closeButtons) {
+ if (btn.closest('button.absolute.right-4.top-4')) {
+ btn.closest('button').click();
+ break;
+ }
+ }
+ });
+ } else {
+ // Use native WebdriverIO click on Windows
+ await dialogCloseButton.waitForClickable({ timeout: 10000 });
+ await dialogCloseButton.click();
+ }
+
+ // Add a small delay to ensure UI has time to respond
+ await browser.pause(500);
+
+ // Click badge - wait for it to be visible
+ const badge = await $('div.cursor-pointer.bg-transparent');
+ await badge.waitForDisplayed({ timeout: 10000 });
+
+ if (isLinux) {
+ // Use JavaScript click directly with a valid CSS selector on Linux
+ await browser.execute(() => {
+ const badges = document.querySelectorAll('div.cursor-pointer.bg-transparent');
+ if (badges.length > 0) {
+ badges[0].click();
+ }
+ });
+ } else {
+ // Use native WebdriverIO click on Windows
+ await badge.waitForClickable({ timeout: 10000 });
+ await badge.click();
+ }
+
+ // Add a small delay to ensure UI has time to respond
+ await browser.pause(500);
+
+ // Wait until the status message is correct
+ await browser.waitUntil(
+ async () => {
+ const statusElement = await $('div.flex-grow p.text-sm');
+ const statusMessage = await statusElement.getText();
+ return statusMessage.includes('screenpipe is running smoothly');
+ },
+ {
+ timeout: 60000, // maximum wait time (1 minute)
+ timeoutMsg: 'status message did not update in time'
+ }
+ );
+
+ // Verify the status message
+ const statusElement = await $('div.flex-grow p.text-sm');
+ const statusMessage = await statusElement.getText();
+ expect(statusMessage).toContain('screenpipe is running smoothly');
+ });
+});
diff --git a/screenpipe-app-tauri/e2e/utils.js b/screenpipe-app-tauri/e2e/utils.js
new file mode 100644
index 000000000..eaaeefb4c
--- /dev/null
+++ b/screenpipe-app-tauri/e2e/utils.js
@@ -0,0 +1,7 @@
+async function findAndClick(selector) {
+ const button = await $(selector);
+ await button.isClickable();
+ await button.click();
+}
+
+module.exports = { findAndClick };
\ No newline at end of file
diff --git a/screenpipe-app-tauri/e2e/videos/.keep b/screenpipe-app-tauri/e2e/videos/.keep
new file mode 100644
index 000000000..e69de29bb
diff --git a/screenpipe-app-tauri/package.json b/screenpipe-app-tauri/package.json
index 29eb5b1c3..11da79bb7 100644
--- a/screenpipe-app-tauri/package.json
+++ b/screenpipe-app-tauri/package.json
@@ -3,6 +3,8 @@
"private": true,
"scripts": {
"dev": "next dev",
+ "test:e2e": "wdio run wdio.conf.js",
+ "test:e2e:terminator": "mocha",
"build": "next build",
"predev": "bun scripts/pre_build.js",
"prebuild": "bun scripts/pre_build.js",
@@ -86,7 +88,16 @@
"eslint-config-next": "14.2.4",
"postcss": "^8",
"tailwindcss": "^3.4.1",
- "typescript": "^5"
+ "typescript": "^5",
+ "ts-node": "^10.9.2",
+ "@wdio/cli": "^8.39.1",
+ "@wdio/globals": "^8.39.1",
+ "@wdio/local-runner": "^8.39.1",
+ "@wdio/mocha-framework": "^8.39.0",
+ "@wdio/spec-reporter": "^8.39.0",
+ "@wdio/types": "^8.39.0",
+ "mocha": "^10.7.0",
+ "desktop-use": "1.0.6"
},
"packageManager": "[email protected]+sha512.d1a029e1a447ad90bc96cd58b0fad486d2993d531856396f7babf2d83eb1823bb83c5a3d0fc18f675b2d10321d49eb161fece36fe8134aa5823ecd215feed392",
"trustedDependencies": [
diff --git a/screenpipe-app-tauri/tsconfig.json b/screenpipe-app-tauri/tsconfig.json
index 7ee536cf7..7e47c1df1 100644
--- a/screenpipe-app-tauri/tsconfig.json
+++ b/screenpipe-app-tauri/tsconfig.json
@@ -27,7 +27,7 @@
"./*"
]
},
- "types": ["@tauri-apps/api"]
+ "types": ["@wdio/globals/types", "@wdio/mocha-framework","@tauri-apps/api"]
},
"include": [
"next-env.d.ts",
diff --git a/screenpipe-app-tauri/wdio.conf.js b/screenpipe-app-tauri/wdio.conf.js
new file mode 100644
index 000000000..7a8bfb82e
--- /dev/null
+++ b/screenpipe-app-tauri/wdio.conf.js
@@ -0,0 +1,81 @@
+const { TestRecorder } = require('./e2e/record.js');
+const { spawn, execSync } = require('node:child_process');
+const os = require('node:os');
+const path = require('node:path');
+const fs = require('node:fs');
+
+const videoRecorder = new TestRecorder();
+let tauriDriver;
+
+// Helper function to find the correct executable path
+const findExecutablePath = () => {
+ const paths = [
+ './src-tauri/target/release/screenpipe-app.exe',
+ './src-tauri/target/x86_64-pc-windows-msvc/release/screenpipe-app.exe',
+ './src-tauri/target/release/screenpipe-app',
+ './src-tauri/target/x86_64-unknown-linux-gnu/release/screenpipe-app'
+ ];
+
+ for (const p of paths) {
+ if (fs.existsSync(p)) {
+ return p;
+ }
+ }
+
+ throw new Error('Could not find screenpipe-app.exe in any of the expected locations');
+};
+
+const executablePath = findExecutablePath();
+exports.config = {
+ hostname: '127.0.0.1',
+ port: 4444,
+ specs: ['./e2e/tests/**/*.js'],
+ maxInstances: 1,
+ capabilities: [
+ {
+ maxInstances: 1,
+ 'tauri:options': {
+ application: executablePath
+ }
+ }
+ ],
+ reporters: ['spec'],
+ framework: 'mocha',
+ mochaOpts: {
+ ui: 'bdd',
+ timeout: 60000
+ },
+
+ waitforTimeout: 10000,
+ connectionRetryTimeout: 120000,
+ connectionRetryCount: 0,
+
+ before: async function() {
+ // Initialize browser object
+ // await browser.setWindowSize(1200, 850);
+ },
+
+ beforeTest: function (test) {
+ const videoPath = path.join(__dirname, '/e2e/videos');
+ videoRecorder.start(test, videoPath);
+ },
+
+ afterTest: async function () {
+ await videoRecorder.stop();
+ },
+
+ // ensure we are running `tauri-driver` before the session starts so that we can proxy the webdriver requests
+ beforeSession: () =>
+ (tauriDriver = spawn(path.resolve(os.homedir(), '.cargo', 'bin', 'tauri-driver'), [], {
+ stdio: [null, process.stdout, process.stderr]
+ })),
+
+ afterSession: async () => {
+ // Make sure to stop the video recorder before killing the tauri driver
+ await videoRecorder.stop();
+
+ if (tauriDriver) {
+ tauriDriver.kill();
+ }
+ },
+};
\ No newline at end of file