From fa1225929015fc336b92d9195702fef25161ba8c Mon Sep 17 00:00:00 2001 From: GIancarlo Buenaflor Date: Tue, 10 Dec 2024 13:38:51 +0100 Subject: [PATCH 01/23] update --- .../integration_test/integration_test.dart | 130 ++++++++++-------- 1 file changed, 73 insertions(+), 57 deletions(-) diff --git a/flutter/example/integration_test/integration_test.dart b/flutter/example/integration_test/integration_test.dart index bcfd55eb72..e81c954af3 100644 --- a/flutter/example/integration_test/integration_test.dart +++ b/flutter/example/integration_test/integration_test.dart @@ -7,16 +7,17 @@ import 'dart:convert'; import 'package:flutter/widgets.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:http/http.dart'; +import 'package:integration_test/integration_test.dart'; import 'package:sentry_flutter/sentry_flutter.dart'; import 'package:sentry_flutter_example/main.dart'; void main() { - // const org = 'sentry-sdks'; - // const slug = 'sentry-flutter'; - // const authToken = String.fromEnvironment('SENTRY_AUTH_TOKEN'); + const org = 'sentry-sdks'; + const slug = 'sentry-flutter'; + const authToken = String.fromEnvironment('SENTRY_AUTH_TOKEN'); const fakeDsn = 'https://abc@def.ingest.sentry.io/1234567'; - TestWidgetsFlutterBinding.ensureInitialized(); + IntegrationTestWidgetsFlutterBinding.ensureInitialized(); tearDown(() async { await Sentry.close(); @@ -162,59 +163,63 @@ void main() { await transaction.finish(); }); - // group('e2e', () { - // var output = find.byKey(const Key('output')); - // late Fixture fixture; - // - // setUp(() { - // fixture = Fixture(); - // }); - // - // testWidgets('captureException', (tester) async { - // await setupSentryAndApp(tester, - // dsn: exampleDsn, beforeSendCallback: fixture.beforeSend); - // - // await tester.tap(find.text('captureException')); - // await tester.pumpAndSettle(); - // - // final text = output.evaluate().single.widget as Text; - // final id = text.data!; - // - // final uri = Uri.parse( - // 'https://sentry.io/api/0/projects/$org/$slug/events/$id/', - // ); - // expect(authToken, isNotEmpty); - // - // final event = await fixture.poll(uri, authToken); - // expect(event, isNotNull); - // - // final sentEvent = fixture.sentEvent; - // expect(sentEvent, isNotNull); - // - // final tags = event!["tags"] as List; - // - // expect(sentEvent!.eventId.toString(), event["id"]); - // expect("_Exception: Exception: captureException", event["title"]); - // expect(sentEvent.release, event["release"]["version"]); - // expect( - // 2, - // (tags.firstWhere((e) => e["value"] == sentEvent.environment) as Map) - // .length); - // expect(sentEvent.fingerprint, event["fingerprint"] ?? []); - // expect( - // 2, - // (tags.firstWhere((e) => e["value"] == SentryLevel.error.name) as Map) - // .length); - // expect(sentEvent.logger, event["logger"]); - // - // final dist = tags.firstWhere((element) => element['key'] == 'dist'); - // expect('1', dist['value']); - // - // final environment = - // tags.firstWhere((element) => element['key'] == 'environment'); - // expect('integration', environment['value']); - // }); - // }); + group('e2e', () { + var output = find.byKey(const Key('output')); + late Fixture fixture; + + setUp(() { + fixture = Fixture(); + }); + + testWidgets('captureException', (tester) async { + late Uri uri; + await restoreFlutterOnErrorAfter(() async { + await setupSentryAndApp(tester, + dsn: exampleDsn, beforeSendCallback: fixture.beforeSend); + + await tester.tap(find.text('captureException')); + await tester.pumpAndSettle(); + + final text = output.evaluate().single.widget as Text; + final id = text.data!; + + uri = Uri.parse( + 'https://sentry.io/api/0/projects/$org/$slug/events/$id/', + ); + }); + + expect(authToken, isNotEmpty); + + final event = await fixture.poll(uri, authToken); + expect(event, isNotNull); + + final sentEvent = fixture.sentEvent; + expect(sentEvent, isNotNull); + + final tags = event!["tags"] as List; + + expect(sentEvent!.eventId.toString(), event["id"]); + expect("_Exception: Exception: captureException", event["title"]); + expect(sentEvent.release, event["release"]["version"]); + expect( + 2, + (tags.firstWhere((e) => e["value"] == sentEvent.environment) as Map) + .length); + expect(sentEvent.fingerprint, event["fingerprint"] ?? []); + expect( + 2, + (tags.firstWhere((e) => e["value"] == SentryLevel.error.name) as Map) + .length); + expect(sentEvent.logger, event["logger"]); + + final dist = tags.firstWhere((element) => element['key'] == 'dist'); + expect('1', dist['value']); + + final environment = + tags.firstWhere((element) => element['key'] == 'environment'); + expect('integration', environment['value']); + }); + }); } class Fixture { @@ -260,3 +265,14 @@ class Fixture { return null; } } + +Future restoreFlutterOnErrorAfter(Future Function() fn) async { + final originalOnError = FlutterError.onError!; + await fn(); + final overriddenOnError = FlutterError.onError!; + + FlutterError.onError = (FlutterErrorDetails details) { + if (overriddenOnError != originalOnError) overriddenOnError(details); + originalOnError(details); + }; +} From 9fe1eaab89b27646019ed7357d3a97dca51f9e7d Mon Sep 17 00:00:00 2001 From: GIancarlo Buenaflor Date: Tue, 10 Dec 2024 14:22:06 +0100 Subject: [PATCH 02/23] update --- .../integration_test/integration_test.dart | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/flutter/example/integration_test/integration_test.dart b/flutter/example/integration_test/integration_test.dart index e81c954af3..a6ac1456a5 100644 --- a/flutter/example/integration_test/integration_test.dart +++ b/flutter/example/integration_test/integration_test.dart @@ -14,7 +14,7 @@ import 'package:sentry_flutter_example/main.dart'; void main() { const org = 'sentry-sdks'; const slug = 'sentry-flutter'; - const authToken = String.fromEnvironment('SENTRY_AUTH_TOKEN'); + const authToken = String.fromEnvironment('SENTRY_AUTH_TOKEN_E2E'); const fakeDsn = 'https://abc@def.ingest.sentry.io/1234567'; IntegrationTestWidgetsFlutterBinding.ensureInitialized(); @@ -99,7 +99,7 @@ void main() { // ignore: deprecated_member_use_from_same_package // ignore: deprecated_member_use - final associatedEventId = await Sentry.captureMessage("Associated"); + final associatedEventId = await Sentry.captureMessage('Associated'); final feedback = SentryFeedback( message: 'message', contactEmail: 'john.appleseed@apple.com', @@ -196,21 +196,23 @@ void main() { final sentEvent = fixture.sentEvent; expect(sentEvent, isNotNull); - final tags = event!["tags"] as List; + final tags = event!['tags'] as List; - expect(sentEvent!.eventId.toString(), event["id"]); - expect("_Exception: Exception: captureException", event["title"]); - expect(sentEvent.release, event["release"]["version"]); + print('event id: ${event['id']}'); + print('event title: ${event['title']}'); + expect(sentEvent!.eventId.toString(), event['id']); + expect('_Exception: Exception: captureException', event['title']); + expect(sentEvent.release, event['release']['version']); expect( 2, - (tags.firstWhere((e) => e["value"] == sentEvent.environment) as Map) + (tags.firstWhere((e) => e['value'] == sentEvent.environment) as Map) .length); - expect(sentEvent.fingerprint, event["fingerprint"] ?? []); + expect(sentEvent.fingerprint, event['fingerprint'] ?? []); expect( 2, - (tags.firstWhere((e) => e["value"] == SentryLevel.error.name) as Map) + (tags.firstWhere((e) => e['value'] == SentryLevel.error.name) as Map) .length); - expect(sentEvent.logger, event["logger"]); + expect(sentEvent.logger, event['logger']); final dist = tags.firstWhere((element) => element['key'] == 'dist'); expect('1', dist['value']); @@ -226,7 +228,7 @@ class Fixture { SentryEvent? sentEvent; FutureOr beforeSend(SentryEvent event, Hint hint) async { - sentEvent = event; + sentEvent ??= event; return event; } @@ -242,16 +244,16 @@ class Fixture { while (retries < maxRetries) { try { - print("Trying to fetch $url [try $retries/$maxRetries]"); + print('Trying to fetch $url [try $retries/$maxRetries]'); final response = await client.get( url, headers: {'Authorization': 'Bearer $authToken'}, ); - print("Response status code: ${response.statusCode}"); + print('Response status code: ${response.statusCode}'); if (response.statusCode == 200) { return jsonDecode(utf8.decode(response.bodyBytes)); } else if (response.statusCode == 401) { - print("Cannot fetch $url - invalid auth token."); + print('Cannot fetch $url - invalid auth token.'); break; } } catch (e) { From 8e7a4fe0d422a1b2df87f9b4a22c8559605e18b2 Mon Sep 17 00:00:00 2001 From: GIancarlo Buenaflor Date: Tue, 10 Dec 2024 16:25:16 +0100 Subject: [PATCH 03/23] update --- .github/workflows/flutter_test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/flutter_test.yml b/.github/workflows/flutter_test.yml index 1bfd543a4d..b49243ad88 100644 --- a/.github/workflows/flutter_test.yml +++ b/.github/workflows/flutter_test.yml @@ -13,7 +13,7 @@ on: - "flutter/**" env: - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + SENTRY_AUTH_TOKEN_E2E: ${{ secrets.SENTRY_AUTH_TOKEN_E2E }} jobs: cancel-previous-workflow: @@ -107,7 +107,7 @@ jobs: avd-name: macOS-avd-x86_64-31 emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none disable-animations: true - script: flutter test integration_test/all.dart --verbose + script: flutter test integration_test/all.dart --dart-define SENTRY_AUTH_TOKEN_E2E=$SENTRY_AUTH_TOKEN_E2E --verbose cocoa: name: "${{ matrix.target }} | ${{ matrix.sdk }}" @@ -158,7 +158,7 @@ jobs: - name: run integration test # Disable flutter integration tests for iOS for now (https://github.com/getsentry/sentry-dart/issues/1605#issuecomment-1695809346) if: ${{ matrix.target != 'ios' }} - run: flutter test -d "${{ steps.device.outputs.name }}" integration_test/all.dart --verbose + run: flutter test -d "${{ steps.device.outputs.name }}" integration_test/all.dart --dart-define SENTRY_AUTH_TOKEN_E2E=$SENTRY_AUTH_TOKEN_E2E --verbose - name: run native test # We only have the native unit test package in the iOS xcodeproj at the moment. From 7aa48f9f1f2205ca702ff1d181ba761bcc3e8e2f Mon Sep 17 00:00:00 2001 From: GIancarlo Buenaflor Date: Tue, 10 Dec 2024 23:28:09 +0100 Subject: [PATCH 04/23] run integration tests in ios again --- .github/workflows/flutter_test.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/flutter_test.yml b/.github/workflows/flutter_test.yml index 01270e6275..aaf276ec95 100644 --- a/.github/workflows/flutter_test.yml +++ b/.github/workflows/flutter_test.yml @@ -156,8 +156,6 @@ jobs: echo "name=${device}" >> "$GITHUB_OUTPUT" - name: run integration test - # Disable flutter integration tests for iOS for now (https://github.com/getsentry/sentry-dart/issues/1605#issuecomment-1695809346) - if: ${{ matrix.target != 'ios' }} run: flutter test -d "${{ steps.device.outputs.name }}" integration_test/all.dart --dart-define SENTRY_AUTH_TOKEN_E2E=$SENTRY_AUTH_TOKEN_E2E --verbose - name: run native test From 8e0d58dfec4f743b5afec3bf7354b2445561b424 Mon Sep 17 00:00:00 2001 From: GIancarlo Buenaflor Date: Tue, 10 Dec 2024 23:39:12 +0100 Subject: [PATCH 05/23] update test --- .../example/integration_test/integration_test.dart | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/flutter/example/integration_test/integration_test.dart b/flutter/example/integration_test/integration_test.dart index a6ac1456a5..58b2f29698 100644 --- a/flutter/example/integration_test/integration_test.dart +++ b/flutter/example/integration_test/integration_test.dart @@ -193,8 +193,11 @@ void main() { final event = await fixture.poll(uri, authToken); expect(event, isNotNull); - final sentEvent = fixture.sentEvent; - expect(sentEvent, isNotNull); + final sentEvents = + fixture.sentEvents.where((el) => el!.eventId == event!['id']); + expect( + sentEvents.length, 1); // one button click should only send one error + final sentEvent = sentEvents.first; final tags = event!['tags'] as List; @@ -225,10 +228,10 @@ void main() { } class Fixture { - SentryEvent? sentEvent; + List sentEvents = []; FutureOr beforeSend(SentryEvent event, Hint hint) async { - sentEvent ??= event; + sentEvents.add(event); return event; } From b46dbd0d6b6d541b3cde45541f584c5ccf62b496 Mon Sep 17 00:00:00 2001 From: GIancarlo Buenaflor Date: Wed, 11 Dec 2024 00:07:22 +0100 Subject: [PATCH 06/23] fix --- flutter/example/integration_test/integration_test.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flutter/example/integration_test/integration_test.dart b/flutter/example/integration_test/integration_test.dart index 58b2f29698..5c08745c7d 100644 --- a/flutter/example/integration_test/integration_test.dart +++ b/flutter/example/integration_test/integration_test.dart @@ -193,8 +193,8 @@ void main() { final event = await fixture.poll(uri, authToken); expect(event, isNotNull); - final sentEvents = - fixture.sentEvents.where((el) => el!.eventId == event!['id']); + final sentEvents = fixture.sentEvents + .where((el) => el!.eventId.toString() == event!['id']); expect( sentEvents.length, 1); // one button click should only send one error final sentEvent = sentEvents.first; From 4699b915737c35439f561187aabd6de98cc1cfa3 Mon Sep 17 00:00:00 2001 From: Giancarlo Buenaflor Date: Wed, 11 Dec 2024 01:31:25 +0100 Subject: [PATCH 07/23] Update flutter_test.yml --- .github/workflows/flutter_test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/flutter_test.yml b/.github/workflows/flutter_test.yml index aaf276ec95..01270e6275 100644 --- a/.github/workflows/flutter_test.yml +++ b/.github/workflows/flutter_test.yml @@ -156,6 +156,8 @@ jobs: echo "name=${device}" >> "$GITHUB_OUTPUT" - name: run integration test + # Disable flutter integration tests for iOS for now (https://github.com/getsentry/sentry-dart/issues/1605#issuecomment-1695809346) + if: ${{ matrix.target != 'ios' }} run: flutter test -d "${{ steps.device.outputs.name }}" integration_test/all.dart --dart-define SENTRY_AUTH_TOKEN_E2E=$SENTRY_AUTH_TOKEN_E2E --verbose - name: run native test From 08b95072e8dbe622e2c5a6f25c88365aaad9ed02 Mon Sep 17 00:00:00 2001 From: GIancarlo Buenaflor Date: Wed, 11 Dec 2024 12:07:42 +0100 Subject: [PATCH 08/23] set runner to ubuntu for android integration test --- .github/workflows/flutter_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/flutter_test.yml b/.github/workflows/flutter_test.yml index 01270e6275..c95abe1e97 100644 --- a/.github/workflows/flutter_test.yml +++ b/.github/workflows/flutter_test.yml @@ -25,7 +25,7 @@ jobs: access_token: ${{ github.token }} test-android: - runs-on: macos-13 + runs-on: ubuntu-latest timeout-minutes: 30 defaults: run: From b885fdec169490b1165aa92520c0a000ea9e69f8 Mon Sep 17 00:00:00 2001 From: GIancarlo Buenaflor Date: Wed, 11 Dec 2024 13:20:51 +0100 Subject: [PATCH 09/23] update test doc --- .../integration_test/integration_test.dart | 257 +++++++++--------- flutter/example/integration_test/utils.dart | 22 ++ 2 files changed, 146 insertions(+), 133 deletions(-) create mode 100644 flutter/example/integration_test/utils.dart diff --git a/flutter/example/integration_test/integration_test.dart b/flutter/example/integration_test/integration_test.dart index 5c08745c7d..ed3df6daca 100644 --- a/flutter/example/integration_test/integration_test.dart +++ b/flutter/example/integration_test/integration_test.dart @@ -11,6 +11,8 @@ import 'package:integration_test/integration_test.dart'; import 'package:sentry_flutter/sentry_flutter.dart'; import 'package:sentry_flutter_example/main.dart'; +import 'utils.dart'; + void main() { const org = 'sentry-sdks'; const slug = 'sentry-flutter'; @@ -42,126 +44,126 @@ void main() { // Tests - testWidgets('setup sentry and render app', (tester) async { - await setupSentryAndApp(tester); - - // Find any UI element and verify it is present. - expect(find.text('Open another Scaffold'), findsOneWidget); - }); - - testWidgets('setup sentry and capture event', (tester) async { - await setupSentryAndApp(tester); - - final event = SentryEvent(); - final sentryId = await Sentry.captureEvent(event); - - expect(sentryId != const SentryId.empty(), true); - }); - - testWidgets('setup sentry and capture exception', (tester) async { - await setupSentryAndApp(tester); - - try { - throw const SentryException( - type: 'StarError', value: 'I have a bad feeling about this...'); - } catch (exception, stacktrace) { - final sentryId = - await Sentry.captureException(exception, stackTrace: stacktrace); - - expect(sentryId != const SentryId.empty(), true); - } - }); - - testWidgets('setup sentry and capture message', (tester) async { - await setupSentryAndApp(tester); - - final sentryId = await Sentry.captureMessage('hello world!'); - - expect(sentryId != const SentryId.empty(), true); - }); - - testWidgets('setup sentry and capture user feedback', (tester) async { - await setupSentryAndApp(tester); - - // ignore: deprecated_member_use_from_same_package - // ignore: deprecated_member_use - final feedback = SentryUserFeedback( - eventId: SentryId.newId(), - name: 'fixture-name', - email: 'fixture@email.com', - comments: 'fixture-comments'); - // ignore: deprecated_member_use - await Sentry.captureUserFeedback(feedback); - }); - - testWidgets('setup sentry and capture feedback', (tester) async { - await setupSentryAndApp(tester); - - // ignore: deprecated_member_use_from_same_package - // ignore: deprecated_member_use - final associatedEventId = await Sentry.captureMessage('Associated'); - final feedback = SentryFeedback( - message: 'message', - contactEmail: 'john.appleseed@apple.com', - name: 'John Appleseed', - associatedEventId: associatedEventId, - ); - await Sentry.captureFeedback(feedback); - }); - - testWidgets('setup sentry and close', (tester) async { - await setupSentryAndApp(tester); - - await Sentry.close(); - }); - - testWidgets('setup sentry and add breadcrumb', (tester) async { - await setupSentryAndApp(tester); - - final breadcrumb = Breadcrumb(message: 'fixture-message'); - await Sentry.addBreadcrumb(breadcrumb); - }); - - testWidgets('setup sentry and configure scope', (tester) async { - await setupSentryAndApp(tester); - - await Sentry.configureScope((scope) async { - await scope.setContexts('contexts-key', 'contexts-value'); - await scope.removeContexts('contexts-key'); - - final user = SentryUser(id: 'fixture-id'); - await scope.setUser(user); - await scope.setUser(null); - - final breadcrumb = Breadcrumb(message: 'fixture-message'); - await scope.addBreadcrumb(breadcrumb); - await scope.clearBreadcrumbs(); - - // ignore: deprecated_member_use - await scope.setExtra('extra-key', 'extra-value'); - // ignore: deprecated_member_use - await scope.removeExtra('extra-key'); - - await scope.setTag('tag-key', 'tag-value'); - await scope.removeTag('tag-key'); - }); - }); - - testWidgets('setup sentry and start transaction', (tester) async { - await setupSentryAndApp(tester); - - final transaction = Sentry.startTransaction('transaction', 'test'); - await transaction.finish(); - }); - - testWidgets('setup sentry and start transaction with context', - (tester) async { - await setupSentryAndApp(tester); - - final context = SentryTransactionContext('transaction', 'test'); - final transaction = Sentry.startTransactionWithContext(context); - await transaction.finish(); - }); + // testWidgets('setup sentry and render app', (tester) async { + // await setupSentryAndApp(tester); + // + // // Find any UI element and verify it is present. + // expect(find.text('Open another Scaffold'), findsOneWidget); + // }); + // + // testWidgets('setup sentry and capture event', (tester) async { + // await setupSentryAndApp(tester); + // + // final event = SentryEvent(); + // final sentryId = await Sentry.captureEvent(event); + // + // expect(sentryId != const SentryId.empty(), true); + // }); + // + // testWidgets('setup sentry and capture exception', (tester) async { + // await setupSentryAndApp(tester); + // + // try { + // throw const SentryException( + // type: 'StarError', value: 'I have a bad feeling about this...'); + // } catch (exception, stacktrace) { + // final sentryId = + // await Sentry.captureException(exception, stackTrace: stacktrace); + // + // expect(sentryId != const SentryId.empty(), true); + // } + // }); + // + // testWidgets('setup sentry and capture message', (tester) async { + // await setupSentryAndApp(tester); + // + // final sentryId = await Sentry.captureMessage('hello world!'); + // + // expect(sentryId != const SentryId.empty(), true); + // }); + // + // testWidgets('setup sentry and capture user feedback', (tester) async { + // await setupSentryAndApp(tester); + // + // // ignore: deprecated_member_use_from_same_package + // // ignore: deprecated_member_use + // final feedback = SentryUserFeedback( + // eventId: SentryId.newId(), + // name: 'fixture-name', + // email: 'fixture@email.com', + // comments: 'fixture-comments'); + // // ignore: deprecated_member_use + // await Sentry.captureUserFeedback(feedback); + // }); + // + // testWidgets('setup sentry and capture feedback', (tester) async { + // await setupSentryAndApp(tester); + // + // // ignore: deprecated_member_use_from_same_package + // // ignore: deprecated_member_use + // final associatedEventId = await Sentry.captureMessage('Associated'); + // final feedback = SentryFeedback( + // message: 'message', + // contactEmail: 'john.appleseed@apple.com', + // name: 'John Appleseed', + // associatedEventId: associatedEventId, + // ); + // await Sentry.captureFeedback(feedback); + // }); + // + // testWidgets('setup sentry and close', (tester) async { + // await setupSentryAndApp(tester); + // + // await Sentry.close(); + // }); + // + // testWidgets('setup sentry and add breadcrumb', (tester) async { + // await setupSentryAndApp(tester); + // + // final breadcrumb = Breadcrumb(message: 'fixture-message'); + // await Sentry.addBreadcrumb(breadcrumb); + // }); + // + // testWidgets('setup sentry and configure scope', (tester) async { + // await setupSentryAndApp(tester); + // + // await Sentry.configureScope((scope) async { + // await scope.setContexts('contexts-key', 'contexts-value'); + // await scope.removeContexts('contexts-key'); + // + // final user = SentryUser(id: 'fixture-id'); + // await scope.setUser(user); + // await scope.setUser(null); + // + // final breadcrumb = Breadcrumb(message: 'fixture-message'); + // await scope.addBreadcrumb(breadcrumb); + // await scope.clearBreadcrumbs(); + // + // // ignore: deprecated_member_use + // await scope.setExtra('extra-key', 'extra-value'); + // // ignore: deprecated_member_use + // await scope.removeExtra('extra-key'); + // + // await scope.setTag('tag-key', 'tag-value'); + // await scope.removeTag('tag-key'); + // }); + // }); + // + // testWidgets('setup sentry and start transaction', (tester) async { + // await setupSentryAndApp(tester); + // + // final transaction = Sentry.startTransaction('transaction', 'test'); + // await transaction.finish(); + // }); + // + // testWidgets('setup sentry and start transaction with context', + // (tester) async { + // await setupSentryAndApp(tester); + // + // final context = SentryTransactionContext('transaction', 'test'); + // final transaction = Sentry.startTransactionWithContext(context); + // await transaction.finish(); + // }); group('e2e', () { var output = find.byKey(const Key('output')); @@ -186,9 +188,9 @@ void main() { uri = Uri.parse( 'https://sentry.io/api/0/projects/$org/$slug/events/$id/', ); - }); - expect(authToken, isNotEmpty); + expect(authToken, isNotEmpty); + }); final event = await fixture.poll(uri, authToken); expect(event, isNotNull); @@ -270,14 +272,3 @@ class Fixture { return null; } } - -Future restoreFlutterOnErrorAfter(Future Function() fn) async { - final originalOnError = FlutterError.onError!; - await fn(); - final overriddenOnError = FlutterError.onError!; - - FlutterError.onError = (FlutterErrorDetails details) { - if (overriddenOnError != originalOnError) overriddenOnError(details); - originalOnError(details); - }; -} diff --git a/flutter/example/integration_test/utils.dart b/flutter/example/integration_test/utils.dart new file mode 100644 index 0000000000..c2755925da --- /dev/null +++ b/flutter/example/integration_test/utils.dart @@ -0,0 +1,22 @@ +import 'dart:async'; + +import 'package:flutter/cupertino.dart'; + +/// Restores Flutter's `FlutterError.onError` to its original state after executing a function. +/// +/// `testWidgets` and `SentryFlutter.init` automatically override `FlutterError.onError`. +/// If `FlutterError.onError` is not restored to its original state and an assertion fails +/// Flutter will complain and throw an error. +/// +/// This function ensures `FlutterError.onError` is restored to its initial state after `fn` runs. +/// It must be called **after** the function executes but **before** any assertions. +FutureOr restoreFlutterOnErrorAfter(FutureOr Function() fn) async { + final originalOnError = FlutterError.onError; + await fn(); + final overriddenOnError = FlutterError.onError; + + FlutterError.onError = (FlutterErrorDetails details) { + if (overriddenOnError != originalOnError) overriddenOnError?.call(details); + originalOnError?.call(details); + }; +} From ef100b659d59d949312f39b61583f71fbc350ac4 Mon Sep 17 00:00:00 2001 From: GIancarlo Buenaflor Date: Wed, 11 Dec 2024 13:28:51 +0100 Subject: [PATCH 10/23] uncomment other tests --- .../integration_test/integration_test.dart | 240 +++++++++--------- 1 file changed, 120 insertions(+), 120 deletions(-) diff --git a/flutter/example/integration_test/integration_test.dart b/flutter/example/integration_test/integration_test.dart index ed3df6daca..970272d1f5 100644 --- a/flutter/example/integration_test/integration_test.dart +++ b/flutter/example/integration_test/integration_test.dart @@ -44,126 +44,126 @@ void main() { // Tests - // testWidgets('setup sentry and render app', (tester) async { - // await setupSentryAndApp(tester); - // - // // Find any UI element and verify it is present. - // expect(find.text('Open another Scaffold'), findsOneWidget); - // }); - // - // testWidgets('setup sentry and capture event', (tester) async { - // await setupSentryAndApp(tester); - // - // final event = SentryEvent(); - // final sentryId = await Sentry.captureEvent(event); - // - // expect(sentryId != const SentryId.empty(), true); - // }); - // - // testWidgets('setup sentry and capture exception', (tester) async { - // await setupSentryAndApp(tester); - // - // try { - // throw const SentryException( - // type: 'StarError', value: 'I have a bad feeling about this...'); - // } catch (exception, stacktrace) { - // final sentryId = - // await Sentry.captureException(exception, stackTrace: stacktrace); - // - // expect(sentryId != const SentryId.empty(), true); - // } - // }); - // - // testWidgets('setup sentry and capture message', (tester) async { - // await setupSentryAndApp(tester); - // - // final sentryId = await Sentry.captureMessage('hello world!'); - // - // expect(sentryId != const SentryId.empty(), true); - // }); - // - // testWidgets('setup sentry and capture user feedback', (tester) async { - // await setupSentryAndApp(tester); - // - // // ignore: deprecated_member_use_from_same_package - // // ignore: deprecated_member_use - // final feedback = SentryUserFeedback( - // eventId: SentryId.newId(), - // name: 'fixture-name', - // email: 'fixture@email.com', - // comments: 'fixture-comments'); - // // ignore: deprecated_member_use - // await Sentry.captureUserFeedback(feedback); - // }); - // - // testWidgets('setup sentry and capture feedback', (tester) async { - // await setupSentryAndApp(tester); - // - // // ignore: deprecated_member_use_from_same_package - // // ignore: deprecated_member_use - // final associatedEventId = await Sentry.captureMessage('Associated'); - // final feedback = SentryFeedback( - // message: 'message', - // contactEmail: 'john.appleseed@apple.com', - // name: 'John Appleseed', - // associatedEventId: associatedEventId, - // ); - // await Sentry.captureFeedback(feedback); - // }); - // - // testWidgets('setup sentry and close', (tester) async { - // await setupSentryAndApp(tester); - // - // await Sentry.close(); - // }); - // - // testWidgets('setup sentry and add breadcrumb', (tester) async { - // await setupSentryAndApp(tester); - // - // final breadcrumb = Breadcrumb(message: 'fixture-message'); - // await Sentry.addBreadcrumb(breadcrumb); - // }); - // - // testWidgets('setup sentry and configure scope', (tester) async { - // await setupSentryAndApp(tester); - // - // await Sentry.configureScope((scope) async { - // await scope.setContexts('contexts-key', 'contexts-value'); - // await scope.removeContexts('contexts-key'); - // - // final user = SentryUser(id: 'fixture-id'); - // await scope.setUser(user); - // await scope.setUser(null); - // - // final breadcrumb = Breadcrumb(message: 'fixture-message'); - // await scope.addBreadcrumb(breadcrumb); - // await scope.clearBreadcrumbs(); - // - // // ignore: deprecated_member_use - // await scope.setExtra('extra-key', 'extra-value'); - // // ignore: deprecated_member_use - // await scope.removeExtra('extra-key'); - // - // await scope.setTag('tag-key', 'tag-value'); - // await scope.removeTag('tag-key'); - // }); - // }); - // - // testWidgets('setup sentry and start transaction', (tester) async { - // await setupSentryAndApp(tester); - // - // final transaction = Sentry.startTransaction('transaction', 'test'); - // await transaction.finish(); - // }); - // - // testWidgets('setup sentry and start transaction with context', - // (tester) async { - // await setupSentryAndApp(tester); - // - // final context = SentryTransactionContext('transaction', 'test'); - // final transaction = Sentry.startTransactionWithContext(context); - // await transaction.finish(); - // }); + testWidgets('setup sentry and render app', (tester) async { + await setupSentryAndApp(tester); + + // Find any UI element and verify it is present. + expect(find.text('Open another Scaffold'), findsOneWidget); + }); + + testWidgets('setup sentry and capture event', (tester) async { + await setupSentryAndApp(tester); + + final event = SentryEvent(); + final sentryId = await Sentry.captureEvent(event); + + expect(sentryId != const SentryId.empty(), true); + }); + + testWidgets('setup sentry and capture exception', (tester) async { + await setupSentryAndApp(tester); + + try { + throw const SentryException( + type: 'StarError', value: 'I have a bad feeling about this...'); + } catch (exception, stacktrace) { + final sentryId = + await Sentry.captureException(exception, stackTrace: stacktrace); + + expect(sentryId != const SentryId.empty(), true); + } + }); + + testWidgets('setup sentry and capture message', (tester) async { + await setupSentryAndApp(tester); + + final sentryId = await Sentry.captureMessage('hello world!'); + + expect(sentryId != const SentryId.empty(), true); + }); + + testWidgets('setup sentry and capture user feedback', (tester) async { + await setupSentryAndApp(tester); + + // ignore: deprecated_member_use_from_same_package + // ignore: deprecated_member_use + final feedback = SentryUserFeedback( + eventId: SentryId.newId(), + name: 'fixture-name', + email: 'fixture@email.com', + comments: 'fixture-comments'); + // ignore: deprecated_member_use + await Sentry.captureUserFeedback(feedback); + }); + + testWidgets('setup sentry and capture feedback', (tester) async { + await setupSentryAndApp(tester); + + // ignore: deprecated_member_use_from_same_package + // ignore: deprecated_member_use + final associatedEventId = await Sentry.captureMessage('Associated'); + final feedback = SentryFeedback( + message: 'message', + contactEmail: 'john.appleseed@apple.com', + name: 'John Appleseed', + associatedEventId: associatedEventId, + ); + await Sentry.captureFeedback(feedback); + }); + + testWidgets('setup sentry and close', (tester) async { + await setupSentryAndApp(tester); + + await Sentry.close(); + }); + + testWidgets('setup sentry and add breadcrumb', (tester) async { + await setupSentryAndApp(tester); + + final breadcrumb = Breadcrumb(message: 'fixture-message'); + await Sentry.addBreadcrumb(breadcrumb); + }); + + testWidgets('setup sentry and configure scope', (tester) async { + await setupSentryAndApp(tester); + + await Sentry.configureScope((scope) async { + await scope.setContexts('contexts-key', 'contexts-value'); + await scope.removeContexts('contexts-key'); + + final user = SentryUser(id: 'fixture-id'); + await scope.setUser(user); + await scope.setUser(null); + + final breadcrumb = Breadcrumb(message: 'fixture-message'); + await scope.addBreadcrumb(breadcrumb); + await scope.clearBreadcrumbs(); + + // ignore: deprecated_member_use + await scope.setExtra('extra-key', 'extra-value'); + // ignore: deprecated_member_use + await scope.removeExtra('extra-key'); + + await scope.setTag('tag-key', 'tag-value'); + await scope.removeTag('tag-key'); + }); + }); + + testWidgets('setup sentry and start transaction', (tester) async { + await setupSentryAndApp(tester); + + final transaction = Sentry.startTransaction('transaction', 'test'); + await transaction.finish(); + }); + + testWidgets('setup sentry and start transaction with context', + (tester) async { + await setupSentryAndApp(tester); + + final context = SentryTransactionContext('transaction', 'test'); + final transaction = Sentry.startTransactionWithContext(context); + await transaction.finish(); + }); group('e2e', () { var output = find.byKey(const Key('output')); From 72f273601617bae54bbc26421fae5c1e31e1f294 Mon Sep 17 00:00:00 2001 From: GIancarlo Buenaflor Date: Wed, 11 Dec 2024 14:04:24 +0100 Subject: [PATCH 11/23] update --- .github/workflows/flutter_test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/flutter_test.yml b/.github/workflows/flutter_test.yml index c95abe1e97..5df5937753 100644 --- a/.github/workflows/flutter_test.yml +++ b/.github/workflows/flutter_test.yml @@ -74,7 +74,6 @@ jobs: profile: Nexus 6 arch: x86_64 force-avd-creation: false - avd-name: macOS-avd-x86_64-31 emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none disable-animations: true script: echo 'Generated AVD snapshot for caching.' From f24c668d017f21a050016a52ac60c2b40d640328 Mon Sep 17 00:00:00 2001 From: GIancarlo Buenaflor Date: Wed, 11 Dec 2024 14:42:23 +0100 Subject: [PATCH 12/23] remove avd name --- .github/workflows/flutter_test.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/flutter_test.yml b/.github/workflows/flutter_test.yml index 5df5937753..84804602ac 100644 --- a/.github/workflows/flutter_test.yml +++ b/.github/workflows/flutter_test.yml @@ -90,7 +90,6 @@ jobs: profile: Nexus 6 arch: x86_64 force-avd-creation: false - avd-name: macOS-avd-x86_64-31 emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none disable-animations: true script: ./gradlew testDebugUnitTest @@ -103,7 +102,6 @@ jobs: profile: Nexus 6 arch: x86_64 force-avd-creation: false - avd-name: macOS-avd-x86_64-31 emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none disable-animations: true script: flutter test integration_test/all.dart --dart-define SENTRY_AUTH_TOKEN_E2E=$SENTRY_AUTH_TOKEN_E2E --verbose From 6317dacff6f91709358632a7de99a15780469259 Mon Sep 17 00:00:00 2001 From: GIancarlo Buenaflor Date: Wed, 11 Dec 2024 14:55:09 +0100 Subject: [PATCH 13/23] update avd name --- .github/workflows/flutter_test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/flutter_test.yml b/.github/workflows/flutter_test.yml index 84804602ac..b53007e279 100644 --- a/.github/workflows/flutter_test.yml +++ b/.github/workflows/flutter_test.yml @@ -74,6 +74,7 @@ jobs: profile: Nexus 6 arch: x86_64 force-avd-creation: false + avd-name: avd-x86_64-31 emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none disable-animations: true script: echo 'Generated AVD snapshot for caching.' @@ -90,6 +91,7 @@ jobs: profile: Nexus 6 arch: x86_64 force-avd-creation: false + avd-name: avd-x86_64-31 emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none disable-animations: true script: ./gradlew testDebugUnitTest @@ -102,6 +104,7 @@ jobs: profile: Nexus 6 arch: x86_64 force-avd-creation: false + avd-name: avd-x86_64-31 emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none disable-animations: true script: flutter test integration_test/all.dart --dart-define SENTRY_AUTH_TOKEN_E2E=$SENTRY_AUTH_TOKEN_E2E --verbose From 76c7b3b1b6debbd9f99048740df9782a0eef34aa Mon Sep 17 00:00:00 2001 From: Giancarlo Buenaflor Date: Wed, 11 Dec 2024 16:55:53 +0100 Subject: [PATCH 14/23] Update flutter_test.yml --- .github/workflows/flutter_test.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/flutter_test.yml b/.github/workflows/flutter_test.yml index b53007e279..e798bace38 100644 --- a/.github/workflows/flutter_test.yml +++ b/.github/workflows/flutter_test.yml @@ -56,6 +56,12 @@ jobs: - name: Gradle cache uses: gradle/gradle-build-action@ac2d340dc04d9e1113182899e983b5400c17cda1 # pin@v3.0.0 + - name: Enable KVM group perms + run: | + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules + sudo udevadm control --reload-rules + sudo udevadm trigger --name-match=kvm + - name: AVD cache uses: actions/cache@v4 id: avd-cache From 7b870a051a3be43776ebb8256396f594b1e09227 Mon Sep 17 00:00:00 2001 From: Giancarlo Buenaflor Date: Wed, 11 Dec 2024 23:11:59 +0100 Subject: [PATCH 15/23] Update flutter_test.yml --- .github/workflows/flutter_test.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/flutter_test.yml b/.github/workflows/flutter_test.yml index e798bace38..a7be968124 100644 --- a/.github/workflows/flutter_test.yml +++ b/.github/workflows/flutter_test.yml @@ -35,6 +35,12 @@ jobs: matrix: sdk: ["stable", "beta"] steps: + - name: Enable KVM group perms + run: | + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules + sudo udevadm control --reload-rules + sudo udevadm trigger --name-match=kvm + - name: checkout uses: actions/checkout@v4 @@ -56,12 +62,6 @@ jobs: - name: Gradle cache uses: gradle/gradle-build-action@ac2d340dc04d9e1113182899e983b5400c17cda1 # pin@v3.0.0 - - name: Enable KVM group perms - run: | - echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules - sudo udevadm control --reload-rules - sudo udevadm trigger --name-match=kvm - - name: AVD cache uses: actions/cache@v4 id: avd-cache From 82f949c16f8dfee89d75c618da91a5cb686c0f20 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos <6349682+vaind@users.noreply.github.com> Date: Thu, 12 Dec 2024 09:18:17 +0100 Subject: [PATCH 16/23] Update .github/workflows/flutter_test.yml --- .github/workflows/flutter_test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/flutter_test.yml b/.github/workflows/flutter_test.yml index a7be968124..342582c45c 100644 --- a/.github/workflows/flutter_test.yml +++ b/.github/workflows/flutter_test.yml @@ -35,15 +35,15 @@ jobs: matrix: sdk: ["stable", "beta"] steps: + - name: checkout + uses: actions/checkout@v4 + - name: Enable KVM group perms run: | echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules sudo udevadm control --reload-rules sudo udevadm trigger --name-match=kvm - - name: checkout - uses: actions/checkout@v4 - - uses: actions/setup-java@v4 with: distribution: "adopt" From 5f54602c579a24e49ccd65079966f1783fd4f366 Mon Sep 17 00:00:00 2001 From: GIancarlo Buenaflor Date: Thu, 12 Dec 2024 12:55:09 +0100 Subject: [PATCH 17/23] move expect after restoring flutter onError --- flutter/example/integration_test/integration_test.dart | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/flutter/example/integration_test/integration_test.dart b/flutter/example/integration_test/integration_test.dart index 970272d1f5..8934deb156 100644 --- a/flutter/example/integration_test/integration_test.dart +++ b/flutter/example/integration_test/integration_test.dart @@ -175,6 +175,7 @@ void main() { testWidgets('captureException', (tester) async { late Uri uri; + await restoreFlutterOnErrorAfter(() async { await setupSentryAndApp(tester, dsn: exampleDsn, beforeSendCallback: fixture.beforeSend); @@ -188,10 +189,10 @@ void main() { uri = Uri.parse( 'https://sentry.io/api/0/projects/$org/$slug/events/$id/', ); - - expect(authToken, isNotEmpty); }); + expect(authToken, isNotEmpty); + final event = await fixture.poll(uri, authToken); expect(event, isNotNull); From 16a2ed71875ddea947d7b9e10d86a45bc111f4ff Mon Sep 17 00:00:00 2001 From: GIancarlo Buenaflor Date: Thu, 12 Dec 2024 13:02:56 +0100 Subject: [PATCH 18/23] creation step without -no-snapshot-save --- .github/workflows/flutter_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/flutter_test.yml b/.github/workflows/flutter_test.yml index 342582c45c..2797aff333 100644 --- a/.github/workflows/flutter_test.yml +++ b/.github/workflows/flutter_test.yml @@ -81,7 +81,7 @@ jobs: arch: x86_64 force-avd-creation: false avd-name: avd-x86_64-31 - emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none + emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none disable-animations: true script: echo 'Generated AVD snapshot for caching.' From 0da24d03e04077c325221bba8451d70db25db941 Mon Sep 17 00:00:00 2001 From: GIancarlo Buenaflor Date: Thu, 12 Dec 2024 13:04:11 +0100 Subject: [PATCH 19/23] update emulator options --- .github/workflows/flutter_test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/flutter_test.yml b/.github/workflows/flutter_test.yml index 2797aff333..c691a34748 100644 --- a/.github/workflows/flutter_test.yml +++ b/.github/workflows/flutter_test.yml @@ -98,8 +98,8 @@ jobs: arch: x86_64 force-avd-creation: false avd-name: avd-x86_64-31 - emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none - disable-animations: true + emulator-options: -no-snapshot-save -no-window -accel on -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none + disable-animations: false script: ./gradlew testDebugUnitTest - name: launch android emulator & run android integration test @@ -111,8 +111,8 @@ jobs: arch: x86_64 force-avd-creation: false avd-name: avd-x86_64-31 - emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none - disable-animations: true + emulator-options: -no-snapshot-save -no-window -accel on -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none + disable-animations: false script: flutter test integration_test/all.dart --dart-define SENTRY_AUTH_TOKEN_E2E=$SENTRY_AUTH_TOKEN_E2E --verbose cocoa: From b8b4e8d07312e56ee0a391ed6c79476041895782 Mon Sep 17 00:00:00 2001 From: GIancarlo Buenaflor Date: Thu, 12 Dec 2024 13:15:01 +0100 Subject: [PATCH 20/23] change cache key --- .github/workflows/flutter_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/flutter_test.yml b/.github/workflows/flutter_test.yml index c691a34748..e3aaed1fbe 100644 --- a/.github/workflows/flutter_test.yml +++ b/.github/workflows/flutter_test.yml @@ -69,7 +69,7 @@ jobs: path: | ~/.android/avd/* ~/.android/adb* - key: avd-31 + key: avd-31-ubuntu - name: create AVD and generate snapshot for caching if: steps.avd-cache.outputs.cache-hit != 'true' From af956f78fca8729779fcffe71deede4d9e080bfa Mon Sep 17 00:00:00 2001 From: GIancarlo Buenaflor Date: Thu, 12 Dec 2024 13:26:14 +0100 Subject: [PATCH 21/23] ignore deprecate --- flutter/lib/src/screenshot/widget_filter.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/flutter/lib/src/screenshot/widget_filter.dart b/flutter/lib/src/screenshot/widget_filter.dart index cd791d60e3..6a392eb4de 100644 --- a/flutter/lib/src/screenshot/widget_filter.dart +++ b/flutter/lib/src/screenshot/widget_filter.dart @@ -233,9 +233,11 @@ extension on Element { @internal extension Opaqueness on Color { @pragma('vm:prefer-inline') + // ignore: deprecated_member_use bool get isOpaque => alpha == 0xff; @pragma('vm:prefer-inline') + // ignore: deprecated_member_use Color asOpaque() => isOpaque ? this : Color.fromARGB(0xff, red, green, blue); } From 7c5a004cbb5493db9380c3dafd1750c52c75d8bf Mon Sep 17 00:00:00 2001 From: GIancarlo Buenaflor Date: Thu, 12 Dec 2024 13:49:25 +0100 Subject: [PATCH 22/23] update emulator --- .github/workflows/flutter_test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/flutter_test.yml b/.github/workflows/flutter_test.yml index e3aaed1fbe..6f4f317563 100644 --- a/.github/workflows/flutter_test.yml +++ b/.github/workflows/flutter_test.yml @@ -82,7 +82,7 @@ jobs: force-avd-creation: false avd-name: avd-x86_64-31 emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none - disable-animations: true + disable-animations: false script: echo 'Generated AVD snapshot for caching.' - name: build apk @@ -99,7 +99,7 @@ jobs: force-avd-creation: false avd-name: avd-x86_64-31 emulator-options: -no-snapshot-save -no-window -accel on -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none - disable-animations: false + disable-animations: true script: ./gradlew testDebugUnitTest - name: launch android emulator & run android integration test @@ -112,7 +112,7 @@ jobs: force-avd-creation: false avd-name: avd-x86_64-31 emulator-options: -no-snapshot-save -no-window -accel on -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none - disable-animations: false + disable-animations: true script: flutter test integration_test/all.dart --dart-define SENTRY_AUTH_TOKEN_E2E=$SENTRY_AUTH_TOKEN_E2E --verbose cocoa: From bff291a12636150d8554671453c4d4ebe8e4f3ae Mon Sep 17 00:00:00 2001 From: GIancarlo Buenaflor Date: Thu, 12 Dec 2024 14:21:56 +0100 Subject: [PATCH 23/23] remove emulator caching --- .github/workflows/flutter_test.yml | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/.github/workflows/flutter_test.yml b/.github/workflows/flutter_test.yml index 6f4f317563..6e0a00013e 100644 --- a/.github/workflows/flutter_test.yml +++ b/.github/workflows/flutter_test.yml @@ -62,28 +62,7 @@ jobs: - name: Gradle cache uses: gradle/gradle-build-action@ac2d340dc04d9e1113182899e983b5400c17cda1 # pin@v3.0.0 - - name: AVD cache - uses: actions/cache@v4 - id: avd-cache - with: - path: | - ~/.android/avd/* - ~/.android/adb* - key: avd-31-ubuntu - - - name: create AVD and generate snapshot for caching - if: steps.avd-cache.outputs.cache-hit != 'true' - uses: reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d #pin@v2.33.0 - with: - working-directory: ./flutter/example - api-level: 31 - profile: Nexus 6 - arch: x86_64 - force-avd-creation: false - avd-name: avd-x86_64-31 - emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none - disable-animations: false - script: echo 'Generated AVD snapshot for caching.' + # TODO: fix emulator caching, in ubuntu-latest emulator won't boot: https://github.com/ReactiveCircus/android-emulator-runner/issues/278 - name: build apk working-directory: ./flutter/example/android