@@ -6,85 +6,147 @@ $ErrorActionPreference = 'Stop'
66Describe ' MAUI app' {
77 BeforeAll {
88 . $PSScriptRoot / ios- simulator- utils.ps1
9+
10+ $tfm = " net9.0-ios18.0"
11+ $target = " ios-simulator-64"
12+ $arch = ($ (uname - m) -eq ' arm64' ) ? ' arm64' : ' x64'
13+ $rid = " iossimulator-$arch "
14+ $udid = Get-IosSimulatorUdid - IosVersion ' 18.5' - Verbose
15+
16+ $arguments = @ (
17+ " -v" ,
18+ " --target=$target " ,
19+ " --output-directory=integration_test_output"
20+ )
21+ if ($udid )
22+ {
23+ $arguments += @ (" --device=$udid " )
24+ }
25+ else
26+ {
27+ Write-Host " No suitable simulator found; proceeding without a specific --device"
28+ }
29+
30+ Push-Location $PSScriptRoot / ../ test/ Sentry.Maui.Device.IntegrationTestApp
31+
32+ Write-Host " ::group::Build Sentry.Maui.Device.IntegrationTestApp.csproj"
33+ dotnet build Sentry.Maui.Device.IntegrationTestApp.csproj `
34+ -- configuration Release `
35+ -- framework $tfm `
36+ -- runtime $rid
37+ | ForEach-Object { Write-Host $_ }
38+ $LASTEXITCODE | Should - Be 0
39+ Write-Host ' ::endgroup::'
40+ }
41+
42+ BeforeEach {
43+ Write-Host " ::group::Install bin/Release/$tfm /$rid /Sentry.Maui.Device.IntegrationTestApp.app"
44+ xharness apple install $arguments `
45+ -- app bin/ Release/ $tfm / $rid / Sentry.Maui.Device.IntegrationTestApp.app
46+ | ForEach-Object { Write-Host $_ }
47+ $LASTEXITCODE | Should - Be 0
48+ Write-Host ' ::endgroup::'
949 }
10- It ' Produces the expected exceptions' {
50+
51+ AfterEach {
52+ Write-Host " ::group::Uninstall io.sentry.dotnet.maui.device.integrationtestapp"
53+ xharness apple uninstall $arguments `
54+ -- app io.sentry.dotnet.maui.device.integrationtestapp
55+ | ForEach-Object { Write-Host $_ }
56+ $LASTEXITCODE | Should - Be 0
57+ Write-Host ' ::endgroup::'
58+ }
59+
60+ AfterAll {
61+ Pop-Location
62+ }
63+
64+ It ' Managed crash' {
1165 $result = Invoke-SentryServer {
1266 Param ([string ]$url )
1367 $dsn = $url.Replace (' http://' , ' http://key@' ) + ' /0'
1468
15- Push-Location $PSScriptRoot / ../ test/ Sentry.Maui.Device.IntegrationTestApp
16- try
17- {
18- $tfm = " net9.0-ios18.0"
19- $target = " ios-simulator-64"
20- $arch = ($ (uname - m) -eq ' arm64' ) ? ' arm64' : ' x64'
21- $rid = " iossimulator-$arch "
22- $udid = Get-IosSimulatorUdid - IosVersion ' 18.5' - Verbose
23-
24- $arguments = @ (
25- " -v" ,
26- " --target=$target " ,
27- " --output-directory=integration_test_output"
28- )
29- if ($udid )
30- {
31- $arguments += @ (" --device=$udid " )
32- }
33- else
34- {
35- Write-Host " No suitable simulator found; proceeding without a specific --device"
36- }
37-
38- Write-Host " ::group::Build"
39- dotnet build Sentry.Maui.Device.IntegrationTestApp.csproj `
40- -- configuration Release `
41- -- framework $tfm `
42- -- runtime $rid
43- | ForEach-Object { Write-Host $_ }
44- $LASTEXITCODE | Should - Be 0
45- Write-Host ' ::endgroup::'
46-
47- Write-Host " ::group::Install"
48- xharness apple install $arguments `
49- -- app bin/ Release/ $tfm / $rid / Sentry.Maui.Device.IntegrationTestApp.app
50- | ForEach-Object { Write-Host $_ }
51- $LASTEXITCODE | Should - Be 0
52- Write-Host ' ::endgroup::'
53-
54- Write-Host " ::group::Crash"
55- xharness apple just- run $arguments `
56- -- app io.sentry.dotnet.maui.device.integrationtestapp `
57- -- set-env SENTRY_DSN= $dsn `
58- -- set-env SENTRY_CRASH_TYPE= Managed
59- | ForEach-Object { Write-Host $_ }
60- $LASTEXITCODE | Should - Be 0
61- Write-Host ' ::endgroup::'
62-
63- Write-Host " ::group::Re-run"
64- xharness apple just- run $arguments `
65- -- app io.sentry.dotnet.maui.device.integrationtestapp `
66- -- set-env SENTRY_DSN= $dsn `
67- -- set-env SENTRY_CRASH_TYPE= Exit
68- | ForEach-Object { Write-Host $_ }
69- $LASTEXITCODE | Should - Be 0
70- Write-Host ' ::endgroup::'
71-
72- Write-Host " ::group::Uninstall"
73- xharness apple uninstall $arguments `
74- -- app io.sentry.dotnet.maui.device.integrationtestapp
75- | ForEach-Object { Write-Host $_ }
76- $LASTEXITCODE | Should - Be 0
77- Write-Host ' ::endgroup::'
78- }
79- finally
80- {
81- Pop-Location
82- }
69+ Write-Host " ::group::Cause managed crash"
70+ xharness apple just- run $arguments `
71+ -- app io.sentry.dotnet.maui.device.integrationtestapp `
72+ -- set-env SENTRY_DSN= $dsn `
73+ -- set-env SENTRY_CRASH_TYPE= Managed
74+ | ForEach-Object { Write-Host $_ }
75+ $LASTEXITCODE | Should - Be 0
76+ Write-Host ' ::endgroup::'
77+
78+ Write-Host " ::group::Re-run"
79+ xharness apple just- run $arguments `
80+ -- app io.sentry.dotnet.maui.device.integrationtestapp `
81+ -- set-env SENTRY_DSN= $dsn `
82+ -- set-env SENTRY_TEST_ACTION= Exit
83+ | ForEach-Object { Write-Host $_ }
84+ $LASTEXITCODE | Should - Be 0
85+ Write-Host ' ::endgroup::'
8386 }
8487
8588 $result.HasErrors () | Should - BeFalse
8689 $result.Envelopes () | Should - AnyElementMatch " `" type`" :`" System.ApplicationException`" "
8790 # TODO: fix redundant SIGABRT (#3954)
8891 { $result.Envelopes () | Should -Not - AnyElementMatch " `" type`" :`" SIGABRT`" " } | Should - Throw
8992 }
93+
94+ It ' Native crash' {
95+ $result = Invoke-SentryServer {
96+ Param ([string ]$url )
97+ $dsn = $url.Replace (' http://' , ' http://key@' ) + ' /0'
98+
99+ Write-Host " ::group::Cause native crash"
100+ xharness apple just- run $arguments `
101+ -- app io.sentry.dotnet.maui.device.integrationtestapp `
102+ -- set-env SENTRY_DSN= $dsn `
103+ -- set-env SENTRY_CRASH_TYPE= Native
104+ | ForEach-Object { Write-Host $_ }
105+ $LASTEXITCODE | Should - Be 0
106+ Write-Host ' ::endgroup::'
107+
108+ Write-Host " ::group::Re-run"
109+ xharness apple just- run $arguments `
110+ -- app io.sentry.dotnet.maui.device.integrationtestapp `
111+ -- set-env SENTRY_DSN= $dsn `
112+ -- set-env SENTRY_TEST_ACTION= Exit
113+ | ForEach-Object { Write-Host $_ }
114+ $LASTEXITCODE | Should - Be 0
115+ Write-Host ' ::endgroup::'
116+ }
117+
118+ $result.HasErrors () | Should - BeFalse
119+ $result.Envelopes () | Should - AnyElementMatch " `" type`" :`" EXC_[A-Z_]+`" "
120+ $result.Envelopes () | Should -Not - AnyElementMatch " `" type`" :`" System.*Exception`" "
121+ }
122+
123+ It ' Null reference exception' {
124+ $result = Invoke-SentryServer {
125+ Param ([string ]$url )
126+ $dsn = $url.Replace (' http://' , ' http://key@' ) + ' /0'
127+
128+ Write-Host " ::group::Trigger null reference exception"
129+ xharness apple just- run $arguments `
130+ -- app io.sentry.dotnet.maui.device.integrationtestapp `
131+ -- set-env SENTRY_DSN= $dsn `
132+ -- set-env SENTRY_TEST_ACTION= NullReferenceException
133+ | ForEach-Object { Write-Host $_ }
134+ $LASTEXITCODE | Should - Be 0
135+ Write-Host ' ::endgroup::'
136+
137+ Write-Host " ::group::Re-run"
138+ xharness apple just- run $arguments `
139+ -- app io.sentry.dotnet.maui.device.integrationtestapp `
140+ -- set-env SENTRY_DSN= $dsn `
141+ -- set-env SENTRY_TEST_ACTION= Exit
142+ | ForEach-Object { Write-Host $_ }
143+ $LASTEXITCODE | Should - Be 0
144+ Write-Host ' ::endgroup::'
145+ }
146+
147+ $result.HasErrors () | Should - BeFalse
148+ $result.Envelopes () | Should - AnyElementMatch " `" type`" :`" System.NullReferenceException`" "
149+ # TODO: fix redundant EXC_BAD_ACCESS (#3954)
150+ { $result.Envelopes () | Should -Not - AnyElementMatch " `" type`" :`" EXC_BAD_ACCESS`" " } | Should - Throw
151+ }
90152}
0 commit comments