فینورا پرو - سامانه جامع حسابداری و صدور فاکتور
test(A04): add fast Windows native backup diagnostics using prebuilt NSIS artifact
davoodmehraban89 committed
Oct 16, 2026 at 19:07 UTC
3d967352fbcacd2aa6eeb5af544529214561b2b2
1 file changed
+33
scripts/windows-vm-fast-native-backup-smoke.ps1
new
+33
@@ -0,0 +1,33 @@
1
+[CmdletBinding()]
2
+param(
3
+ [Parameter(Mandatory=$true)][string]$Installer,
4
+ [string]$ExpectedVersion = '2.0.3'
5
+)
6
+$ErrorActionPreference = 'Stop'
7
+if ($env:RUNNER_OS -ne 'Windows' -or !$env:GITHUB_ACTIONS) {
8
+ throw 'This test only runs inside a disposable Windows GitHub Actions VM'
9
+}
10
+$root = Join-Path $env:RUNNER_TEMP 'factor-fast-native-backup-lab'
11
+$install = Join-Path $root 'installed'
12
+$profile = Join-Path $root 'webview2-profile'
13
+$reportDir = Join-Path $root 'reports'
14
+New-Item -ItemType Directory -Force -Path $install,$profile,$reportDir | Out-Null
15
+if (!(Test-Path -LiteralPath $Installer)) { throw 'Preview installer missing' }
16
+$hash = (Get-FileHash -Path $Installer -Algorithm SHA256).Hash
17
+Write-Host ("Using prebuilt NSIS artifact checksum SHA256: " + $hash)
18
+$installerProcess = Start-Process -FilePath $Installer -ArgumentList @('/S',("/D="+$install)) -PassThru
19
+try {
20
+ if (!$installerProcess.WaitForExit(120000)) { $installerProcess.Kill(); throw 'NSIS timeout' }
21
+ if ($installerProcess.ExitCode -ne 0) { throw "NSIS exited $($installerProcess.ExitCode)" }
22
+} finally { $installerProcess.Dispose() }
23
+$exe = @(Get-ChildItem -LiteralPath $install -File -Recurse |
24
+ Where-Object { $_.Name -in @('app.exe','Factor-easyPro.exe') })[0]
25
+if (!$exe) { throw 'Installed native app EXE missing' }
26
+$report = Join-Path $reportDir 'fast-native-company-backup.json'
27
+& node tests/windows-vm-installed-tauri-cdp.cjs $exe.FullName $profile fresh $ExpectedVersion $report | Out-Host
28
+if ($LASTEXITCODE -ne 0) { throw "Fast native company-backup smoke failed (exit $LASTEXITCODE)" }
29
+$result = Get-Content $report -Raw | ConvertFrom-Json
30
+if ($result.status -ne 'PASSED' -or !$result.encryptedCompanyBackup) {
31
+ throw 'Encrypted company backup did not pass native WebView2 smoke'
32
+}
33
+Write-Host 'Prebuilt NSIS native encrypted backup smoke succeeded.'