mirror of
https://github.com/actions/runner-images.git
synced 2025-12-13 20:56:47 +00:00
[Ubuntu] Rework Selenium installation (#4308)
This commit is contained in:
committed by
GitHub
parent
f5d2b977cd
commit
d502c64087
@@ -23,6 +23,12 @@ function Get-ChromiumVersion {
|
||||
return $chromiumVersion
|
||||
}
|
||||
|
||||
function Get-SeleniumVersion {
|
||||
$seleniumBinaryName = Get-ToolsetValue "selenium.binary_name"
|
||||
$fullSeleniumVersion = (Get-ChildItem "/usr/share/java/${seleniumBinaryName}-*").Name -replace "${seleniumBinaryName}-"
|
||||
return "Selenium server $fullSeleniumVersion"
|
||||
}
|
||||
|
||||
function Build-BrowserWebdriversEnvironmentTable {
|
||||
return @(
|
||||
@{
|
||||
@@ -32,6 +38,10 @@ function Build-BrowserWebdriversEnvironmentTable {
|
||||
@{
|
||||
"Name" = "GECKOWEBDRIVER"
|
||||
"Value" = $env:GECKOWEBDRIVER
|
||||
},
|
||||
@{
|
||||
"Name" = "SELENIUM_JAR_PATH"
|
||||
"Value" = $env:SELENIUM_JAR_PATH
|
||||
}
|
||||
) | ForEach-Object {
|
||||
[PSCustomObject] @{
|
||||
|
||||
@@ -212,7 +212,8 @@ $browsersAndDriversList = @(
|
||||
(Get-ChromeDriverVersion),
|
||||
(Get-FirefoxVersion),
|
||||
(Get-GeckodriverVersion),
|
||||
(Get-ChromiumVersion)
|
||||
(Get-ChromiumVersion),
|
||||
(Get-SeleniumVersion)
|
||||
)
|
||||
|
||||
$markdown += New-MDList -Style Unordered -Lines $browsersAndDriversList
|
||||
|
||||
@@ -7,14 +7,19 @@
|
||||
# Source the helpers for use with the script
|
||||
source $HELPER_SCRIPTS/install.sh
|
||||
|
||||
# Temporarily download Selenium 3.141.59, since 4.* can contain some breaking changes
|
||||
SELENIUM_JAR_NAME="selenium-server-standalone.jar"
|
||||
# Download Selenium server
|
||||
SELENIUM_MAJOR_VERSION=$(get_toolset_value '.selenium.version')
|
||||
SELENIUM_BINARY_NAME=$(get_toolset_value '.selenium.binary_name')
|
||||
SELENIUM_JAR_PATH="/usr/share/java"
|
||||
SELENIUM_DOWNLOAD_URL="https://github.com/SeleniumHQ/selenium/releases/download/selenium-3.141.59/selenium-server-standalone-3.141.59.jar"
|
||||
#SELENIUM_LATEST_VERSION_URL="$(curl -s https://api.github.com/repos/SeleniumHQ/selenium/releases/latest |\
|
||||
# jq -r '.assets[].browser_download_url | select(contains("selenium-server-standalone") and endswith(".jar"))')"
|
||||
SELENIUM_JAR_NAME="$SELENIUM_BINARY_NAME.jar"
|
||||
json=$(curl -s "https://api.github.com/repos/SeleniumHQ/selenium/releases?per_page=100")
|
||||
SELENIUM_DOWNLOAD_URL=$(echo $json | jq -r ".[] | select(.prerelease==false).assets[].browser_download_url | select(contains(\"${SELENIUM_BINARY_NAME}-${SELENIUM_MAJOR_VERSION}\") and endswith(\".jar\"))" | head -1)
|
||||
download_with_retries $SELENIUM_DOWNLOAD_URL $SELENIUM_JAR_PATH $SELENIUM_JAR_NAME
|
||||
|
||||
# Create an epmty file to retrive selenium version
|
||||
SELENIUM_FULL_VERSION=$(echo $SELENIUM_DOWNLOAD_URL | awk -F"${SELENIUM_BINARY_NAME}-|.jar" '{print $2}')
|
||||
touch "$SELENIUM_JAR_PATH/$SELENIUM_BINARY_NAME-$SELENIUM_FULL_VERSION"
|
||||
|
||||
# Add SELENIUM_JAR_PATH environment variable
|
||||
echo "SELENIUM_JAR_PATH=$SELENIUM_JAR_PATH/$SELENIUM_JAR_NAME" | tee -a /etc/environment
|
||||
|
||||
|
||||
@@ -194,8 +194,10 @@ Describe "Sbt" {
|
||||
}
|
||||
|
||||
Describe "Selenium" {
|
||||
It "Selenium Server 'selenium-server-standalone.jar' is installed" {
|
||||
"/usr/share/java/selenium-server-standalone.jar" | Should -Exist
|
||||
It "Selenium is installed" {
|
||||
$seleniumBinaryName = (Get-ToolsetContent).selenium.binary_name
|
||||
$seleniumPath = Join-Path "/usr/share/java" "$seleniumBinaryName.jar"
|
||||
$seleniumPath | Should -Exist
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -278,6 +278,10 @@
|
||||
"8.0"
|
||||
]
|
||||
},
|
||||
"selenium": {
|
||||
"version": "3",
|
||||
"binary_name": "selenium-server-standalone"
|
||||
},
|
||||
"rubygems": [],
|
||||
"node_modules": [
|
||||
{
|
||||
|
||||
@@ -279,6 +279,10 @@
|
||||
"rubygems": [
|
||||
{"name": "fastlane"}
|
||||
],
|
||||
"selenium": {
|
||||
"version": "3",
|
||||
"binary_name": "selenium-server-standalone"
|
||||
},
|
||||
"node_modules": [
|
||||
{
|
||||
"name": "grunt",
|
||||
|
||||
Reference in New Issue
Block a user