Skip to content

Commit fa4025a

Browse files
committed
Merge branch 'main' into antonis/4169-cocoa-DebugImagesFromCache
# Conflicts: # CHANGELOG.md
2 parents 2008d2c + 9cab16b commit fa4025a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1285
-697
lines changed

.github/workflows/e2e.yml

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ concurrency:
1414

1515
env:
1616
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
17+
MAESTRO_VERSION: '1.39.0'
18+
IOS_DEVICE: 'iPhone 14'
1719

1820
jobs:
1921
diff_check:
@@ -168,12 +170,10 @@ jobs:
168170
rn-version: '0.76.0'
169171
runs-on: macos-14 # uses m1 https://github.blog/changelog/2024-01-30-github-actions-macos-14-sonoma-is-now-available/
170172
runtime: 'latest'
171-
device: 'iPhone 14'
172173
- platform: ios
173174
rn-version: '0.65.3'
174175
runs-on: macos-13
175176
runtime: 'latest'
176-
device: 'iPhone 14'
177177
- platform: android
178178
runs-on: ubuntu-latest
179179
exclude:
@@ -308,12 +308,10 @@ jobs:
308308
rn-version: '0.76.0'
309309
runs-on: macos-14 # uses m1 https://github.blog/changelog/2024-01-30-github-actions-macos-14-sonoma-is-now-available/
310310
runtime: 'latest'
311-
device: 'iPhone 14'
312311
- platform: ios
313312
rn-version: '0.65.3'
314313
runs-on: macos-latest
315314
runtime: 'latest'
316-
device: 'iPhone 14'
317315
- platform: android
318316
runs-on: ubuntu-latest
319317
exclude:
@@ -329,12 +327,18 @@ jobs:
329327
- rn-version: '0.76.0'
330328
platform: 'ios'
331329
rn-architecture: 'new'
332-
env:
333-
PLATFORM: ${{ matrix.platform }}
334-
DEVICE: ${{ matrix.device }}
335330
steps:
336331
- uses: actions/checkout@v4
337332

333+
- name: Install Maestro
334+
uses: dniHze/maestro-test-action@bda8a93211c86d0a05b7a4597c5ad134566fbde4 # [email protected]
335+
with:
336+
version: ${{env.MAESTRO_VERSION}}
337+
338+
- name: Install iDB Companion
339+
if: ${{ matrix.platform == 'ios' }}
340+
run: brew tap facebook/fb && brew install facebook/fb/idb-companion
341+
338342
- uses: ./.github/actions/disk-cleanup
339343
if: ${{ matrix.platform == 'android' }}
340344

@@ -400,11 +404,10 @@ jobs:
400404
-timezone US/Pacific
401405
script: ./dev-packages/e2e-tests/cli.mjs ${{ matrix.platform }} --test
402406

403-
- uses: actions/cache@v4
407+
- uses: futureware-tech/simulator-action@bfa03d93ec9de6dacb0c5553bbf8da8afc6c2ee9 # pin@v3
404408
if: ${{ matrix.platform == 'ios' }}
405409
with:
406-
path: test/e2e/DerivedData/Build/Products/Debug-iphonesimulator/WebDriverAgentRunner-Runner.app
407-
key: appium-webdriveragent-${{ hashFiles('test/e2e/yarn.lock') }}
410+
model: ${{ env.IOS_DEVICE }}
408411

409412
- name: Run tests on iOS
410413
if: ${{ matrix.platform == 'ios' }}
@@ -415,6 +418,4 @@ jobs:
415418
uses: actions/upload-artifact@v4
416419
with:
417420
name: ${{ matrix.rn-version }}-${{ matrix.rn-architecture }}-${{ matrix.engine }}-${{ matrix.platform }}-${{ matrix.build-type }}-${{ matrix.ios-use-frameworks }}-logs
418-
path: |
419-
test/e2e/*.log
420-
test/e2e/*.png
421+
path: ./dev-packages/e2e-tests/maestro-logs

CHANGELOG.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,24 @@
88
99
## Unreleased
1010

11-
### Improvements
11+
### Fixes
1212

13+
- Skips ignoring require cycle logs for RN 0.70 or newer ([#4214](https://github.com/getsentry/sentry-react-native/pull/4214))
14+
- Enhanced accuracy of time-to-display spans. ([#4189](https://github.com/getsentry/sentry-react-native/pull/4189))
1315
- Speed up getBinaryImages for finishing transactions and capturing events ([#4194](https://github.com/getsentry/sentry-react-native/pull/4194))
1416

17+
### Features
18+
19+
- Enables Spotlight in Android and iOS SDKs ([#4211](https://github.com/getsentry/sentry-react-native/pull/4211))
20+
1521
### Dependencies
1622

1723
- Bump JavaScript SDK from v8.34.0 to v8.35.0 ([#4196](https://github.com/getsentry/sentry-react-native/pull/4196))
1824
- [changelog](https://github.com/getsentry/sentry-javascript/blob/develop/CHANGELOG.md#8350)
1925
- [diff](https://github.com/getsentry/sentry-javascript/compare/8.34.0...8.35.0)
20-
- Bump CLI from v2.37.0 to v2.38.0 ([#4200](https://github.com/getsentry/sentry-react-native/pull/4200))
21-
- [changelog](https://github.com/getsentry/sentry-cli/blob/master/CHANGELOG.md#2380)
22-
- [diff](https://github.com/getsentry/sentry-cli/compare/2.37.0...2.38.0)
26+
- Bump CLI from v2.37.0 to v2.38.1 ([#4200](https://github.com/getsentry/sentry-react-native/pull/4200), [#4220](https://github.com/getsentry/sentry-react-native/pull/4220))
27+
- [changelog](https://github.com/getsentry/sentry-cli/blob/master/CHANGELOG.md#2381)
28+
- [diff](https://github.com/getsentry/sentry-cli/compare/2.37.0...2.38.1)
2329
- Bump Android SDK from v7.15.0 to v7.16.0 ([#4202](https://github.com/getsentry/sentry-react-native/pull/4202))
2430
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#7160)
2531
- [diff](https://github.com/getsentry/sentry-java/compare/7.15.0...7.16.0)

dev-packages/e2e-tests/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@
22
*.log
33
*.app
44
*.apk
5+
6+
/react-native-versions
7+
/maestro-logs

dev-packages/e2e-tests/cli.mjs

Lines changed: 35 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env node
22
'use strict';
33

4-
import { execSync, spawn } from 'child_process';
4+
import { execSync, execFileSync, spawn } from 'child_process';
55
import * as fs from 'fs';
66
import * as path from 'path';
77
import { argv, env } from 'process';
@@ -64,8 +64,9 @@ const appRepoDir = `${e2eDir}/react-native-versions/${RNVersion}`;
6464
const appName = 'RnDiffApp';
6565
const appDir = `${appRepoDir}/${appName}`;
6666
const testAppName = `${appName}.${platform == 'ios' ? 'app' : 'apk'}`;
67-
const runtime = env.IOS_RUNTIME ? env.IOS_RUNTIME : 'latest';
68-
const device = env.IOS_DEVICE ? env.IOS_DEVICE : 'iPhone 15';
67+
const testApp = `${e2eDir}/${testAppName}`;
68+
const appId = platform === 'ios' ? 'org.reactjs.native.example.RnDiffApp' : 'com.rndiffapp';
69+
const sentryAuthToken = env.SENTRY_AUTH_TOKEN;
6970

7071
// Build and publish the SDK - we only need to do this once in CI.
7172
// Locally, we may want to get updates from the latest build so do it on every app build.
@@ -112,9 +113,12 @@ if (actions.includes('create')) {
112113
env: Object.assign(env, { YARN_ENABLE_IMMUTABLE_INSTALLS: false }),
113114
});
114115

115-
console.log(`done`);
116-
117-
console.log(`done2`);
116+
execSync(`yarn add [email protected]`, {
117+
stdio: 'inherit',
118+
cwd: appDir,
119+
// yarn v3 run immutable install by default in CI
120+
env: Object.assign(env, { YARN_ENABLE_IMMUTABLE_INSTALLS: false }),
121+
});
118122

119123
// Patch the app
120124
execSync(`patch --verbose --strip=0 --force --ignore-whitespace --fuzz 4 < ${patchScriptsDir}/rn.patch`, {
@@ -138,7 +142,6 @@ if (actions.includes('create')) {
138142
cwd: `${appDir}/ios`,
139143
env: env,
140144
});
141-
console.log(`done3`);
142145

143146
if (fs.existsSync(`${appDir}/Gemfile`)) {
144147
execSync(`bundle install`, { stdio: 'inherit', cwd: appDir, env: env });
@@ -185,7 +188,8 @@ if (actions.includes('build')) {
185188
-workspace ${appName}.xcworkspace \
186189
-configuration ${buildType} \
187190
-scheme ${appName} \
188-
-destination 'platform=iOS Simulator,OS=${runtime},name=${device}' \
191+
-sdk 'iphonesimulator' \
192+
-destination 'generic/platform=iOS Simulator' \
189193
ONLY_ACTIVE_ARCH=yes \
190194
-derivedDataPath DerivedData \
191195
build | tee xcodebuild.log | xcbeautify`,
@@ -202,123 +206,40 @@ if (actions.includes('build')) {
202206
appProduct = `${appDir}/android/app/build/outputs/apk/release/app-release.apk`;
203207
}
204208

205-
var testApp = `${e2eDir}/${testAppName}`;
206209
console.log(`Moving ${appProduct} to ${testApp}`);
207210
if (fs.existsSync(testApp)) fs.rmSync(testApp, { recursive: true });
208211
fs.renameSync(appProduct, testApp);
209212
}
210213

211214
if (actions.includes('test')) {
212-
if (
213-
platform == 'ios' &&
214-
!fs.existsSync(`${e2eDir}/DerivedData/Build/Products/Debug-iphonesimulator/WebDriverAgentRunner-Runner.app`)
215-
) {
216-
// Build iOS WebDriverAgent
217-
execSync(
218-
`set -o pipefail && xcodebuild \
219-
-project node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj \
220-
-scheme WebDriverAgentRunner \
221-
-destination 'platform=iOS Simulator,OS=${runtime},name=${device}' \
222-
GCC_TREAT_WARNINGS_AS_ERRORS=0 \
223-
COMPILER_INDEX_STORE_ENABLE=NO \
224-
ONLY_ACTIVE_ARCH=yes \
225-
-derivedDataPath DerivedData \
226-
build | tee xcodebuild-agent.log | xcbeautify`,
227-
{ stdio: 'inherit', cwd: e2eDir, env: env },
228-
);
229-
}
230-
231-
// Start the appium server.
232-
var processesToKill = {};
233-
async function newProcess(name, process) {
234-
await new Promise((resolve, reject) => {
235-
process.on('error', e => {
236-
console.error(`Failed to start process '${name}': ${e}`);
237-
reject(e);
238-
});
239-
process.on('spawn', () => {
240-
console.log(`Process '${name}' (${process.pid}) started`);
241-
resolve();
242-
});
243-
});
244-
245-
processesToKill[name] = {
246-
process: process,
247-
complete: new Promise((resolve, _reject) => {
248-
process.on('close', resolve);
249-
}),
250-
};
251-
}
252-
await newProcess(
253-
'appium',
254-
spawn('node_modules/.bin/appium', ['--log-timestamp', '--log-no-colors', '--log', `appium${platform}.log`], {
255-
stdio: 'inherit',
256-
cwd: e2eDir,
257-
env: env,
258-
shell: false,
259-
}),
260-
);
261-
262-
try {
263-
await waitForAppium();
264-
265-
// Run e2e tests
266-
const testEnv = env;
267-
testEnv.PLATFORM = platform;
268-
testEnv.APPIUM_APP = `./${testAppName}`;
269-
270-
if (platform == 'ios') {
271-
testEnv.APPIUM_DERIVED_DATA = 'DerivedData';
272-
} else if (platform == 'android') {
273-
execSync(`adb devices -l`, { stdio: 'inherit', cwd: e2eDir, env: env });
274-
275-
execSync(`adb logcat -c`, { stdio: 'inherit', cwd: e2eDir, env: env });
276-
277-
var adbLogStream = fs.createWriteStream(`${e2eDir}/adb.log`);
278-
const adbLogProcess = spawn('adb', ['logcat'], { cwd: e2eDir, env: env, shell: false });
279-
adbLogProcess.stdout.pipe(adbLogStream);
280-
adbLogProcess.stderr.pipe(adbLogStream);
281-
adbLogProcess.on('close', () => adbLogStream.close());
282-
await newProcess('adb logcat', adbLogProcess);
283-
}
284-
285-
execSync(`yarn test:e2e:runner --verbose`, { stdio: 'inherit', cwd: e2eDir, env: testEnv });
286-
} finally {
287-
for (const [name, info] of Object.entries(processesToKill)) {
288-
console.log(`Sending termination signal to process '${name}' (${info.process.pid})`);
289-
290-
// Send SIGTERM first to allow graceful shutdown.
291-
info.process.kill(15);
292-
293-
// Also send SIGKILL after 10 seconds.
294-
const killTimeout = setTimeout(() => process.kill(9), '10000');
295-
296-
// Wait for the process to exit (either via SIGTERM or SIGKILL).
297-
const code = await info.complete;
298-
299-
// Successfully exited now, no need to kill (if it hasn't run yet).
300-
clearTimeout(killTimeout);
301-
302-
console.log(`Process '${name}' (${info.process.pid}) exited with code ${code}`);
215+
// Run e2e tests
216+
if (platform == 'ios') {
217+
try {
218+
execSync('xcrun simctl list devices | grep -q "(Booted)"');
219+
} catch (error) {
220+
throw new Error('No simulator is currently booted. Please boot a simulator before running this script.');
303221
}
304-
}
305-
}
306222

307-
async function waitForAppium() {
308-
console.log('Waiting for Appium server to start...');
309-
for (let i = 0; i < 60; i++) {
223+
execFileSync('xcrun', ['simctl', 'install', 'booted', testApp]);
224+
} else if (platform == 'android') {
310225
try {
311-
await fetch('http://127.0.0.1:4723/sessions', { method: 'HEAD' });
312-
console.log('Appium server started');
313-
return;
226+
execSync('adb devices | grep -q "emulator"');
314227
} catch (error) {
315-
console.log(`Appium server hasn't started yet (${error})...`);
316-
await sleep(1000);
228+
throw new Error('No Android emulator is currently running. Please start an emulator before running this script.');
317229
}
230+
231+
execFileSync('adb', ['install', '-r', '-d', testApp]);
318232
}
319-
throw new Error('Appium server failed to start');
320-
}
321233

322-
async function sleep(millis) {
323-
return new Promise(resolve => setTimeout(resolve, millis));
234+
execSync(
235+
`maestro test maestro \
236+
--env=APP_ID="${appId}" \
237+
--env=SENTRY_AUTH_TOKEN="${sentryAuthToken}" \
238+
--debug-output maestro-logs \
239+
--flatten-debug-output`,
240+
{
241+
stdio: 'inherit',
242+
cwd: e2eDir,
243+
},
244+
);
324245
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
appId: ${APP_ID}
2+
---
3+
- runFlow: utils/launchTestAppClear.yml
4+
- tapOn: "Capture Exception"
5+
- runFlow: utils/assertEventIdVisible.yml
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
appId: ${APP_ID}
2+
---
3+
- runFlow: utils/launchTestAppClear.yml
4+
- tapOn: "Capture Message"
5+
- runFlow: utils/assertEventIdVisible.yml
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
appId: ${APP_ID}
2+
---
3+
- runFlow: utils/launchTestAppClear.yml
4+
- tapOn: "Unhandled Promise Rejection"
5+
- runFlow: utils/assertEventIdVisible.yml
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
appId: ${APP_ID}
2+
---
3+
- runFlow: utils/launchTestAppClear.yml
4+
- tapOn: "Close"
5+
6+
- assertNotVisible:
7+
id: "eventId"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
appId: ${APP_ID}
2+
---
3+
- runFlow: utils/launchTestAppClear.yml
4+
- tapOn: "Crash"
5+
6+
- launchApp
7+
- assertVisible: "E2E Tests Ready"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
appId: ${APP_ID}
2+
---
3+
- extendedWaitUntil:
4+
visible:
5+
id: "eventId"
6+
timeout: 600_000 # 10 minutes
7+
8+
- copyTextFrom:
9+
id: "eventId"
10+
- assertTrue: ${maestro.copiedText}

0 commit comments

Comments
 (0)