Detox build command fails in Github jobs - detox

Running build test for ios release locally is working fine, however it fails on Github actions enter image description here

It seems like your app build command (that you have provided in Detox config) is faulty and that is why your app is failing build. Unrelated to Detox.

Related

Build command in detox

Looking at this doc: https://github.com/wix/Detox/blob/master/docs/APIRef.Configuration.md
It says that the
Build command (either xcodebuild, react-native run-ios, etc...), will
be later available through detox CLI tool.
I'm trying to setup the build command to work with Android. Am I supposed to add react-native run-android to the build command? What do they mean by Detox CLI tool?
The build field is optional, and should contain whichever execution logic needed in order to have the .apk file set and ready in the path specified in binaryPath. You are more than welcome to refer to the Detox example project, which was set up as a reference exactly for these type of questions.
In any case, from the react-native CLI tool's help: react-native run-android = builds your app and starts it on a connected Android emulator or device. That makes it not very suitable, as we typically want to build the app, and have detox launch the emulator (optional) and install the app on the device(s), as needed.

How is detox code inserted into the app bundle

I use detox to run e2e tests on react native.
This artcile written by one of the people working on detox says
Gray box essentially uses a piece of code that is planted in the app, it can help us see what’s going on inside.
My question is, how does that happen? Looking at the docs the command used for detox build is
xcodebuild -project ios/YourProject.xcodeproj -scheme YourProject -sdk iphonesimulator -derivedDataPath ios/build
No detox-specific mention to be seen there.
Also, the docs state here that the build command is optional and that
You can also choose not to use it and provide a compiled app by yourself.
Well, how do I do that? How do I inject detox / make sure detox is not injected into my app? If I download compiled app from my CI server it does not work with detox (not surprisingly since the detox code is not planted into the app). But if I use the detox build command (which seem to just run whatever the build command in the config specifies), the tests work. There seems to be some "magic" happening which is not understandable for a newcomer.
Thanks.
It's magic!
Well, actually it isn't. The build step is completely optional, and as stated in the documentation, Detox works with any valid app.
In order to load Detox, we tell the dynamic linker to load it using the DYLD_INSERT_LIBRARIES environment variable. So it only loads Detox when you run detox test from the command line.
This is easy on the simulator as it has access to your Mac's file system. Once we implement support for testing on actual hardware devices, we will still use that environment variable, but we will have to inject it inside your IPA file directly.

How to run Expo test suite

I generated sample expo app, pull the latest https://github.com/expo/test-suite. I run test-suite in the simulator, it shows a spinner which never disappears.
Can you provide me an instruction how to run the tests?
I see some warnings as well while running test-suite.
Warning
Warning: Using unversioned Expo SDK. Do not publish until you set sdkVersion in exp.json
Warning
Warning: 'react' peer depencency missing. Run `npm ls` in /project/test-suite to see full warning.
If there is an issue running your project, please run `npm install` in /project/test-suite and restart.
Thanks
the repository that you linked is not a "test" suit as you understand it. It is not for testing your app. It exist for the developers of Expo as a tool, to test Expo before new releases of it.
Check out more about unit testing and test driven development;
https://en.wikipedia.org/wiki/Unit_testing
https://en.wikipedia.org/wiki/Development_testing
If your goal is to test your own app in you will need a simulator or a development device;
https://docs.expo.io/versions/v18.0.0/guides/up-and-running.html

React Native Expo building standalone app

I use Expo for development. I don't know how to build .apk for Android. I checked out Building Standalone Apps documentation. It says:
This will take a few minutes, you can check up on it by running exp
build:status. When it’s done, you’ll see the url of a .apk (Android)
or .ipa (iOS) file — this is your app.
exp build:android
I tried a few times. It's been a while. No errors, no links. Nothing on the web portal. Am I doing something wrong?
expo has it's integrated system if you are using their building structure.
The building takes a while as stated. (Around 5-10mins) your build process starts with the command;
exp build:android
After a while, check the status of your build with command;
exp build:status
If your build it done, this comman will give you your .apk file url. If not, it will say your build is still in progress and try in a little bit later again.
Expo build take some time (6-15min). You can see build progress log using link
https://expo.io/builds
Web link show all builds of your accounts. You can download old build or see log
or in short you can
exp build:status
Your options are
wait, until your build is completed
Note! If you get the following error:
Cannot start a new build, as there is already an in-progress build.
error Command failed with exit code 1.
then your Expo.io build is stuck. Please go to https://expo.io -> Builds and look for the latest (IOS/Android) build. If it's in "Queued" state (after 17 days as in my case), open the details and click Cancel Build.
Subscribe to the paid Expo.io account so you get priority in build queue.
Install turtle-cli and build the app locally, see https://docs.expo.io/distribution/turtle-cli/
If it normally takes from 15-30minutes for Expo.io to build the app, turtle-cli can do it in 2-3mins.

Unable to run react-native release build

I am trying to deploy my react-native app to android. I follow the steps on this page
https://facebook.github.io/react-native/docs/signed-apk-android.html.
When I try to run it, it tells me
not such file or directory '.../assets/index.android.bundle'
or I get
Task 'installReleaseDebug' not found in root project 'awezaEduApp'
Using Windows 10 and react-native 0.39.2
OUTCOME
I ended up having to reformat my laptop for other reasons and when i repeated the signing process it worked. On account of my previous efforts, prior to reformatting, I would presume that Eldelshell's answer would have solved it.
Note: I think that running gradle tasks in Android Studio's terminal would also work.
You need to execute react-native run-android at least once. Don't worry if it fails because you don't have the emulator running.
or I get Task 'installReleaseDebug' not found in root project 'awezaEduApp'
You have to execute gradle inside the android folder.
Task 'installReleaseDebug' not found in root project 'awezaEduApp'
For RN 0.39.x, you have to run the following for release build:
react-native run-android --configuration=release