mirror of
https://github.com/actions/runner-images.git
synced 2025-12-14 13:17:54 +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
|
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 {
|
function Build-BrowserWebdriversEnvironmentTable {
|
||||||
return @(
|
return @(
|
||||||
@{
|
@{
|
||||||
@@ -32,6 +38,10 @@ function Build-BrowserWebdriversEnvironmentTable {
|
|||||||
@{
|
@{
|
||||||
"Name" = "GECKOWEBDRIVER"
|
"Name" = "GECKOWEBDRIVER"
|
||||||
"Value" = $env:GECKOWEBDRIVER
|
"Value" = $env:GECKOWEBDRIVER
|
||||||
|
},
|
||||||
|
@{
|
||||||
|
"Name" = "SELENIUM_JAR_PATH"
|
||||||
|
"Value" = $env:SELENIUM_JAR_PATH
|
||||||
}
|
}
|
||||||
) | ForEach-Object {
|
) | ForEach-Object {
|
||||||
[PSCustomObject] @{
|
[PSCustomObject] @{
|
||||||
|
|||||||
@@ -212,7 +212,8 @@ $browsersAndDriversList = @(
|
|||||||
(Get-ChromeDriverVersion),
|
(Get-ChromeDriverVersion),
|
||||||
(Get-FirefoxVersion),
|
(Get-FirefoxVersion),
|
||||||
(Get-GeckodriverVersion),
|
(Get-GeckodriverVersion),
|
||||||
(Get-ChromiumVersion)
|
(Get-ChromiumVersion),
|
||||||
|
(Get-SeleniumVersion)
|
||||||
)
|
)
|
||||||
|
|
||||||
$markdown += New-MDList -Style Unordered -Lines $browsersAndDriversList
|
$markdown += New-MDList -Style Unordered -Lines $browsersAndDriversList
|
||||||
|
|||||||
@@ -287,4 +287,4 @@ function Get-ZstdVersion {
|
|||||||
function Get-YqVersion {
|
function Get-YqVersion {
|
||||||
$yqVersion = ($(yq -V) -Split " ")[-1]
|
$yqVersion = ($(yq -V) -Split " ")[-1]
|
||||||
return "yq $yqVersion"
|
return "yq $yqVersion"
|
||||||
}
|
}
|
||||||
@@ -7,14 +7,19 @@
|
|||||||
# Source the helpers for use with the script
|
# Source the helpers for use with the script
|
||||||
source $HELPER_SCRIPTS/install.sh
|
source $HELPER_SCRIPTS/install.sh
|
||||||
|
|
||||||
# Temporarily download Selenium 3.141.59, since 4.* can contain some breaking changes
|
# Download Selenium server
|
||||||
SELENIUM_JAR_NAME="selenium-server-standalone.jar"
|
SELENIUM_MAJOR_VERSION=$(get_toolset_value '.selenium.version')
|
||||||
|
SELENIUM_BINARY_NAME=$(get_toolset_value '.selenium.binary_name')
|
||||||
SELENIUM_JAR_PATH="/usr/share/java"
|
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_JAR_NAME="$SELENIUM_BINARY_NAME.jar"
|
||||||
#SELENIUM_LATEST_VERSION_URL="$(curl -s https://api.github.com/repos/SeleniumHQ/selenium/releases/latest |\
|
json=$(curl -s "https://api.github.com/repos/SeleniumHQ/selenium/releases?per_page=100")
|
||||||
# jq -r '.assets[].browser_download_url | select(contains("selenium-server-standalone") and endswith(".jar"))')"
|
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
|
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
|
# Add SELENIUM_JAR_PATH environment variable
|
||||||
echo "SELENIUM_JAR_PATH=$SELENIUM_JAR_PATH/$SELENIUM_JAR_NAME" | tee -a /etc/environment
|
echo "SELENIUM_JAR_PATH=$SELENIUM_JAR_PATH/$SELENIUM_JAR_NAME" | tee -a /etc/environment
|
||||||
|
|
||||||
|
|||||||
@@ -194,8 +194,10 @@ Describe "Sbt" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Describe "Selenium" {
|
Describe "Selenium" {
|
||||||
It "Selenium Server 'selenium-server-standalone.jar' is installed" {
|
It "Selenium is installed" {
|
||||||
"/usr/share/java/selenium-server-standalone.jar" | Should -Exist
|
$seleniumBinaryName = (Get-ToolsetContent).selenium.binary_name
|
||||||
|
$seleniumPath = Join-Path "/usr/share/java" "$seleniumBinaryName.jar"
|
||||||
|
$seleniumPath | Should -Exist
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -278,6 +278,10 @@
|
|||||||
"8.0"
|
"8.0"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"selenium": {
|
||||||
|
"version": "3",
|
||||||
|
"binary_name": "selenium-server-standalone"
|
||||||
|
},
|
||||||
"rubygems": [],
|
"rubygems": [],
|
||||||
"node_modules": [
|
"node_modules": [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -279,6 +279,10 @@
|
|||||||
"rubygems": [
|
"rubygems": [
|
||||||
{"name": "fastlane"}
|
{"name": "fastlane"}
|
||||||
],
|
],
|
||||||
|
"selenium": {
|
||||||
|
"version": "3",
|
||||||
|
"binary_name": "selenium-server-standalone"
|
||||||
|
},
|
||||||
"node_modules": [
|
"node_modules": [
|
||||||
{
|
{
|
||||||
"name": "grunt",
|
"name": "grunt",
|
||||||
|
|||||||
Reference in New Issue
Block a user