Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup scaffolding for legacy test runner #21423

Merged
merged 33 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
8e73179
Just added a couple of tests
jsuarezruiz Mar 25, 2024
f035bad
Focus on Android and iOS (for now)
jsuarezruiz Mar 25, 2024
60ff9e8
Added legacy tests to the pipeline
jsuarezruiz Mar 25, 2024
2263ab0
Merge branch 'main' into fix-21410
jsuarezruiz Mar 26, 2024
d92b07b
Merge branch 'main' into fix-21410
jsuarezruiz Apr 3, 2024
7fd44be
Merge branch 'main' into fix-21410
jsuarezruiz Apr 8, 2024
6ea9c69
Merge branch 'main' into fix-21410
jsuarezruiz Apr 8, 2024
db7768f
More changes
jsuarezruiz Apr 8, 2024
ce091b5
More changes
jsuarezruiz Apr 9, 2024
bec656f
Fixed build
jsuarezruiz Apr 10, 2024
715a611
Created ui-tests-legacy-steps.yml
jsuarezruiz Apr 10, 2024
656a11c
More changes
jsuarezruiz Apr 10, 2024
d749eea
More changes
jsuarezruiz Apr 10, 2024
3a9edda
Merge branch 'main' into fix-21410
jsuarezruiz Apr 10, 2024
668332b
Updated Appium to RC7
jsuarezruiz Apr 10, 2024
781621c
Update ui-tests.yml
jfversluis Apr 10, 2024
5b5c7e9
Fixed test on Android
jsuarezruiz Apr 11, 2024
a4b5f6d
Fixed test
jsuarezruiz Apr 11, 2024
c7a5fb5
More changes
jsuarezruiz Apr 11, 2024
0ebe135
More changes
jsuarezruiz Apr 11, 2024
fa49de7
Updated snapshot
jsuarezruiz Apr 11, 2024
b8c6711
More fixes
jsuarezruiz Apr 11, 2024
381ae62
Clean code
jsuarezruiz Apr 11, 2024
e63d0a0
Run test only on iOS
jsuarezruiz Apr 11, 2024
ffb72b7
Added pending constant
jsuarezruiz Apr 11, 2024
4967b79
Fix build error
jfversluis Apr 11, 2024
b5e9b40
More changes
jsuarezruiz Apr 11, 2024
ff2fa4f
Update ControlGallery.iOS.Appium.UITests.csproj
jfversluis Apr 12, 2024
b94a421
Update ControlGallery.Shared.Appium.UITests.csproj
jfversluis Apr 12, 2024
7d2852a
Trying to run only on iOS
jsuarezruiz Apr 12, 2024
f80965f
This is the fix, I feel it
jfversluis Apr 12, 2024
bf892e1
Merge branch 'main' into fix-21410
jsuarezruiz Apr 16, 2024
e9f95ab
Fix merge error
jsuarezruiz Apr 16, 2024
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
27 changes: 24 additions & 3 deletions Microsoft.Maui.sln
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,17 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Controls.Xaml.UnitTests.Int
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Controls.Sample.UITests", "src\Controls\samples\Controls.Sample.UITests\Controls.Sample.UITests.csproj", "{F39F75DC-671B-4649-8005-1929797B3217}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UITest.Core", "src\TestUtils\src\UITest.Core\UITest.Core.csproj", "{352C2381-1DEC-4487-819D-340D1EA98FBE}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UITest.Core", "src\TestUtils\src\UITest.Core\UITest.Core.csproj", "{352C2381-1DEC-4487-819D-340D1EA98FBE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UITest.Appium", "src\TestUtils\src\UITest.Appium\UITest.Appium.csproj", "{8C8CD467-11F9-4A14-8AF3-047B2CFD19A7}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UITest.Appium", "src\TestUtils\src\UITest.Appium\UITest.Appium.csproj", "{8C8CD467-11F9-4A14-8AF3-047B2CFD19A7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UITest.NUnit", "src\TestUtils\src\UITest.NUnit\UITest.NUnit.csproj", "{8050448A-E08F-4972-9B47-16042A5DFE82}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UITest.NUnit", "src\TestUtils\src\UITest.NUnit\UITest.NUnit.csproj", "{8050448A-E08F-4972-9B47-16042A5DFE82}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ControlGallery.Android.Appium.UITests", "src\Compatibility\ControlGallery\test\Android.Appium.UITests\ControlGallery.Android.Appium.UITests.csproj", "{F748974F-A8E4-4659-801C-804B739D6326}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ControlGallery.iOS.Appium.UITests", "src\Compatibility\ControlGallery\test\iOS.Appium.UITests\ControlGallery.iOS.Appium.UITests.csproj", "{5923B35B-EA24-4B86-A384-9DAF9F2AFD56}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ControlGallery.Shared.Appium.UITests", "src\Compatibility\ControlGallery\test\Shared.Appium.UITests\ControlGallery.Shared.Appium.UITests.csproj", "{07D8D4B5-C89D-4BE3-A14A-17668358587C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -644,6 +650,18 @@ Global
{8050448A-E08F-4972-9B47-16042A5DFE82}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8050448A-E08F-4972-9B47-16042A5DFE82}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8050448A-E08F-4972-9B47-16042A5DFE82}.Release|Any CPU.Build.0 = Release|Any CPU
{F748974F-A8E4-4659-801C-804B739D6326}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F748974F-A8E4-4659-801C-804B739D6326}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F748974F-A8E4-4659-801C-804B739D6326}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F748974F-A8E4-4659-801C-804B739D6326}.Release|Any CPU.Build.0 = Release|Any CPU
{5923B35B-EA24-4B86-A384-9DAF9F2AFD56}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5923B35B-EA24-4B86-A384-9DAF9F2AFD56}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5923B35B-EA24-4B86-A384-9DAF9F2AFD56}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5923B35B-EA24-4B86-A384-9DAF9F2AFD56}.Release|Any CPU.Build.0 = Release|Any CPU
{07D8D4B5-C89D-4BE3-A14A-17668358587C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{07D8D4B5-C89D-4BE3-A14A-17668358587C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{07D8D4B5-C89D-4BE3-A14A-17668358587C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{07D8D4B5-C89D-4BE3-A14A-17668358587C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -762,6 +780,9 @@ Global
{352C2381-1DEC-4487-819D-340D1EA98FBE} = {7AC28763-9C68-4BF9-A1BA-25CBFFD2D15C}
{8C8CD467-11F9-4A14-8AF3-047B2CFD19A7} = {7AC28763-9C68-4BF9-A1BA-25CBFFD2D15C}
{8050448A-E08F-4972-9B47-16042A5DFE82} = {7AC28763-9C68-4BF9-A1BA-25CBFFD2D15C}
{F748974F-A8E4-4659-801C-804B739D6326} = {DDBA9144-36FC-429E-99E1-2A64825434C1}
{5923B35B-EA24-4B86-A384-9DAF9F2AFD56} = {DDBA9144-36FC-429E-99E1-2A64825434C1}
{07D8D4B5-C89D-4BE3-A14A-17668358587C} = {DDBA9144-36FC-429E-99E1-2A64825434C1}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0B8ABEAD-D2B5-4370-A187-62B5ABE4EE50}
Expand Down
146 changes: 146 additions & 0 deletions eng/pipelines/common/ui-tests-legacy-steps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
parameters:
platform: '' # [ android, ios, windows, catalyst ]
path: '' # path to csproj
device: '' # the xharness device to use
cakeArgs: '' # additional cake args
app: '' #path to app to test
version: '' #the iOS version'
provisionatorChannel: 'latest'
agentPoolAccessToken: ''
targetSample: "dotnet-legacy-controlgallery"
configuration : "Release"

steps:
- ${{ if eq(parameters.platform, 'ios')}}:
- bash: |
chmod +x $(System.DefaultWorkingDirectory)/eng/scripts/clean-bot.sh
$(System.DefaultWorkingDirectory)/eng/scripts/clean-bot.sh
displayName: 'Clean bot'
continueOnError: true
timeoutInMinutes: 60

- template: provision.yml
parameters:
skipProvisioning: ${{ eq(parameters.platform, 'windows') }}
skipAndroidSdks: ${{ ne(parameters.platform, 'android') }}
skipXcode: ${{ or(eq(parameters.platform, 'android'), eq(parameters.platform, 'windows')) }}
provisionatorChannel: ${{ parameters.provisionatorChannel }}

- task: PowerShell@2
condition: ne('${{ parameters.platform }}' , 'windows')
inputs:
targetType: 'inline'
script: |
defaults write -g NSAutomaticCapitalizationEnabled -bool false
defaults write -g NSAutomaticTextCompletionEnabled -bool false
defaults write -g NSAutomaticSpellingCorrectionEnabled -bool false
displayName: "Modify defaults"
continueOnError: true

# AzDO hosted agents default to 1024x768; set something bigger for Windows UI tests
- task: ScreenResolutionUtility@1
condition: eq('${{ parameters.platform }}' , 'windows')
inputs:
displaySettings: 'specific'
width: '1920'
height: '1080'
displayName: "Set screen resolution"

- task: UseNode@1
inputs:
version: "20.3.1"
displayName: "Install node"

- bash: |
echo "##[group]Running ls -al $(npm root -g)"
ls -al $(npm root -g)
echo "##[endgroup]"

echo "##[group]Running ls -al $(npm root -g)/appium"
ls -al $(npm root -g)/appium
echo "##[endgroup]"

echo "##[group]Running ls -al $(npm root -g)/.appium-????????"
ls -al $(npm root -g)/.appium-????????
echo "##[endgroup]"

echo "##[group]Running ls -al $(npm root -g)/appium-doctor"
ls -al $(npm root -g)/appium-doctor
echo "##[endgroup]"

echo "##[group]Running ls -al $(npm root -g)/.appium-doctor-????????"
ls -al $(npm root -g)/.appium-doctor-????????
echo "##[endgroup]"

echo "##[group]Running ps aux"
ps aux
echo "##[endgroup]"
displayName: "Debugging output"
continueOnError: true
condition: startsWith(variables['Agent.Name'], 'XAMBOT')

# Clean up any leftover cached folders of appium and appium-doctor node modules
- bash: |
rm -rf $(npm root -g)/.appium-????????
rm -rf $(npm root -g)/.appium-doctor-????????
displayName: "Delete temp .appium-???????? and .appium-doctor-???????? folders"
continueOnError: true

- pwsh: ./eng/scripts/appium-install.ps1
displayName: "Install Appium (Drivers)"
continueOnError: false
retryCountOnTaskFailure: 1

- pwsh: ./build.ps1 --target=dotnet --configuration="${{ parameters.configuration }}" --verbosity=diagnostic
displayName: 'Install .NET'
retryCountOnTaskFailure: 2
env:
DOTNET_TOKEN: $(dotnetbuilds-internal-container-read-token)
PRIVATE_BUILD: $(PrivateBuild)

- pwsh: echo "##vso[task.prependpath]$(DotNet.Dir)"
displayName: 'Add .NET to PATH'

- pwsh: ./build.ps1 --target=dotnet-buildtasks --configuration="${{ parameters.configuration }}"
displayName: 'Build the MSBuild Tasks'

- pwsh: ./build.ps1 --target=${{ parameters.targetSample }} --configuration="${{ parameters.configuration }}" --${{ parameters.platform }} --verbosity=diagnostic --usenuget=false
displayName: 'Build the Legacy ControlGallery'

- bash: |
if [ -f "$HOME/Library/Logs/CoreSimulator/*" ]; then rm -r $HOME/Library/Logs/CoreSimulator/*; fi
if [ -f "$HOME/Library/Logs/DiagnosticReports/*" ]; then rm -r $HOME/Library/Logs/DiagnosticReports/*; fi
displayName: Delete Old Simulator Logs
condition: ${{ eq(parameters.platform, 'ios') }}
continueOnError: true

- pwsh: ./build.ps1 -Script eng/devices/${{ parameters.platform }}.cake --target=uitest --project="${{ parameters.path }}" --appproject="${{ parameters.app }}" --device="${{ parameters.device }}" --apiversion="${{ parameters.version }}" --configuration="${{ parameters.configuration }}" --results="$(TestResultsDirectory)" --binlog="$(LogDirectory)" ${{ parameters.cakeArgs }} --verbosity=diagnostic
displayName: $(Agent.JobName)
${{ if ne(parameters.platform, 'android')}}:
retryCountOnTaskFailure: 1

- bash: |
suffix=$(date +%Y%m%d%H%M%S)
zip -9r "$(LogDirectory)/CoreSimulatorLog_${suffix}.zip" "$HOME/Library/Logs/CoreSimulator/"
zip -9r "$(LogDirectory)/DiagnosticReports_${suffix}.zip" "$HOME/Library/Logs/DiagnosticReports/"
displayName: Zip Simulator Logs
condition: ${{ eq(parameters.platform, 'ios') }}
continueOnError: true

- task: PublishTestResults@2
displayName: Publish the $(System.PhaseName) test results
condition: always()
inputs:
testResultsFormat: VSTest
testResultsFiles: '$(TestResultsDirectory)/*.trx'
testRunTitle: '$(System.PhaseName)'
failTaskOnFailedTests: true

- task: PublishBuildArtifacts@1
condition: always()
displayName: publish artifacts

# This must always be placed as the last step in the job
- template: agent-rebooter/mac.v1.yml@yaml-templates
parameters:
AgentPoolAccessToken: ${{ parameters.agentPoolAccessToken }}
73 changes: 72 additions & 1 deletion eng/pipelines/common/ui-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ parameters:
macosPool: { }
androidCompatibilityPool: { }
iosCompatibilityPool: { }
androidLegacyPool: { }
iosLegacyPool: { }
androidApiLevels: [ 30 ]
iosVersions: [ 'latest' ]
provisionatorChannel: 'latest'
agentPoolAccessToken: ''
runCompatibilityTests: false
runLegacyTests: true
projects:
- name: name
desc: Human Description
Expand All @@ -22,6 +25,10 @@ parameters:
compatibilityAndroidTestProject: /optional/path/to/android.csproj
compatibilityiOSTestProject: /optional/path/to/ios.csproj
compatibilityiOSApp: /optional/path/to/app.csproj
legacyAndroidApp: /optional/path/to/app.csproj
legacyAndroidTestProject: /optional/path/to/android.csproj
legacyiOSTestProject: /optional/path/to/ios.csproj
legacyiOSApp: /optional/path/to/app.csproj

stages:

Expand Down Expand Up @@ -170,7 +177,6 @@ stages:
provisionatorChannel: ${{ parameters.provisionatorChannel }}
agentPoolAccessToken: ${{ parameters.agentPoolAccessToken }}


- stage: ios_compatibility_ui_tests
displayName: iOS Compatibility UITests
dependsOn: []
Expand Down Expand Up @@ -206,3 +212,68 @@ stages:
device: ios-simulator-64_${{ version }}
provisionatorChannel: ${{ parameters.provisionatorChannel }}
agentPoolAccessToken: ${{ parameters.agentPoolAccessToken }}
- ${{ if eq(parameters.runLegacyTests, true) }}:
- stage: android_legacy_ui_tests
displayName: Android Legacy UITests
dependsOn: []
jobs:
- ${{ each project in parameters.projects }}:
- ${{ if ne(project.android, '') }}:
- ${{ each api in parameters.androidApiLevels }}:
- ${{ if not(containsValue(project.androidApiLevelsExclude, api)) }}:
- job: android_legacy_ui_tests_${{ project.name }}_${{ api }}
timeoutInMinutes: 240
workspace:
clean: all
displayName: ${{ coalesce(project.desc, project.name) }} (API ${{ api }})
pool: ${{ parameters.androidLegacyPool }}
variables:
REQUIRED_XCODE: $(DEVICETESTS_REQUIRED_XCODE)
steps:
- template: ui-tests-legacy-steps.yml
parameters:
platform: android
version: ${{ api }}
path: ${{ project.legacyAndroidTestProject }}
app: ${{ project.legacyAndroidApp }}
targetSample: "dotnet-legacy-controlgallery-android"
${{ if eq(api, 27) }}:
device: android-emulator-32_${{ api }}
${{ if not(eq(api, 27)) }}:
device: android-emulator-64_${{ api }}
provisionatorChannel: ${{ parameters.provisionatorChannel }}
agentPoolAccessToken: ${{ parameters.agentPoolAccessToken }}

- stage: ios_legacy_ui_tests
displayName: iOS Legacy UITests
dependsOn: []
jobs:
- ${{ each project in parameters.projects }}:
- ${{ if ne(project.ios, '') }}:
- ${{ each version in parameters.iosVersions }}:
- ${{ if not(containsValue(project.iosVersionsExclude, version)) }}:
- job: ios_legacy_ui_tests_${{ project.name }}_${{ replace(version, '.', '_') }}
timeoutInMinutes: 240
workspace:
clean: all
displayName: ${{ coalesce(project.desc, project.name) }} (v${{ version }})
pool: ${{ parameters.iosLegacyPool }}
variables:
REQUIRED_XCODE: $(DEVICETESTS_REQUIRED_XCODE)
steps:
- template: ui-tests-legacy-steps.yml
parameters:
platform: ios
${{ if eq(version, 'latest') }}:
version: 16.4
${{ if ne(version, 'latest') }}:
version: ${{ version }}
path: ${{ project.legacyiOSTestProject }}
app: ${{ project.legacyiOSApp }}
targetSample: "dotnet-legacy-controlgallery-ios"
${{ if eq(version, 'latest') }}:
device: ios-simulator-64
${{ if ne(version, 'latest') }}:
device: ios-simulator-64_${{ version }}
provisionatorChannel: ${{ parameters.provisionatorChannel }}
agentPoolAccessToken: ${{ parameters.agentPoolAccessToken }}
23 changes: 23 additions & 0 deletions eng/pipelines/ui-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,23 @@ parameters:
- macOS.Name -equals Ventura
- macOS.Architecture -equals x64

- name: androidLegacyPool
type: object
default:
name: $(androidTestsVmPool)
vmImage: $(androidTestsVmImage)
demands:
- macOS.Name -equals Ventura
- macOS.Architecture -equals x64

- name: iosLegacyPool
type: object
default:
name: $(iosTestsVmPool)
vmImage: $(iosTestsVmImage)
demands:
- macOS.Name -equals Ventura
- macOS.Architecture -equals x64

resources:
repositories:
Expand All @@ -128,6 +145,8 @@ stages:
macosPool: ${{ parameters.macosPool }}
androidCompatibilityPool: ${{ parameters.androidCompatibilityPool }}
iosCompatibilityPool: ${{ parameters.iosCompatibilityPool }}
iosLegacyPool: ${{ parameters.iosLegacyPool }}
androidLegacyPool: ${{ parameters.androidLegacyPool }}
agentPoolAccessToken: $(AgentPoolAccessToken)
${{ if or(parameters.BuildEverything, and(ne(variables['Build.Reason'], 'PullRequest'), eq(variables['System.TeamProject'], 'devdiv'))) }}:
androidApiLevels: [ 30 ]
Expand All @@ -153,4 +172,8 @@ stages:
compatibilityAndroidTestProject: $(System.DefaultWorkingDirectory)/src/Compatibility/ControlGallery/test/Android.UITests/Compatibility.ControlGallery.Android.UITests.csproj
compatibilityiOSApp: $(System.DefaultWorkingDirectory)/src/Compatibility/ControlGallery/src/iOS/Compatibility.ControlGallery.iOS.csproj
compatibilityiOSTestProject: $(System.DefaultWorkingDirectory)/src/Compatibility/ControlGallery/test/iOS.UITests/Compatibility.ControlGallery.iOS.UITests.csproj
legacyAndroidApp: $(System.DefaultWorkingDirectory)/src/Compatibility/ControlGallery/src/Android/Compatibility.ControlGallery.Android.csproj
legacyAndroidTestProject: $(System.DefaultWorkingDirectory)/src/Compatibility/ControlGallery/test/Android.Appium.UITests/ControlGallery.Android.Appium.UITests.csproj
legacyiOSApp: $(System.DefaultWorkingDirectory)/src/Compatibility/ControlGallery/src/iOS/Compatibility.ControlGallery.iOS.csproj
legacyiOSTestProject: $(System.DefaultWorkingDirectory)/src/Compatibility/ControlGallery/test/iOS.Appium.UITests/ControlGallery.iOS.Appium.UITests.csproj

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Android.Content;
using Android.Content.PM;
using Android.OS;
using Android.Runtime;
using Java.Interop;
using Microsoft.Maui.Controls.Compatibility.Platform.Android;
using Microsoft.Maui.Controls.ControlGallery;
Expand All @@ -28,6 +29,7 @@ namespace Microsoft.Maui.Controls.ControlGallery.Android
DataScheme = "http", DataHost = App.AppName, DataPathPrefix = "/gallery/"
)
]
[Register("com.microsoft.mauicompatibilitygallery.MainActivity")]
public partial class Activity1 : MauiAppCompatActivity
{
App App => Microsoft.Maui.Controls.Application.Current as App;
Expand Down
Loading
Loading