Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,14 @@
<NSubstitutePackageVersion>5.1.0</NSubstitutePackageVersion>
<CoverletCollectorPackageVersion>6.0.0</CoverletCollectorPackageVersion>
</PropertyGroup>
<PropertyGroup>
<!-- Appium -->
<AppiumVersion>2.11.5</AppiumVersion>
<AppiumWindowsDriverVersion>2.12.32</AppiumWindowsDriverVersion>
<AppiumXCUITestDriverVersion>7.27.0</AppiumXCUITestDriverVersion>
<AppiumMac2DriverVersion>1.19.1</AppiumMac2DriverVersion>
<AppiumUIAutomator2DriverVersion>3.8.0</AppiumUIAutomator2DriverVersion>
</PropertyGroup>
<PropertyGroup>
<!-- arcade -->
<!-- xunit -->
Expand Down
63 changes: 54 additions & 9 deletions eng/scripts/appium-install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,54 @@ Find the script for that on the DevDiv Azure DevOps instance, Engineering team,

param
(
[string] $appiumVersion = '2.11.0',
[string] $windowsDriverVersion = '2.12.23',
[string] $androidDriverVersion = '3.7.0',
[string] $iOSDriverVersion = '7.21.0',
[string] $macDriverVersion = '1.17.4',
[string] $appiumVersion = '',
[string] $windowsDriverVersion = '',
[string] $androidDriverVersion = '',
[string] $iOSDriverVersion = '',
[string] $macDriverVersion = '',
[string] $logsDir = '../appium-logs'
)

# By default, versions should be read from /eng/Versions.props
$getLocation = $PSScriptRoot
$versionPropsPath = [IO.Path]::Combine($getLocation, '..', 'Versions.props')

Write-Output "Checking $versionPropsPath for versions..."

if (Test-Path $versionPropsPath)
{
Write-Output "Reading versions from Version.props..."
[xml]$versionProps = Get-Content $versionPropsPath

$versionPropsAppiumVersion = $versionProps.Project.PropertyGroup.AppiumVersion | Where-Object { $_ -ne $null } | Select-Object -Last 1
if ($versionPropsAppiumVersion -ne $null) {
$appiumVersion = $versionPropsAppiumVersion
}

$versionPropsWindowsDriverVersion = $versionProps.Project.PropertyGroup.AppiumWindowsDriverVersion | Where-Object { $_ -ne $null } | Select-Object -Last 1
if ($versionPropsWindowsDriverVersion -ne $null) {
$windowsDriverVersion = $versionPropsWindowsDriverVersion
}

$versionPropsUIAutomator2DriverVersion = $versionProps.Project.PropertyGroup.AppiumUIAutomator2DriverVersion | Where-Object { $_ -ne $null } | Select-Object -Last 1
if ($versionPropsUIAutomator2DriverVersion -ne $null) {
$androidDriverVersion = $versionPropsUIAutomator2DriverVersion
}

$versionPropsXCUItestDriverVersion = $versionProps.Project.PropertyGroup.AppiumXCUITestDriverVersion | Where-Object { $_ -ne $null } | Select-Object -Last 1
if ($versionPropsXCUItestDriverVersion -ne $null) {
$iOSDriverVersion = $versionPropsXCUItestDriverVersion
}

$versionPropsMac2DriverVersion = $versionProps.Project.PropertyGroup.AppiumMac2DriverVersion | Where-Object { $_ -ne $null } | Select-Object -Last 1
if ($versionPropsMac2DriverVersion -ne $null) {
$macDriverVersion = $versionPropsMac2DriverVersion
}
}
else {
throw "The version.props file was not found at path: $versionPropsPath"
}

Write-Output "Welcome to the Appium installer"

Write-Output "Node version"
Expand Down Expand Up @@ -87,11 +127,16 @@ if ($appiumCurrentVersion) {
Write-Output "No Appium version installed"
}

# Check if we found a version of appium at all
$missingAppium = [string]::IsNullOrEmpty($appiumCurrentVersion)

# If current version does not match the one we want, uninstall and install the new version
if ($appiumCurrentVersion -ne $appiumVersion) {
Write-Output "Uninstalling appium $appiumCurrentVersion"
npm uninstall --logs-dir=$logsDir --loglevel $npmLogLevel -g appium
Write-Output "Uninstalled appium $appiumCurrentVersion"
if ($missingAppium -or ($appiumCurrentVersion -ne $appiumVersion)) {
if (-not $missingAppium) {
Write-Output "Uninstalling appium $appiumCurrentVersion"
npm uninstall --logs-dir=$logsDir --loglevel $npmLogLevel -g appium
Write-Output "Uninstalled appium $appiumCurrentVersion"
}

Write-Output "Installing appium $appiumVersion"
npm install --logs-dir=$logsDir --loglevel $npmLogLevel -g appium@$appiumVersion
Expand Down