mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Enable more tests to be run in a container. (#17294)
This commit is contained in:
@@ -42,6 +42,7 @@ Describe 'Online help tests for PowerShell Cmdlets' -Tags "Feature" {
|
||||
|
||||
# TopicTitle - is the cmdlet name in the csv file
|
||||
# HelpURI - is the expected help URI in the csv file
|
||||
# If this is correct, then launching the cmdlet should open the expected help URI.
|
||||
|
||||
It "Validate 'get-help $($cmdlet.TopicTitle) -Online'" -Skip:$skipTest {
|
||||
$actualURI = Get-Help $cmdlet.TopicTitle -Online
|
||||
@@ -52,48 +53,6 @@ Describe 'Online help tests for PowerShell Cmdlets' -Tags "Feature" {
|
||||
}
|
||||
}
|
||||
|
||||
Describe 'Get-Help -Online opens the default web browser and navigates to the cmdlet help content' -Tags "Feature" {
|
||||
|
||||
$skipTest = [System.Management.Automation.Platform]::IsIoT -or
|
||||
[System.Management.Automation.Platform]::IsNanoServer -or
|
||||
$env:__INCONTAINER -eq 1
|
||||
|
||||
# this code is a workaround for issue: https://github.com/PowerShell/PowerShell/issues/3079
|
||||
if((-not ($skipTest)) -and $IsWindows)
|
||||
{
|
||||
$skipTest = $true
|
||||
$regKey = "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice"
|
||||
|
||||
try
|
||||
{
|
||||
$progId = (Get-ItemProperty $regKey).ProgId
|
||||
if($progId)
|
||||
{
|
||||
if (-not (Test-Path 'HKCR:\'))
|
||||
{
|
||||
New-PSDrive -PSProvider registry -Root HKEY_CLASSES_ROOT -Name HKCR | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
$browserExe = ((Get-ItemProperty "HKCR:\$progId\shell\open\command")."(default)" -replace '"', '') -split " "
|
||||
if ($browserExe.count -ge 1)
|
||||
{
|
||||
if($browserExe[0] -match '.exe')
|
||||
{
|
||||
$skipTest = $false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
# We are not able to access Registry, skipping test.
|
||||
}
|
||||
}
|
||||
|
||||
It "Get-Help get-process -online" -Skip:$skipTest {
|
||||
{ Get-Help get-process -Online } | Should -Not -Throw
|
||||
}
|
||||
}
|
||||
|
||||
Describe 'Get-Help -Online is not supported on Nano Server and IoT' -Tags "CI" {
|
||||
|
||||
$skipTest = -not ([System.Management.Automation.Platform]::IsIoT -or [System.Management.Automation.Platform]::IsNanoServer)
|
||||
|
||||
@@ -578,7 +578,7 @@ Describe "Help failure cases" -Tags Feature {
|
||||
|
||||
# under some conditions this does not throw, so include what we actually got
|
||||
$helpTopic = [guid]::NewGuid().ToString("N")
|
||||
{ & $command $helpTopic -ErrorAction Stop } | Should -Throw -ErrorId "HelpNotFound,Microsoft.PowerShell.Commands.GetHelpCommand" -Because "$(& $command $helpTopic -ea Ignore)"
|
||||
{ & $command $helpTopic -ErrorAction Stop } | Should -Throw -ErrorId "HelpNotFound,Microsoft.PowerShell.Commands.GetHelpCommand" -Because "A help topic was unexpectantly found for $helpTopic"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user