Skip to content
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

Cavy timing out on the Android release build of a new project #186

Open
aarondail opened this issue Jun 10, 2020 · 5 comments
Open

Cavy timing out on the Android release build of a new project #186

aarondail opened this issue Jun 10, 2020 · 5 comments
Assignees
Labels

Comments

@aarondail
Copy link

I am probably missing something basic, but I created a new RN app today (react-native init), installed and setup Cavy, ran the sample tests successfully on Android (cavy run-android) but cannot get it to work when running the Android release build (cavy run-android --variant release).

The app gets built and installed on the emulator but there is some sort of communication problem and cavy times out (with no tests seemingly run). This is what I see in the terminal:

...
BUILD SUCCESSFUL in 14s
29 actionable tasks: 2 executed, 27 up-to-date
info Connecting to the development server...
info Starting the app on "emulator-5554"...
Starting: Intent { cmp=com.rncavyhermes/.MainActivity }
cavy: react-native exited with code 0.
cavy: Running /Users/adail/Library/Android/sdk/platform-tools/adb reverse tcp:8082 tcp:8082
cavy: Listening on port 8082 for test results...
No response from Cavy within 2 minutes.
Terminating processes.
cavy: Putting your index.js back.
cavy: Running `mv index.js index.test.js && mv index.notest.js index.js`...

One weird thing is that I can run cavy fine in another (older) project on Android in our release builds... but not with Hermes enabled. (That problem with Hermes is what I was trying to look into, but this issue is blocking that... and to be clear Hermes is disabled in the scenario I describe above).

Does this ring a bell for anyone?

Thanks!

@AbigailMcP
Copy link
Contributor

Hmmm interesting - I haven't come across this issue before. Can you let me know what version of cavy you're running in your app?

@aarondail
Copy link
Author

Yeah 4.0.0 ... I think it was released less the same day I was doing my investigation.

@AbigailMcP
Copy link
Contributor

Ahhh thank you! I'm doing a bit of digging into this issue for you.

Cavy 4.0 uses websockets to connect to cavy-cli and it seems as though this change is what has caused this issue. Apps running tests in debug seem to be unaffected - the issue seems to be with release versions only.

Cavy 3.4.1 (before introduction of websockets) seems to have no problem running tests in release builds.

I'll continue investigating, but if you manage to make any headway in the meantime, please update on here! Thanks :)

@AbigailMcP AbigailMcP self-assigned this Jul 3, 2020
@arancauchi
Copy link

I too have stumbled on this issue, and I'm looking for a fix. I experimented downgrading cavy to 3.4.1 but no dice, it still just sits there and times out.
For replication, this is a build on bitrise, using a docker ubuntu 16.04

@pqkluan
Copy link

pqkluan commented Jun 3, 2021

I was able to debug this issue by log the websocket error

# <root>/node_modules/cavy/src/Reporter.js

export default class Reporter {
  onStart() {
    const url = 'ws://127.0.0.1:8082/';
    this.ws = new WebSocket(url);
+   this.ws.onerror = console.error
  }

The output shown that the websocket was failed to open due to this issue Cleartext HTTP traffic not permitted.

In my case, the issue was resolved by adding 127.0.0.1 as domain in @xml/network_security_config

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants