Running E2E tests with Detox and Android emulator on mac m1 - react-native

I have some troubleshoot when running detox e2e tests on Android emulator with my Macbook pro m1 (Apple chipset)
I want to know if it's only me or if there is others with the same difficulty ?

I had the same issue with M1, I solved it by upgrading detox to 19.9.2

I do. Randomly having issue like this
The pending request #-1000 ("isReady") has been rejected

Related

After updating to Expo SDK 41 from Expo SDK 40, Android Studio won't start emulator

I go to start emulator on my mac m1 and it'll bring up the phone emulator however my project is not uploaded to the phone.
I am getting this error in the terminal:
› Opening on Android...
› Opening emulator Pixel_5_API_33
› Opening exp://172.16.100.190:19000 on Pixel_5_API_33
Couldn't start project on Android: Error running adb: adb: failed to install /Users/me/.expo/android-apk-cache/Exponent-2.19.7.apk: Failure [INSTALL_FAILED_INSUFFICIENT_STORAGE]
› Press ? │ show all commands
This download is taking longer than expected. You can also try downloading the clients from the website at https://expo.dev/tools
⠦ Installing Expo Go 2.19.7 on Pixel_5_API_33
The ios emulator seems to be working fine
I just solved this issue for myself, it appears your emulator doesn't have enough storage assigned to it.
Here's how you can increase the storage on your emulator
For my emulator I increased the device Internal Storage to 8GB and enabled No SDCard. This has allowed me to emulate my expo react-native app on Android while running on my M1 silicon chip MacBook.

React-native-app The development server returned response error code: 500 in vs code emulator

[How to solve this red emulator error?
(React native app in VScode?][1]
How to solve this red emulator error?
(React native app in VScode?
It's at start project.
I use:
Vscode + yarn android
[1]: https://i.stack.imgur.com/g0RhY.jpg
The adb port doesn't seem to be suitable. You can try the following.
adb reverse tcp:8081 tcp:8081
yarn start
yarn android
Check your navigations, clean gradle and try to run it. Otherwise uninstall it and then again put commands. Check Local properties and paths also.

React-native-admob-native-ads not working on real device without testID and iOS simulator

I have installed 'react-native-admob-native-ads' plugin with 0.4.1 version and react-native version is 0.64.2.
i can't test ad without testAdId in Android,
iOS we can't test with testAdId in simulator.
any one can help me to figure this out?
unfortunately, current can't use Ad on react-native.
https://github.com/invertase/react-native-firebase/issues/5329#issuecomment-843272057

Unable to launch app via appium capabilities but app launched successfully via 'xcrun simctl install booted install myApp.app'

Error message: ‘myApp.app’ cannot be opened because the developer cannot be verified.
I face above error when I install the myApp.app using Appium on my iOS simulator. However, when I install the same myApp.app using terminal command ‘xcrun simctl install booted install myApp.app’ then the app installed/launched perfectly fine.
Note: I am a tester hence I have not built the app using XCode and moving forward I will be getting the .app file only from the developer for testing.
Below are the details
Appium desktop client version : 1.15.1
macOS version : 10.15.2
XCode version: 11.3
I am using below appium desired capabilities for iOS
{
“platformName”: “iOS”,
“platformVersion”: “13.3”,
“deviceName”: “iPhone 8”,
“automationName”: “XCUITest”,
“app”: “/Users/harj/Desktop/myApp.app”,
“bundleId”: “com.abc.xyzApp”,
“commandTimeouts”: 60000,
“noReset”: false,
“autoGrantPermissions”: true,
“useNewWDA”: true,
“showXcodeLog”: true
}
Appium logs
There are many errors in the log but i found this one relevent
Original error: ‘idb’ has not been found in PATH. Is it installed? Read https://www.fbidb.io for more details
That would be great if someone faced the same problem and got a solution.
Happpy Testing
harj
I can able to launch the sample .app file on simulator with below versions.
I have resolved setup issue for simulator 13.4 version with xcode 11.4.
Simulator-: 13.4
xcode -: 11.4
mac os. -: 10.15.4
appium v -: 1.17.0
If you still face any issue then let me know. with appium logs and whole details.
Finally, the solution has been found.
Actually, the problem is with the macOS Catalina not with the Appium. The OS was preventing the .app to install on the simulator. There are two ways to solve this problem.
1) Degrade the gatekeeper(security) check on your mac.
2) Quarantine that specific app using below terminal command
xattr -dr com.apple.quarantine /yourAppPath/myApp.app
I recommended the option2 as it will keep your mac safe from attacks.

React Native Detox hardware limitations?

I've set up detox on my 2014 mac mini, which is also running jenkins to serve as my CI.
I've been getting inconsistent test results from isNil or isVisible matcher, slow simulator boot up, and tests will always fail when running in headless mode.
I've had to set up jest timeouts as well as await timeouts on the tests to factor the slowness of my mac mini booting up a simulator.
When I run detox on my local 2018 macbook pro, I see no issues and the tests pass fine without so much delay.
Are there hardware limitations that I should be aware about or is there anyway to speed up my mac mini so it doesn't take so long to boot a device?
Is become quite a hassle the detox test is becoming more painful