Skip to content

test(react-native): Add E2E iOS Tests for React Native #889

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
merged 106 commits into from
Apr 29, 2025

Conversation

antonis
Copy link
Collaborator

@antonis antonis commented Mar 20, 2025

Based on: #884

Part of #856

Description

This PR aims to test the iOS React Native wizard modification:

✅ xcode project is updated correctly

ios/sentry.properties is added

To test locally run:

  • yarn test:e2e React-Native

#skip-changelog

antonis added 30 commits March 19, 2025 17:07
@antonis
Copy link
Collaborator Author

antonis commented Apr 24, 2025

I'm still investigating why this happens and how to work around it.

Adding a couple of missing declarations in the fork made the tests to run successfully on CI in strict mode 🎉

The next step would be to come up with a solution that doesn't require forking https://github.com/apache/cordova-node-xcode

@antonis antonis requested a review from Copilot April 25, 2025 11:38
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds E2E tests for the iOS React Native wizard modifications to verify that key configuration files are added and that the xcode project is updated correctly.

  • Adds tests for verifying the existence and contents of ios/sentry.properties and android/sentry.properties.
  • Adds tests to check that the xcode project includes the expected Sentry build phase script updates.
  • Updates the CI workflow configuration to run React-Native wizard tests on macos-15.

Reviewed Changes

Copilot reviewed 6 out of 15 changed files in this pull request and generated no comments.

File Description
e2e-tests/tests/react-native.test.ts Added tests for iOS sentry.properties, pod install prompt, prettier prompt, and xcode project updates.
e2e-tests/test-applications/react-native-test-app/ios/AppDelegate.swift Added a Swift AppDelegate leveraging React Native dependencies.
e2e-tests/test-applications/react-native-test-app/ios/Podfile Added Podfile for proper React Native iOS project configuration.
.github/workflows/build.yml Modified CI workflow to include/exclude React-Native wizard tests on macos-15.
Files not reviewed (9)
  • e2e-tests/test-applications/react-native-test-app/ios/.xcode.env: Language not supported
  • e2e-tests/test-applications/react-native-test-app/ios/reactnative078.xcodeproj/xcshareddata/xcschemes/reactnative078.xcscheme: Language not supported
  • e2e-tests/test-applications/react-native-test-app/ios/reactnative078/Images.xcassets/AppIcon.appiconset/Contents.json: Language not supported
  • e2e-tests/test-applications/react-native-test-app/ios/reactnative078/Images.xcassets/Contents.json: Language not supported
  • e2e-tests/test-applications/react-native-test-app/ios/reactnative078/Info.plist: Language not supported
  • e2e-tests/test-applications/react-native-test-app/ios/reactnative078/LaunchScreen.storyboard: Language not supported
  • e2e-tests/test-applications/react-native-test-app/ios/reactnative078/PrivacyInfo.xcprivacy: Language not supported
  • package.json: Language not supported
  • patches/xcode+3.0.1.patch: Language not supported
Comments suppressed due to low confidence (2)

e2e-tests/tests/react-native.test.ts:32

  • [nitpick] The comment does not accurately reflect the action. Update the comment to something like '// Prompt for pod install execution' since the prompt asks 'Do you want to run pod install now?'.
// Enable feedback widget

e2e-tests/tests/react-native.test.ts:47

  • [nitpick] The inline comment contradicts the prompt message regarding Prettier. Consider updating it to '// Prompt for running Prettier' to clarify the expected action.
// Skip pod install

- wizard: React-Native
include:
- wizard: React-Native
os: macos-15
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Running on ubuntu-latest will make the pod-install step to be skipped and the test to fail.

Copy link
Member

Choose a reason for hiding this comment

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

Can we run the test with pod-install -> no on ubuntu?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The issue is that there is no pod-install prompt and the test is stuck waiting. I'll check if I can make this check conditional 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I reverted the build.yml change and optionally skipped the pod-install check and iOS tests.

Copy link
Collaborator Author

@antonis antonis Apr 25, 2025

Choose a reason for hiding this comment

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

Patching was needed to fix the CI failure as described in #889 (comment)

Probably this also fixes failures in environments similar to our CI setup too.

Copy link
Member

Choose a reason for hiding this comment

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

Since we were unable to reproduce this locally, it's okay to patch the lib for the E2E tests, but if we get any reports of this or we will be able to reproduce this in the future we need to fix the Xcode lib or migrate to a new supported lib (for example bacons/xcode).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Makes sense 👍

@antonis antonis marked this pull request as ready for review April 25, 2025 11:44
@antonis antonis requested a review from krystofwoldrich April 25, 2025 11:47
@krystofwoldrich
Copy link
Member

The test looks good, I just have a two questions about the post install script and one about the run on linux.

@antonis antonis requested a review from krystofwoldrich April 28, 2025 16:40
Copy link
Member

@krystofwoldrich krystofwoldrich left a comment

Choose a reason for hiding this comment

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

🚀 Looks good, thank you for adding the E2E tests.

@krystofwoldrich krystofwoldrich merged commit ff15ba4 into master Apr 29, 2025
44 checks passed
@krystofwoldrich krystofwoldrich deleted the antonis/rn-e2e-ios branch April 29, 2025 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants