Skip to content

Commit e415511

Browse files
author
Mohammod Al Amin Ashik
committed
Improve Tauri E2E setup for Windows
1 parent dab2cc6 commit e415511

2 files changed

Lines changed: 84 additions & 24 deletions

File tree

scripts/setup-dev.ps1

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,49 @@ if (-not $SkipTauriDriver) {
4949
Write-Host "`nInstalling tauri-driver..." -ForegroundColor Yellow
5050
cargo install tauri-driver --locked
5151
Write-Host " Done" -ForegroundColor Green
52+
53+
# Windows: Install Edge WebDriver (required for tauri-driver)
54+
if ($IsWindows -or $env:OS -eq "Windows_NT") {
55+
Write-Host "`nInstalling Edge WebDriver..." -ForegroundColor Yellow
56+
57+
# Get Edge version
58+
$edgePath = "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"
59+
if (-not (Test-Path $edgePath)) {
60+
$edgePath = "C:\Program Files\Microsoft\Edge\Application\msedge.exe"
61+
}
62+
63+
if (Test-Path $edgePath) {
64+
$edgeVersion = (Get-Item $edgePath).VersionInfo.ProductVersion
65+
$majorVersion = $edgeVersion.Split('.')[0]
66+
Write-Host " Edge version: $edgeVersion" -ForegroundColor Cyan
67+
68+
# Download matching Edge WebDriver
69+
$driverUrl = "https://msedgedriver.azureedge.net/$edgeVersion/edgedriver_win64.zip"
70+
$driverZip = "$env:TEMP\edgedriver.zip"
71+
$driverDir = "$env:LOCALAPPDATA\EdgeDriver"
72+
73+
try {
74+
Write-Host " Downloading Edge WebDriver..." -ForegroundColor Cyan
75+
Invoke-WebRequest -Uri $driverUrl -OutFile $driverZip -UseBasicParsing
76+
77+
# Extract
78+
if (Test-Path $driverDir) { Remove-Item -Recurse -Force $driverDir }
79+
Expand-Archive -Path $driverZip -DestinationPath $driverDir -Force
80+
Remove-Item $driverZip
81+
82+
# Add to PATH for this session
83+
$env:PATH = "$driverDir;$env:PATH"
84+
85+
Write-Host " Edge WebDriver installed to: $driverDir" -ForegroundColor Green
86+
Write-Host " Add to PATH: $driverDir" -ForegroundColor Yellow
87+
} catch {
88+
Write-Host " Warning: Could not download Edge WebDriver" -ForegroundColor Yellow
89+
Write-Host " Download manually from: https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/" -ForegroundColor Yellow
90+
}
91+
} else {
92+
Write-Host " Warning: Edge not found. Tauri E2E tests won't work." -ForegroundColor Yellow
93+
}
94+
}
5295
}
5396

5497
# Install cargo-nextest for faster Rust tests
@@ -62,7 +105,10 @@ Write-Host "`n=== Setup Complete ===" -ForegroundColor Cyan
62105
Write-Host ""
63106
Write-Host "You can now run:"
64107
Write-Host " pnpm dev - Start development server"
65-
Write-Host " pnpm test - Run all tests"
66-
Write-Host " pnpm test:e2e:web - Run web E2E tests (Playwright)"
67-
Write-Host " pnpm test:e2e - Run full Tauri E2E tests (requires built app)"
108+
Write-Host " pnpm test - Run all tests (Rust + TypeScript)"
109+
Write-Host " pnpm test:e2e:web - Run web E2E tests (Playwright) - RECOMMENDED"
110+
Write-Host ""
111+
Write-Host "Full Tauri E2E (advanced, requires build):"
112+
Write-Host " pnpm build - Build the app first"
113+
Write-Host " pnpm test:e2e - Run Tauri E2E tests"
68114
Write-Host ""

tests/e2e/README.md

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,46 @@
11
# E2E Testing
22

3-
Two E2E test suites for different purposes:
3+
Two E2E test suites for different purposes.
44

5-
## 1. Tauri E2E (WebdriverIO) - Full Integration
5+
## 1. Web-only E2E (Playwright) - RECOMMENDED
66

7-
Tests the actual built Tauri application with backend.
7+
Tests UI components without Tauri backend (mocked IPC). Works everywhere.
88

99
```bash
10-
# Prerequisites
10+
pnpm test:e2e:web
11+
pnpm test:e2e:web:headed # With browser visible
12+
```
13+
14+
**Supported platforms**: All (Windows, Linux, macOS)
15+
**Use for**: UI layout, component rendering, navigation, most testing
16+
17+
**Test files**: `specs/*.spec.ts`
18+
19+
## 2. Tauri E2E (WebdriverIO) - Full Integration
20+
21+
Tests the actual built Tauri application with real backend. Complex setup.
22+
23+
### Prerequisites
24+
25+
```bash
26+
# 1. Install tauri-driver
1127
cargo install tauri-driver --locked
1228

13-
# Windows: Install Edge Driver matching your Edge version
14-
# Linux: apt-get install webkit2gtk-driver
29+
# 2. Platform-specific WebDriver:
1530

31+
# Windows: Download Edge WebDriver matching your Edge version
32+
# https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/
33+
# Add msedgedriver.exe to PATH
34+
35+
# Linux:
36+
sudo apt-get install webkit2gtk-driver
37+
38+
# macOS: NOT SUPPORTED (no WKWebView driver)
39+
```
40+
41+
### Running
42+
43+
```bash
1644
# Build the app first
1745
pnpm build
1846

@@ -21,24 +49,10 @@ pnpm test:e2e
2149
```
2250

2351
**Supported platforms**: Windows, Linux
24-
**NOT supported**: macOS (no WKWebView driver)
52+
**NOT supported**: macOS
2553

2654
**Test files**: `specs/*.wdio.ts`
2755

28-
## 2. Web-only E2E (Playwright)
29-
30-
Tests UI components without Tauri backend (mocked IPC).
31-
32-
```bash
33-
pnpm test:e2e:web
34-
pnpm test:e2e:web:headed # With browser visible
35-
```
36-
37-
**Supported platforms**: All
38-
**Use for**: UI layout, component rendering, visual testing
39-
40-
**Test files**: `specs/*.spec.ts`
41-
4256
## When to Use Which
4357

4458
| Scenario | Suite |

0 commit comments

Comments
 (0)