From 3febe0ab83f2f0524962218d4837d65c160fb8b1 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Tue, 17 May 2022 10:14:37 -0400 Subject: [PATCH] [path_provider] Fix integration tests on macOS Recent versions of macOS prompt for access to the Downloads directory when trying to use it, even with the permission set in the entitlements, causing the test that validates that the directory can be used to fail on some CI. This switches to a less comprehensive test for that directory on macOS, which doesn't require permissions. --- packages/path_provider/path_provider/CHANGELOG.md | 4 ++++ .../example/integration_test/path_provider_test.dart | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/path_provider/path_provider/CHANGELOG.md b/packages/path_provider/path_provider/CHANGELOG.md index 990021671801..0567b7e7ae33 100644 --- a/packages/path_provider/path_provider/CHANGELOG.md +++ b/packages/path_provider/path_provider/CHANGELOG.md @@ -1,3 +1,7 @@ +## NEXT + +* Fixes integration test permission issue on recent versions of macOS. + ## 2.0.10 * Removes unnecessary imports. 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 27493a76012c..4f5a1873bfb8 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 @@ -92,7 +92,14 @@ void main() { expect(result, throwsA(isInstanceOf())); } else { final Directory? result = await getDownloadsDirectory(); - _verifySampleFile(result, 'downloads'); + if (Platform.isMacOS) { + // On recent versions of macOS, actually using the downloads directory + // requires a user prompt, so will fail on CI. Instead, just check that + // it returned a path with the expected directory name. + expect(result?.path, endsWith('Downloads')); + } else { + _verifySampleFile(result, 'downloads'); + } } }); }