From 9b2096ca83f36947ff0dcd2db2c28f600b3346ff Mon Sep 17 00:00:00 2001 From: Victoria Ashworth Date: Wed, 5 Jun 2024 11:00:11 -0500 Subject: [PATCH 1/2] Skip verifying sample file on macOS --- .../example/integration_test/path_provider_test.dart | 10 +++++++++- .../example/integration_test/path_provider_test.dart | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/packages/path_provider/path_provider/example/integration_test/path_provider_test.dart b/packages/path_provider/path_provider/example/integration_test/path_provider_test.dart index 9a4a5d6b21f..b2d79d483f9 100644 --- a/packages/path_provider/path_provider/example/integration_test/path_provider_test.dart +++ b/packages/path_provider/path_provider/example/integration_test/path_provider_test.dart @@ -17,7 +17,15 @@ void main() { testWidgets('getApplicationDocumentsDirectory', (WidgetTester tester) async { final Directory result = await getApplicationDocumentsDirectory(); - _verifySampleFile(result, 'applicationDocuments'); + if (Platform.isMacOS) { + // _verifySampleFile causes hangs in driver when sandboxing is disabled + // because the path changes from an app specific directory to + // ~/Documents, which requires additional permissions to access on macOS. + // Instead, validate that a non-empty path was returned. + expect(result, isNotEmpty); + } else { + _verifySampleFile(result, 'applicationDocuments'); + } }); testWidgets('getApplicationSupportDirectory', (WidgetTester tester) async { diff --git a/packages/path_provider/path_provider_foundation/example/integration_test/path_provider_test.dart b/packages/path_provider/path_provider_foundation/example/integration_test/path_provider_test.dart index 0d05745127a..4436dc55f8f 100644 --- a/packages/path_provider/path_provider_foundation/example/integration_test/path_provider_test.dart +++ b/packages/path_provider/path_provider_foundation/example/integration_test/path_provider_test.dart @@ -20,7 +20,15 @@ void main() { testWidgets('getApplicationDocumentsDirectory', (WidgetTester tester) async { final PathProviderPlatform provider = PathProviderPlatform.instance; final String? result = await provider.getApplicationDocumentsPath(); - _verifySampleFile(result, 'applicationDocuments'); + if (Platform.isMacOS) { + // _verifySampleFile causes hangs in driver when sandboxing is disabled + // because the path changes from an app specific directory to + // ~/Documents, which requires additional permissions to access on macOS. + // Instead, validate that a non-empty path was returned. + expect(result, isNotEmpty); + } else { + _verifySampleFile(result, 'applicationDocuments'); + } }); testWidgets('getApplicationSupportDirectory', (WidgetTester tester) async { From f6b558060b42ab4176deab3a953a6edd2a6c97c3 Mon Sep 17 00:00:00 2001 From: Victoria Ashworth Date: Wed, 5 Jun 2024 11:14:29 -0500 Subject: [PATCH 2/2] fix expect to check for path --- .../example/integration_test/path_provider_test.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/path_provider/path_provider/example/integration_test/path_provider_test.dart b/packages/path_provider/path_provider/example/integration_test/path_provider_test.dart index b2d79d483f9..846d87df399 100644 --- a/packages/path_provider/path_provider/example/integration_test/path_provider_test.dart +++ b/packages/path_provider/path_provider/example/integration_test/path_provider_test.dart @@ -22,7 +22,7 @@ void main() { // because the path changes from an app specific directory to // ~/Documents, which requires additional permissions to access on macOS. // Instead, validate that a non-empty path was returned. - expect(result, isNotEmpty); + expect(result.path, isNotEmpty); } else { _verifySampleFile(result, 'applicationDocuments'); }