Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@

## Unreleased

### Features

- Report the generation of the cellular network technology in `device.connection_effective_type` on Android and iOS, for example `4g` or `5g` ([#6827](https://github.com/getsentry/sentry-react-native/pull/6827))
- On Android 11 and earlier, the app must have the `READ_PHONE_STATE` permission. The SDK does not request this permission.

### Fixes

- Fix stale `turbo_module.*` tags on Android native crashes ([#6823](https://github.com/getsentry/sentry-react-native/pull/6823))
Expand Down
13 changes: 13 additions & 0 deletions packages/core/test/integrations/devicecontext.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,19 @@ describe('Device Context Integration', () => {
});
});

it('adds the native connection type and technology to the device context', async () => {
const { processedEvent } = await processEventWith({
nativeContexts: {
contexts: { device: { connection_type: 'cellular', connection_effective_type: '5g' } },
},
});
expect(processedEvent).toStrictEqual({
contexts: {
device: { connection_type: 'cellular', connection_effective_type: '5g' },
},
});
});

it('merge native tags', async () => {
const { processedEvent } = await processEventWith({
nativeContexts: { tags: { duplicate: 'native-tag', native: 'tag' } },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ describe('Capture message', () => {
contexts: expect.objectContaining({
device: expect.objectContaining({
arch: expect.any(String),
connection_type: expect.any(String),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The iOS e2e test incorrectly asserts that the optional connection_type field is always present, which can lead to flaky test failures.
Severity: LOW

Suggested Fix

The assertion for connection_type should be updated to handle cases where the field is absent. Instead of expect.any(String), consider a more flexible matcher that accepts either a string or an undefined value to align with the native SDK's behavior and prevent flaky test failures.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: samples/react-native/e2e/tests/captureMessage/captureMessage.test.ios.ts#L61

Potential issue: The iOS end-to-end test at `captureMessage.test.ios.ts:61` adds a
strict assertion for `connection_type: expect.any(String)`. However, the underlying
`sentry-cocoa` SDK documentation specifies that the `connection_type` field is optional
and will be omitted if the connection is unknown. This discrepancy will cause the test
to fail when the SDK legitimately omits this field, a plausible scenario in CI
environments due to timing or network conditions. This makes the test flaky and
unreliable.

Did we get this right? 👍 / 👎 to inform future reviews.

family: expect.any(String),
free_memory: expect.any(Number),
locale: expect.any(String),
Expand Down
Loading