Skip to content

Commit 65294b4

Browse files
committed
qa: exercise the installed native uninstaller and capture setup diagnostics
1 parent defc9ca commit 65294b4

2 files changed

Lines changed: 24 additions & 4 deletions

File tree

‎scripts/qa-desktop-removal.cjs‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,13 @@ for w in list where (w[kCGWindowOwnerName as String] as? String) == "Finder" &&
8383
} else {
8484
const script=path.join(temp,'phoenix-installer.sh');
8585
run('curl',['-fsSL','--retry','3','https://updates.phcode.io/linux/installer.sh','-o',script]);
86-
run('xvfb-run',['-a','bash',script],{timeout:480000});
86+
fs.mkdirSync(path.join(os.homedir(),'.config'),{recursive:true});
87+
fs.mkdirSync(path.join(os.homedir(),'.local','bin'),{recursive:true});
88+
const install = require('node:child_process').spawnSync('xvfb-run',['-a','bash',script],{
89+
timeout:480000,encoding:'utf8',maxBuffer:32*1024*1024,env:{...process.env,XDG_CURRENT_DESKTOP:'GNOME'}});
90+
const output=(install.stdout+'\n'+install.stderr).split('\n').filter(l=>!/^\s*\d+K /.test(l)).slice(-32).join('\n');
91+
record(output);
92+
if(install.status !== 0) record('Installer exited '+install.status+'; checking its actual installed files before testing removal.');
8793
for (const item of ['.phoenix-code/phoenix-code.AppImage','.local/share/applications/PhoenixCode.desktop','.local/bin/phcode']) {
8894
assert(fs.existsSync(path.join(os.homedir(),item)), 'Installed file '+item);
8995
}

‎scripts/qa-desktop-window.ps1‎

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,18 @@ $app = Find-App
1717
if (!$app) {throw 'Phoenix Code was not installed'}
1818
$exe = $app.UninstallString.Trim('"')
1919
Write-Output ("Installed program: " + $app.DisplayName + " " + $app.DisplayVersion)
20-
Start-Process -FilePath $exe
20+
$running = Start-Process -PassThru -FilePath $exe -ArgumentList ("_?=" + (Split-Path $exe -Parent))
2121
$root = [Windows.Automation.AutomationElement]::RootElement
2222
$trueCondition = [Windows.Automation.Condition]::TrueCondition
2323
$scope = [Windows.Automation.TreeScope]
2424
$buttonProp = [Windows.Automation.AutomationElement]::ControlTypeProperty
2525
function Get-Dialog {
2626
foreach ($win in $root.FindAll($scope::Children,$trueCondition)) {
27-
if ($win.Current.Name -match 'Phoenix Code' -and $win.Current.ClassName -eq '#32770') {return $win}
27+
if ($win.Current.Name -match 'Installer Language|Language Selection') {
28+
$ok = $win.FindAll($scope::Descendants,$trueCondition) | Where-Object { $_.Current.Name -eq 'OK' } | Select-Object -First 1
29+
if ($ok) { $ok.GetCurrentPattern([Windows.Automation.InvokePattern]::Pattern).Invoke() }
30+
}
31+
if (($win.Current.Name -match 'Phoenix Code' -or $win.Current.ProcessId -eq $running.Id) -and $win.Current.ClassName -eq '#32770') {return $win}
2832
}
2933
}
3034
$limit = [datetime]::UtcNow.AddSeconds(38)
@@ -36,7 +40,17 @@ do {
3640
$uninstall = $controls | Where-Object { $_.Current.Name.Trim('&') -eq 'Uninstall' -and $_.Current.ControlType -eq [Windows.Automation.ControlType]::Button } | Select-Object -First 1
3741
}
3842
} until ($uninstall -or [datetime]::UtcNow -gt $limit)
39-
if (!$uninstall) {throw 'The native confirmation dialog or Uninstall button was unavailable.'}
43+
if (!$uninstall) {
44+
$detail = foreach ($win in $root.FindAll($scope::Children,$trueCondition)) {
45+
$win.Current.Name + ' | ' + $win.Current.ClassName + ' | ' + $win.Current.ProcessId
46+
if ($win.Current.Name -match 'Phoenix|Language|Setup|Uninstall') {
47+
@($win.FindAll($scope::Descendants,$trueCondition) | ForEach-Object { $_.Current.Name })
48+
}
49+
}
50+
$detail += (Get-Process | Where-Object { $_.ProcessName -match 'install|^Au_|phoenix' } | Format-Table Name,MainWindowTitle,MainWindowHandle,Id,SessionId | Out-String)
51+
$detail | Out-File (Join-Path $ArtifactDir 'native-windows.txt')
52+
throw "The native confirmation dialog or Uninstall button was unavailable: $detail"
53+
}
4054
$names = @($controls | ForEach-Object { $_.Current.Name } | Where-Object { $_ } | Select-Object -Unique)
4155
Write-Output $dialog.Current.Name
4256
Write-Output ($names -join ' / ')

0 commit comments

Comments
 (0)