Skip to content

Commit 18f759c

Browse files
Fix linux-e2e: WebKitWebDriver PATH and tauri-driver GTK initialization (#1806)
* Fix linux-e2e: ensure WebKitWebDriver is in PATH The webkit2gtk-driver package on Ubuntu 24.04 may install WebKitWebDriver to a versioned library directory that's not on PATH by default. This causes tauri-driver to fail with 'can not find binary WebKitWebDriver in the PATH'. This fix: - Checks if webkit2gtk-driver package is installed - Verifies WebKitWebDriver is callable from PATH - If not, locates the binary using dpkg -L and creates a symlink to /usr/local/bin - Validates the symlink works before proceeding This ensures tauri-driver can find WebKitWebDriver regardless of where the package installs it. Co-Authored-By: yujonglee <[email protected]> * Fix tauri-driver GTK initialization by wrapping with xvfb-run in CI The previous fix ensured WebKitWebDriver was in PATH, which worked. However, tauri-driver itself needs GTK/X11 to initialize its event loop. In CI, tauri-driver was starting in onPrepare before xvfb was initialized, causing GTK initialization to fail with 'Failed to initialize gtk backend'. This fix wraps tauri-driver with xvfb-run when running in CI (detected via CI env var), providing a virtual display before tauri-driver starts. Local development is unaffected (no xvfb-run wrapper). Co-Authored-By: yujonglee <[email protected]> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: yujonglee <[email protected]>
1 parent af3ba9c commit 18f759c

File tree

2 files changed

+38
-5
lines changed

2 files changed

+38
-5
lines changed

apps/desktop-e2e/wdio.conf.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,15 @@ export const config = {
3737

3838
onPrepare: function () {
3939
return new Promise((resolve, reject) => {
40-
tauriDriver = spawn("tauri-driver", [], {
40+
// In CI, wrap tauri-driver with xvfb-run to provide a virtual display
41+
// This is needed because tauri-driver initializes GTK which requires X11
42+
const useXvfb = !!process.env.CI;
43+
const cmd = useXvfb ? "xvfb-run" : "tauri-driver";
44+
const args = useXvfb ? ["-a", "tauri-driver"] : [];
45+
46+
console.log(`Starting tauri-driver${useXvfb ? " with xvfb-run" : ""}...`);
47+
48+
tauriDriver = spawn(cmd, args, {
4149
stdio: ["ignore", "pipe", "pipe"],
4250
});
4351

scripts/setup-desktop-e2e.sh

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,38 @@ else
2121
echo "tauri-driver already installed"
2222
fi
2323

24-
# Install WebKitWebDriver if not already installed
25-
if ! command -v WebKitWebDriver >/dev/null 2>&1; then
26-
echo "Installing WebKitWebDriver..."
24+
# Install WebKitWebDriver package if not already installed
25+
if ! dpkg -l | grep -q webkit2gtk-driver; then
26+
echo "Installing webkit2gtk-driver package..."
2727
sudo apt-get update
2828
sudo apt-get install -y webkit2gtk-driver
2929
else
30-
echo "WebKitWebDriver already installed"
30+
echo "webkit2gtk-driver package already installed"
31+
fi
32+
33+
# Ensure WebKitWebDriver is actually callable from PATH
34+
if ! command -v WebKitWebDriver >/dev/null 2>&1; then
35+
echo "WebKitWebDriver not on PATH, trying to locate binary from webkit2gtk-driver package..."
36+
DRIVER_PATH=$(dpkg -L webkit2gtk-driver | grep -E 'WebKitWebDriver$' | head -n 1 || true)
37+
38+
if [[ -z "${DRIVER_PATH}" ]]; then
39+
echo "Error: Could not find WebKitWebDriver binary in webkit2gtk-driver package"
40+
exit 1
41+
fi
42+
43+
echo "Found WebKitWebDriver at: ${DRIVER_PATH}"
44+
echo "Creating symlink at /usr/local/bin/WebKitWebDriver (requires sudo)..."
45+
sudo ln -sf "${DRIVER_PATH}" /usr/local/bin/WebKitWebDriver
46+
47+
# Verify the symlink works
48+
if ! command -v WebKitWebDriver >/dev/null 2>&1; then
49+
echo "Error: WebKitWebDriver still not found in PATH after creating symlink"
50+
exit 1
51+
fi
52+
53+
echo "WebKitWebDriver successfully linked to PATH"
54+
else
55+
echo "WebKitWebDriver already available in PATH"
3156
fi
3257

3358
echo "Desktop E2E test environment setup complete"

0 commit comments

Comments
 (0)