2023-05-05 12:13:47 +02:00
Import-Module " $PSScriptRoot /../helpers/Common.Helpers.psm1 "
2021-01-29 16:37:48 +07:00
$os = Get-OSVersion
Describe " Disk free space " {
It " Image has more than 10GB free space " {
# we should have at least 10 GB of free space on macOS images
# https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops#capabilities-and-limitations
$freeSpace = ( Get-PSDrive " / " ) . Free
$freeSpace | Should -BeGreaterOrEqual 10 GB
}
}
Describe " Certificate " {
It " Apple Worldwide Developer Relations Certification Authority[expired: 2030-02] is installed " {
$sha1Hash = " 06EC06599F4ED0027CC58956B4D3AC1255114F35 "
$certs = security find-certificate -a -c Worldwide -p -Z | Out-String
$certs | Should -Match $sha1Hash
}
2022-02-09 10:34:31 +03:00
It " Developer ID Certification Authority[expired: 2031-09] is installed " {
$sha1Hash = " 5B45F61068B29FCC8FFFF1A7E99B78DA9E9C4635 "
$certs = security find-certificate -a -c " Developer ID " -p -Z | Out-String
$certs | Should -Match $sha1Hash
}
2021-01-29 16:37:48 +07:00
}
2023-11-10 18:53:24 +01:00
Describe " Audio device " -Skip: ( $os . IsVentura -or $os . IsSonoma ) {
2021-01-29 16:37:48 +07:00
It " Sox is installed " {
" sox --version " | Should -ReturnZeroExitCode
}
It " SwitchAudioSource is installed " {
" SwitchAudioSource -c " | Should -ReturnZeroExitCode
}
2023-02-13 16:40:48 +01:00
It " Audio channel BlackHole 2ch " {
2021-06-08 10:44:31 +03:00
SwitchAudioSource -c | Should -BeLikeExactly " BlackHole 2ch "
}
2021-01-29 16:37:48 +07:00
}
2023-05-12 13:30:13 +02:00
Describe " Screen Resolution " -Skip: ( isVeertu ) {
2021-01-29 16:37:48 +07:00
It " Screen Resolution " {
2021-09-27 09:03:26 +00:00
system_profiler SPDisplaysDataType | Select-String " Resolution " | Should -Match " 1176 x 885|1920 x 1080 "
2021-01-29 16:37:48 +07:00
}
}
2022-02-10 18:10:43 +03:00
2023-05-12 13:30:13 +02:00
Describe " Open windows " -Skip: ( isVeertu ) {
2022-02-10 18:10:43 +03:00
It " Opened windows not found " {
2022-11-21 10:55:49 +01:00
'tell application id "com.apple.systemevents" to get every window of (every process whose class of windows contains window)' | Tee-Object / tmp / windows . osascript
$cmd = " osascript /tmp/windows.osascript "
2022-02-10 18:10:43 +03:00
$openWindows = bash -c $cmd
$openWindows . Split ( " , " ) . Trim ( ) | Where-Object { $_ -notmatch " NotificationCenter " } | Should -BeNullOrEmpty
}
}
2022-04-20 17:25:58 +02:00
Describe " AutomationModeTool " {
2023-05-24 15:34:44 +02:00
It " Does not require user authentication " -Skip: ( $os . IsBigSur ) {
2022-04-20 17:25:58 +02:00
automationmodetool | Out-String | Should -Match " DOES NOT REQUIRE "
}
}