ignite
ignite copied to clipboard
Detox flaky when running yarn test:e2e and using npx ignite-cli new PizzaApp --expo
What's going on?
Detox fails sometimes when running app with Expo.
Steps to reproduce
- npx ignite-cli new PizzaApp --expo
- yarn test:e2e
ignite doctor results:
λ npx ignite doctor
Downloading Chromium r588429 - 82.7 Mb [====================] 100% 0.0s
✔ cwebp pre-build test passed successfully
✔ gifsicle pre-build test passed successfully
✔ mozjpeg pre-build test passed successfully
✔ optipng pre-build test passed successfully
✔ pngquant pre-build test passed successfully
(node:52274) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open '/package.json'
at Object.openSync (fs.js:462:3)
at Object.readFileSync (fs.js:364:35)
at getAuthor (/Users/henrymoulton/.npm/_npx/52274/lib/node_modules/ignite/dist/ignite.js:132:54)
at build (/Users/henrymoulton/.npm/_npx/52274/lib/node_modules/ignite/dist/ignite.js:270:16)
at Object.<anonymous> (/Users/henrymoulton/.npm/_npx/52274/lib/node_modules/ignite/dist/ignite-cli.js:16:21)
at Module._compile (internal/modules/cjs/loader.js:1015:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
at Module.load (internal/modules/cjs/loader.js:879:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
(node:52274) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:52274) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Adding a test above that just maybe waits for the UI of the app being inserted into the Expo app come into view helps:
it('handles expo -> app transition', async () => {
await waitFor(element(by.id("next-screen-button"))).toBeVisible().withTimeout(8000)
})
@henrymoulton Does the "handles expo -> app transition" test help every time? Or is it still flaky, but just somewhat less so?
@jamonholmgren
$ npx ignite-cli new PizzaApp --expo
$ cd PizzaApp
$ yarn test:e2e
yarn run v1.22.17
$ ./bin/downloadExpoApp.sh && detox test --configuration ios.sim.expo
detox[21929] INFO: [test.js] configuration="ios.sim.expo" useCustomLogger=true DETOX_START_TIMESTAMP=1642198819479 reportSpecs=true jest --config e2e/config.json --testNamePattern '^((?!:android:).)*$' --maxWorkers 1 e2e
detox[22002] INFO: [DetoxServer.js] server listening on localhost:64091...
detox[22002] INFO: [AppleSimUtils.js] host.exp.Exponent launched. To watch simulator logs, run:
/usr/bin/xcrun simctl spawn 327E3C9F-5839-4672-9777-BACE8C6D4D19 log stream --level debug --style compact --predicate 'process == "Expo Go"'
detox[22002] ERROR: [DetoxExportWrapper.js/DETOX_INIT_ERROR]
DetoxRuntimeError: Aborted detox.init() execution, and now running detox.cleanup()
HINT: Most likely, your test runner is tearing down the suite due to the timeout error
at Detox.[_assertNoPendingInit] (/Users/norfeldt/Desktop/PizzaApp/node_modules/detox/src/Detox.js:204:9)
at Detox.beforeEach (/Users/norfeldt/Desktop/PizzaApp/node_modules/detox/src/Detox.js:111:37)
at DetoxExportWrapper.<computed> (/Users/norfeldt/Desktop/PizzaApp/node_modules/detox/src/DetoxExportWrapper.js:87:32)
at DetoxAdapterImpl.beforeEach (/Users/norfeldt/Desktop/PizzaApp/node_modules/detox/runners/jest/DetoxAdapterImpl.js:28:22)
at DetoxAdapterJasmine.beforeEach (/Users/norfeldt/Desktop/PizzaApp/node_modules/detox/runners/jest/DetoxAdapterJasmine.js:19:5)
detox[22002] INFO: [AppleSimUtils.js] host.exp.Exponent launched. To watch simulator logs, run:
/usr/bin/xcrun simctl spawn 327E3C9F-5839-4672-9777-BACE8C6D4D19 log stream --level debug --style compact --predicate 'process == "Expo Go"'
RUNS e2e/firstTest.spec.js
It opens the simulator, installs the app, tries to open it and fails.
Our Detox workflow has been revamped since our latest Ignite release, Maverick.
This is going to be closed for now, but please re-open if this still needs attention.