MetaMask / metamask-mobile

Mobile web browser providing access to websites that use the Ethereum blockchain
https://metamask.io
Other
2.18k stars 1.12k forks source link

[E2E iOS specific] Detox is failing when running tests on bitrise against release builds #6610

Open cortisiko opened 1 year ago

cortisiko commented 1 year ago

Detox on iOS is failing on bitrise. The reason being is because the tests are encountering a fatal error during test execution. See the screenshot of the error below:

image.png

You can follow this thread for more info: https://consensys.slack.com/archives/C04GLB755TK/p1686001534455339?thread_ts=1685635037.860389&cid=C04GLB755TK

sethkfman commented 1 year ago

To unblock this issue:

@cortisiko Let chat async on this or reach out.

tommasini commented 1 year ago

With the react native upgrade to the version 0.71.6, when changing the configuration of the build on xCode to release. (To do it, press cmd+shift+, )

image

We build and run MetaMask, but after importing or creating a wallet, we have the following errors: On console, we can detect some errors: image

Xcode points to this error Unhandled JS Exception: Error: Should not already be working.

tommasini commented 1 year ago

Tried to activate the new architecture on IOS following this guide: Upgraded react native to 0-72.rc-6 to support react native reanimated with new architecture:

Having these errors so far: debug configuration: index.js: The "id" argument must be of type string. Received undefined release: Unhandled JS Exception: TypeError: undefined is not an object (evaluating 'this.InnerNativeModule.installCoreFunctions'

cortisiko commented 1 year ago

We spoke about this and decided to address the post-RN merge. The temporary solution is to run the E2E tests against a debug build for iOS. Long term solution is to address the crash.

tommasini commented 1 year ago

Log progress: The error is only when navigating to wallet view (from import or create a new wallet, or logging in)

Things to try:

tommasini commented 1 year ago

I'm ending the day, what we have found so far:

I will explain better the last one here: Right now I went the deeper possible without a crash, only have commented the lines 131-144of onboardingWizard component, returning a view instead of the onboarding modal, and the line 551 of Tokens component (The one that renders the list or the empty text, I let only render the empty text). Both of this components are rendered on Wallet view. Uncommenting one of these lines the error is Unhandled JS Exception: Error: Should not already be working.,. And it's consistent, it happens when we log in, when we import a wallet or create a new one.

I think this is an error of something on react native new version or xcode that is not working well yet with the apple chips.

tommasini commented 1 year ago

We checked as well the stack size limit of the processor on this apple silicon machine, the difference between the first m1 apple chip (512kb) to an intel processor (8mb), but now the default on the new m1 machines is 8mb as well, and we checked that with the command ulimit -n, It was tried as well to increase the stack size of the simulator itself, hardcoding it on xCode, and the error persists Should not already be working . What tells me is that this is not a stack size issue anymore after commenting described the comment above.

tommasini commented 1 year ago

Moving this to the blocked column to discuss new ideas with the team

tommasini commented 1 year ago

Next step will try to upgrade react-native without enabling new architecture

tommasini commented 1 year ago

Version 0.71.12 -> Same error Version 0.72.2 -> Stopped with an error Import of module 'glog.glog.log_severity' appears within namespace 'google'

On 0.72.2 the only difference on code that we can see on react native upgrade helper, it's on the podfile because we have a custom react_native_post_install function and a custom function for the targets, and the config that it's on react native upgrade helper it's on that custom function instead of the parameters of react_native_post_install

Cal-L commented 1 year ago

Hey team! Please add your planning poker estimate with Zenhub @jpcloureiro @MarioAslau @NicolasMassart @tommasini

hesterbruikman commented 1 year ago

Workaround exists. Expected: E2E should run against release build Current: E2E runs against debug build on CI

tommasini commented 1 year ago

Next move:

Future move:

cortisiko commented 8 months ago

We should aim to run the tests in release mode for both iOS and android cc @Andepande

Andepande commented 7 months ago

As discussed with @Cal-L, let's split this ticket into two. Currently facing another issue building Android in release mode on Bitrise

Andepande commented 7 months ago

with Joao's help I was able to build both IOS and Android, currently blocked by the restore caching issue present on Bitrise

cortisiko commented 7 months ago

@Andepande This is excellent news! Can you also run the tests?