From 61073b5565ae9a8d358a3cfdadec8b0f73f946be Mon Sep 17 00:00:00 2001 From: jesswrd Date: Fri, 15 Nov 2024 15:03:50 -0600 Subject: [PATCH 1/2] skipped flaky integration tests --- .../example/integration_test/camera_test.dart | 2 +- .../example/integration_test/camera_test.dart | 14 +++++++------- .../example/integration_test/integration_test.dart | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/camera/camera/example/integration_test/camera_test.dart b/packages/camera/camera/example/integration_test/camera_test.dart index 1c5c8526c733..8669285bbab0 100644 --- a/packages/camera/camera/example/integration_test/camera_test.dart +++ b/packages/camera/camera/example/integration_test/camera_test.dart @@ -94,7 +94,7 @@ void main() { await controller.dispose(); } } - }); + }, skip: true); // This tests that the capture is no bigger than the preset, since we have // automatic code to fall back to smaller sizes when we need to. Returns diff --git a/packages/camera/camera_android/example/integration_test/camera_test.dart b/packages/camera/camera_android/example/integration_test/camera_test.dart index 8e1a6ce7f791..5afc54f4d868 100644 --- a/packages/camera/camera_android/example/integration_test/camera_test.dart +++ b/packages/camera/camera_android/example/integration_test/camera_test.dart @@ -92,7 +92,7 @@ void main() { await controller.dispose(); } } - }); + }, skip: true); // This tests that the capture is no bigger than the preset, since we have // automatic code to fall back to smaller sizes when we need to. Returns @@ -197,7 +197,7 @@ void main() { await videoController.dispose(); expect(duration, lessThan(recordingTime - timePaused)); - }); + }, skip: true); testWidgets('Set description while recording', (WidgetTester tester) async { final List cameras = @@ -234,7 +234,7 @@ void main() { // cameras switched expect(controller.description, cameras[1]); } - }); + }, skip: true); testWidgets('Set description', (WidgetTester tester) async { final List cameras = @@ -249,7 +249,7 @@ void main() { await controller.setDescription(cameras[1]); expect(controller.description, cameras[1]); - }); + }, skip: true); testWidgets( 'image streaming', @@ -281,7 +281,7 @@ void main() { await controller.stopImageStream(); await controller.dispose(); - }, + }, skip: true ); testWidgets( @@ -320,7 +320,7 @@ void main() { await controller.dispose(); expect(controller.value.isStreamingImages, false); - }, + }, skip: true ); group('Camera settings', () { @@ -457,5 +457,5 @@ void main() { expect(lengths[n], greaterThan(0)); } }); - }); + }, skip: true); } diff --git a/packages/camera/camera_android_camerax/example/integration_test/integration_test.dart b/packages/camera/camera_android_camerax/example/integration_test/integration_test.dart index 5da28d229e73..ebcbf3a3e879 100644 --- a/packages/camera/camera_android_camerax/example/integration_test/integration_test.dart +++ b/packages/camera/camera_android_camerax/example/integration_test/integration_test.dart @@ -107,7 +107,7 @@ void main() { await controller.dispose(); } } - }); + }, skip: true); testWidgets('Preview takes expected resolution from preset', (WidgetTester tester) async { From 11303a9addf67623150331ee086493c502da0fd9 Mon Sep 17 00:00:00 2001 From: jesswrd Date: Fri, 15 Nov 2024 16:04:14 -0600 Subject: [PATCH 2/2] added TODOs and formatted files --- .../example/integration_test/camera_test.dart | 1 + .../example/integration_test/camera_test.dart | 122 ++++++++++-------- .../integration_test/integration_test.dart | 4 +- 3 files changed, 69 insertions(+), 58 deletions(-) diff --git a/packages/camera/camera/example/integration_test/camera_test.dart b/packages/camera/camera/example/integration_test/camera_test.dart index 8669285bbab0..28bc923f106a 100644 --- a/packages/camera/camera/example/integration_test/camera_test.dart +++ b/packages/camera/camera/example/integration_test/camera_test.dart @@ -94,6 +94,7 @@ void main() { await controller.dispose(); } } + // TODO(camillesimon): Re-enable test when issue is fixed https://github.com/flutter/flutter/issues/154682. }, skip: true); // This tests that the capture is no bigger than the preset, since we have diff --git a/packages/camera/camera_android/example/integration_test/camera_test.dart b/packages/camera/camera_android/example/integration_test/camera_test.dart index 5afc54f4d868..a9618c6e9cd0 100644 --- a/packages/camera/camera_android/example/integration_test/camera_test.dart +++ b/packages/camera/camera_android/example/integration_test/camera_test.dart @@ -92,7 +92,9 @@ void main() { await controller.dispose(); } } - }, skip: true); + }, + // TODO(camillesimon): Re-enable test when issue is fixed https://github.com/flutter/flutter/issues/154682. + skip: true); // This tests that the capture is no bigger than the preset, since we have // automatic code to fall back to smaller sizes when we need to. Returns @@ -197,7 +199,9 @@ void main() { await videoController.dispose(); expect(duration, lessThan(recordingTime - timePaused)); - }, skip: true); + }, + // TODO(camillesimon): Re-enable test when issue is fixed https://github.com/flutter/flutter/issues/154682. + skip: true); testWidgets('Set description while recording', (WidgetTester tester) async { final List cameras = @@ -234,7 +238,9 @@ void main() { // cameras switched expect(controller.description, cameras[1]); } - }, skip: true); + }, + // TODO(camillesimon): Re-enable test when issue is fixed https://github.com/flutter/flutter/issues/154682. + skip: true); testWidgets('Set description', (WidgetTester tester) async { final List cameras = @@ -249,79 +255,79 @@ void main() { await controller.setDescription(cameras[1]); expect(controller.description, cameras[1]); - }, skip: true); + }, + // TODO(camillesimon): Re-enable test when issue is fixed https://github.com/flutter/flutter/issues/154682. + skip: true); - testWidgets( - 'image streaming', - (WidgetTester tester) async { - final List cameras = - await CameraPlatform.instance.availableCameras(); - if (cameras.isEmpty) { + testWidgets('image streaming', (WidgetTester tester) async { + final List cameras = + await CameraPlatform.instance.availableCameras(); + if (cameras.isEmpty) { + return; + } + + final CameraController controller = CameraController(cameras[0]); + + await controller.initialize(); + bool isDetecting = false; + + await controller.startImageStream((CameraImageData image) { + if (isDetecting) { return; } - final CameraController controller = CameraController(cameras[0]); + isDetecting = true; - await controller.initialize(); - bool isDetecting = false; + expectLater(image, isNotNull).whenComplete(() => isDetecting = false); + }); - await controller.startImageStream((CameraImageData image) { - if (isDetecting) { - return; - } + expect(controller.value.isStreamingImages, true); - isDetecting = true; + sleep(const Duration(milliseconds: 500)); - expectLater(image, isNotNull).whenComplete(() => isDetecting = false); - }); + await controller.stopImageStream(); + await controller.dispose(); + }, + // TODO(camillesimon): Re-enable test when issue is fixed https://github.com/flutter/flutter/issues/154682. + skip: true); - expect(controller.value.isStreamingImages, true); + testWidgets('recording with image stream', (WidgetTester tester) async { + final List cameras = + await CameraPlatform.instance.availableCameras(); + if (cameras.isEmpty) { + return; + } - sleep(const Duration(milliseconds: 500)); + final CameraController controller = CameraController(cameras[0]); - await controller.stopImageStream(); - await controller.dispose(); - }, skip: true - ); + await controller.initialize(); + bool isDetecting = false; - testWidgets( - 'recording with image stream', - (WidgetTester tester) async { - final List cameras = - await CameraPlatform.instance.availableCameras(); - if (cameras.isEmpty) { + await controller.startVideoRecording( + streamCallback: (CameraImageData image) { + if (isDetecting) { return; } - final CameraController controller = CameraController(cameras[0]); + isDetecting = true; - await controller.initialize(); - bool isDetecting = false; - - await controller.startVideoRecording( - streamCallback: (CameraImageData image) { - if (isDetecting) { - return; - } - - isDetecting = true; - - expectLater(image, isNotNull); - }); + expectLater(image, isNotNull); + }); - expect(controller.value.isStreamingImages, true); + expect(controller.value.isStreamingImages, true); - // Stopping recording before anything is recorded will throw, per - // https://developer.android.com/reference/android/media/MediaRecorder.html#stop() - // so delay long enough to ensure that some data is recorded. - await Future.delayed(const Duration(seconds: 2)); + // Stopping recording before anything is recorded will throw, per + // https://developer.android.com/reference/android/media/MediaRecorder.html#stop() + // so delay long enough to ensure that some data is recorded. + await Future.delayed(const Duration(seconds: 2)); - await controller.stopVideoRecording(); - await controller.dispose(); + await controller.stopVideoRecording(); + await controller.dispose(); - expect(controller.value.isStreamingImages, false); - }, skip: true - ); + expect(controller.value.isStreamingImages, false); + }, + // TODO(camillesimon): Re-enable test when issue is fixed https://github.com/flutter/flutter/issues/154682. + skip: true); group('Camera settings', () { Future getCamera() async { @@ -457,5 +463,7 @@ void main() { expect(lengths[n], greaterThan(0)); } }); - }, skip: true); + }, + // TODO(camillesimon): Re-enable test when issue is fixed https://github.com/flutter/flutter/issues/154682. + skip: true); } diff --git a/packages/camera/camera_android_camerax/example/integration_test/integration_test.dart b/packages/camera/camera_android_camerax/example/integration_test/integration_test.dart index ebcbf3a3e879..14b3a29fed77 100644 --- a/packages/camera/camera_android_camerax/example/integration_test/integration_test.dart +++ b/packages/camera/camera_android_camerax/example/integration_test/integration_test.dart @@ -107,7 +107,9 @@ void main() { await controller.dispose(); } } - }, skip: true); + }, + // TODO(camillesimon): Re-enable test when issue is fixed https://github.com/flutter/flutter/issues/154682. + skip: true); testWidgets('Preview takes expected resolution from preset', (WidgetTester tester) async {