-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Documentation on using w/ React Native's officially sanctioned Expo tooling #236
Comments
Some thoughts:
|
As far as I know you should be able to use the same build commands as in the build a standalone version of your app and use this as a command in the build part of the detox configuration and the rest should behave like normally. I didn't test it out, but I will try to come up with an example and link it here. |
Not sure about running things with expo, but regarding 1, you can use |
Is there another way to specify I got the impression from your docs that
|
Hello! I have investigated this and learned the following: e2e/init.js should install the app and dismiss the welcome popupFor example: require('babel-polyfill');
const detox = require('detox');
const config = require('../package.json').detox;
before(async () => {
await detox.init(config);
let url = 'exp://exp.host/@notbrent/detox-testing';
await device.relaunchApp({ url, sourceApp: 'host.exp.exponent' });
await expect(element(by.label('Got it'))).toBeVisible();
await element(by.label('Got it')).tap();
});
after(async () => {
await detox.cleanup();
}); We need to make it possible to disable live reload by defaultDetox works great currently against published apps (if you run Expo needs to support starting the app with live reload disabled -- this makes it so things don't work in dev. We will work on this, I created an issue to track it internally. After that, it works as expectedIt can be helpful though to use this little script to reload your app in const { UrlUtils } = require('xdl');
let url;
module.exports = async function() {
if (!url) {
url = await UrlUtils.constructManifestUrlAsync(process.cwd());
}
await device.relaunchApp({ url, sourceApp: 'host.exp.exponent' });
} You will need to |
Actually it's possible to simplify it a bit further, so we don't need to manually dismiss the welcome screen: const { UrlUtils } = require('xdl');
let url;
module.exports = async function() {
if (!url) {
url = await UrlUtils.constructManifestUrlAsync(process.cwd());
}
await device.relaunchApp({
url,
sourceApp: 'host.exp.exponent',
launchArgs: { EXKernelDisableNuxDefaultsKey: true },
});
}; Perhaps the best approach for us then is to add support for a NSUserDefaults key that disables live reload. |
@brentvatne you can disable network sync to specific hosts. by using await device.setURLBlacklist(['.*exp.direct.*']); at the beginning of your test suite, you can continue working with live reload (I'm pretty sure Detox will still be able to sync on all bundle load events, so there should be no problem) |
@brentvatne, do you think you can format this as a documentation section ? I'd love to add a "Using Expo" section to the readme. |
thanks @rotemmiz -- that worked nicely :) I'll try to find time for that soon. for now I created the following repos: |
Thanks for the docs! I was able to get this working on my (jest) project with one modification: Whenever I tried using the |
not sure I understand @jackkinsella -- you should start the packager with |
This is going to seem wacky to you, but my experience was that it worked out exactly the opposite way around for me–i.e. I don't expect you to change anything–I'm only mentioning this for the benefit of any other lost souls who might bypass their troubles by switching to an alternative initialisation process. Trawling Github issue comments is my number one source of salvation these days, and I expect this is true for many other programmers too! |
haha that is strange! if you can share your project, i'd be happy to investigate, feel free to add me to private repo. |
Hi @jackkinsella, would you mind to share how did you integrate I did try to integrate them using https://github.com/expo/detox-expo-helpers and https://github.com/grabbou/react-native-detox-example but still no luck. Here is the repo for the project that I tried to use detox with jest: https://github.com/oshimayoan/try-detox
|
@brentvatne @oshimayoan - I created a bare-bones repo that should help answer both your questions https://github.com/jackkinsella/initialisationWoes |
Thanks for your respond but I still got the same error from tail:
The expo just closed after it launched, do you have any idea? |
@oshimayoan have you ever managed to that error resolved? I am getting same problem. |
@anton6 Not yet using CRNA, but I did on React Native. |
See #630 |
I'm still getting timeouts. I've isolated the problem to I dug into Detox's code enough to realize that it expects DetoxManager to return a (Yes, I'm using the |
@earksiinni also fall into timeout... |
Closing this issue since Expo docs have been merged already in #630. |
I was unable to get Detox working with Expo (despite following what was written in this thread: #147). Now I am hoping for a little guidance from the Detox library maintainers–even just a few sample guidance files. I am aware that the Expo maintainers are aware of this issue too (expo/expo#424), but there doesn't seem to be any movement on their side.
Expo is now recommended on page 1 of the official Getting Started With React Native page,
so this requested documentation would be sure to cover an overwhelmingly common use-case.
Bonus points: Document using Expo with Jest, since Jest is the officially preferred testing toolkit, and I imagine most new React programmers will go with the flow.
The text was updated successfully, but these errors were encountered: