Skip to content

Commit

Permalink
comment in e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
denrase committed Aug 29, 2023
1 parent 430038b commit da19bc2
Showing 1 changed file with 56 additions and 57 deletions.
113 changes: 56 additions & 57 deletions flutter/example/integration_test/integration_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import 'package:sentry_flutter_example/main.dart';
import 'package:http/http.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://[email protected]/1234567';

TestWidgetsFlutterBinding.ensureInitialized();
Expand Down Expand Up @@ -141,60 +141,59 @@ void main() {
await transaction.finish();
});

// Disabled until CI issues are fixed
// 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<dynamic>;
//
// 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 {
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<dynamic>;

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 {
Expand Down

0 comments on commit da19bc2

Please sign in to comment.