fixed browser tests

This commit is contained in:
Aleksandr Chebotov
2020-07-13 11:44:04 +03:00
parent 81865d867e
commit f8bf39d9ad
3 changed files with 20 additions and 23 deletions

View File

@@ -18,7 +18,7 @@ Describe "Chrome" {
Context "Browser" { Context "Browser" {
$chromeRegPath = "HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe" $chromeRegPath = "HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe"
It "$edgeRegPath registry path exists" -TestCases @{chromeRegPath = $chromeRegPath} { It "Chrome <chromeRegPath> registry path exists" -TestCases @{chromeRegPath = $chromeRegPath} {
$chromeRegPath | Should -Exist $chromeRegPath | Should -Exist
} }
@@ -67,7 +67,7 @@ Describe "Edge" {
Context "Browser" { Context "Browser" {
$edgeRegPath = "HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\msedge.exe" $edgeRegPath = "HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\msedge.exe"
It "$edgeRegPath registry path exists" -TestCases @{edgeRegPath = $edgeRegPath} { It "Edge <edgeRegPath> registry path exists" -TestCases @{edgeRegPath = $edgeRegPath} {
$edgeRegPath | Should -Exist $edgeRegPath | Should -Exist
} }
@@ -102,7 +102,7 @@ Describe "Firefox" {
Context "Browser" { Context "Browser" {
$firefoxRegPath = "HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe" $firefoxRegPath = "HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe"
It "$firefoxRegPath registry path exists" -TestCases @{firefoxRegPath = $firefoxRegPath} { It "Firefox <firefoxRegPath> registry path exists" -TestCases @{firefoxRegPath = $firefoxRegPath} {
$firefoxRegPath | Should -Exist $firefoxRegPath | Should -Exist
} }
@@ -125,7 +125,7 @@ Describe "Internet Explorer" {
$env:IEWebDriver | Should -Exist $env:IEWebDriver | Should -Exist
} }
It "iedriverserver.exe is intalled" { It "iedriverserver.exe is installed" {
"$env:IEWebDriver\IEDriverServer.exe --version" | Should -ReturnZeroExitCode "$env:IEWebDriver\IEDriverServer.exe --version" | Should -ReturnZeroExitCode
} }

View File

@@ -15,7 +15,7 @@ Describe "Git" {
(Get-Command -Name $toolName).Source | Should -Match $source (Get-Command -Name $toolName).Source | Should -Match $source
} }
It "hub is installed" { It "ToolName 'hub' is installed" {
"hub --version" | Should -ReturnZeroExitCode "hub --version" | Should -ReturnZeroExitCode
} }

View File

@@ -1,33 +1,30 @@
Describe "Haskell" { Describe "Haskell" {
It "ghc" {
"ghc --version" | Should -ReturnZeroExitCode
}
It "cabal" {
"cabal --version" | Should -ReturnZeroExitCode
}
$chocoPackagesPath = Join-Path $env:ChocolateyInstall "lib" $chocoPackagesPath = Join-Path $env:ChocolateyInstall "lib"
[array]$ghcVersionList = Get-ChildItem -Path $chocoPackagesPath -Filter "ghc.*" | ForEach-Object { $_.Name.TrimStart("ghc.") } [array]$ghcVersionList = Get-ChildItem -Path $chocoPackagesPath -Filter "ghc.*" | ForEach-Object { $_.Name.TrimStart("ghc.") }
$ghcCount = $ghcVersionList.Count $ghcCount = $ghcVersionList.Count
$defaultGhcVersion = $ghcVersionList | Sort-Object {[Version]$_} | Select-Object -Last 1
$ghcTestCases = $ghcVersionList | ForEach-Object {
$ghcVersion = $_
@{
ghcVersion = $ghcVersion
binGhcPath = Join-Path $chocoPackagesPath "ghc.$ghcVersion\tools\ghc-$ghcVersion\bin\ghc.exe"
}
}
It "Accurate 3 versions of GHC are installed" -TestCases @{ghcCount = $ghcCount} { It "Accurate 3 versions of GHC are installed" -TestCases @{ghcCount = $ghcCount} {
$ghcCount | Should -BeExactly 3 $ghcCount | Should -BeExactly 3
} }
$ghcTestCases = $ghcVersionList | ForEach-Object { It "GHC <ghcVersion> is installed" -TestCases $ghcTestCases {
@{
ghcVersion = $_
}
}
It "<ghcVersion> is installed" -TestCases $ghcTestCases {
$binGhcPath = Join-Path $env:ChocolateyInstall "lib\ghc.$ghcVersion\tools\ghc-$ghcVersion\bin\ghc.exe"
& $binGhcPath --version | Should -Match $ghcVersion & $binGhcPath --version | Should -Match $ghcVersion
} }
It "Default version of GHC should be the latest installed" -TestCases @{ghcVersionList = $ghcVersionList} { It "GHC <defaultGhcVersion> is the default version and should be the latest installed" -TestCases @{defaultGhcVersion = $defaultGhcVersion} {
$defaultGhcVersion = $ghcVersionList | Sort-Object {[Version]$_} |Select-Object -Last 1
ghc --version | Should -Match $defaultGhcVersion ghc --version | Should -Match $defaultGhcVersion
} }
It "Cabal is installed" {
"cabal --version" | Should -ReturnZeroExitCode
}
} }