Files
pyramid/scripts/test.ps1
T
Bernd SteckmeisterandClaude Opus 5.5 87b472a373 fix(ui): UX-Audit – Sackgassen, tote Knöpfe, englische Reste; Screenshot-Tour
Bernds Wunsch 2026-10-08: UI grundsätzlich prüfen (Navigation, Sackgassen,
Anruf-Logik). Audit + Konzept in docs/UI_AUDIT.md, belegt mit neuer
Screenshot-Tour integration_test/ui_audit_tour_test.dart (35 Zustände,
Handy + PC, zwei Testkonten, Test-Space mit Sprachkanal).

Sofort behoben:
- S1/S2: Gegenseite legt auf / Anruf scheitert / Sprachkanal bricht ab →
  automatisch zurück zum Chat mit Hinweis (Fehler sichtbar statt still);
  leere Anrufansicht deutsch mit Zurück-Knopf (vorher englische Sackgasse
  ohne Zurück am Handy).
- S4: toter „Threads“-Knopf entfernt. S5: Space betreten (PC) öffnet
  letzten bzw. ersten Textkanal. S6: keine doppelte Anrufsteuerung am PC.
- Annehmen-Fenster mit Anrufer-Avatar und Anrufart; eigene Kachel mit
  eigenem Initial statt „D“; Mitgliederliste rund mit Profilbild und „(Du)“;
  Tastaturkürzel nur am PC; englische Texte in Anruf/Leerzuständen deutsch.
- Tests: Fehlerempfänger des Testrahmens nach app.main() zurück (vorher
  verschwanden Fehlermeldungen), Lesebestätigungs-Test im Wegwerf-Raum statt
  in der DM, robustere Schritte; test.ps1 räumt liegengebliebene
  Test-Prozesse weg; gemeinsame Hilfen integration_test/support/.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-09 11:35:40 +02:00

160 lines
7.1 KiB
PowerShell
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#Requires -Version 7.0
# Pyramid – Tests & Benchmarks mit einem Befehl
#
# pwsh scripts/test.ps1 Analyse + Unit-Tests (Standard, ~2 min)
# pwsh scripts/test.ps1 -Live + Live-Test gegen steggi-matrix.work
# (Test-Accounts pyramidtest1/2, NICHT Bernd/Uta)
# pwsh scripts/test.ps1 -Bench + Benchmarks (Datenbank/Verschlüsselung, Migration)
# pwsh scripts/test.ps1 -Ui + UI-Durchlauf im Handy-Format mit Screenshots
# (echte App, Testprofil pyramidtest1 → build/ui_screens/)
# pwsh scripts/test.ps1 -All alles zusammen
# pwsh scripts/test.ps1 -Bench -UpdateBaseline
# Benchmark-Werte als neue Baseline speichern
# (nach bewusster Änderung / auf neuer Hardware)
# -SkipAnalyze flutter analyze überspringen
#
# Details: docs/TESTS_UND_BENCHMARKS.md
param(
[switch]$Live,
[switch]$Bench,
[switch]$Ui,
[switch]$All,
[switch]$UpdateBaseline,
[switch]$SkipAnalyze
)
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
# Immer aus dem Projektordner arbeiten, egal von wo das Skript aufgerufen wird.
Set-Location (Split-Path $PSScriptRoot -Parent)
if ($All) { $Live = $true; $Bench = $true; $Ui = $true }
$results = [System.Collections.Generic.List[object]]::new()
function Invoke-Step([string]$Name, [scriptblock]$Action) {
Write-Host ""
Write-Host "━━ $Name" -ForegroundColor Cyan
$watch = [Diagnostics.Stopwatch]::StartNew()
$global:LASTEXITCODE = 0
& $Action
$ok = ($LASTEXITCODE -eq 0)
$results.Add([pscustomobject]@{
Schritt = $Name
Ergebnis = if ($ok) { "OK" } else { "FEHLER" }
Dauer = "{0:n0} s" -f $watch.Elapsed.TotalSeconds
})
if (-not $ok) { Write-Host "✗ $Name fehlgeschlagen (Exit-Code $LASTEXITCODE)" -ForegroundColor Red }
}
function Add-Skipped([string]$Name, [string]$Reason) {
Write-Host ""
Write-Host "━━ $Name – übersprungen: $Reason" -ForegroundColor Yellow
$results.Add([pscustomobject]@{ Schritt = $Name; Ergebnis = "ÜBERSPRUNGEN"; Dauer = "–" })
}
# ── SQLCipher-Bibliothek ─────────────────────────────────────────────────────
# Die Datenbank-Tests und Benchmarks benutzen dieselbe sqlite3.dll (SQLCipher)
# wie die App – sie entsteht beim Windows-Build. Fehlt sie, einmal bauen.
$cipherDll = Get-ChildItem "build/windows/x64/runner/*/sqlite3.dll" -ErrorAction SilentlyContinue |
Select-Object -First 1
if (-not $cipherDll) {
Invoke-Step "Windows-Build (einmalig, liefert die SQLCipher-DLL)" {
flutter build windows --debug
}
}
if (-not $SkipAnalyze) {
# Infos (z. B. der bekannte onUpdate-Hinweis) werden angezeigt, lassen den
# Lauf aber nicht scheitern – Warnungen und Fehler schon.
Invoke-Step "Statische Analyse (flutter analyze)" { flutter analyze --no-fatal-infos }
}
Invoke-Step "Unit-Tests (test/)" { flutter test }
if ($Live) {
$accounts = if ($env:PYRAMID_TEST_ACCOUNTS) { $env:PYRAMID_TEST_ACCOUNTS }
else { Join-Path $env:USERPROFILE ".pyramid-autopilot\test-accounts.txt" }
if (-not (Test-Path $accounts)) {
Add-Skipped "Live-Test (echter Homeserver)" "Zugangsdatei fehlt: $accounts"
} else {
$env:PYRAMID_LIVE_TEST = "1"
try {
Invoke-Step "Live-Test: SQLCipher mit echtem Login (pyramidtest1)" {
flutter test test/live_encryption_e2e_test.dart --concurrency=1
}
Invoke-Step "Live-Test: Logout + sofortiger Re-Login (SDK-Wettlauf)" {
flutter test test/live_logout_race_test.dart --concurrency=1
}
} finally {
Remove-Item Env:PYRAMID_LIVE_TEST -ErrorAction SilentlyContinue
}
}
}
if ($Bench) {
if ($UpdateBaseline) { $env:PYRAMID_BENCH_UPDATE_BASELINE = "1" }
try {
# concurrency=1: Benchmarks dürfen sich nicht gegenseitig die CPU klauen.
Invoke-Step "Benchmarks (benchmark/)" { flutter test benchmark --concurrency=1 }
} finally {
Remove-Item Env:PYRAMID_BENCH_UPDATE_BASELINE -ErrorAction SilentlyContinue
}
Write-Host "Benchmark-Berichte: build/benchmarks/*.json (Baseline: benchmark/baseline/)"
}
if ($Ui) {
$uiProfile = Join-Path $env:USERPROFILE ".pyramid-autopilot\profile1"
if (-not (Test-Path (Join-Path $uiProfile "pyramid.sqlite"))) {
Add-Skipped "UI-Durchlauf (Handy-Format)" "Testprofil fehlt: $uiProfile"
} elseif (Get-Process pyramid -ErrorAction SilentlyContinue |
Where-Object { $_.Path -like "*\build\windows\*" }) {
# Nie zwei Matrix-Clients auf derselben DB: ein noch laufender Testlauf
# (Build-Ordner) nutzt profile1. Bernds echte Pyramid und seine
# Testinstanz (profile2, C:\Users\nordm\pyramid-testinstanz) stören nicht.
Add-Skipped "UI-Durchlauf (Handy-Format)" "Ein Testlauf läuft noch – erst beenden"
} else {
$env:PYRAMID_PROFILE_DIR = $uiProfile
try {
Invoke-Step "UI-Durchlauf (Handy-Format, Testprofil)" {
flutter test integration_test/mobile_ui_screens_test.dart -d windows
}
$accounts = Join-Path $env:USERPROFILE ".pyramid-autopilot\test-accounts.txt"
if (Test-Path $accounts) {
Invoke-Step "Live: Lesebestätigung + Einladung (2 Testkonten)" {
flutter test integration_test/live_receipts_invite_test.dart -d windows
}
# Nutzt kurz Mikrofon + Bildschirm (nur lokal zwischen zwei Testkonten).
Invoke-Step "Live: 1:1-Anruf, Ton + Bildschirm teilen (2 Testkonten)" {
flutter test integration_test/live_call_test.dart -d windows
}
} else {
Add-Skipped "Live: Lesebestätigung + Einladung" "test-accounts.txt fehlt"
}
} finally {
Remove-Item Env:PYRAMID_PROFILE_DIR -ErrorAction SilentlyContinue
# Integrationstests lassen die Test-App manchmal weiterlaufen – die
# hielte die Testprofil-DB offen (zwei Clients auf einer DB beim
# nächsten Lauf). Nur Prozesse aus DIESEM Build-Ordner beenden.
Get-Process pyramid -ErrorAction SilentlyContinue |
Where-Object { $_.Path -like "$PWDuild\windows\*" } |
Stop-Process -Force -Confirm:$false -ErrorAction SilentlyContinue
}
Write-Host "Screenshots: build/ui_screens/ (Testinhalte ggf. mit test/live_ui_fixture_test.dart anlegen)"
}
}
Write-Host ""
Write-Host "━━ Zusammenfassung" -ForegroundColor Cyan
$results | Format-Table -AutoSize | Out-String | Write-Host
$failed = @($results | Where-Object { $_.Ergebnis -eq "FEHLER" })
if ($failed.Count -gt 0) {
Write-Host "✗ $($failed.Count) Schritt(e) fehlgeschlagen." -ForegroundColor Red
exit 1
}
Write-Host "✓ Alles grün." -ForegroundColor Green
exit 0