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

test(e2e): Add auto init from JS tests for Android #4602

Draft
wants to merge 39 commits into
base: capture-app-start-errors
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
cc9543f
chore(samples): Add package scripts for native builds, dsn and testing
krystofwoldrich Feb 18, 2025
c20ac08
Merge branch 'capture-app-start-errors' into kw-simplify-local-sample…
krystofwoldrich Feb 18, 2025
f2a14c9
fix ci
krystofwoldrich Feb 19, 2025
d9fec19
fix android archive path
krystofwoldrich Feb 19, 2025
6b8f314
fix ios build release
krystofwoldrich Feb 19, 2025
25ab23b
fix(sample-e2e): Fix type errors missing sentry/core and afterAll
krystofwoldrich Feb 19, 2025
20a132e
Merge branch 'kw-fix-bad-merge' into kw-simplify-local-sample-testing
krystofwoldrich Feb 19, 2025
8b2227a
fix IOS_DEVICE empty check
krystofwoldrich Feb 20, 2025
d5e8e92
Merge branch 'capture-app-start-errors' into kw-simplify-local-sample…
krystofwoldrich Feb 20, 2025
20e7f55
fix ios archive
krystofwoldrich Feb 20, 2025
56fe4b8
test(e2e): Verify captured Errors Screen transaction
krystofwoldrich Feb 20, 2025
4cfc937
add more tests
krystofwoldrich Feb 21, 2025
b484b07
Merge branch 'capture-app-start-errors' into kw-test-transactions
krystofwoldrich Feb 24, 2025
86a675e
revert dsn change
krystofwoldrich Feb 24, 2025
71fada9
fix lint
krystofwoldrich Feb 24, 2025
0d6f543
remove jest extended from sample e2e tests
krystofwoldrich Feb 24, 2025
c5c93d2
Relax test to expect any type of app start, remove native frames as m…
krystofwoldrich Feb 24, 2025
def6e30
add app, device and react native context smoke tests
krystofwoldrich Feb 24, 2025
3aae5bf
include transaction name in the tests
krystofwoldrich Feb 24, 2025
46782a8
test(e2e): Add auto init from JS tests
krystofwoldrich Feb 24, 2025
6b663e0
test(e2e): Add app start crash test for iOS
krystofwoldrich Feb 24, 2025
bf4ee0d
split ios test config to manual and auto
krystofwoldrich Feb 25, 2025
b7bb5fb
update test job name to include test type
krystofwoldrich Feb 25, 2025
d336903
add test-ios-auto sh script
krystofwoldrich Feb 25, 2025
97e1b30
remove jest extended
krystofwoldrich Feb 25, 2025
9d4c63a
Merge branch 'kw-test-transactions' into kw-add-auto-init-tests-ios
krystofwoldrich Feb 25, 2025
a97e5b3
Merge branch 'kw-add-auto-init-tests-ios' into kw-add-app-start-crash…
krystofwoldrich Feb 25, 2025
0dbd3dc
fix c format
krystofwoldrich Feb 25, 2025
b86c577
Merge remote-tracking branch 'origin/capture-app-start-errors' into k…
krystofwoldrich Feb 25, 2025
a0301bc
fix detox config name doesn't have auto yet
krystofwoldrich Feb 25, 2025
01e28d8
Merge branch 'kw-add-auto-init-tests-ios' into kw-add-app-start-crash…
krystofwoldrich Feb 25, 2025
03cd6ba
add auto postfix to the config
krystofwoldrich Feb 25, 2025
ea022c2
Merge remote-tracking branch 'origin/capture-app-start-errors' into k…
krystofwoldrich Feb 25, 2025
ed2bedb
test(e2e): Avoid race conditions when waiting for captured message
krystofwoldrich Feb 25, 2025
a880707
also apply to envelope header
krystofwoldrich Feb 25, 2025
6ffaf2f
add android auto tests
krystofwoldrich Feb 25, 2025
510e732
Merge remote-tracking branch 'origin/capture-app-start-errors' into k…
krystofwoldrich Feb 26, 2025
56380bd
fix dsn
krystofwoldrich Feb 26, 2025
872c5b1
Add missing dynamic frameworks build tests
krystofwoldrich Feb 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
124 changes: 102 additions & 22 deletions .github/workflows/sample-application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
uses: ./.github/workflows/skip-ci.yml

build:
name: Build ${{ matrix.rn-architecture }} ${{ matrix.platform }} ${{ matrix.build-type }} ${{ matrix.ios-use-frameworks}}
name: ${{ matrix.job-name }}
runs-on: ${{ matrix.runs-on }}
needs: [diff_check]
if: ${{ needs.diff_check.outputs.skip_ci != 'true' }}
Expand All @@ -36,26 +36,96 @@ jobs:
# we want that the matrix keeps running, default is to cancel them if it fails.
fail-fast: false
matrix:
rn-architecture: ['legacy', 'new']
ios-use-frameworks: ['no-frameworks', 'dynamic-frameworks']
platform: ['android', 'ios', 'macos']
build-type: ['dev', 'production']
include:
- platform: ios
# macOS builds
- job-name: Build macOS Legacy Dev
platform: macos
runs-on: macos-15
- platform: macos
rn-architecture: legacy
build-type: dev

- job-name: Build macOS Legacy Release
platform: macos
runs-on: macos-15
- platform: android
runs-on: ubuntu-latest
exclude:
- platform: 'android'
rn-architecture: legacy
build-type: production

# iOS builds
- job-name: Build iOS Legacy Dev
platform: ios
runs-on: macos-15
rn-architecture: legacy
build-type: dev

- job-name: Build iOS Legacy Prod
platform: ios
runs-on: macos-15
rn-architecture: legacy
build-type: production

- job-name: Build iOS New Arch Dev Static
platform: ios
runs-on: macos-15
rn-architecture: new
build-type: dev
ios-use-frameworks: 'no-frameworks'

- job-name: Build iOS New Arch Prod Static
platform: ios
runs-on: macos-15
rn-architecture: new
build-type: production
ios-use-frameworks: 'no-frameworks'

- job-name: Build iOS New Arch Dev Dynamic
platform: ios
runs-on: macos-15
rn-architecture: new
build-type: dev
ios-use-frameworks: 'dynamic-frameworks'
- rn-architecture: 'new'

- job-name: Build iOS New Arch Prod Dynamic
platform: ios
runs-on: macos-15
rn-architecture: new
build-type: production
ios-use-frameworks: 'dynamic-frameworks'
- rn-architecture: 'new'
platform: 'macos'
- ios-use-frameworks: 'dynamic-frameworks'
platform: 'macos'

# Android builds
- job-name: Build Android Legacy Dev Manual
platform: android
runs-on: ubuntu-latest
rn-architecture: legacy
build-type: dev
init-type: manual

- job-name: Build Android Legacy Prod Manual
platform: android
runs-on: ubuntu-latest
rn-architecture: legacy
build-type: production
init-type: manual

- job-name: Build Android New Arch Dev Manual
platform: android
runs-on: ubuntu-latest
rn-architecture: new
build-type: dev
init-type: manual

- job-name: Build Android New Arch Prod Manual
platform: android
runs-on: ubuntu-latest
rn-architecture: new
build-type: production
init-type: manual

- job-name: Build Android New Arch Prod Auto
platform: android
runs-on: ubuntu-latest
rn-architecture: new
build-type: production
init-type: auto
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -114,6 +184,7 @@ jobs:
run: |
export RN_ARCHITECTURE="${{ matrix.rn-architecture }}"
[[ "${{ matrix.build-type }}" == "production" ]] && export CONFIG='release' || export CONFIG='debug'
[[ "${{ matrix.init-type }}" == "auto" ]] && export SENTRY_DISABLE_NATIVE_START='true' || export SENTRY_DISABLE_NATIVE_START='false'

./scripts/set-dsn-aos.mjs
./scripts/build-android.sh -PreactNativeArchitectures=x86
Expand Down Expand Up @@ -174,7 +245,7 @@ jobs:
if: ${{ matrix.platform == 'android' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' }}
uses: actions/upload-artifact@v4
with:
name: sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.platform }}
name: sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.platform }}-${{ matrix.init-type }}
path: ${{ env.ANDROID_APP_ARCHIVE_PATH }}
retention-days: 1

Expand All @@ -195,28 +266,37 @@ jobs:
fail-fast: false
matrix:
include:
- job-name: 'Test iOS Release Auto Init'
- job-name: 'Test iOS Prod New Arch Auto Init'
platform: ios
runs-on: macos-15
rn-architecture: 'new'
ios-use-frameworks: 'no-frameworks'
build-type: 'production'
test-command: 'yarn test-ios-auto' # tests native auto init from JS

- job-name: 'Test iOS Release Manual Init'
- job-name: 'Test iOS Prod New Arch Manual Init'
platform: ios
runs-on: macos-15
rn-architecture: 'new'
ios-use-frameworks: 'no-frameworks'
build-type: 'production'
test-command: 'yarn test-ios-manual'

- job-name: 'Test Android Release Manual Init'
- job-name: 'Test Android Prod New Arch Manual Init'
platform: android
runs-on: ubuntu-latest
rn-architecture: 'new'
build-type: 'production'
init-type: manual
test-command: 'yarn test-android-manual'

- job-name: 'Test Android Prod New Arch Auto Init'
platform: android
runs-on: ubuntu-latest
rn-architecture: 'new'
build-type: 'production'
test-command: 'yarn test-android'
init-type: auto
test-command: 'yarn test-android-auto'

steps:
- uses: actions/checkout@v4
Expand All @@ -232,7 +312,7 @@ jobs:
if: ${{ matrix.platform == 'android' }}
uses: actions/download-artifact@v4
with:
name: sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.platform }}
name: sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.platform }}-${{ matrix.init-type }}
path: ${{ env.REACT_NATIVE_SAMPLE_PATH }}

- name: Unzip iOS App Archive
Expand Down
67 changes: 33 additions & 34 deletions samples/react-native/.detoxrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
const process = require('process');

const baseConfig = jestConfig => ({
testRunner: {
args: {
$0: 'jest',
config: jestConfig,
},
jest: {
setupTimeout: 120000,
},
},
});

const androidConfig = () => ({
device: 'ci.emulator',
app: 'ci.android',
});

const iosConfig = () => ({
device: 'ci.simulator',
app: 'ci.ios',
});

/** @type {Detox.DetoxConfig} */
module.exports = {
testRunner: {},
Expand Down Expand Up @@ -31,44 +53,21 @@ module.exports = {
},
},
configurations: {
'ci.android': {
device: 'ci.emulator',
app: 'ci.android',
testRunner: {
args: {
$0: 'jest',
config: 'e2e/jest.config.android.js',
},
jest: {
setupTimeout: 120000,
},
},
'ci.android.auto': {
...baseConfig('e2e/jest.config.android.auto.js'),
...androidConfig(),
},
'ci.android.manual': {
...baseConfig('e2e/jest.config.android.manual.js'),
...androidConfig(),
},
'ci.sim.auto': {
device: 'ci.simulator',
app: 'ci.ios',
testRunner: {
args: {
$0: 'jest',
config: 'e2e/jest.config.ios.auto.js',
},
jest: {
setupTimeout: 120000,
},
},
...baseConfig('e2e/jest.config.ios.auto.js'),
...iosConfig(),
},
'ci.sim.manual': {
device: 'ci.simulator',
app: 'ci.ios',
testRunner: {
args: {
$0: 'jest',
config: 'e2e/jest.config.ios.manual.js',
},
jest: {
setupTimeout: 120000,
},
},
...baseConfig('e2e/jest.config.ios.manual.js'),
...iosConfig(),
},
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@ const baseConfig = require('./jest.config.base');
/** @type {import('@jest/types').Config.InitialOptions} */
module.exports = {
...baseConfig,
testMatch: [...baseConfig.testMatch, '<rootDir>/e2e/**/*.test.android.ts'],
testMatch: [
...baseConfig.testMatch,
'<rootDir>/e2e/**/*.test.android.ts',
'<rootDir>/e2e/**/*.test.android.auto.ts',
],
};
11 changes: 11 additions & 0 deletions samples/react-native/e2e/jest.config.android.manual.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const baseConfig = require('./jest.config.base');

/** @type {import('@jest/types').Config.InitialOptions} */
module.exports = {
...baseConfig,
testMatch: [
...baseConfig.testMatch,
'<rootDir>/e2e/**/*.test.android.ts',
'<rootDir>/e2e/**/*.test.android.manual.ts',
],
};
15 changes: 10 additions & 5 deletions samples/react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,21 @@
"scripts": {
"postinstall": "patch-package",
"start": "react-native start",
"build-android-release": "scripts/build-android-release.sh",
"build-android-release-legacy": "scripts/build-android-release-legacy.sh",
"build-android-debug": "scripts/build-android-debug.sh",
"build-android-debug-legacy": "scripts/build-android-debug-legacy.sh",
"build-android-release-manual": "scripts/build-android-release-manual.sh",
"build-android-release-legacy-manual": "scripts/build-android-release-legacy-manual.sh",
"build-android-debug-manual": "scripts/build-android-debug-manual.sh",
"build-android-debug-legacy-manual": "scripts/build-android-debug-legacy-manual.sh",
"build-android-release-auto": "scripts/build-android-release-auto.sh",
"build-android-release-legacy-auto": "scripts/build-android-release-legacy-auto.sh",
"build-android-debug-auto": "scripts/build-android-debug-auto.sh",
"build-android-debug-legacy-auto": "scripts/build-android-debug-legacy-auto.sh",
"build-ios-release": "scripts/build-ios-release.sh",
"build-ios-debug": "scripts/build-ios-debug.sh",
"test": "jest",
"set-test-dsn-android": "scripts/set-dsn-aos.mjs",
"set-test-dsn-ios": "scripts/set-dsn-ios.mjs",
"test-android": "scripts/test-android.sh",
"test-android-auto": "scripts/test-android-auto.sh",
"test-android-manual": "scripts/test-android-manual.sh",
"test-ios-manual": "scripts/test-ios-manual.sh",
"test-ios-auto": "scripts/test-ios-auto.sh",
"lint": "npx eslint . --ext .js,.jsx,.ts,.tsx",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ thisFilePath=$(dirname "$0")

export RN_ARCHITECTURE="new"
export CONFIG="debug"
export SENTRY_DISABLE_NATIVE_START="true"

"${thisFilePath}/build-android.sh"
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ thisFilePath=$(dirname "$0")

export RN_ARCHITECTURE="legacy"
export CONFIG="debug"
export SENTRY_DISABLE_NATIVE_START="true"

"${thisFilePath}/build-android.sh"
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

# Exit on error
set -e

thisFilePath=$(dirname "$0")

export RN_ARCHITECTURE="legacy"
export CONFIG="debug"
export SENTRY_DISABLE_NATIVE_START="false"

"${thisFilePath}/build-android.sh"
12 changes: 12 additions & 0 deletions samples/react-native/scripts/build-android-debug-manual.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

# Exit on error
set -e

thisFilePath=$(dirname "$0")

export RN_ARCHITECTURE="new"
export CONFIG="debug"
export SENTRY_DISABLE_NATIVE_START="false"

"${thisFilePath}/build-android.sh"
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ thisFilePath=$(dirname "$0")

export RN_ARCHITECTURE="new"
export CONFIG="release"
export SENTRY_DISABLE_NATIVE_START="true"

"${thisFilePath}/build-android.sh"
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ thisFilePath=$(dirname "$0")

export RN_ARCHITECTURE="legacy"
export CONFIG="release"
export SENTRY_DISABLE_NATIVE_START="true"

"${thisFilePath}/build-android.sh"
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

# Exit on error
set -e

thisFilePath=$(dirname "$0")

export RN_ARCHITECTURE="legacy"
export CONFIG="release"
export SENTRY_DISABLE_NATIVE_START="false"

"${thisFilePath}/build-android.sh"
Loading
Loading