Skip to content

Commit 7d72059

Browse files
committed
Pre-install & xharness adb devices
Now `pwsh integration-test/android.Tests.ps1` device/emulator discovery works without adb in PATH or ANDROID_SERIAL explicitly defined.
1 parent e1cc0c5 commit 7d72059

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

integration-test/android.Tests.ps1

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,14 @@ BeforeDiscovery {
88
# Skip Android integration tests unless an emulator has been already started
99
# by Android Device Tests, or manually when testing locally. This avoids
1010
# slowing down non-Device Test CI builds further.
11+
Install-XHarness
1112
$script:emulator = Get-AndroidEmulatorId
1213
}
1314

1415
Describe 'MAUI app' -ForEach @(
1516
@{ tfm = "net9.0-android35.0" }
1617
) -Skip:(-not $script:emulator) {
1718
BeforeAll {
18-
. $PSScriptRoot/../scripts/device-test-utils.ps1
19-
Install-XHarness
20-
2119
Remove-Item -Path "$PSScriptRoot/mobile-app" -Recurse -Force -ErrorAction SilentlyContinue
2220
Copy-Item -Path "$PSScriptRoot/net9-maui" -Destination "$PSScriptRoot/mobile-app" -Recurse -Force
2321
Push-Location $PSScriptRoot/mobile-app

scripts/device-test-utils.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function Get-AndroidEmulatorId {
1616
}
1717
try
1818
{
19-
return & adb devices | Select-String "device$" | ForEach-Object { ($_ -split "`t")[0] } | Select-Object -First 1
19+
return & xharness android adb -- devices | Select-String "device$" | ForEach-Object { ($_ -split "`t")[0] } | Select-Object -First 1
2020
}
2121
catch
2222
{

0 commit comments

Comments
 (0)