@@ -54,8 +54,7 @@ Describe 'MAUI app (<tfm>, <configuration>)' -ForEach @(
5454 {
5555 param (
5656 [string ] $Dsn ,
57- [string ] $TestArg = ' None' ,
58- [ScriptBlock ] $Callback = $null
57+ [string ] $TestArg = ' None'
5958 )
6059 Write-Host " ::group::Run Android app (TestArg=$TestArg )"
6160 $dsn = $Dsn.Replace (' http://' , ' http://key@' ) + ' /0'
@@ -74,10 +73,7 @@ Describe 'MAUI app (<tfm>, <configuration>)' -ForEach @(
7473
7574 $procid = (& xharness android adb -- shell pidof " io.sentry.dotnet.maui.device.integrationtestapp" ) -replace ' \s' , ' '
7675 $activity = (& xharness android adb -- shell dumpsys activity activities) -match " io\.sentry\.dotnet\.maui\.device\.integrationtestapp"
77- if ($procid -and $activity -and $Callback )
78- {
79- & $Callback | ForEach-Object { Write-Host $_ }
80- }
76+
8177 } while ($procid -and $activity )
8278 }
8379
@@ -182,54 +178,27 @@ Describe 'MAUI app (<tfm>, <configuration>)' -ForEach @(
182178 }
183179 }
184180
185- It ' Delivers battery breadcrumbs in main thread (<configuration>)' - Skip:($configuration -eq " Release" ) {
186- try
187- {
188- $result = Invoke-SentryServer {
189- param ([string ]$url )
190- RunAndroidApp - Dsn $url - TestArg " BATTERY_CHANGED" {
191- # Trigger BATTERY_CHANGED events by incrementing the battery level
192- $battery = [int ](& xharness android adb -- shell dumpsys battery get level)
193- $battery = ($battery % 100 ) + 1
194- xharness android adb - v -- shell dumpsys battery set level $battery | ForEach-Object { Write-Host $_ }
195- }
196- }
197-
198- Dump- ServerErrors - Result $result
199- $result.HasErrors () | Should - BeFalse
200- $result.Envelopes () | Should - AnyElementMatch " `" type`" :`" system`" ,`" thread_id`" :1,`" category`" :`" device.event`" ,`" action`" :`" BATTERY_CHANGED`" "
201- $result.Envelopes () | Should - HaveCount 1
202- }
203- finally
204- {
205- xharness android adb - v -- shell dumpsys battery reset | ForEach-Object { Write-Host $_ }
181+ It ' Delivers battery breadcrumbs in main thread (<configuration>)' {
182+ $result = Invoke-SentryServer {
183+ param ([string ]$url )
184+ RunAndroidApp - Dsn $url - TestArg " BATTERY_CHANGED"
206185 }
207- }
208186
209- It ' Delivers network breadcrumbs in main thread (<configuration>)' - Skip:($configuration -eq " Release" ) {
210- try
211- {
212- $result = Invoke-SentryServer {
213- param ([string ]$url )
214- RunAndroidApp - Dsn $url - TestArg " NETWORK_CAPABILITIES_CHANGED" {
215- # Trigger NETWORK_CAPABILITIES_CHANGED events by toggling WiFi on/off
216- $wifi = (& xharness android adb -- shell settings get global wifi_on) -replace ' \s' , ' '
217- if ($wifi -eq ' 1' ) {
218- xharness android adb - v -- shell svc wifi disable | ForEach-Object { Write-Host $_ }
219- } else {
220- xharness android adb - v -- shell svc wifi enable | ForEach-Object { Write-Host $_ }
221- }
222- }
223- }
187+ Dump- ServerErrors - Result $result
188+ $result.HasErrors () | Should - BeFalse
189+ $result.Envelopes () | Should - AnyElementMatch " `" type`" :`" system`" ,`" thread_id`" :`" 1`" ,`" category`" :`" device.event`" ,`" action`" :`" BATTERY_CHANGED`" "
190+ $result.Envelopes () | Should - HaveCount 1
191+ }
224192
225- Dump- ServerErrors - Result $result
226- $result.HasErrors () | Should - BeFalse
227- $result.Envelopes () | Should - AnyElementMatch " `" type`" :`" system`" ,`" thread_id`" :1,`" category`" :`" network.event`" ,`" action`" :`" NETWORK_CAPABILITIES_CHANGED`" "
228- $result.Envelopes () | Should - HaveCount 1
229- }
230- finally
231- {
232- xharness android adb - v -- shell svc wifi enable | ForEach-Object { Write-Host $_ }
193+ It ' Delivers network breadcrumbs in main thread (<configuration>)' {
194+ $result = Invoke-SentryServer {
195+ param ([string ]$url )
196+ RunAndroidApp - Dsn $url - TestArg " NETWORK_CAPABILITIES_CHANGED"
233197 }
198+
199+ Dump- ServerErrors - Result $result
200+ $result.HasErrors () | Should - BeFalse
201+ $result.Envelopes () | Should - AnyElementMatch " `" type`" :`" system`" ,`" thread_id`" :`" 1`" ,`" category`" :`" network.event`" ,`" action`" :`" NETWORK_CAPABILITIES_CHANGED`" "
202+ $result.Envelopes () | Should - HaveCount 1
234203 }
235204}
0 commit comments