Skip to content

Commit 780a59c

Browse files
committed
Update
1 parent eead0ce commit 780a59c

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

packages/flutter/example/integration_test/integration_test.dart

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,60 @@ void main() {
599599
expect(debugImageByStacktrace.first.imageAddr, expectedImage.imageAddr);
600600
});
601601

602+
testWidgets('fetchNativeAppStart returns app start data', (tester) async {
603+
await restoreFlutterOnErrorAfter(() async {
604+
await setupSentryAndApp(tester);
605+
});
606+
607+
if (Platform.isAndroid || Platform.isIOS || Platform.isMacOS) {
608+
// fetchNativeAppStart should return data on mobile platforms
609+
final appStart = await SentryFlutter.native?.fetchNativeAppStart();
610+
611+
expect(appStart, isNotNull, reason: 'App start data should be available');
612+
613+
if (appStart != null) {
614+
expect(appStart.appStartTime, greaterThan(0),
615+
reason: 'App start time should be positive');
616+
expect(appStart.pluginRegistrationTime, greaterThan(0),
617+
reason: 'Plugin registration time should be positive');
618+
expect(appStart.isColdStart, isA<bool>(),
619+
reason: 'isColdStart should be a boolean');
620+
expect(appStart.nativeSpanTimes, isA<Map>(),
621+
reason: 'Native span times should be a map');
622+
}
623+
} else {
624+
// On other platforms, it should return null
625+
final appStart = await SentryFlutter.native?.fetchNativeAppStart();
626+
expect(appStart, isNull,
627+
reason: 'App start should be null on non-mobile platforms');
628+
}
629+
});
630+
631+
testWidgets('displayRefreshRate returns valid refresh rate', (tester) async {
632+
await restoreFlutterOnErrorAfter(() async {
633+
await setupSentryAndApp(tester);
634+
});
635+
636+
if (Platform.isAndroid || Platform.isIOS) {
637+
final refreshRate = await SentryFlutter.native?.displayRefreshRate();
638+
639+
// Refresh rate should be available on mobile platforms
640+
expect(refreshRate, isNotNull,
641+
reason: 'Display refresh rate should be available');
642+
643+
if (refreshRate != null) {
644+
expect(refreshRate, greaterThan(0),
645+
reason: 'Refresh rate should be positive');
646+
expect(refreshRate, lessThanOrEqualTo(1000),
647+
reason: 'Refresh rate should be reasonable (<=1000Hz)');
648+
}
649+
} else {
650+
final refreshRate = await SentryFlutter.native?.displayRefreshRate();
651+
expect(refreshRate, isNull,
652+
reason: 'Refresh rate should be null or positive on other platforms');
653+
}
654+
});
655+
602656
group('e2e', () {
603657
var output = find.byKey(const Key('output'));
604658
late Fixture fixture;

0 commit comments

Comments
 (0)