Skip to content

Commit f499dc5

Browse files
rmarinhoRedthPureWeen
committed
[net9] Try fix running UITests on iOS18 (#25070)
* [housekeeping] Update & Consolidate Appium + driver versions (#24817) * Update appium + driver versions Updating to latest * Move appium versions to eng/Versions.props * Fix ps1 get-location * Check if appium is completely missing too No need to attempt to uninstall appium if it's not installed * - bump versions * - fix script --------- Co-authored-by: Shane Neuville <shneuvil@microsoft.com> * Try iOS18 device * See if this works * Try xs --------- Co-authored-by: Jonathan Dick <jodick@microsoft.com> Co-authored-by: Shane Neuville <shneuvil@microsoft.com>
1 parent 6b08341 commit f499dc5

4 files changed

Lines changed: 69 additions & 12 deletions

File tree

eng/Versions.props

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,14 @@
146146
<NSubstitutePackageVersion>5.1.0</NSubstitutePackageVersion>
147147
<CoverletCollectorPackageVersion>6.0.0</CoverletCollectorPackageVersion>
148148
</PropertyGroup>
149+
<PropertyGroup>
150+
<!-- Appium -->
151+
<AppiumVersion>2.11.5</AppiumVersion>
152+
<AppiumWindowsDriverVersion>2.12.32</AppiumWindowsDriverVersion>
153+
<AppiumXCUITestDriverVersion>7.27.0</AppiumXCUITestDriverVersion>
154+
<AppiumMac2DriverVersion>1.19.1</AppiumMac2DriverVersion>
155+
<AppiumUIAutomator2DriverVersion>3.8.0</AppiumUIAutomator2DriverVersion>
156+
</PropertyGroup>
149157
<PropertyGroup>
150158
<!-- arcade -->
151159
<!-- xunit -->

eng/devices/ios.cake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#addin nuget:?package=Cake.AppleSimulator&version=0.2.0
22
#load "./uitests-shared.cake"
33

4-
const string DefaultVersion = "17.2";
4+
const string DefaultVersion = "18.0";
55
const string DefaultTestDevice = $"ios-simulator-64_{DefaultVersion}";
66

77
// Required arguments

eng/scripts/appium-install.ps1

Lines changed: 54 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,54 @@ Find the script for that on the DevDiv Azure DevOps instance, Engineering team,
4040

4141
param
4242
(
43-
[string] $appiumVersion = '2.11.0',
44-
[string] $windowsDriverVersion = '2.12.23',
45-
[string] $androidDriverVersion = '3.7.0',
46-
[string] $iOSDriverVersion = '7.21.0',
47-
[string] $macDriverVersion = '1.17.4',
43+
[string] $appiumVersion = '',
44+
[string] $windowsDriverVersion = '',
45+
[string] $androidDriverVersion = '',
46+
[string] $iOSDriverVersion = '',
47+
[string] $macDriverVersion = '',
4848
[string] $logsDir = '../appium-logs'
4949
)
5050

51+
# By default, versions should be read from /eng/Versions.props
52+
$getLocation = $PSScriptRoot
53+
$versionPropsPath = [IO.Path]::Combine($getLocation, '..', 'Versions.props')
54+
55+
Write-Output "Checking $versionPropsPath for versions..."
56+
57+
if (Test-Path $versionPropsPath)
58+
{
59+
Write-Output "Reading versions from Version.props..."
60+
[xml]$versionProps = Get-Content $versionPropsPath
61+
62+
$versionPropsAppiumVersion = $versionProps.Project.PropertyGroup.AppiumVersion | Where-Object { $_ -ne $null } | Select-Object -Last 1
63+
if ($versionPropsAppiumVersion -ne $null) {
64+
$appiumVersion = $versionPropsAppiumVersion
65+
}
66+
67+
$versionPropsWindowsDriverVersion = $versionProps.Project.PropertyGroup.AppiumWindowsDriverVersion | Where-Object { $_ -ne $null } | Select-Object -Last 1
68+
if ($versionPropsWindowsDriverVersion -ne $null) {
69+
$windowsDriverVersion = $versionPropsWindowsDriverVersion
70+
}
71+
72+
$versionPropsUIAutomator2DriverVersion = $versionProps.Project.PropertyGroup.AppiumUIAutomator2DriverVersion | Where-Object { $_ -ne $null } | Select-Object -Last 1
73+
if ($versionPropsUIAutomator2DriverVersion -ne $null) {
74+
$androidDriverVersion = $versionPropsUIAutomator2DriverVersion
75+
}
76+
77+
$versionPropsXCUItestDriverVersion = $versionProps.Project.PropertyGroup.AppiumXCUITestDriverVersion | Where-Object { $_ -ne $null } | Select-Object -Last 1
78+
if ($versionPropsXCUItestDriverVersion -ne $null) {
79+
$iOSDriverVersion = $versionPropsXCUItestDriverVersion
80+
}
81+
82+
$versionPropsMac2DriverVersion = $versionProps.Project.PropertyGroup.AppiumMac2DriverVersion | Where-Object { $_ -ne $null } | Select-Object -Last 1
83+
if ($versionPropsMac2DriverVersion -ne $null) {
84+
$macDriverVersion = $versionPropsMac2DriverVersion
85+
}
86+
}
87+
else {
88+
throw "The version.props file was not found at path: $versionPropsPath"
89+
}
90+
5191
Write-Output "Welcome to the Appium installer"
5292

5393
Write-Output "Node version"
@@ -87,11 +127,16 @@ if ($appiumCurrentVersion) {
87127
Write-Output "No Appium version installed"
88128
}
89129

130+
# Check if we found a version of appium at all
131+
$missingAppium = [string]::IsNullOrEmpty($appiumCurrentVersion)
132+
90133
# If current version does not match the one we want, uninstall and install the new version
91-
if ($appiumCurrentVersion -ne $appiumVersion) {
92-
Write-Output "Uninstalling appium $appiumCurrentVersion"
93-
npm uninstall --logs-dir=$logsDir --loglevel $npmLogLevel -g appium
94-
Write-Output "Uninstalled appium $appiumCurrentVersion"
134+
if ($missingAppium -or ($appiumCurrentVersion -ne $appiumVersion)) {
135+
if (-not $missingAppium) {
136+
Write-Output "Uninstalling appium $appiumCurrentVersion"
137+
npm uninstall --logs-dir=$logsDir --loglevel $npmLogLevel -g appium
138+
Write-Output "Uninstalled appium $appiumCurrentVersion"
139+
}
95140

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

src/Controls/tests/TestCases.Shared.Tests/UITest.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public override IConfig GetTestConfig()
6363
break;
6464
case TestDevice.iOS:
6565
config.SetProperty("DeviceName", Environment.GetEnvironmentVariable("DEVICE_NAME") ?? "iPhone Xs");
66-
config.SetProperty("PlatformVersion", Environment.GetEnvironmentVariable("PLATFORM_VERSION") ?? "17.2");
66+
config.SetProperty("PlatformVersion", Environment.GetEnvironmentVariable("PLATFORM_VERSION") ?? "18.0");
6767
config.SetProperty("Udid", Environment.GetEnvironmentVariable("DEVICE_UDID") ?? "");
6868
break;
6969
case TestDevice.Windows:
@@ -142,7 +142,11 @@ but both can happen.
142142
var platformVersion = (string)((AppiumApp)App).Driver.Capabilities.GetCapability("platformVersion");
143143
var device = (string)((AppiumApp)App).Driver.Capabilities.GetCapability("deviceName");
144144

145-
if (deviceName == "iPhone Xs (iOS 17.2)" || (device.Contains(" Xs", StringComparison.OrdinalIgnoreCase) && platformVersion == "17.2"))
145+
if (device.Contains(" Xs", StringComparison.OrdinalIgnoreCase) && platformVersion == "18.0")
146+
{
147+
environmentName = "ios";
148+
}
149+
else if (deviceName == "iPhone Xs (iOS 17.2)" || (device.Contains(" Xs", StringComparison.OrdinalIgnoreCase) && platformVersion == "17.2"))
146150
{
147151
environmentName = "ios";
148152
}

0 commit comments

Comments
 (0)