From e2871ebcb97abd0dc7269a52db21cb7b3cd29e02 Mon Sep 17 00:00:00 2001 From: Dan Siegel Date: Tue, 28 Jan 2020 15:27:56 -0800 Subject: [PATCH] refactor uitesting --- .../HelloWorld.UITests.csproj | 4 ++ Source/build/azure-pipelines.yml | 14 +++++-- Source/build/jobs/sandbox-android.yml | 3 +- Source/build/jobs/sandbox-ios.yml | 1 - Source/build/jobs/sandbox-uitest.yml | 39 +++++++++++++++++++ Source/build/jobs/xamarin-uitest.yml | 23 +++++------ 6 files changed, 64 insertions(+), 20 deletions(-) create mode 100644 Source/build/jobs/sandbox-uitest.yml diff --git a/Sandbox/Xamarin/HelloWorld/HelloWorld/HelloWorld.UITests/HelloWorld.UITests.csproj b/Sandbox/Xamarin/HelloWorld/HelloWorld/HelloWorld.UITests/HelloWorld.UITests.csproj index 725cfd1092..52916df81d 100644 --- a/Sandbox/Xamarin/HelloWorld/HelloWorld/HelloWorld.UITests/HelloWorld.UITests.csproj +++ b/Sandbox/Xamarin/HelloWorld/HelloWorld/HelloWorld.UITests/HelloWorld.UITests.csproj @@ -6,6 +6,10 @@ NU1201 + + $(ArtifactStagingRoot) + + diff --git a/Source/build/azure-pipelines.yml b/Source/build/azure-pipelines.yml index 17cab37cfa..8fdc11caf3 100644 --- a/Source/build/azure-pipelines.yml +++ b/Source/build/azure-pipelines.yml @@ -29,8 +29,8 @@ variables: value: Release - name: BuildPlatform value: Any CPU -- name: AppCenterDroidSlug - value: Prism/Sandbox.Android +- name: AppCenterDroidAppName + value: Sandbox.Android - name: AppCenterDroidDevices value: 8804278a - group: SignClient @@ -61,6 +61,14 @@ stages: - template: jobs/xamarin-uitest.yml + - template: jobs/sandbox-uitest.yml + parameters: + artifactName: Sandbox-Android + sandboxJobName: sandboxAndroid + appFile: '$(Pipeline.Workspace)/Sandbox-Android/com.prismlibrary.helloworld.apk' + appName: $(AppCenterDroidAppName) + devices: $(AppCenterDroidDevices) + - stage: buildPackage displayName: Build Prism Library jobs: @@ -78,7 +86,7 @@ stages: steps: - template: steps/appcenter-deploy.yml parameters: - appName: 'Sandbox.Android' + appName: $(AppCenterDroidAppName) appFile: '$(Pipeline.Workspace)/Sandbox-Android/com.prismlibrary.helloworld.apk' distributionGroup: '88fd9e93-9e2e-4a44-bda4-e7d6bf8f7a10' diff --git a/Source/build/jobs/sandbox-android.yml b/Source/build/jobs/sandbox-android.yml index f339a8d733..14ba5bea82 100644 --- a/Source/build/jobs/sandbox-android.yml +++ b/Source/build/jobs/sandbox-android.yml @@ -1,5 +1,5 @@ parameters: - buildConfiguration: 'Debug' + buildConfiguration: 'Release' versionName: '' jobs: @@ -48,4 +48,3 @@ jobs: inputs: targetPath: '$(Build.ArtifactStagingDirectory)' artifactName: Sandbox-Android - condition: and(succeeded(), eq(variables['system.pullrequest.isfork'], false)) \ No newline at end of file diff --git a/Source/build/jobs/sandbox-ios.yml b/Source/build/jobs/sandbox-ios.yml index ffd7960076..97ebdad00c 100644 --- a/Source/build/jobs/sandbox-ios.yml +++ b/Source/build/jobs/sandbox-ios.yml @@ -59,4 +59,3 @@ jobs: inputs: targetPath: '$(Build.ArtifactStagingDirectory)' artifactName: Sandbox-iOS - condition: and(succeeded(), eq(variables['system.pullrequest.isfork'], false)) \ No newline at end of file diff --git a/Source/build/jobs/sandbox-uitest.yml b/Source/build/jobs/sandbox-uitest.yml new file mode 100644 index 0000000000..e78699ba61 --- /dev/null +++ b/Source/build/jobs/sandbox-uitest.yml @@ -0,0 +1,39 @@ +parameters: + artifactName: '' + sandboxJobName: '' + appFile: '' + appName: '' + devices: '' + +jobs: +- job: appCenterTests-${{ parameters.artifactName }} + displayName: App Center Tests ${{ parameters.artifactName }} + dependsOn: | + ${{ parameters.sandboxJobName }} + xamarinUITest + pool: + vmImage: $(VMImage) + demands: + - MSBuild + workspace: + clean: all + steps: + - task: DownloadPipelineArtifact@2 + displayName: Download UI Test Project + inputs: + artifactName: XamarinUITests + targetPath: '$(Pipeline.Workspace)' + - task: DownloadPipelineArtifact@2 + displayName: Download ${{ parameters.artifactName }} + inputs: + artifactName: ${{ parameters.artifactName }} + targetPath: '$(Pipeline.Workspace)' + - task: AppCenterTest@1 + displayName: 'Run UI Tests ${{ parameters.artifactName }} with App Center' + inputs: + appFile: ${{ parameters.appFile }} + frameworkOption: uitest + uiTestBuildDirectory: $(Pipeline.Workspace)/XamarinUITests/ + serverEndpoint: 'Prism-AppCenter' + appSlug: 'Prism/${{ parameters.appName }}' + devices: ${{ parameters.devices }} diff --git a/Source/build/jobs/xamarin-uitest.yml b/Source/build/jobs/xamarin-uitest.yml index d1edfd8ab1..f610c6c489 100644 --- a/Source/build/jobs/xamarin-uitest.yml +++ b/Source/build/jobs/xamarin-uitest.yml @@ -1,7 +1,6 @@ jobs: - job: xamarinUITest displayName: HelloWorld.UITests - dependsOn: sandboxAndroid pool: vmImage: $(VMImage) demands: @@ -13,18 +12,14 @@ jobs: parameters: solution: Sandbox/Xamarin/HelloWorld/HelloWorld/HelloWorld.UITests/HelloWorld.UITests.csproj solutionName: HelloWorld.UITests - - task: DownloadPipelineArtifact@2 - inputs: - artifactName: 'Sandbox-Android' - targetPath: '$(Pipeline.Workspace)' - - task: AppCenterTest@1 - displayName: 'Test Android with Visual Studio App Center' + + - powershell: Get-ChildItem . -Recurse | ForEach-Object -Process { $_.FullName } + displayName: List Artifacts + + - task: PublishPipelineArtifact@0 + displayName: 'Publish Sandbox Artifacts' inputs: - appFile: '**/*.apk' - frameworkOption: uitest - uiTestBuildDirectory: 'Sandbox/Xamarin/HelloWorld/HelloWorld/HelloWorld.UITests/bin/$(BuildConfiguration)/net461/' - serverEndpoint: 'Prism-AppCenter' - appSlug: '$(AppCenterDroidSlug)' - devices: '$(AppCenterDroidDevices)' - enabled: true + targetPath: '$(Build.ArtifactStagingDirectory)' + artifactName: XamarinUITests +