Skip to content

Uv/test android ci #297

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

Open
wants to merge 43 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
ef2abea
test: Adding simple test cases as a foundation for e2e tests for Reac…
kilian-tennyson Jun 23, 2025
743b158
Merge remote-tracking branch 'origin/main' into maestro_playground
kilian-tennyson Jun 23, 2025
36b0685
feat: running tests as part of the pipeline
kilian-tennyson Jun 24, 2025
a1573a9
chore: removing accidental space
kilian-tennyson Jun 24, 2025
1a39885
feat: installing ruby version from .ruby-version
kilian-tennyson Jun 24, 2025
cf68ea2
none: try installing a particular ruby version
kilian-tennyson Jun 24, 2025
4601908
none: adding cocoapods to fix error
kilian-tennyson Jun 25, 2025
8ef74f3
none: trying to increase resources to run android test
kilian-tennyson Jun 25, 2025
4a670b9
none: fixing error with resources
kilian-tennyson Jun 25, 2025
56e9d2c
none: trying to allocate resources to android-e2e-test
kilian-tennyson Jun 25, 2025
c824c94
none: increasing the android orb version
kilian-tennyson Jun 25, 2025
147da46
none: adding missing parameters
kilian-tennyson Jun 25, 2025
998a8fa
none: reverting resource parameter as it is duplicated
kilian-tennyson Jun 25, 2025
3663aa8
none: trying to install correct ruby version
kilian-tennyson Jun 25, 2025
00bf65d
none: trying to install correct ruby version using chruby
kilian-tennyson Jun 25, 2025
59fd75f
none: adding setup ruby step to ios test job
kilian-tennyson Jun 25, 2025
934bfc0
none: returning to original pod command
kilian-tennyson Jun 25, 2025
468bd2b
none: trying to get pod install to work
kilian-tennyson Jun 25, 2025
626affc
none: reverting pod changes to original
kilian-tennyson Jun 25, 2025
0698ff4
none: trying to fix android resourcing
kilian-tennyson Jun 25, 2025
fa8eb3b
chore: bumping ruby and node versions
kilian-tennyson Jun 25, 2025
39d1997
chore: check ruby file and fix file path of index
kilian-tennyson Jun 25, 2025
908e914
none: checking emulator is up before running tests and installing rub…
kilian-tennyson Jun 25, 2025
8503d31
none: readding node orb and setting ruby version to 3.3.0
kilian-tennyson Jun 25, 2025
66e5ee8
none: listing available emulators as ios step cant find any
kilian-tennyson Jun 25, 2025
ecf24ca
none: trying to use older version of maestro
kilian-tennyson Jun 25, 2025
6364fda
none: reverting maestro dependency to see if it fixes the issue
kilian-tennyson Jun 25, 2025
6530573
none: try listing maestro version and returning tag to default
kilian-tennyson Jun 25, 2025
7d21a27
Merge remote-tracking branch 'origin/main' into maestro-circle-ci
kilian-tennyson Jun 25, 2025
08464dc
feat: add steps to install ios app on emulator
kilian-tennyson Jun 26, 2025
a0f0e98
test: adding a delay to allow for logging in
kilian-tennyson Jun 26, 2025
9c0c728
test: trying to fix ios help center test
kilian-tennyson Jun 26, 2025
8510379
test: check if present help center is enabled before tapping
kilian-tennyson Jun 26, 2025
f7e2784
feat: adding android install step
kilian-tennyson Jun 26, 2025
6a80360
test: adding assertions to make android tests pass
kilian-tennyson Jun 26, 2025
18e2ea7
test: adding assertions to get android tests to pass
kilian-tennyson Jun 26, 2025
817582e
none: trying to fix android app for android tests
kilian-tennyson Jun 26, 2025
b0b26a8
none: reverting change to build.gradle
kilian-tennyson Jun 26, 2025
ae37806
refactor: moving tests to test folder and updating config
kilian-tennyson Jun 26, 2025
1e1b667
none: restored original e2e package.json, since it has been moved int…
kilian-tennyson Jun 26, 2025
6d157c5
test: testing on debug app
kilian-tennyson Jun 26, 2025
7a2c723
add logging
uddish Jun 26, 2025
7b3463c
fix syntax
uddish Jun 26, 2025
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
119 changes: 89 additions & 30 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2.1
# Default VM config to be used for macOS builds
macos_config: &macos_config
macos:
xcode: 15.3.0
xcode: 16.0.0
resource_class: macos.m1.large.gen1
shell: /bin/bash --login -eo pipefail

Expand All @@ -20,7 +20,8 @@ executors:
working_directory: ~/project

orbs:
android: circleci/[email protected]
android: circleci/[email protected]
node: circleci/[email protected]

# Always run job
run_always: &run_always
Expand All @@ -36,7 +37,6 @@ run_on_release: &run_on_release
branches:
ignore: /.*/


commands:
attach_project:
steps:
Expand All @@ -55,17 +55,13 @@ jobs:
command: |
corepack enable
yarn install --cwd example
yarn install --cwd example/e2e
yarn install
- save_cache:
key: dependencies-{{ checksum "package.json" }}
paths: node_modules
- save_cache:
key: dependencies-example-{{ checksum "example/package.json" }}
paths: example/node_modules
- save_cache:
key: dependencies-example-e2e-{{ checksum "example/package.json" }}
paths: example/e2e/node_modules
- persist_to_workspace:
root: .
paths: .
Expand Down Expand Up @@ -115,18 +111,26 @@ jobs:
JAVA_OPTS: '-Xms512m -Xmx1024m'
executor:
name: android/android-machine
resource-class: large
tag: default
working_directory: ~/project
steps:
- checkout:
path: ~/project
- node/install:
node-version: 18.17.0

- attach_workspace:
at: ~/project

- <<: *setup_env_file

- run:
working_directory: example/e2e
name: Install Maestro
command: curl -Ls "https://get.maestro.mobile.dev" | bash

- run:
working_directory: example/test
name: Build android
command: npm run build:android

Expand All @@ -141,10 +145,44 @@ jobs:
post-emulator-launch-assemble-command: echo Emulator Started

- run:
working_directory: example/e2e
name: Wait for emulator to finish booting
command: |
echo "⏳ Waiting for emulator to boot..."
adb wait-for-device
boot_completed=""
until [[ "$boot_completed" == "1" ]]; do
boot_completed=$(adb shell getprop sys.boot_completed 2>/dev/null | tr -d '\r')
echo "boot_completed=$boot_completed"
sleep 5
done
echo "✅ Emulator boot complete"

- run:
name: Log emulator + Intercom info
command: |
echo "🛰 Connected ADB devices:"
adb devices

echo "📱 Installed packages:"
adb shell pm list packages | grep intercom || true

echo "📜 Last 100 lines of logcat:"
adb logcat -d | tail -n 100 || true

- run:
name: Install app on emulator
command: |
adb install -r ~/project/example/android/app/build/outputs/apk/release/app-release.apk

- run:
working_directory: example/test
name: Run UI Tests
command: npm run test:android

- store_artifacts:
path: ~/.maestro/tests
destination: maestro-tests

# Build the Test App used for UI Testing and save is to the workspace. This allows it to be used by other jobs.
ios-e2e-test:
<<: *macos_config
Expand All @@ -155,28 +193,49 @@ jobs:

- <<: *setup_env_file

- run:
working_directory: example/e2e
name: Install Maestro
command: curl -Ls "https://get.maestro.mobile.dev" | bash

- restore_cache:
keys:
- pod-dependencies-{{ checksum "~/project/example/ios/Podfile" }}
- run:
working_directory: example/ios
name: Install Pods
command: pod install

- save_cache:
key: pod-dependencies-{{ checksum "~/project/example/ios/Podfile" }}
paths:
- ~/project/example/ios/Pods

- run:
working_directory: example/e2e
working_directory: example/test
name: Build
command: npm run build:ios

- run:
working_directory: example/e2e
name: Create and boot iPhone 15 simulator
command: |
echo "Creating iPhone 15 simulator with runtime $RUNTIME"
xcrun simctl create "iPhone 15" com.apple.CoreSimulator.SimDeviceType.iPhone-15 $RUNTIME
xcrun simctl boot "iPhone 15" || true

- run:
name: Install app on simulator
command: |
xcrun simctl install booted ~/project/example/test/build/Build/Products/Release-iphonesimulator/IntercomReactNativeExampleUI.app

- run:
working_directory: example/test
name: Run UI Tests
command: npm run test:ios

- store_artifacts:
path: ~/.maestro/tests
destination: maestro-tests

release-to-npm:
executor: default
Expand All @@ -201,7 +260,6 @@ jobs:
name: Publish the package
command: npm publish


workflows:
version: 2.1
build-and-test:
Expand All @@ -224,22 +282,23 @@ workflows:
<<: *run_always
requires:
- install-dependencies
# - android-e2e-test:
# <<: *run_always
# requires:
# - install-dependencies
# - lint
# - typescript
# - unit-tests
# - build-package
# - ios-e2e-test:
# <<: *run_always
# requires:
# - install-dependencies
# - lint
# - typescript
# - unit-tests
# - build-package
- android-e2e-test:
<<: *run_always
requires:
- install-dependencies
- lint
- typescript
- unit-tests
- build-package
- ios-e2e-test:
<<: *run_always
requires:
- install-dependencies
- lint
- typescript
- unit-tests
- build-package

- release-to-npm:
<<: *run_on_release
context:
Expand All @@ -250,5 +309,5 @@ workflows:
- typescript
- unit-tests
- build-package
# - ios-e2e-test
# - android-e2e-test
- ios-e2e-test
- android-e2e-test
2 changes: 1 addition & 1 deletion example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ react {
// bundleAssetName = "MyApplication.android.bundle"
//
// The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
entryFile = file("index.tsx")
entryFile = file("../../index.tsx")
//
// A list of extra flags to pass to the 'bundle' commands.
// See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
Expand Down
3 changes: 3 additions & 0 deletions example/test/maestro/android/open-help-center.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ tags:
---
- launchApp
- tapOn: "Login as an Unidentified User"
- assertVisible:
text: "Present Help Center"
enabled: true
- tapOn: "Present Help Center"
- assertVisible: "Help"
- assertVisible: "Untitled Collection"
Expand Down
2 changes: 1 addition & 1 deletion example/test/maestro/android/open-messenger.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
git appId: com.example.intercomreactnative
appId: com.example.intercomreactnative
tags:
- android
- messenger
Expand Down
4 changes: 3 additions & 1 deletion example/test/maestro/ios/open-help-center.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ tags:
---
- launchApp
- tapOn: "Login as an Unidentified User"
- assertVisible:
text: "Present Help Center"
enabled: true
- tapOn: "Present Help Center"
- assertVisible: "Help"
- assertVisible: "Untitled collection"
- tapOn: "Untitled collection"
4 changes: 3 additions & 1 deletion example/test/maestro/ios/open-messenger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ tags:
---
- launchApp
- tapOn: "Login as an Unidentified User"
- assertVisible:
text: "Present Intercom"
enabled: true
- tapOn: "Present Intercom"
- tapOn: "Messenger apps"

15 changes: 15 additions & 0 deletions example/test/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "intercom-react-native-example-e2e-tests",
"description": "Running",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"build:android": "../android/gradlew assembleRelease -Pfoss -p ../android",
"build:ios": "xcodebuild build -workspace ../ios/IntercomReactNativeExample.xcworkspace -scheme IntercomReactNativeExampleUI -configuration Release -sdk iphonesimulator -derivedDataPath ./build",
"test:android": "maestro test ./maestro/android/*.yaml",
"test:ios": "maestro test ./maestro/ios/*.yaml"
},
"keywords": [],
"author": "",
"license": "ISC"
}