From 6aaf34303b99f36f9b0aa8051b0cecfea3476854 Mon Sep 17 00:00:00 2001 From: Rui Marinho Date: Wed, 23 Aug 2023 13:48:17 +0100 Subject: [PATCH] =?UTF-8?q?[uitests]=C2=A0Bump=20versions=20and=20fix=20sc?= =?UTF-8?q?ript=20(#16917)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [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 --- build.cake | 3 +- eng/pipelines/common/provision.yml | 4 + eng/pipelines/common/ui-tests-steps.yml | 4 + eng/provisioning/provisioning.csx | 5 +- eng/scripts/appium-install.ps1 | 101 ++++++++---------- .../UITests/Tests/CarouselViewUITests.cs | 70 ++++++------ 6 files changed, 90 insertions(+), 97 deletions(-) diff --git a/build.cake b/build.cake index 79ffca79367e..a6aeb0eaed16 100644 --- a/build.cake +++ b/build.cake @@ -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" @@ -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 diff --git a/eng/pipelines/common/provision.yml b/eng/pipelines/common/provision.yml index 3d6c01773bce..435e74443425 100644 --- a/eng/pipelines/common/provision.yml +++ b/eng/pipelines/common/provision.yml @@ -3,6 +3,7 @@ parameters: skipXcode: false skipVS: true skipProvisioning: $(skipProvisionator) + skipAndroidSdks: false checkoutDirectory: $(System.DefaultWorkingDirectory) provisionatorPath: $(provisionator.path) provisionatorXCodePath: $(provisionator.xcode) @@ -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 @@ -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: | diff --git a/eng/pipelines/common/ui-tests-steps.yml b/eng/pipelines/common/ui-tests-steps.yml index 186647546c16..68bc76e02d9b 100644 --- a/eng/pipelines/common/ui-tests-steps.yml +++ b/eng/pipelines/common/ui-tests-steps.yml @@ -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 }} diff --git a/eng/provisioning/provisioning.csx b/eng/provisioning/provisioning.csx index 02a67c80aae3..e08692ea73d5 100644 --- a/eng/provisioning/provisioning.csx +++ b/eng/provisioning/provisioning.csx @@ -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) @@ -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(); diff --git a/eng/scripts/appium-install.ps1 b/eng/scripts/appium-install.ps1 index 89c4902f27ef..c5a4f842ff28 100644 --- a/eng/scripts/appium-install.ps1 +++ b/eng/scripts/appium-install.ps1 @@ -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" @@ -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 @@ -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!" \ No newline at end of file +Write-Output "Check everything is installed correctly with appium doctor" +appium-doctor + +Write-Output "Done, thanks!" diff --git a/src/Controls/tests/UITests/Tests/CarouselViewUITests.cs b/src/Controls/tests/UITests/Tests/CarouselViewUITests.cs index 863d990a1ab0..7dc28d7a866b 100644 --- a/src/Controls/tests/UITests/Tests/CarouselViewUITests.cs +++ b/src/Controls/tests/UITests/Tests/CarouselViewUITests.cs @@ -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) {