expo / detox-expo-helpers

44 stars 34 forks source link

reloadApp() hangs in Expo SDK 36 #15

Open jabirbarber-giacom opened 4 years ago

jabirbarber-giacom commented 4 years ago

Not working with Expo SDK 36

Debugging reveals that it's hanging on await device.launchApp() in reloadApp()

package.json

`"scripts": {
    "e2e": "detox test --configuration ios.sim",
},
"devDependencies": {
    "babel-eslint": "^10.0.3",
    "babel-preset-expo": "^7.0.0",
    "detox": "^15.2.2",
    "detox-expo-helpers": "^0.6.0",
    "eslint-config-airbnb": "^18.0.1",
    "eslint-config-prettier": "^6.7.0",
    "eslint-plugin-prettier": "^3.1.1",
    "expo-detox-hook": "^1.0.10",
    "jest-expo": "^35.0.0",
    "pusher-js-mock": "^0.2.0",
    "react-native-testing-library": "^1.12.0",
    "react-test-renderer": "^16.12.0"
},
"private": true,
"detox": {
    "configurations": {
        "ios.sim": {
            "binaryPath": "bin/Exponent.app",
            "type": "ios.simulator",
            "name": "iPhone 11"
        }
    },
    "test-runner": "jest"
}`

Even if I bypass the hanging promise via function timeout(ms) { return new Promise(resolve => setTimeout(resolve, ms)); } beforeEach(async () => { reloadApp(); await timeout(12000); }); It hangs on await expect(element(by.id('welcome'))).toBeVisible();

masesisaac commented 4 years ago

I also previously had this issue, but repeating all the steps in this article seemed to solve it. Maybe I had skipped a step.

https://blog.expo.io/testing-expo-apps-with-detox-and-react-native-testing-library-7fbdbb82ac87?gi=8881be06b6c1

One thing to note, am using detox v15.1.4 on Expo v36.0.0 and my tests are running just fine

davidevernizzi commented 4 years ago

It works with v36.0.0, but not with v37.0.0

christianjuth commented 4 years ago

@davidevernizzi are you using app.json or app.config.js?

My Detox tests stopped working when I switched to app.config.js. Below is the minimum app.json config that got the tests working for me. The rest of my fields are in app.config.js.

{
  "expo": {
    "name": "App Name"
  }
}
sandermenke commented 4 years ago

I have the same issue on SDK version v38. Does anyone have a solution?

lookitsatravis commented 3 years ago

Hi all. I've outlined a solution for newer versions of Expo and Detox here: https://github.com/expo/detox-tools/issues/1#issuecomment-740675824, and it's directly relevant to this repo as well.

Rambatino commented 3 years ago

hi @lookitsatravis I followed your example closely, but it currently still hangs. At least I'm almost certain I followed your example exactly.

I'm going to dig into it a bit more today, but if you're aware of any changes, please let me know.

Ideally there should be a PR into this repo.

jackkinsella commented 3 years ago

For anyone stuck on this: here is a repo showing a setup that works for ios at least https://github.com/fschoenfeldt/clean-expo-detox-testing

d4rky-pl commented 2 years ago

The setup mentioned above is a workaround that works by disabling the synchronization. I'm not sure if it fork actually solves the problem as running device.enableSynchronization() hangs indefinitely so it's possible the Expo integration is still not injected correctly.