-
-
Notifications
You must be signed in to change notification settings - Fork 352
test(e2e): Add app start crash test for iOS #4593
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
krystofwoldrich
merged 33 commits into
capture-app-start-errors
from
kw-add-app-start-crash-ios
Feb 25, 2025
Merged
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
cc9543f
chore(samples): Add package scripts for native builds, dsn and testing
krystofwoldrich c20ac08
Merge branch 'capture-app-start-errors' into kw-simplify-local-sample…
krystofwoldrich f2a14c9
fix ci
krystofwoldrich d9fec19
fix android archive path
krystofwoldrich 6b8f314
fix ios build release
krystofwoldrich 25ab23b
fix(sample-e2e): Fix type errors missing sentry/core and afterAll
krystofwoldrich 20a132e
Merge branch 'kw-fix-bad-merge' into kw-simplify-local-sample-testing
krystofwoldrich 8b2227a
fix IOS_DEVICE empty check
krystofwoldrich d5e8e92
Merge branch 'capture-app-start-errors' into kw-simplify-local-sample…
krystofwoldrich 20e7f55
fix ios archive
krystofwoldrich 56fe4b8
test(e2e): Verify captured Errors Screen transaction
krystofwoldrich 4cfc937
add more tests
krystofwoldrich b484b07
Merge branch 'capture-app-start-errors' into kw-test-transactions
krystofwoldrich 86a675e
revert dsn change
krystofwoldrich 71fada9
fix lint
krystofwoldrich 0d6f543
remove jest extended from sample e2e tests
krystofwoldrich c5c93d2
Relax test to expect any type of app start, remove native frames as m…
krystofwoldrich def6e30
add app, device and react native context smoke tests
krystofwoldrich 3aae5bf
include transaction name in the tests
krystofwoldrich 46782a8
test(e2e): Add auto init from JS tests
krystofwoldrich 6b663e0
test(e2e): Add app start crash test for iOS
krystofwoldrich bf4ee0d
split ios test config to manual and auto
krystofwoldrich b7bb5fb
update test job name to include test type
krystofwoldrich d336903
add test-ios-auto sh script
krystofwoldrich 97e1b30
remove jest extended
krystofwoldrich 9d4c63a
Merge branch 'kw-test-transactions' into kw-add-auto-init-tests-ios
krystofwoldrich a97e5b3
Merge branch 'kw-add-auto-init-tests-ios' into kw-add-app-start-crash…
krystofwoldrich 0dbd3dc
fix c format
krystofwoldrich b86c577
Merge remote-tracking branch 'origin/capture-app-start-errors' into k…
krystofwoldrich a0301bc
fix detox config name doesn't have auto yet
krystofwoldrich 01e28d8
Merge branch 'kw-add-auto-init-tests-ios' into kw-add-app-start-crash…
krystofwoldrich 03cd6ba
add auto postfix to the config
krystofwoldrich ea022c2
Merge remote-tracking branch 'origin/capture-app-start-errors' into k…
krystofwoldrich File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
121 changes: 121 additions & 0 deletions
121
samples/react-native/e2e/captureAppStartCrash.test.ios.manual.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
import { describe, it, beforeAll, expect, afterAll } from '@jest/globals'; | ||
import { Envelope, EventItem } from '@sentry/core'; | ||
import { device } from 'detox'; | ||
import { | ||
createSentryServer, | ||
containingEvent, | ||
} from './utils/mockedSentryServer'; | ||
import { getItemOfTypeFrom } from './utils/event'; | ||
|
||
describe('Capture app start crash', () => { | ||
let sentryServer = createSentryServer(); | ||
sentryServer.start(); | ||
|
||
let envelope: Envelope; | ||
|
||
beforeAll(async () => { | ||
const launchConfig = { | ||
launchArgs: { | ||
0: '--sentry-crash-on-start', | ||
}, | ||
}; | ||
|
||
const envelopePromise = sentryServer.waitForEnvelope(containingEvent); | ||
|
||
device.launchApp(launchConfig); | ||
device.launchApp(launchConfig); // This launch sends the crash event before the app crashes again | ||
|
||
envelope = await envelopePromise; | ||
}); | ||
|
||
afterAll(async () => { | ||
await sentryServer.close(); | ||
}); | ||
|
||
it('envelope contains sdk metadata', async () => { | ||
const item = getItemOfTypeFrom<EventItem>(envelope, 'event'); | ||
|
||
expect(item).toEqual([ | ||
{ | ||
length: expect.any(Number), | ||
type: 'event', | ||
}, | ||
expect.objectContaining({ | ||
platform: 'cocoa', | ||
sdk: { | ||
features: [], | ||
integrations: [ | ||
'SessionReplay', | ||
'WatchdogTerminationTracking', | ||
'Screenshot', | ||
'Crash', | ||
'ANRTracking', | ||
'ViewHierarchy', | ||
'AutoBreadcrumbTracking', | ||
'AutoSessionTracking', | ||
'NetworkTracking', | ||
'AppStartTracking', | ||
'FramesTracking', | ||
], | ||
name: 'sentry.cocoa.react-native', | ||
packages: [ | ||
{ | ||
name: 'cocoapods:getsentry/sentry.cocoa.react-native', | ||
version: expect.any(String), | ||
}, | ||
{ | ||
name: 'npm:@sentry/react-native', | ||
version: expect.any(String), | ||
}, | ||
], | ||
version: expect.any(String), | ||
}, | ||
tags: { | ||
'event.environment': 'native', | ||
'event.origin': 'ios', | ||
}, | ||
}), | ||
]); | ||
}); | ||
|
||
it('envelope contains the expected exception', async () => { | ||
const item = getItemOfTypeFrom<EventItem>(envelope, 'event'); | ||
|
||
expect(item).toEqual([ | ||
{ | ||
length: expect.any(Number), | ||
type: 'event', | ||
}, | ||
expect.objectContaining({ | ||
exception: { | ||
values: expect.arrayContaining([ | ||
expect.objectContaining({ | ||
mechanism: expect.objectContaining({ | ||
handled: false, | ||
meta: { | ||
mach_exception: { | ||
code: 0, | ||
exception: 10, | ||
name: 'EXC_CRASH', | ||
subcode: 0, | ||
}, | ||
signal: { | ||
code: 0, | ||
name: 'SIGABRT', | ||
number: 6, | ||
}, | ||
}, | ||
type: 'nsexception', | ||
}), | ||
stacktrace: expect.objectContaining({ | ||
frames: expect.any(Array), | ||
}), | ||
type: 'CrashOnStart', | ||
value: 'This was intentional test crash before JS started.', | ||
}), | ||
]), | ||
}, | ||
}), | ||
]); | ||
}); | ||
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,7 @@ | ||
const baseConfig = require('./jest.config.base'); | ||
|
||
/** @type {import('@jest/types').Config.InitialOptions} */ | ||
module.exports = { | ||
preset: 'ts-jest', | ||
rootDir: '..', | ||
testMatch: [ | ||
'<rootDir>/e2e/**/*.test.ts', | ||
'<rootDir>/e2e/**/*.test.android.ts', | ||
], | ||
testTimeout: 120000, | ||
maxWorkers: 1, | ||
globalSetup: 'detox/runners/jest/globalSetup', | ||
globalTeardown: 'detox/runners/jest/globalTeardown', | ||
reporters: ['detox/runners/jest/reporter'], | ||
testEnvironment: 'detox/runners/jest/testEnvironment', | ||
verbose: true, | ||
...baseConfig, | ||
testMatch: [...baseConfig.testMatch, '<rootDir>/e2e/**/*.test.android.ts'], | ||
}; |
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const baseConfig = require('./jest.config.base'); | ||
|
||
/** @type {import('@jest/types').Config.InitialOptions} */ | ||
module.exports = { | ||
...baseConfig, | ||
testMatch: [ | ||
...baseConfig.testMatch, | ||
'<rootDir>/e2e/**/*.test.ios.ts', | ||
'<rootDir>/e2e/**/*.test.ios.auto.ts', | ||
], | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const baseConfig = require('./jest.config.base'); | ||
|
||
/** @type {import('@jest/types').Config.InitialOptions} */ | ||
module.exports = { | ||
...baseConfig, | ||
testMatch: [ | ||
...baseConfig.testMatch, | ||
'<rootDir>/e2e/**/*.test.ios.ts', | ||
'<rootDir>/e2e/**/*.test.ios.manual.ts', | ||
], | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.