Skip to content

Commit

Permalink
(fix) Fix Flaky Edge Package Test
Browse files Browse the repository at this point in the history
Add handling to bring edge under Chocolatey management if it was natively installed by a newer server OS.

This should ensure that the test is more consistent, delivering the same result regardless of if the Chocolatey package were installed or not.
  • Loading branch information
ryanrichter94 committed Aug 13, 2024
1 parent fab94c4 commit c7fe463
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions Start-C4bNexusSetup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,24 @@ process {
choco source add -n 'ChocolateyCore' -s "$((Get-NexusRepository -Name 'ChocolateyCore').url)/index.json" --priority 0 --admin-only

# Install a non-IE browser for browsing the Nexus web portal.
if (-not (Test-Path 'C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe')) {
if (Test-Path 'C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe'){
Write-Host "Syncing Microsoft Edge, to bring it under Chocolatey management"
choco sync --id="Microsoft Edge" --package-id="microsoft-edge"
}
else {
Write-Host "Installing Microsoft Edge, to allow viewing the Nexus site"
choco install microsoft-edge -y --source ChocolateyInternal
if ($LASTEXITCODE -eq 0) {
if (Test-Path 'HKLM:\SOFTWARE\Microsoft\Edge') {
$RegArgs = @{
Path = 'HKLM:\SOFTWARE\Microsoft\Edge\'
Name = 'HideFirstRunExperience'
Type = 'Dword'
Value = 1
Force = $true
}
$null = Set-ItemProperty @RegArgs
choco install microsoft-edge -y --source ChocolateyCore
}
if ($LASTEXITCODE -eq 0) {
if (Test-Path 'HKLM:\SOFTWARE\Microsoft\Edge') {
$RegArgs = @{
Path = 'HKLM:\SOFTWARE\Microsoft\Edge\'
Name = 'HideFirstRunExperience'
Type = 'Dword'
Value = 1
Force = $true
}
$null = Set-ItemProperty @RegArgs
}
}

Expand Down

0 comments on commit c7fe463

Please sign in to comment.