Release 0.0.6 with usable GUI diagnostics and capture controls
Windows tests / test-and-build (push) Canceled after 0s
Windows tests / test-and-build (push) Canceled after 0s
This commit is contained in:
1 parent
65f302279d
commit
41bb252214
18 files changed
+81
-37
No files matched your search
@@ -33,6 +33,8 @@ try{
|
||||
& (Join-Path $root 'Network.ps1') -Mode CaptureStart -CaptureDirectory $preview -WhatIf
|
||||
& (Join-Path $root 'Network.ps1') -Mode CaptureStop -CaptureDirectory $preview -WhatIf
|
||||
Assert-Capture (-not(Test-Path -LiteralPath $preview)) 'Capture preview created state on disk.'
|
||||
& (Join-Path $root 'Network.ps1') -Mode CaptureConvert -CaptureDirectory $preview -WhatIf
|
||||
Assert-Capture (-not(Test-Path -LiteralPath $preview)) 'Capture conversion preview created state on disk.'
|
||||
}finally{
|
||||
$full=[IO.Path]::GetFullPath($state);$temp=[IO.Path]::GetFullPath([IO.Path]::GetTempPath()).TrimEnd('\')+'\'
|
||||
if(-not$full.StartsWith($temp,[StringComparison]::OrdinalIgnoreCase)){throw 'Unsafe test cleanup path.'}
|
||||
|
||||
@@ -28,6 +28,9 @@ try{
|
||||
$invokerRun=Invoke-MsPrivateGroupPlan -Groups @([pscustomobject]@{Id='Invoker';Label='Captured script invoker';DependsOn=@();Action=$action})
|
||||
Assert-True ($invokerRun.Status-eq'Completed'-and[IO.File]::ReadAllText((Join-Path $ioRoot 'probe.txt'))-eq'nested-module') 'Captured child-script invoker failed across execution-module scope.'
|
||||
$threw=$false;try{& $invoker '..\outside.ps1' @{}|Out-Null}catch{$threw=$true};Assert-True $threw 'Child-script invoker accepted path traversal.'
|
||||
[IO.File]::WriteAllText((Join-Path $ioRoot 'Output.ps1'),'param([string]$Value) [pscustomobject]@{Value=$Value}')
|
||||
$output=& $invoker 'Output.ps1' @{Value='visible-audit'} -PassThru
|
||||
Assert-True ($output.Value-eq'visible-audit') 'GUI script invoker discarded requested output.'
|
||||
|
||||
$writerPath=Join-Path $ioRoot 'captured-writer.json';$writer=New-MsPrivateJsonWriter -Path $writerPath -Depth 4
|
||||
$writerAction=({& $writer ([pscustomobject]@{Value='captured-writer'})}.GetNewClosure())
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
#Requires -Version 5.1
|
||||
Set-StrictMode -Version Latest
|
||||
$ErrorActionPreference='Stop'
|
||||
$root=[IO.Path]::GetFullPath((Join-Path $PSScriptRoot '..'))
|
||||
$scratch=Join-Path ([IO.Path]::GetTempPath()) ('ms-private-gui-test-'+[guid]::NewGuid().ToString('N'))
|
||||
try{
|
||||
[IO.Directory]::CreateDirectory($scratch)|Out-Null
|
||||
foreach($folder in @('src','config')){Copy-Item -LiteralPath (Join-Path $root $folder) -Destination $scratch -Recurse}
|
||||
$source=[IO.File]::ReadAllText((Join-Path $root 'ms-private-GUI.ps1'))
|
||||
$marker='[void]$form.ShowDialog()'
|
||||
if(([regex]::Matches($source,[regex]::Escape($marker))).Count-ne1){throw 'GUI smoke test requires exactly one top-level window entry point.'}
|
||||
# Construct the real controls and event handlers without opening a window or clicking mutation actions.
|
||||
$check=@'
|
||||
try{
|
||||
if($tabs.TabPages.Count-ne6){throw 'Expected six GUI tabs.'}
|
||||
if($capturePath.Parent-ne$network-or$stopCapture.Parent-ne$network-or$convertCapture.Parent-ne$network){throw 'Capture controls are not attached to the network tab.'}
|
||||
if($stopCapture.Tag-ne'CaptureStop'-or$convertCapture.Tag-ne'CaptureConvert'){throw 'Capture controls target the wrong commands.'}
|
||||
if($securityAudit.Parent-ne$maintenance){throw 'Security audit button is missing.'}
|
||||
if($homeTab.Controls.Count-lt9){throw 'Home guide controls are missing.'}
|
||||
Write-Output 'GUI construction smoke check passed. No window actions were invoked.'
|
||||
}finally{$form.Dispose()}
|
||||
'@
|
||||
$path=Join-Path $scratch 'ms-private-GUI.ps1'
|
||||
[IO.File]::WriteAllText($path,$source.Replace($marker,$check),[Text.UTF8Encoding]::new($false))
|
||||
& $path
|
||||
}finally{
|
||||
$temp=[IO.Path]::GetFullPath([IO.Path]::GetTempPath()).TrimEnd('\')+'\'
|
||||
if(-not[IO.Path]::GetFullPath($scratch).StartsWith($temp,[StringComparison]::OrdinalIgnoreCase)){throw 'Unsafe GUI test cleanup path.'}
|
||||
if([IO.Directory]::Exists($scratch)){[IO.Directory]::Delete($scratch,$true)}
|
||||
}
|
||||
Reference in new issue
Block a user