mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2025-12-31 14:07:39 +08:00
[macOS] Add test to check opened windows (#5052)
* Add test to check opened windows * Move check before xcode * Move check after homebrew * Exclude NotificationCenter * Update pester test
This commit is contained in:
committed by
GitHub
parent
84450e8a9d
commit
a31ed06b10
21
images/macos/provision/core/open_windows_check.sh
Normal file
21
images/macos/provision/core/open_windows_check.sh
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash -e -o pipefail
|
||||
|
||||
openwindows=$(osascript -e 'tell application "System Events" to get every window of (every process whose class of windows contains window)')
|
||||
IFS=',' read -r -a windowslist <<< "$openwindows"
|
||||
|
||||
if [ -n "${openwindows}" ]; then
|
||||
echo "Found opened window:"
|
||||
fi
|
||||
|
||||
for window in "${windowslist[@]}"; do
|
||||
if [[ $window =~ "NotificationCenter" ]]; then
|
||||
echo "[Warning] $window"
|
||||
else
|
||||
echo " - ${window}" | xargs
|
||||
scripterror=true
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "${scripterror}" = true ]; then
|
||||
exit 1
|
||||
fi
|
||||
@@ -131,6 +131,7 @@
|
||||
"scripts": [
|
||||
"./provision/core/xcode-clt.sh",
|
||||
"./provision/core/homebrew.sh",
|
||||
"./provision/core/open_windows_check.sh",
|
||||
"./provision/core/powershell.sh",
|
||||
"./provision/core/dotnet.sh",
|
||||
"./provision/core/python.sh",
|
||||
|
||||
@@ -136,6 +136,7 @@
|
||||
"pause_before": "30s",
|
||||
"scripts": [
|
||||
"./provision/core/homebrew.sh",
|
||||
"./provision/core/open_windows_check.sh",
|
||||
"./provision/core/powershell.sh",
|
||||
"./provision/core/dotnet.sh",
|
||||
"./provision/core/python.sh",
|
||||
|
||||
@@ -135,6 +135,7 @@ build {
|
||||
pause_before = "30s"
|
||||
scripts = [
|
||||
"./provision/core/homebrew.sh",
|
||||
"./provision/core/open_windows_check.sh",
|
||||
"./provision/core/powershell.sh",
|
||||
"./provision/core/dotnet.sh",
|
||||
"./provision/core/python.sh",
|
||||
|
||||
@@ -136,6 +136,7 @@
|
||||
"pause_before": "30s",
|
||||
"scripts": [
|
||||
"./provision/core/homebrew.sh",
|
||||
"./provision/core/open_windows_check.sh",
|
||||
"./provision/core/powershell.sh",
|
||||
"./provision/core/dotnet.sh",
|
||||
"./provision/core/python.sh",
|
||||
|
||||
@@ -46,3 +46,11 @@ Describe "Screen Resolution" {
|
||||
system_profiler SPDisplaysDataType | Select-String "Resolution" | Should -Match "1176 x 885|1920 x 1080"
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Open windows" {
|
||||
It "Opened windows not found" {
|
||||
$cmd = "osascript -e 'tell application \""System Events\"" to get every window of (every process whose class of windows contains window)'"
|
||||
$openWindows = bash -c $cmd
|
||||
$openWindows.Split(",").Trim() | Where-Object { $_ -notmatch "NotificationCenter" } | Should -BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user