[E2E] Add Detox tests#4182
Conversation
…ied pinch gesture boundary check
nd versioned docs to also not rely on the SrcFiles
…re-handler merge main
There was a problem hiding this comment.
Note that I've tested only release configuration. I'll leave the other to be tested later
| description: 'androidTestImplementation for Detox', | ||
| find: ` if (hermesEnabled.toBoolean()) {`, | ||
| replace: ` androidTestImplementation('com.wix:detox:+') | ||
|
|
||
| if (hermesEnabled.toBoolean()) {`, |
There was a problem hiding this comment.
I don't think we have to do this for now
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…-gesture-handler into @mbert/e2e
| @@ -1,4 +1,5 @@ | |||
| import type { ExamplesSection } from '../common'; | |||
| import panE2E from '../e2e_screens/gestures/pan'; | |||
There was a problem hiding this comment.
Components should start with an uppercase name
There was a problem hiding this comment.
Yes I know, leftover from previous implementation. It is already changed in my branch with follow-up, but I can change it here if you prefer.
There was a problem hiding this comment.
| @@ -0,0 +1,15 @@ | |||
| import { by, device, element, waitFor } from 'detox'; | |||
|
|
|||
| export async function navigateTo(screenName: string) { | |||
There was a problem hiding this comment.
By the name, I'd expect it to just navigate, not restart the entire app. Can you update the name?
There was a problem hiding this comment.
I'd expect it to just navigate, not restart the entire app.
It doesn't 😄
await device.launchApp({ newInstance: false });Launches app only if it is not already opened.
await device.reloadReactNative();Reloads app if back button is not available.
If you're talking about restarting app between tests it is Detox "feature" 😄
Anyway, if we want to change that, maybe something along openScreen or resetAndNavigateTo?
Co-authored-by: Jakub Piasecki <jakub.piasecki@swmansion.com>
…-gesture-handler into @mbert/e2e
Huge thanks to @relextm19 for investigating this problem and helping with setup ❤️
Description
This PR adds Detox E2E tests to our example app. Sources for examples are placed in
common-app/e2e_screens, tests are located inexpo-example/e2e. This PR adds only one simple test forPangesture, more tests will be added in the follow-ups.Tests are also run on CI when pushing to
mainor modifyinge2esources mentioned above.Since our example app uses
expoprebuilds, e2e setup requires additional script on android that will configure app for tests.Important
You may need to adjust device name in
.detoxrc.jsfile.Running E2E
This PR also adds few yarn scripts:
yarn build-detox-android(also runs preparation script for android)yarn build-detox-iosyarn build-detox(combines both of the above)To run tests you can use the following command:
yarn detox test -c ios.sim.release <test>yarn detox test -c android.emu.release <test>yarn e2e:iosandyarn e2e:androidare added, in the future they'll run all tests. For now they just runPantest.Note
For now I've only tested release build, but other configurations are left to be checked
Test plan
Well well well...
yarn build-detoxyarn e2e:iosyarn e2e:android