1+ param (
2+ [string ] $dotnet_version = " net10.0"
3+ )
4+
15# This file contains test cases for https://pester.dev/
26Set-StrictMode - Version Latest
37$ErrorActionPreference = ' Stop'
48. $PSScriptRoot / pester.ps1
9+ . $PSScriptRoot / common.ps1
510. $PSScriptRoot / ../ scripts/ device- test-utils.ps1
611
712BeforeDiscovery {
@@ -12,11 +17,14 @@ BeforeDiscovery {
1217 $script :emulator = Get-AndroidEmulatorId
1318}
1419
15- Describe ' MAUI app (<tfm>, <configuration>)' - ForEach @ (
16- @ { tfm = " net9.0-android35.0" ; configuration = " Release" }
17- @ { tfm = " net9.0-android35.0" ; configuration = " Debug" }
18- ) - Skip:(-not $script :emulator ) {
20+ $cases = @ (
21+ @ { configuration = ' Release' }
22+ @ { configuration = ' Debug' }
23+ )
24+ Describe ' MAUI app (<dotnet_version>, <configuration>)' - ForEach $cases - Skip:(-not $script :emulator ) {
1925 BeforeAll {
26+ $tfm = " $dotnet_version -android$ ( GetAndroidTpv $dotnet_version ) "
27+
2028 Remove-Item - Path " $PSScriptRoot /mobile-app" - Recurse - Force - ErrorAction SilentlyContinue
2129 Copy-Item - Path " $PSScriptRoot /net9-maui" - Destination " $PSScriptRoot /mobile-app" - Recurse - Force
2230 Push-Location $PSScriptRoot / mobile- app
@@ -126,9 +134,9 @@ Describe 'MAUI app (<tfm>, <configuration>)' -ForEach @(
126134
127135 Dump- ServerErrors - Result $result
128136 $result.HasErrors () | Should - BeFalse
129- $result.Envelopes () | Should - AnyElementMatch " `" type`" :`" System.ApplicationException`" "
130- $result.Envelopes () | Should -Not - AnyElementMatch " `" type`" :`" SIGABRT`" "
131- $result.Envelopes () | Should - HaveCount 1
137+ $result.Events () | Should - AnyElementMatch " `" type`" :`" System.ApplicationException`" "
138+ $result.Events () | Should -Not - AnyElementMatch " `" type`" :`" SIGABRT`" "
139+ $result.Events () | Should - HaveCount 1
132140 }
133141
134142 It ' Java crash (<configuration>)' {
@@ -140,9 +148,9 @@ Describe 'MAUI app (<tfm>, <configuration>)' -ForEach @(
140148
141149 Dump- ServerErrors - Result $result
142150 $result.HasErrors () | Should - BeFalse
143- $result.Envelopes () | Should - AnyElementMatch " `" type`" :`" RuntimeException`" "
144- $result.Envelopes () | Should -Not - AnyElementMatch " `" type`" :`" System.\w+Exception`" "
145- $result.Envelopes () | Should - HaveCount 1
151+ $result.Events () | Should - AnyElementMatch " `" type`" :`" RuntimeException`" "
152+ $result.Events () | Should -Not - AnyElementMatch " `" type`" :`" System.\w+Exception`" "
153+ $result.Events () | Should - HaveCount 1
146154 }
147155
148156 It ' Native crash (<configuration>)' {
@@ -154,9 +162,9 @@ Describe 'MAUI app (<tfm>, <configuration>)' -ForEach @(
154162
155163 Dump- ServerErrors - Result $result
156164 $result.HasErrors () | Should - BeFalse
157- $result.Envelopes () | Should - AnyElementMatch " `" type`" :`" SIG[A-Z]+`" " # SIGILL (x86_64), SIGTRAP (arm64-v8a)
158- $result.Envelopes () | Should -Not - AnyElementMatch " `" type`" :`" System.\w+Exception`" "
159- $result.Envelopes () | Should - HaveCount 1
165+ $result.Events () | Should - AnyElementMatch " `" type`" :`" SIG[A-Z]+`" " # SIGILL (x86_64), SIGTRAP (arm64-v8a)
166+ $result.Events () | Should -Not - AnyElementMatch " `" type`" :`" System.\w+Exception`" "
167+ $result.Events () | Should - HaveCount 1
160168 }
161169
162170 It ' Null reference exception (<configuration>)' {
@@ -168,13 +176,13 @@ Describe 'MAUI app (<tfm>, <configuration>)' -ForEach @(
168176
169177 Dump- ServerErrors - Result $result
170178 $result.HasErrors () | Should - BeFalse
171- $result.Envelopes () | Should - AnyElementMatch " `" type`" :`" System.NullReferenceException`" "
179+ $result.Events () | Should - AnyElementMatch " `" type`" :`" System.NullReferenceException`" "
172180 # TODO: fix redundant SIGSEGV in Release (#3954)
173181 if ($configuration -eq " Release" ) {
174- { $result.Envelopes () | Should -Not - AnyElementMatch " `" type`" :`" SIGSEGV`" " } | Should - Throw
182+ { $result.Events () | Should -Not - AnyElementMatch " `" type`" :`" SIGSEGV`" " } | Should - Throw
175183 } else {
176- $result.Envelopes () | Should -Not - AnyElementMatch " `" type`" :`" SIGSEGV`" "
177- $result.Envelopes () | Should - HaveCount 1
184+ $result.Events () | Should -Not - AnyElementMatch " `" type`" :`" SIGSEGV`" "
185+ $result.Events () | Should - HaveCount 1
178186 }
179187 }
180188
@@ -186,8 +194,8 @@ Describe 'MAUI app (<tfm>, <configuration>)' -ForEach @(
186194
187195 Dump- ServerErrors - Result $result
188196 $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
197+ $result.Events () | Should - AnyElementMatch " `" type`" :`" system`" ,`" thread_id`" :`" 1`" ,`" category`" :`" device.event`" ,`" action`" :`" BATTERY_CHANGED`" "
198+ $result.Events () | Should - HaveCount 1
191199 }
192200
193201 It ' Delivers network breadcrumbs in main thread (<configuration>)' {
@@ -198,7 +206,7 @@ Describe 'MAUI app (<tfm>, <configuration>)' -ForEach @(
198206
199207 Dump- ServerErrors - Result $result
200208 $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
209+ $result.Events () | Should - AnyElementMatch " `" type`" :`" system`" ,`" thread_id`" :`" 1`" ,`" category`" :`" network.event`" ,`" action`" :`" NETWORK_CAPABILITIES_CHANGED`" "
210+ $result.Events () | Should - HaveCount 1
203211 }
204212}
0 commit comments