diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e72a76e..f8298e6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,10 +16,21 @@ jobs: timeout-minutes: 20 steps: - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: npm + cache-dependency-path: src/ZipXP.UI/package-lock.json - uses: actions/setup-dotnet@v4 with: dotnet-version: 10.0.x - name: Build run: dotnet build ZipXP.slnx --nologo -warnaserror + - name: Test React interface + working-directory: src/ZipXP.UI + run: | + npm test + npx playwright install chromium + npm run test:ui - name: Run checks run: dotnet run --project tests/ZipXP.Checks/ZipXP.Checks.csproj --no-build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2ad5788..e28c6ae 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,6 +15,11 @@ jobs: timeout-minutes: 30 steps: - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: npm + cache-dependency-path: src/ZipXP.UI/package-lock.json - uses: actions/setup-dotnet@v4 with: dotnet-version: 10.0.x diff --git a/.gitignore b/.gitignore index d10f9c0..6306c40 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,9 @@ .vs/ *.user artifacts/ +**/node_modules/ +**/dist/ +*.tsbuildinfo + +**/test-results/ +**/playwright-report/ diff --git a/README.md b/README.md index 2fee620..c59c174 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,9 @@ ZipXP needs Windows 11 and a local NTFS drive. Install the latest release for yo curl.exe -fsSL https://kiranscript.github.io/zipxp/install.ps1 -o "$env:TEMP\zipxp-get.ps1"; powershell -NoProfile -ExecutionPolicy Bypass -File "$env:TEMP\zipxp-get.ps1" ``` -It downloads the release ZIP, verifies its SHA-256 and runs the installer; see [Install and uninstall](docs/install.md) for options and what it does. Or build from source with the [.NET 10 SDK](https://dotnet.microsoft.com/download): +It downloads the release ZIP, verifies its SHA-256 and runs the installer; see [Install and uninstall](docs/install.md) for options and what it does. The React desktop interface requires the [Microsoft Edge WebView2 Runtime](https://developer.microsoft.com/microsoft-edge/webview2/). + +Or build from source with the [.NET 10 SDK](https://dotnet.microsoft.com/download) and Node.js 22.12+ installed: ```powershell git clone https://github.com/kiranscript/zipxp.git @@ -48,6 +50,8 @@ cd zipxp dotnet run --project src/ZipXP.App/ZipXP.App.csproj ``` +If WebView2 is unavailable, pass `-- --native-ui` to the run command for the original WPF interface. + Then choose **Managed folders → Add folder…**, pick a test folder that holds copies of some documents, and read the estimate. To build a package you can install, see [Install and uninstall](docs/install.md). Storage insights shows which folders take the room and what was saved in each: @@ -73,7 +77,8 @@ Compression savings depend entirely on what is in the folder. One known accounti ```text src/ZipXP.Core/ compression engine, queue, SQLite store -src/ZipXP.App/ WPF dashboard and tray app +src/ZipXP.App/ WebView2 desktop host, WPF fallback and tray app +src/ZipXP.UI/ React + TypeScript interface (Vite) tests/ real-filesystem checks scripts/ dev launcher, check, publish, install docs/ documentation diff --git a/docs/development.md b/docs/development.md index 8f1d7e8..fd325d4 100644 --- a/docs/development.md +++ b/docs/development.md @@ -1,5 +1,31 @@ # Development +## React desktop interface + +The default interface uses React + TypeScript + Vite in `src/ZipXP.UI`, hosted locally by WebView2 in the WPF shell. The C# engine, SQLite data, tray icon, single-instance handling and sign-in registration stay in `ZipXP.App` and `ZipXP.Core`. Closing the window keeps the tray worker running. + +The React interface uses soft black, white and neutral grays. Status is conveyed with explicit labels, icons and outlines; color is never the only signal. Compact desktop tables move metadata below filenames so failure details and recovery controls remain visible. Browser checks enforce the neutral palette and cover settings/list scroll cues. They also run the label-in-name accessibility rule explicitly and verify that failed-file counts are announced in navigation and attention controls, with correct singular and plural wording. + +Install Node.js 22.12+ (or a supported newer LTS), the .NET 10 Windows SDK, and the Microsoft Edge WebView2 Evergreen Runtime. Windows builds and `scripts/publish.ps1` build and copy the React bundle into the app's `UI` folder automatically; packaged users need WebView2 but do not need Node.js or npm. The runtime is not bundled by the publisher yet. + +Frontend work: + +```bash +cd src/ZipXP.UI +npm ci +npm run dev # browser layout development; no desktop file access +npm test # bridge and interaction checks +npm run build # TypeScript check + production bundle +npx playwright install chromium # once, for browser checks +npm run test:ui # interaction tests, accessibility audits, rendered screenshots +``` + +Browser checks route the compiled bundle into an isolated headless browser and provide fixture data through a mock desktop bridge; they never access managed folders. Screenshots and accessibility reports are saved under `artifacts/ui-review`. Set `ZIPXP_REVIEW_ROUND` to choose a report subfolder, or `ZIPXP_CHROMIUM` to use an existing Chromium executable. The Windows UI Automation checks in `scripts/ui-check.ps1` additionally verify real engine data and navigation in both desktop interfaces. + +Browser development shows the connection state; real data and actions require the Windows app. Rebuild/relaunch the desktop app to pick up frontend changes. It serves the bundled files without a local HTTP server and accepts only explicit, typed commands from its own `https://zipxp.internal/index.html` document. External navigation, frames, popups and host objects are blocked. Folder pickers and previews for compression/restore use native dialogs. + +Launch with `--native-ui` to use the original WPF screens, including if WebView2 is unavailable. If the React host fails, its error screen also offers **Open native interface**. Saved folder policies and history are shared between both interfaces. + ## Run from WSL From the repository root: @@ -8,7 +34,7 @@ From the repository root: ./scripts/dev.sh ``` -This launches the native Windows desktop app using Windows `dotnet.exe`. It looks on PATH, in `C:\Program Files\dotnet`, and in the local `C:\Temp\zipxp-dotnet` SDK used for development. Set `WINDOWS_DOTNET_EXE` to another executable's WSL path if needed. A Linux SDK cannot run WPF. +Install Node.js in WSL first. The launcher checks PATH and NVM installations for Linux Node.js 22.12+ and uses npm from the same installation. Set `ZIPXP_NODE_EXE` to an explicit Linux Node executable if needed. The launcher builds React with Linux npm and then launches the Windows desktop app using Windows `dotnet.exe`. It looks on PATH, in `C:\Program Files\dotnet`, and in the local `C:\Temp\zipxp-dotnet` SDK used for development. Set `WINDOWS_DOTNET_EXE` to another executable's WSL path if needed. A Linux SDK cannot run WPF. From Windows PowerShell at the repository root: @@ -46,7 +72,9 @@ Press Ctrl+C in the terminal to stop a dev run: the launcher asks the app to qui .\scripts\check.ps1 -Dotnet C:\Temp\zipxp-dotnet\dotnet.exe ``` -The check harness references the actual core library. It creates a unique disposable NTFS run directory in the user's temp folder and retains its files. It uses real compression, hashes, locks, hard links, directory defaults, replacements, and the persistent automatic worker; injected battery/CPU/free-space signals exercise waiting policies without filling a disk. A separate isolated database seeds the actual WPF window for native UI Automation navigation tests. The launch-check instance exits normally on its own and does not register startup. +The check script runs frontend tests, builds the bundle and desktop app, then runs the core harness and both desktop navigation checks. From WSL, run `npm test` and `npm run build` in `src/ZipXP.UI` first, then call the Windows check script with `-SkipReactBuild` to avoid mixing Windows and Linux npm dependencies. + +The check harness references the actual core library. It creates a unique disposable NTFS run directory in the user's temp folder and retains its files. It uses real compression, hashes, locks, hard links, directory defaults, replacements, and the persistent automatic worker; injected battery/CPU/free-space signals exercise waiting policies without filling a disk. A separate isolated database seeds the React/WebView2 window and the original WPF window for Windows UI Automation navigation tests. The launch-check instance exits normally on its own and does not register startup. Validation on the development Windows host is recorded in [validation.md](validation.md). Wider compatibility/performance testing, signing with a release certificate, sign-in lifecycle checks, and a private user pilot remain release acceptance work. This is an unsigned development build until published with a real signing certificate; it is not presented as a completed private beta. @@ -54,7 +82,8 @@ Validation on the development Windows host is recorded in [validation.md](valida ```text src/ZipXP.Core/ Models, native handles/identities, SQLite store, analysis, rules, worker -src/ZipXP.App/ WPF dashboard (Views/), controls, tray/single-instance/startup (Shell/), plain-language text (Text/) +src/ZipXP.UI/ React screens, styles, typed bridge, interaction tests +src/ZipXP.App/ WebView2 host and desktop bridge (Web/), WPF fallback (Views/), controls, tray/single-instance/startup (Shell/), plain-language text (Text/) tests/ZipXP.Checks/ Real-service policy, native, persistence and automation checks tests/ZipXP.FolderTest/ Helper used by scripts/test-existing-folder.ps1 scripts/ dev.sh (WSL launcher), check, publish, install, uninstall diff --git a/docs/validation.md b/docs/validation.md index 4097798..2e5d033 100644 --- a/docs/validation.md +++ b/docs/validation.md @@ -16,6 +16,16 @@ Fixture and package-lifecycle folders from these runs were retained locally as t Runtime testing found and fixed a launch-check assumption about console-host `WaitForInputIdle`, missing-startup-entry handling in PowerShell uninstall, and an operation-cache edge case that could block explicit decompression. The final executed checks have no unresolved failures. +## React desktop UI verification (2026-11-17) + +- React production build and Windows desktop build: passed; Windows build has zero warnings/errors. +- 10 frontend unit tests, 31 browser interaction/audit tests, and 71 Windows core checks: passed. The core suite includes sorting more than 500 storage items before limiting the response. +- Twelve saved accessibility reports (six WCAG audits and six explicit label-in-name audits): zero detected violations. +- Browser regressions cover compact 900px layouts, long folder names, persistent settings actions and validation, background scroll containment, full-width modal dimming, and system-colored primary buttons. Review captures use viewport dimensions and include all main pages in forced-colors emulation. +- Windows UI Automation: both React/WebView2 and native fallback launched, navigated all four pages, preserved analysis-only file attributes, and quit gracefully. A duplicate WPF resource inherited during the merge was found by the launch check and removed. The host reported 120 DPI (125% scaling); the locked Windows desktop prevented useful visual captures, so those captures were discarded. + +These are automated development checks. No manual Narrator/NVDA, real Windows contrast-theme, native-dialog visual, or additional-DPI acceptance is claimed. Browser captures use fixture data rather than the live engine. The accounting issue and release acceptance items below remain separate from UI quality. + ## Additional real-folder run: accounting defect found A subsequent manual 35-file test (2026-11-09; its evidence files have since been removed from the repository) exercised the actual app on a local test folder, including the default quiet period, closed-window background work, restart catch-up, and GUI decompression. All original hashes and recorded file metadata were preserved and restored. diff --git a/scripts/check.ps1 b/scripts/check.ps1 index 4977fe7..6a4fcd7 100644 --- a/scripts/check.ps1 +++ b/scripts/check.ps1 @@ -1,58 +1,20 @@ [CmdletBinding()] -param([string]$Dotnet = 'dotnet') +param([string]$Dotnet = 'dotnet', [switch]$SkipReactBuild) $ErrorActionPreference = 'Stop' $root = Split-Path -Parent $PSScriptRoot -& $Dotnet build (Join-Path $root 'src/ZipXP.App/ZipXP.App.csproj') --nologo +if (-not $SkipReactBuild) { + Push-Location (Join-Path $root 'src/ZipXP.UI') + try { + & npm.cmd ci --no-fund --no-audit + if ($LASTEXITCODE -ne 0) { throw 'React dependency installation failed.' } + & npm.cmd test + if ($LASTEXITCODE -ne 0) { throw 'React interaction checks failed.' } + } finally { Pop-Location } +} +$buildReact = (-not $SkipReactBuild).ToString().ToLowerInvariant() +& $Dotnet build (Join-Path $root 'src/ZipXP.App/ZipXP.App.csproj') "-p:BuildReact=$buildReact" --nologo if ($LASTEXITCODE -ne 0) { throw 'WPF build failed.' } & $Dotnet run --project (Join-Path $root 'tests/ZipXP.Checks/ZipXP.Checks.csproj') if ($LASTEXITCODE -ne 0) { throw 'Service/integration checks failed.' } -$state = Join-Path $env:TEMP ('ZipXP-window-check-' + [Guid]::NewGuid().ToString('N')) -& $Dotnet run --project (Join-Path $root 'tests/ZipXP.Checks/ZipXP.Checks.csproj') -- --seed-ui $state -if ($LASTEXITCODE -ne 0) { throw 'UI fixture setup failed.' } -$dll = Join-Path $root 'src/ZipXP.App/bin/Debug/net10.0-windows/ZipXP.StorageManager.dll' -$start = [Diagnostics.ProcessStartInfo]::new() -$start.FileName = (Get-Command $Dotnet).Source -$start.UseShellExecute = $false -$start.CreateNoWindow = $true -$start.Arguments = '"' + $dll + '" --data-dir "' + $state + '" --launch-check' -$app = [Diagnostics.Process]::Start($start) -try { - # dotnet.exe is a console host, so WaitForInputIdle is not valid even with a WPF child window. - $deadline = [DateTime]::UtcNow.AddSeconds(15) - do { - $app.Refresh() - if ($app.HasExited -or $app.MainWindowHandle -ne 0) { break } - Start-Sleep -Milliseconds 100 - } while ([DateTime]::UtcNow -lt $deadline) - if ($app.HasExited -or $app.MainWindowHandle -eq 0 -or $app.MainWindowTitle -notlike 'ZipXP*') { throw 'ZipXP window was not found.' } - Write-Host "PASS: actual WPF dashboard launched: $($app.MainWindowTitle)" - Add-Type -AssemblyName UIAutomationClient - Add-Type -AssemblyName UIAutomationTypes - $window = [Windows.Automation.AutomationElement]::FromHandle($app.MainWindowHandle) - function Invoke-Button([string]$pattern) { - $deadline = [DateTime]::UtcNow.AddSeconds(5) - do { - $buttons = $window.FindAll([Windows.Automation.TreeScope]::Descendants, [Windows.Automation.PropertyCondition]::new([Windows.Automation.AutomationElement]::ControlTypeProperty, [Windows.Automation.ControlType]::Button)) - foreach ($button in $buttons) { - if ($button.Current.Name -like $pattern -and -not $button.Current.IsOffscreen) { - $invoke = $button.GetCurrentPattern([Windows.Automation.InvokePattern]::Pattern) - $invoke.Invoke() - return - } - } - Start-Sleep -Milliseconds 100 - } while ([DateTime]::UtcNow -lt $deadline) - throw "UI button not found: $pattern" - } - foreach ($page in @('Managed folders', 'Storage insights', 'Activity', 'Overview')) { - Invoke-Button $page - Write-Host "PASS: native dashboard navigation: $page" - } - $checkFile = Join-Path $state 'demo-fixture/analyze-only.txt' - if (([IO.File]::GetAttributes($checkFile) -band [IO.FileAttributes]::Compressed) -ne 0) { throw 'Analysis-only UI fixture was unexpectedly compressed.' } - Write-Host 'PASS: actual dashboard analysis does not compress files without an enabled policy.' - if (-not $app.WaitForExit(20000)) { throw 'Smoke-check app did not exit gracefully.' } - if ($app.ExitCode -ne 0) { throw "App exited with $($app.ExitCode)." } - Write-Host 'PASS: graceful worker/tray shutdown; isolated settings database retained.' -} finally { $app.Dispose() } +& (Join-Path $PSScriptRoot 'ui-check.ps1') -Dotnet $Dotnet diff --git a/scripts/dev.sh b/scripts/dev.sh index f193ce0..fde13b1 100755 --- a/scripts/dev.sh +++ b/scripts/dev.sh @@ -30,6 +30,33 @@ for arg in "$@"; do done if (( fresh && reset )); then echo 'Use either --fresh or --reset, not both.' >&2; exit 2; fi +# Noninteractive shells may not load NVM, and Windows npm can appear on WSL's PATH. +# Find a supported Linux Node and always pair it with npm from the same installation. +node_exe="" +node_candidates=() +if [[ -n "${ZIPXP_NODE_EXE:-}" ]]; then + node_candidates+=("$ZIPXP_NODE_EXE") +else + node_candidates+=("$(command -v node || true)") + while IFS= read -r candidate; do node_candidates+=("$candidate"); done < <( + printf '%s\n' "${NVM_DIR:-$HOME/.nvm}"/versions/node/*/bin/node | sort -Vr + ) +fi +for candidate in "${node_candidates[@]}"; do + [[ -x "$candidate" ]] || continue + if resolved_node="$("$candidate" -e 'const [major, minor] = process.versions.node.split(".").map(Number); if (process.platform !== "linux" || major < 22 || (major === 22 && minor < 12)) process.exit(1); process.stdout.write(process.execPath);' 2>/dev/null)"; then + if [[ -f "$(dirname -- "$resolved_node")/npm" ]]; then node_exe="$resolved_node"; break; fi + fi +done +if [[ -z "$node_exe" ]]; then + echo 'Could not find Linux Node.js 22.12+ with npm. Install it in WSL, or set ZIPXP_NODE_EXE to its node executable.' >&2 + exit 1 +fi +node_bin="$(dirname -- "$node_exe")" +export PATH="$node_bin:$PATH" +echo "Building React with Node $("$node_exe" --version) ($node_exe)" +(cd "$repo_root/src/ZipXP.UI" && "$node_exe" "$node_bin/npm" ci --no-fund --no-audit && "$node_exe" "$node_bin/npm" run build) + win_path() { powershell.exe -NoProfile -Command "$1" - -