mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2025-12-30 13:27:15 +08:00
[macOS] Activate "Allow Remote Automation" Safari option during image generation (#3996)
* Move logic to activate "Allow Remote Automation" from base image to image gen scripts * add shebang
This commit is contained in:
@@ -2,12 +2,6 @@
|
||||
|
||||
source ~/utils/utils.sh
|
||||
|
||||
echo "Enabling safari driver..."
|
||||
# https://developer.apple.com/documentation/webkit/testing_with_webdriver_in_safari
|
||||
# Safari’s executable is located at /usr/bin/safaridriver
|
||||
# Configure Safari to Enable WebDriver Support
|
||||
sudo safaridriver --enable
|
||||
|
||||
echo "Enabling developer mode..."
|
||||
sudo /usr/sbin/DevToolsSecurity --enable
|
||||
|
||||
|
||||
16
images/macos/provision/core/safari.sh
Normal file
16
images/macos/provision/core/safari.sh
Normal file
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash -e -o pipefail
|
||||
|
||||
echo "Enabling safari driver..."
|
||||
# https://developer.apple.com/documentation/webkit/testing_with_webdriver_in_safari
|
||||
# Safari’s executable is located at /usr/bin/safaridriver
|
||||
# Configure Safari to Enable WebDriver Support
|
||||
sudo safaridriver --enable
|
||||
|
||||
echo "Enabling the 'Allow Remote Automation' option in Safari's Develop menu"
|
||||
mkdir -p $HOME/Library/WebDriver
|
||||
safari_plist="$HOME/Library/WebDriver/com.apple.Safari.plist"
|
||||
# "|| true" is needed to suppress exit code 1 in case if property or file doesn't exist
|
||||
/usr/libexec/PlistBuddy -c 'delete AllowRemoteAutomation' $safari_plist || true
|
||||
/usr/libexec/PlistBuddy -c 'add AllowRemoteAutomation bool true' $safari_plist
|
||||
|
||||
invoke_tests "Browsers" "Safari"
|
||||
@@ -171,6 +171,7 @@
|
||||
"./provision/core/postgresql.sh",
|
||||
"./provision/core/mongodb.sh",
|
||||
"./provision/core/miniconda.sh",
|
||||
"./provision/core/safari.sh",
|
||||
"./provision/core/chrome.sh",
|
||||
"./provision/core/edge.sh",
|
||||
"./provision/core/firefox.sh",
|
||||
|
||||
@@ -176,6 +176,7 @@
|
||||
"./provision/core/postgresql.sh",
|
||||
"./provision/core/mongodb.sh",
|
||||
"./provision/core/audiodevice.sh",
|
||||
"./provision/core/safari.sh",
|
||||
"./provision/core/chrome.sh",
|
||||
"./provision/core/edge.sh",
|
||||
"./provision/core/firefox.sh",
|
||||
|
||||
@@ -181,6 +181,7 @@
|
||||
"./provision/core/audiodevice.sh",
|
||||
"./provision/core/vcpkg.sh",
|
||||
"./provision/core/miniconda.sh",
|
||||
"./provision/core/safari.sh",
|
||||
"./provision/core/chrome.sh",
|
||||
"./provision/core/edge.sh",
|
||||
"./provision/core/firefox.sh",
|
||||
|
||||
@@ -185,6 +185,7 @@
|
||||
"./provision/core/audiodevice.sh",
|
||||
"./provision/core/vcpkg.sh",
|
||||
"./provision/core/miniconda.sh",
|
||||
"./provision/core/safari.sh",
|
||||
"./provision/core/chrome.sh",
|
||||
"./provision/core/edge.sh",
|
||||
"./provision/core/firefox.sh",
|
||||
|
||||
@@ -31,4 +31,15 @@ Describe "Firefox" {
|
||||
It "Geckodriver" {
|
||||
"geckodriver --version" | Should -ReturnZeroExitCode
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Safari" {
|
||||
It "'Allow Remote Automation' option is activated" {
|
||||
$plistPath = "$env:HOME/Library/WebDriver/com.apple.Safari.plist"
|
||||
$command = "/usr/libexec/PlistBuddy -c 'print AllowRemoteAutomation' $plistPath"
|
||||
$plistPath | Should -Exist
|
||||
$commandResult = Get-CommandResult $command
|
||||
$commandResult.ExitCode | Should -Be 0
|
||||
$commandResult.Output | Should -Be "true"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user