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

Using detox plugin #34

Closed
Norfeldt opened this issue Dec 31, 2021 · 6 comments
Closed

Using detox plugin #34

Norfeldt opened this issue Dec 31, 2021 · 6 comments

Comments

@Norfeldt
Copy link

The readme seems really well written however I do face some issue that I hope you can help me we details on.

'yarn e2e:ios'

I don't have this script in my package.json made the project by expo init. What do you suggest me to do?

@jetaix
Copy link

jetaix commented Jan 4, 2022

@Norfeldt I think this should be useful to you

"scripts": {
	"e2e:ios": "npm run build:ios && npm run test:ios"
}

source: package.json

@Norfeldt
Copy link
Author

Norfeldt commented Jan 8, 2022

Oh, I thought I could use the plugin in a managed app with the expo go client.

I use a macBook but really enjoy not having to compile locally (or do anything in xcode)

@EvanBacon
Copy link
Collaborator

@Norfeldt sorry for the misunderstanding. On the bright side, E2E tests generally run in CI environments.

@Norfeldt
Copy link
Author

Norfeldt commented Jan 11, 2022

@EvanBacon No need to be sorry about anything. You have been pushing RN with expo in the right direction for years now and I admire the work you do. I'm just having a really hard time finding some good videos/tutorials/guides on how to do detox testing in a managed app (and have a CI with it).

Do you have any good reference materials on how to get started or is there any chance that you could drop a quick YT video of you showing off a very very simple detox with expo?

@EvanBacon
Copy link
Collaborator

@Norfeldt as far as I know, there aren't very good resources right now. I really don't like the current set of workarounds and hacks involved with getting Detox working so I'm not comfortable documenting them at the moment. Here is a pseudo example of using prebuild + detox in a monorepo, it's currently broken.

Somethings we're working on to fix this:

  1. You need to install expo-cli (npm i -g expo-cli) to run expo prebuild (ref). The global CLI takes a while to install and the global node modules aren't cached. To fix this, we're moving expo prebuild into the expo package so it's always versioned, cached, and fast to download.
  2. After we have a CLI interface in the expo package, we'll create a bundle and start command to override the npx react-native bundle and npx react-native start commands. This will enable us to resolve the main entry file using Node.js module resolution (i.e. respect the main field in the package.json), this will reduce the chance of error in monorepos and managed projects which tend to use node_modules/expo/AppEntry.js as the entry file.
  3. After all is working in some capacity, we can write up a step to cache the native build cache files which should introduce some nice time savings.
  4. We should add a feature to detox to automatically choose the first available simulator and emulator, right now it's unclear which devices are available and you end up having to log from the environment.

Really there are too many steps involved. E2E testing, auto screenshots, etc. would benefit a lot from some type of managed CI service.

If you manage to get an example repo working I'd love to hear your findings.

@Norfeldt
Copy link
Author

@EvanBacon thank you for taking the time to clarify the current situation. Now I understand that it's not just my googling on 'react native e2e' that is bad, but it's because it's a struggle to get a stable setup (all the examples I have found has been broken).

Yes, a managed CI service would be fantastic 🎉🎉 and I'm crossing my fingers for Expo coming to the rescue regarding E2E testing and auto screenshots. Been looking into Appcenter from MS but not much good resources are to find on that either (but the phone farm looks cool).

Expo has been knocking down roadblock in RN land:

  • 🐢 run on physical device 💥 Expo fixed that 💥
  • 🐢 deploy to stores 💥 Expo fixed that 💥
  • 🐢 accept payments 💥 Expo fixed that 💥
  • 🐢 bring the 3rd platform (web) to RN 🧨 Expo will fix that* 🧨
  • 🐢 End to end testing 🧨 Expo will fix that 🧨

*tried the expo web in the hope of doing test with cypress, but I seem to beak it quickly with even simple components (don't know if it was the hot reloading or something else).

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

No branches or pull requests

3 participants