-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Track: HTTP client support on React Native for Android and iOS #3404
Comments
Having tests running in React Native will be tricker than I initially expected. I had a look at Detox a couple of weeks ago and I was under the impression it allowed to run any kind of tests in React Native's environment. However, I had a deeper look most recently and Detox's architecture and inner workings and it turns out it's not possible at all. Detox supports test runners such as Mocha and Jest, but they actually run in a separate Node process, external to the app's runtime. Detox's assertions and matchers communicate with the app back and forth through a web socket and such APIs are designed exclusively for UI testing. Therefore, we will not be able to use Detox to run Fetch's tests. I was not able to find anything else out there in open source that achieves what we're looking for, i.e. having tests actually running in a React Native app just like Playwright does so in the web counterpart. Thus, we have to come up with something of our own. The first step is to explore how to have Mocha running in React Native (eventually discuss this with Mocha's team as well). I did have a quick shot at it yesterday, but I got a bunch of errors so I'll have to go in deeper. If Mocha reveals to be quite problematic in this regard, I can try with something more simpler, such as Tape. The second step is to design a solution to extract test results out of the app. A HTTP server should do, since we only need unidirectional communication where the app is the client. Once the JS kicks in upon app startup, the test runner would start immediately. The third and last step is to orchestrate the whole thing with a Node process: build the app, start te app, setup the server, signal the server that the tests are about to run, wait for the tests to run to completion, send the results and report them. |
try https://github.com/lukeed/uvu or https://github.com/lorenzofox3/zora these should be simpler to integrate in rn and wrap with something similar to playrwright-test for rn. |
@hugomrdias thanks! 💪 |
@autonome there has been a minor setback with regards to the developments of the test runner for RN. I had a discussion with @hugomrdias today, and we concluded that some changes are necessary to make it work properly when using the runner as a dependency (details above). It will require a bit more work but it's nothing to be concerned about. 😉 |
@autonome when @acostalima updates the OP you probably don't get a notification, we can setup a different process to make sure you get a ping about updates. |
Adding #3076 for tracking as well |
Finishing up the changes me and @hugomrdias agreed on in order to avoid packaging and distributing the test app to npm: acostalima/react-native-test-runner#2. The tests are passing locally, but failing on CI at the moment. |
This week:
|
The Fetch implementation for React Native is ready for v1.0.0 release. Meanwhile, I've asked Christoph from Facebook to give me permissions to publish the package in react-native-community scope. CC @autonome |
Last week
This week
CC @autonome |
Last week
This week
CC @autonome |
Last week
Next
CC @autonome |
This looks very promising, thank you @acostalima! As it may take a while to get any feedback from RN team, I'd like to ask if this is currently usable with the polyfills/patches? |
@rikur yes, you should be able to use most methods of the HTTP client with the available polyfills and patches. Have a look at https://github.com/ipfs-shipyard/react-native-ipfs-demo to see how to make it work. Note that I'm not sure whether the patch available at https://github.com/acostalima/react-native-polyfill-globals/blob/master/patches/react-native%2B0.63.3.patch can be applied to RN versions in the range <0.63.3 >=0.64.0. I know for sure the patch is compatible with 0.63.3 and 0.63.4. If you run into any issues, please let me know. 💪 |
@BigLep |
js-ipfs is being deprecated in favor of Helia. You can #4336 and read the migration guide. Please feel to reopen with any comments by 2023-06-02. We will do a final pass on reopened issues afterward (see #4336). @Haianh9999 note that I'm pushing for getting an example using react-native in Helia. I posted a comment at ipfs/helia#43 (comment), please feel free to contribute an example if you get time! |
HTTP client - January 18-29 ⌛
pubsub.subscribe
method to pass an option to fetch to activate text streaming support (custom option for React Native)React Native Test Runner - January 4-8 ✅
A CLI tool in line of what @hugomrdias has done with playright-test but for React Native. The first version includes support for Zora test runner.
Repo: https://github.com/acostalima/react-native-test-runner
xcrun simctl
, Wix's AppleSimulatorUtils, ...xcodebuild
,pod
server.close()
hangs after an app connects to the server and then when it's terminatedgradlew
adb
,emulator
,avdmanager
meow
,yarn
react-native init
to initialize a new React Native app instead and distributing itnode_modules
directory by hardcoded relative path look ups (e.g.../node_modules/react-native
). As such, the Android and iOS projects cannot be packaged and released to npm.react-native init
for Android and iOS respectively to launch the appsReferences & Inspiration
Fetch API - January 8-15 ✅
Technical discussion: react-native-community/fetch#4
ReadableStream
support and text streaming built in top of React Native's networking APIReadableStream
React Native - January 18-22 ⌛
console.error
andconsole.warn
when consuming aBlob
withFileReader.readAsDataURL
.FormData.set
methodFormData.getParts
capable of handlingBlob
instancesFileReader.readAsArrayBuffer
Related work
Jet by Invertase
The developers behind React Native Firebase. Currently, the project is a PoC and does not have a dedicated GitHub repo.
Blob download/upload
The text was updated successfully, but these errors were encountered: