Skip to content

Commit 461db48

Browse files
committed
ci(e2e): resilient msedgedriver download for Windows desktop E2E
The Windows e2e-desktop job downloaded an msedgedriver matching the exact WebView2 runtime build (e.g. 148.0.3967.83). Microsoft does not publish a driver for every exact build, so when the runner's WebView2 outpaces the published Edge drivers the download 404s and the job fails before any spec runs — unrelated to the code under test. Try the exact version first, then fall back to LATEST_RELEASE_<major>_WINDOWS, then LATEST_STABLE (major-version compatibility is sufficient for msedgedriver). Fails with a clear message only if no candidate is downloadable. Signed-off-by: Mohammod Al Amin Ashik <maa.ashik00@gmail.com>
1 parent 25b261f commit 461db48

1 file changed

Lines changed: 41 additions & 5 deletions

File tree

.github/workflows/e2e-desktop.yml

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,16 +131,52 @@ jobs:
131131
if: matrix.os == 'windows-latest'
132132
shell: pwsh
133133
run: |
134-
# Tauri uses the WebView2 runtime, not Edge directly.
135-
# msedgedriver must match the WebView2 runtime version, not the Edge browser version.
134+
# Tauri uses the WebView2 runtime, not Edge directly, so msedgedriver must be
135+
# compatible with the WebView2 runtime (matching the major version is sufficient).
136+
# Microsoft does not publish a driver for every exact runtime build, so try the
137+
# exact version first, then fall back to the latest driver for the same major
138+
# version, then LATEST_STABLE. This keeps the job from breaking whenever the
139+
# runner's WebView2 build outpaces the published Edge drivers.
140+
$ErrorActionPreference = 'Stop'
136141
$wv2Key = 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}'
137142
if (-not (Test-Path $wv2Key)) { $wv2Key = 'HKLM:\SOFTWARE\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}' }
138143
$wv2Version = (Get-ItemProperty $wv2Key).pv
139-
Write-Host "WebView2 runtime version: $wv2Version"
140-
$driverUrl = "https://msedgewebdriverstorage.blob.core.windows.net/edgewebdriver/$wv2Version/edgedriver_win64.zip"
144+
$wv2Major = $wv2Version.Split('.')[0]
145+
Write-Host "WebView2 runtime version: $wv2Version (major $wv2Major)"
146+
147+
$base = "https://msedgewebdriverstorage.blob.core.windows.net/edgewebdriver"
148+
149+
# Ordered list of candidate driver versions to try.
150+
$candidates = [System.Collections.Generic.List[string]]::new()
151+
$candidates.Add($wv2Version)
152+
foreach ($marker in @("LATEST_RELEASE_${wv2Major}_WINDOWS", "LATEST_STABLE")) {
153+
try {
154+
$resolved = (Invoke-WebRequest -UseBasicParsing -Uri "$base/$marker").Content
155+
# Markers are UTF-16/BOM encoded; keep only version characters.
156+
$resolved = ($resolved -replace '[^0-9\.]', '').Trim()
157+
if ($resolved) { $candidates.Add($resolved); Write-Host "marker $marker -> $resolved" }
158+
} catch {
159+
Write-Host "marker $marker unavailable: $($_.Exception.Message)"
160+
}
161+
}
162+
141163
$zipPath = "$env:TEMP\edgedriver.zip"
142164
$extractDir = "$env:TEMP\edgedriver"
143-
Invoke-WebRequest -Uri $driverUrl -OutFile $zipPath
165+
$ok = $false
166+
foreach ($v in ($candidates | Select-Object -Unique)) {
167+
$driverUrl = "$base/$v/edgedriver_win64.zip"
168+
Write-Host "Trying EdgeDriver $v -> $driverUrl"
169+
try {
170+
Invoke-WebRequest -UseBasicParsing -Uri $driverUrl -OutFile $zipPath
171+
Write-Host "Downloaded EdgeDriver $v"
172+
$ok = $true
173+
break
174+
} catch {
175+
Write-Host " not available: $($_.Exception.Message)"
176+
}
177+
}
178+
if (-not $ok) { throw "No compatible msedgedriver found for WebView2 $wv2Version (tried: $($candidates -join ', '))" }
179+
144180
Expand-Archive -Path $zipPath -DestinationPath $extractDir -Force
145181
$driverDir = "$extractDir\edgedriver_win64"
146182
if (-not (Test-Path "$driverDir\msedgedriver.exe")) { $driverDir = $extractDir }

0 commit comments

Comments
 (0)