|
| 1 | +--- |
| 2 | +name: engine-e2e |
| 3 | +description: Run Wix Engine (mobile-apps-engine) iOS E2E tests locally to validate RNN changes. Use when you need to test RNN fixes against the Engine's Detox test suite. |
| 4 | +--- |
| 5 | + |
| 6 | +# Running Engine E2E Tests Against Local RNN Changes |
| 7 | + |
| 8 | +The Engine app (`@wix/wix-one-app-engine`) in `~/Documents/mobile-apps-engine` consumes RNN |
| 9 | +from `node_modules/react-native-navigation`. To test RNN changes against the Engine's E2E |
| 10 | +suite, you patch the Engine's copy of RNN, rebuild the native binary, and run the tests. |
| 11 | + |
| 12 | +## Prerequisites |
| 13 | + |
| 14 | +- Node via nvm (`nvm use default`) |
| 15 | +- The `CI` env var must be **unset** (not `0`, fully unset) to avoid CI-specific codepaths. |
| 16 | + Use `env -u CI` before every command. |
| 17 | +- The Engine repo at `~/Documents/mobile-apps-engine` with `yarn install` already done. |
| 18 | + |
| 19 | +## Step 1: Patch RNN in Engine's node_modules |
| 20 | + |
| 21 | +Apply your RNN source changes to the corresponding files under: |
| 22 | +``` |
| 23 | +~/Documents/mobile-apps-engine/node_modules/react-native-navigation/ios/ |
| 24 | +``` |
| 25 | +The directory structure mirrors the RNN repo's `ios/` folder exactly. |
| 26 | + |
| 27 | +## Step 2: Rebuild the iOS Native Binary |
| 28 | + |
| 29 | +```bash |
| 30 | +cd ~/Documents/mobile-apps-engine |
| 31 | +unset PREFIX && . ~/.nvm/nvm.sh > /dev/null && nvm use default > /dev/null |
| 32 | +env -u CI yarn workspace @wix/mobile-apps-engine-native-builds build-local-ios |
| 33 | +``` |
| 34 | + |
| 35 | +This runs `xcodebuild` with `-quiet` flag — expect no output until it finishes. |
| 36 | +Takes ~10-15 minutes on M-series Macs. |
| 37 | + |
| 38 | +The build output (`.app` bundle) lands in: |
| 39 | +``` |
| 40 | +packages/native/mobile-apps-engine-native-builds/dist/binaries.json |
| 41 | +``` |
| 42 | + |
| 43 | +### Troubleshooting Build |
| 44 | + |
| 45 | +- **Keychain error** (`SecKeychainUnlock`): The `CI` env var is set. Use `env -u CI`. |
| 46 | +- **Signing errors**: Expected for local builds — the script handles ad-hoc signing. |
| 47 | + |
| 48 | +## Step 3: Build JS Bundles (first time only) |
| 49 | + |
| 50 | +These are needed once per checkout. Skip if already built. |
| 51 | + |
| 52 | +```bash |
| 53 | +env -u CI yarn workspace @wix/mobile-apps-engine-extra-bundle local:build |
| 54 | +env -u CI yarn workspace @wix/mobile-apps-dependencies local:build |
| 55 | +``` |
| 56 | + |
| 57 | +## Step 4: Run E2E Tests |
| 58 | + |
| 59 | +```bash |
| 60 | +cd ~/Documents/mobile-apps-engine |
| 61 | +unset PREFIX && . ~/.nvm/nvm.sh > /dev/null && nvm use default > /dev/null |
| 62 | +env -u CI yarn workspace @wix/wix-one-app-engine test:e2e:ios -w d <suite_files...> |
| 63 | +``` |
| 64 | + |
| 65 | +The `-w d` flag selects the Detox worker count. |
| 66 | + |
| 67 | +### Specific suites relevant to RNN |
| 68 | + |
| 69 | +| Suite file | What it tests | |
| 70 | +|-----------|---------------| |
| 71 | +| `e2e/suites/ExternalLinks.test.js` | Deep link navigation, back button | |
| 72 | +| `e2e/suites/ExternalLinksModes.test.js` | Deep link modes (pop to root, tab switch) | |
| 73 | +| `e2e/suites/ExternalLinksPushNotifications.test.js` | Push notification deep links | |
| 74 | +| `e2e/suites/ExtenalLinksWithSiteSelect.test.js` | Deep links with site selection | |
| 75 | +| `e2e/suites/EngineUIComponents.test.js` | Error screen, UI components | |
| 76 | +| `e2e/suites/LaunchArgs.test.js` | Launch arguments | |
| 77 | +| `e2e/suites/LazyModules.test.js` | Lazy-loaded modules | |
| 78 | + |
| 79 | +### Example: Run the deep-link suites |
| 80 | + |
| 81 | +```bash |
| 82 | +env -u CI yarn workspace @wix/wix-one-app-engine test:e2e:ios -w d \ |
| 83 | + e2e/suites/ExternalLinks.test.js \ |
| 84 | + e2e/suites/ExternalLinksModes.test.js \ |
| 85 | + e2e/suites/ExternalLinksPushNotifications.test.js |
| 86 | +``` |
| 87 | + |
| 88 | +### Troubleshooting Tests |
| 89 | + |
| 90 | +- **`Error: No dist version found`**: The native build hasn't run or failed. |
| 91 | + Run step 2 again. |
| 92 | +- **`Cannot find module .../mobile-apps-engine-extra-bundle/index.js`**: |
| 93 | + Run step 3 (`local:build` for extra-bundle). |
| 94 | +- **`ENOENT .../metadata.json`**: Run step 3 (`local:build` for mobile-apps-dependencies). |
| 95 | +- **`Unable to resolve module @rozenite/...`**: The Rozenite plugin import is broken. |
| 96 | + Patch `packages/wix-one-app-engine/src/rozenitePlugin/helper/rozenite-network-inspector.ts` |
| 97 | + to make the import optional with a no-op fallback. |
| 98 | +- **Tests time out on `navigateBack()`**: The `navigateBack()` helper taps |
| 99 | + `element(by.id('pop'))` on iOS. This relies on RNN's `setBackButtonTestID` working |
| 100 | + correctly. If the back button's view hierarchy changed (e.g., iOS 26 Liquid Glass), |
| 101 | + the testID isn't applied and the element can't be found. |
| 102 | + |
| 103 | +## Key Engine Files |
| 104 | + |
| 105 | +| File | Purpose | |
| 106 | +|------|---------| |
| 107 | +| `packages/wix-one-app-engine/e2e/helpers/utils.js` | Test helpers including `navigateBack()` | |
| 108 | +| `packages/wix-one-app-engine/demo-modules/deep-links/module.js` | Deep link route definitions | |
| 109 | +| `packages/wix-one-app-engine/demo-modules/deep-links/Screens.js` | Deep link screen components | |
| 110 | +| `packages/wix-one-app-engine/internalScripts/test-e2e.js` | E2E test runner script | |
| 111 | +| `packages/native/mobile-apps-engine-native-builds/local_build_scripts/build_ios.js` | Local iOS build script | |
| 112 | + |
0 commit comments