Files
runner-images/images/macos/scripts/build/install-edge.sh
Alexey-Ayupov ed3d2204db [macOS] refactor utils.sh and related scripts (#8998)
* Update Software Report to support azcopy output

* Update util.sh and related scripts

* Remove rosetta test from the script

* Update mono script

* clean up

* remove condition from install pipx script

* Update scripts according to comments

---------

Co-authored-by: Alexey Ayupov <“alexey.ayupov@akvelon.com”>
2023-12-21 14:48:28 +01:00

63 lines
2.3 KiB
Bash

#!/bin/bash -e -o pipefail
################################################################################
## File: install-edge.sh
## Desc: Install edge browser
################################################################################
source ~/utils/utils.sh
echo "Installing Microsoft Edge..."
brew install --cask microsoft-edge
EDGE_INSTALLATION_PATH="/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge"
edge_version=$("$EDGE_INSTALLATION_PATH" --version | cut -d' ' -f 3)
edge_version_major=$(echo $edge_version | cut -d'.' -f 1)
echo "Version of Microsoft Edge: ${edge_version}"
echo "Installing Microsoft Edge WebDriver..."
edge_driver_version_file_path=$(download_with_retry "https://msedgedriver.azureedge.net/LATEST_RELEASE_${edge_version_major}_MACOS")
edge_driver_latest_version=$(iconv -f utf-16 -t utf-8 "$edge_driver_version_file_path" | tr -d '\r')
edge_driver_url="https://msedgedriver.azureedge.net/${edge_driver_latest_version}/edgedriver_mac64.zip"
echo "Compatible version of WebDriver: ${edge_driver_latest_version}"
edge_driver_archive_path=$(download_with_retry "$edge_driver_url")
# Move webdriver to the separate directory to be consistent with the docs
# https://docs.microsoft.com/en-us/azure/devops/pipelines/test/continuous-test-selenium?view=azure-devops#decide-how-you-will-deploy-and-test-your-app
EDGE_DRIVER_DIR="/usr/local/share/edge_driver"
mkdir -p $EDGE_DRIVER_DIR
unzip -qq "$edge_driver_archive_path" -d "$EDGE_DRIVER_DIR"
ln -s "$EDGE_DRIVER_DIR/msedgedriver" "/usr/local/bin/msedgedriver"
echo "export EDGEWEBDRIVER=${EDGE_DRIVER_DIR}" >> "${HOME}/.bashrc"
# Configure Edge Updater to prevent auto update
# https://learn.microsoft.com/en-us/deployedge/edge-learnmore-edgeupdater-for-macos
sudo mkdir "/Library/Managed Preferences"
cat <<EOF | sudo tee "/Library/Managed Preferences/com.microsoft.EdgeUpdater.plist" > /dev/null
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>updatePolicies</key>
<dict>
<key>global</key>
<dict>
<key>UpdateDefault</key>
<integer>3</integer>
</dict>
</dict>
</dict>
</plist>
EOF
sudo chown root:wheel "/Library/Managed Preferences/com.microsoft.EdgeUpdater.plist"
invoke_tests "Browsers" "Edge"