Skip to content

Commit

Permalink
[uitests] Bump versions and fix script (#16917)
Browse files Browse the repository at this point in the history
* [appium] Bump Versions

* [appium] Some fixes to the script

* [appium] Install also appium-doctor

* [provisioning] Allow skip provision all android api sdks

* Fix

* [cake] Bump nuget tool

* [uitests] Comment out CarouselView tests

* Remove grep doesn't exist on windows
  • Loading branch information
rmarinho authored Aug 23, 2023
1 parent 40ed78b commit 6aaf343
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 97 deletions.
3 changes: 1 addition & 2 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ PowerShell:
// ADDINS
//////////////////////////////////////////////////////////////////////
#addin "nuget:?package=Cake.Android.SdkManager&version=3.0.2"
#addin "nuget:?package=Cake.Boots&version=1.0.4.624"
#addin "nuget:?package=Cake.AppleSimulator&version=0.2.0"
#addin "nuget:?package=Cake.FileHelpers&version=3.2.1"
#load "eng/cake/dotnet.cake"
Expand All @@ -29,7 +28,7 @@ PowerShell:
// TOOLS
//////////////////////////////////////////////////////////////////////
#tool "nuget:?package=NUnit.ConsoleRunner&version=3.16.3"
#tool "nuget:?package=nuget.commandline&version=6.5.0"
#tool "nuget:?package=nuget.commandline&version=6.6.1"

//////////////////////////////////////////////////////////////////////
// ARGUMENTS
Expand Down
4 changes: 4 additions & 0 deletions eng/pipelines/common/provision.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ parameters:
skipXcode: false
skipVS: true
skipProvisioning: $(skipProvisionator)
skipAndroidSdks: false
checkoutDirectory: $(System.DefaultWorkingDirectory)
provisionatorPath: $(provisionator.path)
provisionatorXCodePath: $(provisionator.xcode)
Expand Down Expand Up @@ -34,6 +35,7 @@ steps:
env:
PROVISIONATOR_CHANNEL: ${{ parameters.provisionatorChannel }}
AUTH_TOKEN_COMPONENTS_MAC_IOS_CERTIFICATE_P12: ${{ parameters.certPass }}

# Provision Additional Software
- ${{ if ne(parameters.skipProvisioning, 'true') }}:
- task: xamops.azdevex.provisionator-task.provisionator@2
Expand All @@ -47,6 +49,8 @@ steps:
env:
PROVISIONATOR_CHANNEL: ${{ parameters.provisionatorChannel }}
AUTH_TOKEN_COMPONENTS_MAC_IOS_CERTIFICATE_P12: ${{ parameters.certPass }}
${{ if eq(parameters.skipAndroidSdks, 'true') }}:
SKIP_ANDROID_API_SDKS: true

# Setup JDK Paths (gradle needs it)
- bash: |
Expand Down
4 changes: 4 additions & 0 deletions eng/pipelines/common/ui-tests-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ steps:
skipProvisioning: true
${{ if ne(parameters.platform, 'windows') }}:
skipProvisioning: false
${{ if eq(parameters.platform, 'android') }}:
skipAndroidSdks : false
${{ if ne(parameters.platform, 'android') }}:
skipAndroidSdks: false
skipXcode: false
provisionatorChannel: ${{ parameters.provisionatorChannel }}

Expand Down
5 changes: 3 additions & 2 deletions eng/provisioning/provisioning.csx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ if (IsMac)
}

string ANDROID_API_SDKS = Environment.GetEnvironmentVariable ("ANDROID_API_SDKS");
string SKIP_ANDROID_API_SDKS = Environment.GetEnvironmentVariable ("SKIP_ANDROID_API_SDKS");

if(String.IsNullOrWhiteSpace(ANDROID_API_SDKS))
if(String.IsNullOrWhiteSpace(ANDROID_API_SDKS) && String.IsNullOrWhiteSpace(SKIP_ANDROID_API_SDKS))
{
AndroidSdk()
.ApiLevel((AndroidApiLevel)21)
Expand Down Expand Up @@ -55,7 +56,7 @@ if(String.IsNullOrWhiteSpace(ANDROID_API_SDKS))

AndroidSdk().SdkManagerPackage ("build-tools;33.0.0");
}
else
else if(!String.IsNullOrWhiteSpace(ANDROID_API_SDKS))
{

var androidSDK = AndroidSdk();
Expand Down
101 changes: 43 additions & 58 deletions eng/scripts/appium-install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,19 @@ The mac2 driver version to update or install
.EXAMPLE
PS> .\appium-install.ps1 '2.0.0-beta.61' 2.7.2 2.25.1 4.30.2 1.6.1
PS> .\appium-install.ps1 '2.1.1' 2.7.2 2.25.1 4.30.2 1.6.1
This would install or update Appium version 2.0.0-beta.61, the windows driver 2.7.2, the uiautomator2 driver with 2.25.1, the xcuitest driver with 4.30.2 and mac2 driver with 1.6.1
This would install or update Appium version 2.1.1, the windows driver 2.7.2, the uiautomator2 driver with 2.25.1, the xcuitest driver with 4.30.2 and mac2 driver with 1.6.1
#>


param
(
[string] $appiumVersion = '2.0.1',
[string] $windowsDriverVersion = '2.9.2',
[string] $androidDriverVersion = '2.29.2',
[string] $iOSDriverVersion = '4.32.23',
[string] $macDriverVersion = '1.6.3'
[string] $appiumVersion = '2.1.1',
[string] $windowsDriverVersion = '2.10.1',
[string] $androidDriverVersion = '2.29.4',
[string] $iOSDriverVersion = '4.34.0',
[string] $macDriverVersion = '1.7.2'
)

Write-Output "Welcome to the Appium installer"
Expand All @@ -54,63 +54,45 @@ npm install -g npm
Write-Output "Node version"
node -v

Write-Output "Check if appium is installed"
npm list -g | grep appium

$modulesFolder = "/Users/builder/azdo/_work/_tool/node/20.3.1/x64/lib/node_modules/appium"
if (Test-Path -Path $modulesFolder ) {
Write-Output "appium exists!"

$existingDrivers = appium driver list --installed --json | ConvertFrom-Json
Write-Output "List of installed drivers $x"
if($existingDrivers.windows)
{
Write-Output "Uninstalling appium driver windows"
appium driver uninstall windows
Write-Output "Unistalled appium driver windows"
}

if($existingDrivers.uiautomator2)
{
Write-Output "Uninstalling appium driver uiautomator2"
appium driver uninstall uiautomator2
Write-Output "Unistalled appium driver uiautomator2"
}

if($existingDrivers.xcuitest)
{
Write-Output "Uninstalling appium driver xcuitest"
appium driver uninstall xcuitest
Write-Output "Unistalled appium driver xcuitest"
}

if($existingDrivers.mac2)
{
Write-Output "Uninstalling appium driver mac2"
appium driver uninstall mac2
Write-Output "Unistalled appium driver mac2"
}

Write-Output "Uninstalling appium"
npm uninstall -g appium
Write-Output "Unistalled appium"
#rm -rf $modulesFolder
} else {
Write-Output "node_modules doesn't exist."
}

Write-Output "Check if appium is installed after uninstall"
npm list -g | grep appium

Write-Output "Installing appium $appiumVersion"
npm install -g appium@$appiumVersion
write-Output "Installed appium"
appium -v

Write-Output "Installing appium doctor"
npm install -g appium-doctor
Write-Output "Installed appium doctor"

$existingDrivers = appium driver list --installed --json | ConvertFrom-Json
Write-Output "List of installed drivers $existingDrivers"
if ($existingDrivers.windows) {
Write-Output "Uninstalling appium driver windows"
appium driver uninstall windows
Write-Output "Unistalled appium driver windows"
}

if ($existingDrivers.uiautomator2) {
Write-Output "Uninstalling appium driver uiautomator2"
appium driver uninstall uiautomator2
Write-Output "Unistalled appium driver uiautomator2"
}

if ($existingDrivers.xcuitest) {
Write-Output "Uninstalling appium driver xcuitest"
appium driver uninstall xcuitest
Write-Output "Unistalled appium driver xcuitest"
}

if ($existingDrivers.mac2) {
Write-Output "Uninstalling appium driver mac2"
appium driver uninstall mac2
Write-Output "Unistalled appium driver mac2"
}

$drivers = appium driver list --installed --json | ConvertFrom-Json
Write-Output "List of installed drivers $drivers"
Write-Output "List of installed drivers after cleaup $drivers"

Write-Output "Going to install appium drivers windows $windowsDriverVersion, uiautomator2 $androidDriverVersion, xcuitest $iOSDriverVersion and mac2 $macDriverVersio"
Write-Output "We will now install the appium drivers windows $windowsDriverVersion, uiautomator2 $androidDriverVersion, xcuitest $iOSDriverVersion and mac2 $macDriverVersion"

Write-Output "Installing appium driver windows $windowsDriverVersion"
appium driver install --source=npm appium-windows-driver@$windowsDriverVersion
Expand All @@ -128,4 +110,7 @@ Write-Output "Installing appium driver mac2 $macDriverVersion"
appium driver install mac2@$macDriverVersion
Write-Output "Installed appium driver mac2"

Write-Output "Done, thanks!"
Write-Output "Check everything is installed correctly with appium doctor"
appium-doctor

Write-Output "Done, thanks!"
70 changes: 35 additions & 35 deletions src/Controls/tests/UITests/Tests/CarouselViewUITests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,44 +24,44 @@ protected override void FixtureTeardown()
App.NavigateBack();
}

[Test]
public async Task CarouselViewSetPosition()
{
if (Device != TestDevice.Android)
{
Assert.Ignore("For now, running this test only on Android.");
}
else
{
App.WaitForElement("lblPosition");
await Task.Delay(1000);
var result = App.Query(c => c.Marked("lblPosition")).First().Text;
Assert.AreEqual("3", result);
}
}
//[Test]
//public async Task CarouselViewSetPosition()
//{
// if (Device != TestDevice.Android)
// {
// Assert.Ignore("For now, running this test only on Android.");
// }
// else
// {
// App.WaitForElement("lblPosition");
// await Task.Delay(1000);
// var result = App.Query(c => c.Marked("lblPosition")).First().Text;
// Assert.AreEqual("3", result);
// }
//}

[Test]
public void CarouselViewGoToNextCurrentItem()
{
if (Device != TestDevice.Android)
{
Assert.Ignore("For now, running this test only on Android.");
}
else
{
int indexToTest = 3;
var index = indexToTest.ToString();
var nextIndex = (indexToTest + 1).ToString();
//[Test]
//public void CarouselViewGoToNextCurrentItem()
//{
// if (Device != TestDevice.Android)
// {
// Assert.Ignore("For now, running this test only on Android.");
// }
// else
// {
// int indexToTest = 3;
// var index = indexToTest.ToString();
// var nextIndex = (indexToTest + 1).ToString();

CheckLabelValue("lblPosition", index);
CheckLabelValue("lblCurrentItem", index);
// CheckLabelValue("lblPosition", index);
// CheckLabelValue("lblCurrentItem", index);

App.Tap(x => x.Marked("btnNext"));
CheckLabelValue("lblPosition", nextIndex);
CheckLabelValue("lblCurrentItem", nextIndex);
CheckLabelValue("lblSelected", nextIndex);
}
}
// App.Tap(x => x.Marked("btnNext"));
// CheckLabelValue("lblPosition", nextIndex);
// CheckLabelValue("lblCurrentItem", nextIndex);
// CheckLabelValue("lblSelected", nextIndex);
// }
//}

static void CheckLabelValue(string labelAutomationId, string value)
{
Expand Down

0 comments on commit 6aaf343

Please sign in to comment.