Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/actions/androidapp-road-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ runs:
if: steps.e2e.outputs.phase == 'full' || steps.e2e.outputs.phase == 'build' || steps.e2e.outputs.phase == 'test'
run: |
node <<'NODE'
const { getAndroidAppDetoxVariant } = require('./apps/brownfield-example-shared-tests/detox-androidapp-variants.cjs');
const { getAndroidAppDetoxVariant } = require('./apps/shared-tests/detox-androidapp-variants.cjs');
const variant = getAndroidAppDetoxVariant(process.env.ANDROIDAPP_VARIANT);
const append = (key, value) => {
const fs = require('node:fs');
Expand Down Expand Up @@ -396,9 +396,9 @@ runs:
# low on disk after Gradle/NDK builds (see ReactiveCircus/android-emulator-runner#455).
script: |
echo "==> Starting Detox tests at $(date -u +%H:%M:%S)"
bash apps/brownfield-example-shared-tests/scripts/prepare-android-emulator-for-detox.sh
bash apps/shared-tests/scripts/prepare-android-emulator-for-detox.sh
cd apps/AndroidApp
bash apps/brownfield-example-shared-tests/scripts/run-with-android-logcat.sh apps/AndroidApp/e2e-artifacts/logcat-full.txt yarn "$ANDROIDAPP_E2E_TEST_SCRIPT"
bash ../shared-tests/scripts/run-with-android-logcat.sh e2e-artifacts/logcat-full.txt yarn "$ANDROIDAPP_E2E_TEST_SCRIPT"
env:
ANDROIDAPP_E2E_TEST_SCRIPT: ${{ env.ANDROIDAPP_E2E_TEST_SCRIPT }}

Expand Down
4 changes: 2 additions & 2 deletions .github/actions/appleapp-road-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ runs:
if: inputs.run-e2e == 'true'
run: |
node <<'NODE'
const { getAppleAppDetoxVariant } = require('./apps/brownfield-example-shared-tests/detox-appleapp-variants.cjs');
const { getAppleAppDetoxVariant } = require('./apps/shared-tests/detox-appleapp-variants.cjs');
const variant = getAppleAppDetoxVariant(process.env.APPLEAPP_VARIANT);
const append = (key, value) => {
const fs = require('node:fs');
Expand All @@ -208,7 +208,7 @@ runs:
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: apps/AppleApp/build
key: ${{ runner.os }}-e2e-appleapp-${{ inputs.variant }}-build-${{ hashFiles(format('{0}/ios/Podfile.lock', inputs.rn-project-path), 'apps/AppleApp/Brownfield Apple App.xcodeproj/project.pbxproj', 'apps/brownfield-example-shared-tests/e2e/**') }}-${{ hashFiles('apps/AppleApp/package/**/*.swiftinterface') }}
key: ${{ runner.os }}-e2e-appleapp-${{ inputs.variant }}-build-${{ hashFiles(format('{0}/ios/Podfile.lock', inputs.rn-project-path), 'apps/AppleApp/Brownfield Apple App.xcodeproj/project.pbxproj', 'apps/shared-tests/e2e/**') }}-${{ hashFiles('apps/AppleApp/package/**/*.swiftinterface') }}

- name: Install Detox iOS artifacts
if: inputs.run-e2e == 'true'
Expand Down
15 changes: 10 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,24 @@ jobs:
- 'packages/**'
rnapp:
- 'apps/RNApp/**'
- 'apps/brownfield-example-shared-tests/**'
- 'apps/shared-tests/**'
- 'apps/shared-runtime/**'
expo58:
- 'apps/ExpoApp58/**'
- 'apps/brownfield-example-shared-tests/**'
- 'apps/shared-tests/**'
- 'apps/shared-runtime/**'
expo57:
- 'apps/ExpoApp57/**'
- 'apps/brownfield-example-shared-tests/**'
- 'apps/shared-tests/**'
- 'apps/shared-runtime/**'
androidapp:
- 'apps/AndroidApp/**'
- 'apps/brownfield-example-shared-tests/**'
- 'apps/shared-tests/**'
- 'apps/shared-runtime/**'
appleapp:
- 'apps/AppleApp/**'
- 'apps/brownfield-example-shared-tests/**'
- 'apps/shared-tests/**'
- 'apps/shared-runtime/**'
gradle-plugins:
- 'gradle-plugins/**'
scripts:
Expand Down
13 changes: 8 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ Root scripts run from the repository root with `yarn <script>`. Scripts marked _
- `lint` - runs `lint` in all workspaces _[Turbo]_
- `typecheck` - runs `typecheck` in all workspaces _[Turbo]_
- `test:packages` - runs `test` in the workspaces under `packages/` _[Turbo]_
- `test:apps` - runs `test` in the workspaces under `apps/`, including the Node test suite in `apps/brownfield-example-shared-tests` _[Turbo]_
- `test:apps` - runs `test` in the workspaces under `apps/`, including the Node test suite in `apps/shared-tests` _[Turbo]_
- `test:scripts` - runs the Node test runner on `scripts/__tests__/**/*.test.ts`

### Brownfield Gradle plugin
Expand Down Expand Up @@ -266,7 +266,9 @@ AppleApp now derives its native shell label from target build settings and uses

## Tests

The React Native example apps share Jest utilities and test suites from `apps/brownfield-example-shared-tests`. Tests exercise integration with `@callstack/react-native-brownfield`, `@callstack/brownfield-navigation`, and `@callstack/brownie` as used in each demo.
Runtime code shared by the demo apps lives in [`apps/shared-runtime`](apps/shared-runtime/README.md). Keep test-only imports out of that package.

The React Native example apps share Jest utilities and test suites from `apps/shared-tests`. Tests exercise integration with `@callstack/react-native-brownfield`, `@callstack/brownfield-navigation`, and `@callstack/brownie` as used in each demo.

From the repository root:

Expand All @@ -280,14 +282,15 @@ Per example app (run from the repo root):
| --------------------------------------------------------------- | --------------------------------- |
| `yarn workspace @callstack/brownfield-example-rn-app test` | Plain React Native (`apps/RNApp`) |
| `yarn workspace @callstack/brownfield-example-expo-app-58 test` | Expo SDK 58 (`apps/ExpoApp58`) |
| `yarn workspace @callstack/brownfield-example-expo-app-57 test` | Expo SDK 57 (`apps/ExpoApp57`) |

Package-level scripts (`yarn test` inside `apps/RNApp` or `apps/ExpoApp58`) invoke Jest with each app’s `jest.config.js`.
Package-level scripts (`yarn test` inside `apps/RNApp`, `apps/ExpoApp57`, or `apps/ExpoApp58`) invoke Jest with each app’s `jest.config.js`.

The native-only sample apps (`apps/AppleApp`, `apps/AndroidApp`) use their platform test runners (Xcode / Gradle), not Jest.

## E2E tests (Detox)

End-to-end tests use [Detox](https://wix.github.io/Detox/) on the iOS Simulator and Android emulator. Shared specs and helpers live in `apps/brownfield-example-shared-tests/e2e/`; each app wires them through its own `.detoxrc*.cjs` and `e2e/jest.config*.cjs`.
End-to-end tests use [Detox](https://wix.github.io/Detox/) on the iOS Simulator and Android emulator. Shared specs and helpers live in `apps/shared-tests/e2e/`; each app wires them through its own `.detoxrc*.cjs` and `e2e/jest.config*.cjs`.

E2E runs without Metro: release/debug host builds load the JS bundle embedded in the packaged brownfield artifact so the app matches CI.

Expand Down Expand Up @@ -369,4 +372,4 @@ Host-app scripts run `yarn install`, `yarn build`, brownfield codegen, `expo pre

### `e2e-artifacts/`

Detox writes failure diagnostics under `<app>/e2e-artifacts/` (configured in `apps/brownfield-example-shared-tests/detox-artifacts-config.cjs`). Each run creates a timestamped subfolder, e.g. `e2e-artifacts/ios.sim.debug.<TIMESTAMP>/`.
Detox writes failure diagnostics under `<app>/e2e-artifacts/` (configured in `apps/shared-tests/detox-artifacts-config.cjs`). Each run creates a timestamped subfolder, e.g. `e2e-artifacts/ios.sim.debug.<TIMESTAMP>/`.
2 changes: 1 addition & 1 deletion apps/AndroidApp/.detoxrc.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const {
createAndroidAppEmulatorReleaseDetoxConfig,
} = require('../brownfield-example-shared-tests/detox-rc-androidapp-emulator-release.cjs');
} = require('../shared-tests/detox-rc-androidapp-emulator-release.cjs');

/** @type {import('detox').DetoxConfig} */
module.exports = createAndroidAppEmulatorReleaseDetoxConfig({
Expand Down
2 changes: 1 addition & 1 deletion apps/AndroidApp/.detoxrc.expo57.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const {
createAndroidAppEmulatorReleaseDetoxConfig,
} = require('../brownfield-example-shared-tests/detox-rc-androidapp-emulator-release.cjs');
} = require('../shared-tests/detox-rc-androidapp-emulator-release.cjs');

/** @type {import('detox').DetoxConfig} */
module.exports = createAndroidAppEmulatorReleaseDetoxConfig({
Expand Down
2 changes: 1 addition & 1 deletion apps/AndroidApp/.detoxrc.expo58.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const {
createAndroidAppEmulatorReleaseDetoxConfig,
} = require('../brownfield-example-shared-tests/detox-rc-androidapp-emulator-release.cjs');
} = require('../shared-tests/detox-rc-androidapp-emulator-release.cjs');

/** @type {import('detox').DetoxConfig} */
module.exports = createAndroidAppEmulatorReleaseDetoxConfig({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.callstack.brownfield.android.example

/** Keep in sync with `@callstack/brownfield-example-shared-tests` `e2eTestIds`. */
/** Keep in sync with `@callstack/shared-tests` `e2eTestIds`. */
object E2eTestIds {
const val nativeAppGreeting = "brownfield-e2e-appleapp-greeting"
const val nativeAppOpenReactNative = "brownfield-e2e-appleapp-open-react-native"
Expand Down
7 changes: 2 additions & 5 deletions apps/AndroidApp/e2e/jest.config.cjs
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
const path = require('node:path');
const {
createDetoxJestConfig,
} = require('../../brownfield-example-shared-tests/e2e/createDetoxJestConfig.cjs');
} = require('../../shared-tests/e2e/createDetoxJestConfig.cjs');

module.exports = createDetoxJestConfig({
e2eDir: __dirname,
testMatch: [
path.join(
__dirname,
'../../brownfield-example-shared-tests/e2e/androidAppBrownfield.e2e.js'
),
path.join(__dirname, '../../shared-tests/e2e/androidAppBrownfield.e2e.js'),
],
});
4 changes: 2 additions & 2 deletions apps/AndroidApp/e2e/jest.config.expo57.cjs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
const path = require('node:path');
const {
createDetoxJestConfig,
} = require('../../brownfield-example-shared-tests/e2e/createDetoxJestConfig.cjs');
} = require('../../shared-tests/e2e/createDetoxJestConfig.cjs');

module.exports = createDetoxJestConfig({
e2eDir: __dirname,
testTimeout: 600_000,
testMatch: [
path.join(
__dirname,
'../../brownfield-example-shared-tests/e2e/androidAppExpoBrownfield.e2e.js'
'../../shared-tests/e2e/androidAppExpoBrownfield.e2e.js'
),
],
});
4 changes: 2 additions & 2 deletions apps/AndroidApp/e2e/jest.config.expo58.cjs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
const path = require('node:path');
const {
createDetoxJestConfig,
} = require('../../brownfield-example-shared-tests/e2e/createDetoxJestConfig.cjs');
} = require('../../shared-tests/e2e/createDetoxJestConfig.cjs');

module.exports = createDetoxJestConfig({
e2eDir: __dirname,
testTimeout: 600_000,
testMatch: [
path.join(
__dirname,
'../../brownfield-example-shared-tests/e2e/androidAppExpoBrownfield.e2e.js'
'../../shared-tests/e2e/androidAppExpoBrownfield.e2e.js'
),
],
});
2 changes: 1 addition & 1 deletion apps/AndroidApp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"ci:local:e2e:android:expo57": "bash ../../scripts/ci-local-androidapp-android-e2e.sh --variant expo57"
},
"devDependencies": {
"@callstack/brownfield-example-shared-tests": "workspace:^",
"@callstack/shared-tests": "workspace:^",
"detox": "^20.27.0",
"jest": "^29.7.0"
}
Expand Down
2 changes: 1 addition & 1 deletion apps/AppleApp/.detoxrc.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const {
createAppleAppIosSimDebugDetoxConfig,
} = require('../brownfield-example-shared-tests/detox-rc-appleapp-ios-sim-debug.cjs');
} = require('../shared-tests/detox-rc-appleapp-ios-sim-debug.cjs');

/** @type {import('detox').DetoxConfig} */
module.exports = createAppleAppIosSimDebugDetoxConfig({
Expand Down
4 changes: 2 additions & 2 deletions apps/AppleApp/.detoxrc.expo57.cjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const {
createAppleAppIosSimDebugDetoxConfig,
} = require('../brownfield-example-shared-tests/detox-rc-appleapp-ios-sim-debug.cjs');
} = require('../shared-tests/detox-rc-appleapp-ios-sim-debug.cjs');
const {
getAppleAppDetoxVariant,
} = require('../brownfield-example-shared-tests/detox-appleapp-variants.cjs');
} = require('../shared-tests/detox-appleapp-variants.cjs');

const variant = getAppleAppDetoxVariant('expo57');

Expand Down
4 changes: 2 additions & 2 deletions apps/AppleApp/.detoxrc.expo58.cjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const {
createAppleAppIosSimDebugDetoxConfig,
} = require('../brownfield-example-shared-tests/detox-rc-appleapp-ios-sim-debug.cjs');
} = require('../shared-tests/detox-rc-appleapp-ios-sim-debug.cjs');
const {
getAppleAppDetoxVariant,
} = require('../brownfield-example-shared-tests/detox-appleapp-variants.cjs');
} = require('../shared-tests/detox-appleapp-variants.cjs');

const variant = getAppleAppDetoxVariant('expo58');

Expand Down
2 changes: 1 addition & 1 deletion apps/AppleApp/Brownfield Apple App/E2eTestIds.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Foundation

/// Keep in sync with `@callstack/brownfield-example-shared-tests` `e2eTestIds`.
/// Keep in sync with `@callstack/shared-tests` `e2eTestIds`.
enum E2eTestIds {
static let appleAppGreeting = "brownfield-e2e-appleapp-greeting"
static let appleAppOpenReactNative = "brownfield-e2e-appleapp-open-react-native"
Expand Down
7 changes: 2 additions & 5 deletions apps/AppleApp/e2e/jest.config.cjs
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
const path = require('node:path');
const {
createDetoxJestConfig,
} = require('../../brownfield-example-shared-tests/e2e/createDetoxJestConfig.cjs');
} = require('../../shared-tests/e2e/createDetoxJestConfig.cjs');

module.exports = createDetoxJestConfig({
e2eDir: __dirname,
testMatch: [
path.join(
__dirname,
'../../brownfield-example-shared-tests/e2e/appleAppBrownfield.e2e.js'
),
path.join(__dirname, '../../shared-tests/e2e/appleAppBrownfield.e2e.js'),
],
});
9 changes: 3 additions & 6 deletions apps/AppleApp/e2e/jest.config.expo57.cjs
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
const path = require('node:path');
const {
createDetoxJestConfig,
} = require('../../brownfield-example-shared-tests/e2e/createDetoxJestConfig.cjs');
} = require('../../shared-tests/e2e/createDetoxJestConfig.cjs');
const {
getAppleAppDetoxVariant,
} = require('../../brownfield-example-shared-tests/detox-appleapp-variants.cjs');
} = require('../../shared-tests/detox-appleapp-variants.cjs');

const variant = getAppleAppDetoxVariant('expo57');

module.exports = createDetoxJestConfig({
e2eDir: __dirname,
testMatch: [
path.join(
__dirname,
`../../brownfield-example-shared-tests/e2e/${variant.e2eTestFile}`
),
path.join(__dirname, `../../shared-tests/e2e/${variant.e2eTestFile}`),
],
});
9 changes: 3 additions & 6 deletions apps/AppleApp/e2e/jest.config.expo58.cjs
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
const path = require('node:path');
const {
createDetoxJestConfig,
} = require('../../brownfield-example-shared-tests/e2e/createDetoxJestConfig.cjs');
} = require('../../shared-tests/e2e/createDetoxJestConfig.cjs');
const {
getAppleAppDetoxVariant,
} = require('../../brownfield-example-shared-tests/detox-appleapp-variants.cjs');
} = require('../../shared-tests/detox-appleapp-variants.cjs');

const variant = getAppleAppDetoxVariant('expo58');

module.exports = createDetoxJestConfig({
e2eDir: __dirname,
testMatch: [
path.join(
__dirname,
`../../brownfield-example-shared-tests/e2e/${variant.e2eTestFile}`
),
path.join(__dirname, `../../shared-tests/e2e/${variant.e2eTestFile}`),
],
});
2 changes: 1 addition & 1 deletion apps/AppleApp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"ci:local:e2e:ios:expo57": "bash ../../scripts/ci-local-appleapp-ios-e2e.sh --variant expo57"
},
"devDependencies": {
"@callstack/brownfield-example-shared-tests": "workspace:^",
"@callstack/shared-tests": "workspace:^",
"@rock-js/tools": "^0.13.5",
"detox": "^20.27.0",
"jest": "^29.7.0"
Expand Down
Loading