From ca36462d1384a0f544ce36f99e770bfde9f01387 Mon Sep 17 00:00:00 2001 From: karolinaoparczyk Date: Wed, 9 Oct 2024 12:38:18 +0200 Subject: [PATCH 01/16] Add clear permissions test failing on ios --- .../permissions/clear_permissions_test.dart | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 dev/e2e_app/integration_test/permissions/clear_permissions_test.dart diff --git a/dev/e2e_app/integration_test/permissions/clear_permissions_test.dart b/dev/e2e_app/integration_test/permissions/clear_permissions_test.dart new file mode 100644 index 000000000..fbcf4b6c2 --- /dev/null +++ b/dev/e2e_app/integration_test/permissions/clear_permissions_test.dart @@ -0,0 +1,29 @@ +import '../common.dart'; + +const _timeout = Duration(seconds: 5); // to avoid timeouts on CI + +void main() { + patrol('grants various permissions', ($) async { + await createApp($); + + await $('Open permissions screen').scrollTo().tap(); + + await _requestAndGrantCameraPermission($); + }); + patrol('grants various permissions 2', ($) async { + await createApp($); + + await $('Open permissions screen').scrollTo().tap(); + + await _requestAndGrantCameraPermission($); + }); +} + +Future _requestAndGrantCameraPermission(PatrolIntegrationTester $) async { + expect($(#camera).$(#statusText).text, 'Not granted'); + await $('Request camera permission').tap(); + if (await $.native.isPermissionDialogVisible(timeout: _timeout)) { + await $.native.grantPermissionWhenInUse(); + await $.pump(); + } +} From d8ad226929d7c2de9bf86b211411b614fd58f663 Mon Sep 17 00:00:00 2001 From: karolinaoparczyk Date: Wed, 9 Oct 2024 15:58:09 +0200 Subject: [PATCH 02/16] POC - resetting camera permission on ios --- .../ios/Runner.xcodeproj/project.pbxproj | 118 +++++++++--------- dev/e2e_app/ios/Runner/AppDelegate.swift | 2 +- .../Classes/PatrolIntegrationTestIosRunner.h | 4 +- 3 files changed, 63 insertions(+), 61 deletions(-) diff --git a/dev/e2e_app/ios/Runner.xcodeproj/project.pbxproj b/dev/e2e_app/ios/Runner.xcodeproj/project.pbxproj index b8588a28d..2daca13aa 100644 --- a/dev/e2e_app/ios/Runner.xcodeproj/project.pbxproj +++ b/dev/e2e_app/ios/Runner.xcodeproj/project.pbxproj @@ -8,15 +8,15 @@ /* Begin PBXBuildFile section */ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 3A16A7A891650C176C30778F /* Pods_Runner_RunnerUITests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5B18DDD7DB44311F55B8FBAC /* Pods_Runner_RunnerUITests.framework */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; - 6090F033F64EF2E6EC73E939 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B67A70BD9498C1A200C5D078 /* Pods_Runner.framework */; }; + 51FAB981AF21A7BA28EAA01D /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DE9611E92EB9F9C3E24E4795 /* Pods_Runner.framework */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 983964DC2978A956007EB76F /* RunnerUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 983964DB2978A956007EB76F /* RunnerUITests.m */; }; 9862560529F9A72100B267FA /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9862560429F9A72100B267FA /* RunnerTests.swift */; }; - FA27315210C24EEDF8E3A8C2 /* Pods_Runner_RunnerUITests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 93E89E9CC733F51B93EF71E1 /* Pods_Runner_RunnerUITests.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -50,18 +50,17 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 039FF0702EF7414DA773B859 /* Pods-Runner-RunnerUITests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner-RunnerUITests.profile.xcconfig"; path = "Target Support Files/Pods-Runner-RunnerUITests/Pods-Runner-RunnerUITests.profile.xcconfig"; sourceTree = ""; }; - 0CD8ADEABA35D9D53F0DF923 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; - 2F26359F19FF5877E6D9BB4A /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; + 1CAFA55991482D2827868BBC /* Pods-Runner-RunnerUITests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner-RunnerUITests.profile.xcconfig"; path = "Target Support Files/Pods-Runner-RunnerUITests/Pods-Runner-RunnerUITests.profile.xcconfig"; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; - 6AD63AC0BB42D464CC8ABFC5 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; - 714A2CF42B7519C44AFD56B9 /* Pods-Runner-RunnerUITests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner-RunnerUITests.debug.xcconfig"; path = "Target Support Files/Pods-Runner-RunnerUITests/Pods-Runner-RunnerUITests.debug.xcconfig"; sourceTree = ""; }; + 3E657AC8E202D4BE9F236453 /* Pods-Runner-RunnerUITests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner-RunnerUITests.debug.xcconfig"; path = "Target Support Files/Pods-Runner-RunnerUITests/Pods-Runner-RunnerUITests.debug.xcconfig"; sourceTree = ""; }; + 5B18DDD7DB44311F55B8FBAC /* Pods_Runner_RunnerUITests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner_RunnerUITests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; - 93E89E9CC733F51B93EF71E1 /* Pods_Runner_RunnerUITests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner_RunnerUITests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 8B49F10ED0F3AEA47F9419A9 /* Pods-Runner-RunnerUITests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner-RunnerUITests.release.xcconfig"; path = "Target Support Files/Pods-Runner-RunnerUITests/Pods-Runner-RunnerUITests.release.xcconfig"; sourceTree = ""; }; + 8CEE83C435018ACEAB31DA94 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -74,8 +73,9 @@ 98575F2E29FA960A00AF8421 /* RunnerTests-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RunnerTests-Bridging-Header.h"; sourceTree = ""; }; 9862560229F9A72100B267FA /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 9862560429F9A72100B267FA /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; - B447E7B3C41089DE3953018D /* Pods-Runner-RunnerUITests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner-RunnerUITests.release.xcconfig"; path = "Target Support Files/Pods-Runner-RunnerUITests/Pods-Runner-RunnerUITests.release.xcconfig"; sourceTree = ""; }; - B67A70BD9498C1A200C5D078 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + B4D1855B6A1A2B813F77F7AC /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; + DCA20AF227EE6F4FD0EDFF29 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + DE9611E92EB9F9C3E24E4795 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -83,7 +83,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 6090F033F64EF2E6EC73E939 /* Pods_Runner.framework in Frameworks */, + 51FAB981AF21A7BA28EAA01D /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -91,7 +91,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - FA27315210C24EEDF8E3A8C2 /* Pods_Runner_RunnerUITests.framework in Frameworks */, + 3A16A7A891650C176C30778F /* Pods_Runner_RunnerUITests.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -105,15 +105,24 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 1BA48497B0822771ADDC9C20 /* Frameworks */ = { + isa = PBXGroup; + children = ( + DE9611E92EB9F9C3E24E4795 /* Pods_Runner.framework */, + 5B18DDD7DB44311F55B8FBAC /* Pods_Runner_RunnerUITests.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; 71514460146D120DA8711EC5 /* Pods */ = { isa = PBXGroup; children = ( - 6AD63AC0BB42D464CC8ABFC5 /* Pods-Runner.debug.xcconfig */, - 0CD8ADEABA35D9D53F0DF923 /* Pods-Runner.release.xcconfig */, - 2F26359F19FF5877E6D9BB4A /* Pods-Runner.profile.xcconfig */, - 714A2CF42B7519C44AFD56B9 /* Pods-Runner-RunnerUITests.debug.xcconfig */, - B447E7B3C41089DE3953018D /* Pods-Runner-RunnerUITests.release.xcconfig */, - 039FF0702EF7414DA773B859 /* Pods-Runner-RunnerUITests.profile.xcconfig */, + B4D1855B6A1A2B813F77F7AC /* Pods-Runner.debug.xcconfig */, + DCA20AF227EE6F4FD0EDFF29 /* Pods-Runner.release.xcconfig */, + 8CEE83C435018ACEAB31DA94 /* Pods-Runner.profile.xcconfig */, + 3E657AC8E202D4BE9F236453 /* Pods-Runner-RunnerUITests.debug.xcconfig */, + 8B49F10ED0F3AEA47F9419A9 /* Pods-Runner-RunnerUITests.release.xcconfig */, + 1CAFA55991482D2827868BBC /* Pods-Runner-RunnerUITests.profile.xcconfig */, ); path = Pods; sourceTree = ""; @@ -138,7 +147,7 @@ 9862560329F9A72100B267FA /* RunnerTests */, 97C146EF1CF9000F007C117D /* Products */, 71514460146D120DA8711EC5 /* Pods */, - E54C552FCC7A91D75B1E4F09 /* Frameworks */, + 1BA48497B0822771ADDC9C20 /* Frameworks */, ); sourceTree = ""; }; @@ -184,15 +193,6 @@ path = RunnerTests; sourceTree = ""; }; - E54C552FCC7A91D75B1E4F09 /* Frameworks */ = { - isa = PBXGroup; - children = ( - B67A70BD9498C1A200C5D078 /* Pods_Runner.framework */, - 93E89E9CC733F51B93EF71E1 /* Pods_Runner_RunnerUITests.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -200,14 +200,14 @@ isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( - 01FBF9092C877C4910CAC196 /* [CP] Check Pods Manifest.lock */, + 885D0EFA88B11BF5E5AC1B8E /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* xcode_backend build */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* xcode_backend embed_and_thin */, - E621EC4C03882F1FC407353C /* [CP] Embed Pods Frameworks */, + A8D5E21E8BC98A494C1E46CD /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -222,13 +222,13 @@ isa = PBXNativeTarget; buildConfigurationList = 983964E12978A956007EB76F /* Build configuration list for PBXNativeTarget "RunnerUITests" */; buildPhases = ( - CCBA4E2120CD0A4549A78A05 /* [CP] Check Pods Manifest.lock */, + 38F0C60ADAC89D16CDC28C92 /* [CP] Check Pods Manifest.lock */, 983964E62978A9F4007EB76F /* xcode_backend build */, 983964D52978A956007EB76F /* Sources */, 983964D62978A956007EB76F /* Frameworks */, 983964D72978A956007EB76F /* Resources */, 983964E52978A9D4007EB76F /* xcode_backend embed_and_thin */, - FB0F1ED3C61A5044791AC712 /* [CP] Embed Pods Frameworks */, + B82A5CCEBEC7517DCC30622A /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -332,7 +332,7 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 01FBF9092C877C4910CAC196 /* [CP] Check Pods Manifest.lock */ = { + 38F0C60ADAC89D16CDC28C92 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -347,7 +347,7 @@ outputFileListPaths = ( ); outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + "$(DERIVED_FILE_DIR)/Pods-Runner-RunnerUITests-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -368,39 +368,43 @@ shellPath = /bin/sh; shellScript = "echo \"Runner xcode_backend embed_and_thin\"\n/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin\n"; }; - 9740EEB61CF901F6004384FC /* xcode_backend build */ = { + 885D0EFA88B11BF5E5AC1B8E /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); + inputFileListPaths = ( + ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( ); - name = "xcode_backend build"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "echo \"Runner xcode_backend build\"\n/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; }; - 983964E52978A9D4007EB76F /* xcode_backend embed_and_thin */ = { + 9740EEB61CF901F6004384FC /* xcode_backend build */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); - inputFileListPaths = ( - ); inputPaths = ( ); - name = "xcode_backend embed_and_thin"; - outputFileListPaths = ( - ); + name = "xcode_backend build"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "echo \"RunnerUITests xcode_backend embed_and_thin\"\n/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin\n"; + shellScript = "echo \"Runner xcode_backend build\"\n/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build\n"; }; - 983964E62978A9F4007EB76F /* xcode_backend build */ = { + 983964E52978A9D4007EB76F /* xcode_backend embed_and_thin */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -409,16 +413,16 @@ ); inputPaths = ( ); - name = "xcode_backend build"; + name = "xcode_backend embed_and_thin"; outputFileListPaths = ( ); outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "echo \"RunnerUITests xcode_backend build\"\n/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build\n"; + shellScript = "echo \"RunnerUITests xcode_backend embed_and_thin\"\n/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin\n"; }; - CCBA4E2120CD0A4549A78A05 /* [CP] Check Pods Manifest.lock */ = { + 983964E62978A9F4007EB76F /* xcode_backend build */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -426,21 +430,17 @@ inputFileListPaths = ( ); inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", ); - name = "[CP] Check Pods Manifest.lock"; + name = "xcode_backend build"; outputFileListPaths = ( ); outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-Runner-RunnerUITests-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; + shellScript = "echo \"RunnerUITests xcode_backend build\"\n/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build\n"; }; - E621EC4C03882F1FC407353C /* [CP] Embed Pods Frameworks */ = { + A8D5E21E8BC98A494C1E46CD /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -457,7 +457,7 @@ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - FB0F1ED3C61A5044791AC712 /* [CP] Embed Pods Frameworks */ = { + B82A5CCEBEC7517DCC30622A /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -578,7 +578,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.4; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -656,7 +656,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.4; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -705,7 +705,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.4; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; diff --git a/dev/e2e_app/ios/Runner/AppDelegate.swift b/dev/e2e_app/ios/Runner/AppDelegate.swift index f778914dd..698da0ccd 100644 --- a/dev/e2e_app/ios/Runner/AppDelegate.swift +++ b/dev/e2e_app/ios/Runner/AppDelegate.swift @@ -1,7 +1,7 @@ import Flutter import UIKit -@UIApplicationMain +@main @objc class AppDelegate: FlutterAppDelegate { override func application( _ application: UIApplication, diff --git a/packages/patrol/darwin/Classes/PatrolIntegrationTestIosRunner.h b/packages/patrol/darwin/Classes/PatrolIntegrationTestIosRunner.h index 15260d6d9..064c11cfb 100644 --- a/packages/patrol/darwin/Classes/PatrolIntegrationTestIosRunner.h +++ b/packages/patrol/darwin/Classes/PatrolIntegrationTestIosRunner.h @@ -103,7 +103,9 @@ BOOL skip = [dartTest[@"skip"] boolValue]; \ \ IMP implementation = imp_implementationWithBlock(^(id _self) { \ - [[[XCUIApplication alloc] init] launch]; \ + XCUIApplication *app = [[XCUIApplication alloc] init]; \ + [app resetAuthorizationStatusForResource:XCUIProtectedResourceCamera]; \ + [app launch]; \ if (skip) { \ XCTSkip(@"Skip that test \"%@\"", dartTestName); \ } \ From d2d64a33355b2607807a35233aea1b0b0f50419e Mon Sep 17 00:00:00 2001 From: karolinaoparczyk Date: Wed, 9 Oct 2024 16:03:57 +0200 Subject: [PATCH 03/16] Use target 14 --- .../ios/Runner.xcodeproj/project.pbxproj | 134 +++++++++--------- 1 file changed, 67 insertions(+), 67 deletions(-) diff --git a/dev/e2e_app/ios/Runner.xcodeproj/project.pbxproj b/dev/e2e_app/ios/Runner.xcodeproj/project.pbxproj index 2daca13aa..42101b06f 100644 --- a/dev/e2e_app/ios/Runner.xcodeproj/project.pbxproj +++ b/dev/e2e_app/ios/Runner.xcodeproj/project.pbxproj @@ -8,15 +8,15 @@ /* Begin PBXBuildFile section */ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; - 3A16A7A891650C176C30778F /* Pods_Runner_RunnerUITests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5B18DDD7DB44311F55B8FBAC /* Pods_Runner_RunnerUITests.framework */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; - 51FAB981AF21A7BA28EAA01D /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DE9611E92EB9F9C3E24E4795 /* Pods_Runner.framework */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 983964DC2978A956007EB76F /* RunnerUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 983964DB2978A956007EB76F /* RunnerUITests.m */; }; 9862560529F9A72100B267FA /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9862560429F9A72100B267FA /* RunnerTests.swift */; }; + 9EB122AD19AB87EF9A455AE0 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6BC3560B4830BA000C071318 /* Pods_Runner.framework */; }; + B0857128DF1F6A49AC8F8B45 /* Pods_Runner_RunnerUITests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 54E01A95706666750AB61B42 /* Pods_Runner_RunnerUITests.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -52,15 +52,16 @@ /* Begin PBXFileReference section */ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; - 1CAFA55991482D2827868BBC /* Pods-Runner-RunnerUITests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner-RunnerUITests.profile.xcconfig"; path = "Target Support Files/Pods-Runner-RunnerUITests/Pods-Runner-RunnerUITests.profile.xcconfig"; sourceTree = ""; }; + 21A84891CCDF0395C677C1FA /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; - 3E657AC8E202D4BE9F236453 /* Pods-Runner-RunnerUITests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner-RunnerUITests.debug.xcconfig"; path = "Target Support Files/Pods-Runner-RunnerUITests/Pods-Runner-RunnerUITests.debug.xcconfig"; sourceTree = ""; }; - 5B18DDD7DB44311F55B8FBAC /* Pods_Runner_RunnerUITests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner_RunnerUITests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 437B59E3AFD5588395844415 /* Pods-Runner-RunnerUITests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner-RunnerUITests.release.xcconfig"; path = "Target Support Files/Pods-Runner-RunnerUITests/Pods-Runner-RunnerUITests.release.xcconfig"; sourceTree = ""; }; + 54E01A95706666750AB61B42 /* Pods_Runner_RunnerUITests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner_RunnerUITests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 61EF0D45B2EFB3231A29904D /* Pods-Runner-RunnerUITests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner-RunnerUITests.profile.xcconfig"; path = "Target Support Files/Pods-Runner-RunnerUITests/Pods-Runner-RunnerUITests.profile.xcconfig"; sourceTree = ""; }; + 6BC3560B4830BA000C071318 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 75273ABBA75A9DB827CA72CB /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; - 8B49F10ED0F3AEA47F9419A9 /* Pods-Runner-RunnerUITests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner-RunnerUITests.release.xcconfig"; path = "Target Support Files/Pods-Runner-RunnerUITests/Pods-Runner-RunnerUITests.release.xcconfig"; sourceTree = ""; }; - 8CEE83C435018ACEAB31DA94 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -73,9 +74,8 @@ 98575F2E29FA960A00AF8421 /* RunnerTests-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RunnerTests-Bridging-Header.h"; sourceTree = ""; }; 9862560229F9A72100B267FA /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 9862560429F9A72100B267FA /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; - B4D1855B6A1A2B813F77F7AC /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; - DCA20AF227EE6F4FD0EDFF29 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; - DE9611E92EB9F9C3E24E4795 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + C936D69C8587B6EF0FDCEC12 /* Pods-Runner-RunnerUITests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner-RunnerUITests.debug.xcconfig"; path = "Target Support Files/Pods-Runner-RunnerUITests/Pods-Runner-RunnerUITests.debug.xcconfig"; sourceTree = ""; }; + D4B72E459E8D5DA38685313A /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -83,7 +83,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 51FAB981AF21A7BA28EAA01D /* Pods_Runner.framework in Frameworks */, + 9EB122AD19AB87EF9A455AE0 /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -91,7 +91,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 3A16A7A891650C176C30778F /* Pods_Runner_RunnerUITests.framework in Frameworks */, + B0857128DF1F6A49AC8F8B45 /* Pods_Runner_RunnerUITests.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -105,24 +105,15 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 1BA48497B0822771ADDC9C20 /* Frameworks */ = { - isa = PBXGroup; - children = ( - DE9611E92EB9F9C3E24E4795 /* Pods_Runner.framework */, - 5B18DDD7DB44311F55B8FBAC /* Pods_Runner_RunnerUITests.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; 71514460146D120DA8711EC5 /* Pods */ = { isa = PBXGroup; children = ( - B4D1855B6A1A2B813F77F7AC /* Pods-Runner.debug.xcconfig */, - DCA20AF227EE6F4FD0EDFF29 /* Pods-Runner.release.xcconfig */, - 8CEE83C435018ACEAB31DA94 /* Pods-Runner.profile.xcconfig */, - 3E657AC8E202D4BE9F236453 /* Pods-Runner-RunnerUITests.debug.xcconfig */, - 8B49F10ED0F3AEA47F9419A9 /* Pods-Runner-RunnerUITests.release.xcconfig */, - 1CAFA55991482D2827868BBC /* Pods-Runner-RunnerUITests.profile.xcconfig */, + 21A84891CCDF0395C677C1FA /* Pods-Runner.debug.xcconfig */, + D4B72E459E8D5DA38685313A /* Pods-Runner.release.xcconfig */, + 75273ABBA75A9DB827CA72CB /* Pods-Runner.profile.xcconfig */, + C936D69C8587B6EF0FDCEC12 /* Pods-Runner-RunnerUITests.debug.xcconfig */, + 437B59E3AFD5588395844415 /* Pods-Runner-RunnerUITests.release.xcconfig */, + 61EF0D45B2EFB3231A29904D /* Pods-Runner-RunnerUITests.profile.xcconfig */, ); path = Pods; sourceTree = ""; @@ -147,7 +138,7 @@ 9862560329F9A72100B267FA /* RunnerTests */, 97C146EF1CF9000F007C117D /* Products */, 71514460146D120DA8711EC5 /* Pods */, - 1BA48497B0822771ADDC9C20 /* Frameworks */, + A9EDE3A914EB8EA7657CFA4E /* Frameworks */, ); sourceTree = ""; }; @@ -193,6 +184,15 @@ path = RunnerTests; sourceTree = ""; }; + A9EDE3A914EB8EA7657CFA4E /* Frameworks */ = { + isa = PBXGroup; + children = ( + 6BC3560B4830BA000C071318 /* Pods_Runner.framework */, + 54E01A95706666750AB61B42 /* Pods_Runner_RunnerUITests.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -200,14 +200,14 @@ isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( - 885D0EFA88B11BF5E5AC1B8E /* [CP] Check Pods Manifest.lock */, + 5C9D315B699EF318EC999391 /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* xcode_backend build */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* xcode_backend embed_and_thin */, - A8D5E21E8BC98A494C1E46CD /* [CP] Embed Pods Frameworks */, + 99630BC56F6B45CF3ED3670B /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -222,13 +222,13 @@ isa = PBXNativeTarget; buildConfigurationList = 983964E12978A956007EB76F /* Build configuration list for PBXNativeTarget "RunnerUITests" */; buildPhases = ( - 38F0C60ADAC89D16CDC28C92 /* [CP] Check Pods Manifest.lock */, + 48CC73F6B1992D6DD8140860 /* [CP] Check Pods Manifest.lock */, 983964E62978A9F4007EB76F /* xcode_backend build */, 983964D52978A956007EB76F /* Sources */, 983964D62978A956007EB76F /* Frameworks */, 983964D72978A956007EB76F /* Resources */, 983964E52978A9D4007EB76F /* xcode_backend embed_and_thin */, - B82A5CCEBEC7517DCC30622A /* [CP] Embed Pods Frameworks */, + 43FE5AEE72206FD010751A9E /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -332,43 +332,60 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 38F0C60ADAC89D16CDC28C92 /* [CP] Check Pods Manifest.lock */ = { + 3B06AD1E1E4923F5004D2608 /* xcode_backend embed_and_thin */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); - inputFileListPaths = ( - ); inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( ); + name = "xcode_backend embed_and_thin"; outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-Runner-RunnerUITests-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + shellScript = "echo \"Runner xcode_backend embed_and_thin\"\n/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin\n"; + }; + 43FE5AEE72206FD010751A9E /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner-RunnerUITests/Pods-Runner-RunnerUITests-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner-RunnerUITests/Pods-Runner-RunnerUITests-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner-RunnerUITests/Pods-Runner-RunnerUITests-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - 3B06AD1E1E4923F5004D2608 /* xcode_backend embed_and_thin */ = { + 48CC73F6B1992D6DD8140860 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); + inputFileListPaths = ( + ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( ); - name = "xcode_backend embed_and_thin"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-RunnerUITests-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "echo \"Runner xcode_backend embed_and_thin\"\n/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; }; - 885D0EFA88B11BF5E5AC1B8E /* [CP] Check Pods Manifest.lock */ = { + 5C9D315B699EF318EC999391 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -440,7 +457,7 @@ shellPath = /bin/sh; shellScript = "echo \"RunnerUITests xcode_backend build\"\n/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build\n"; }; - A8D5E21E8BC98A494C1E46CD /* [CP] Embed Pods Frameworks */ = { + 99630BC56F6B45CF3ED3670B /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -457,23 +474,6 @@ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - B82A5CCEBEC7517DCC30622A /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner-RunnerUITests/Pods-Runner-RunnerUITests-frameworks-${CONFIGURATION}-input-files.xcfilelist", - ); - name = "[CP] Embed Pods Frameworks"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner-RunnerUITests/Pods-Runner-RunnerUITests-frameworks-${CONFIGURATION}-output-files.xcfilelist", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner-RunnerUITests/Pods-Runner-RunnerUITests-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -578,7 +578,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 13.4; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -656,7 +656,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 13.4; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -705,7 +705,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 13.4; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; From 8da17cafb9288386f67cdfb7c1f00a74ffafa600 Mon Sep 17 00:00:00 2001 From: karolinaoparczyk Date: Thu, 10 Oct 2024 10:02:29 +0200 Subject: [PATCH 04/16] Reset many permissions --- .../permissions/clear_permissions_test.dart | 13 +++++++++++ .../Classes/PatrolIntegrationTestIosRunner.h | 22 ++++++++++++++++--- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/dev/e2e_app/integration_test/permissions/clear_permissions_test.dart b/dev/e2e_app/integration_test/permissions/clear_permissions_test.dart index fbcf4b6c2..e6fb7478b 100644 --- a/dev/e2e_app/integration_test/permissions/clear_permissions_test.dart +++ b/dev/e2e_app/integration_test/permissions/clear_permissions_test.dart @@ -9,6 +9,7 @@ void main() { await $('Open permissions screen').scrollTo().tap(); await _requestAndGrantCameraPermission($); + await _requestAndGrantMicrophonePermission($); }); patrol('grants various permissions 2', ($) async { await createApp($); @@ -16,6 +17,7 @@ void main() { await $('Open permissions screen').scrollTo().tap(); await _requestAndGrantCameraPermission($); + await _requestAndGrantMicrophonePermission($); }); } @@ -27,3 +29,14 @@ Future _requestAndGrantCameraPermission(PatrolIntegrationTester $) async { await $.pump(); } } + +Future _requestAndGrantMicrophonePermission( + PatrolIntegrationTester $, +) async { + expect($(#microphone).$(#statusText).text, 'Not granted'); + await $('Request microphone permission').tap(); + if (await $.native.isPermissionDialogVisible(timeout: _timeout)) { + await $.native.grantPermissionOnlyThisTime(); + await $.pump(); + } +} diff --git a/packages/patrol/darwin/Classes/PatrolIntegrationTestIosRunner.h b/packages/patrol/darwin/Classes/PatrolIntegrationTestIosRunner.h index 064c11cfb..25ceab291 100644 --- a/packages/patrol/darwin/Classes/PatrolIntegrationTestIosRunner.h +++ b/packages/patrol/darwin/Classes/PatrolIntegrationTestIosRunner.h @@ -39,6 +39,23 @@ return true; \ } \ \ + +(void)resetPermissions { \ + XCUIApplication *app = [[XCUIApplication alloc] init]; \ + if (@available(iOS 13.4, *)) { \ + [app resetAuthorizationStatusForResource:XCUIProtectedResourceLocation]; \ + [app resetAuthorizationStatusForResource:XCUIProtectedResourceContacts]; \ + [app resetAuthorizationStatusForResource:XCUIProtectedResourceCalendar]; \ + [app resetAuthorizationStatusForResource:XCUIProtectedResourceReminders]; \ + [app resetAuthorizationStatusForResource:XCUIProtectedResourcePhotos]; \ + [app resetAuthorizationStatusForResource:XCUIProtectedResourceBluetooth]; \ + [app resetAuthorizationStatusForResource:XCUIProtectedResourceMicrophone]; \ + [app resetAuthorizationStatusForResource:XCUIProtectedResourceCamera]; \ + [app resetAuthorizationStatusForResource:XCUIProtectedResourceHomeKit]; \ + [app resetAuthorizationStatusForResource:XCUIProtectedResourceMediaLibrary]; \ + [app resetAuthorizationStatusForResource:XCUIProtectedResourceKeyboardNetwork]; \ + } \ + } \ + \ +(NSArray *)testInvocations { \ /* Start native automation server */ \ PatrolServer *server = [[PatrolServer alloc] init]; \ @@ -103,9 +120,8 @@ BOOL skip = [dartTest[@"skip"] boolValue]; \ \ IMP implementation = imp_implementationWithBlock(^(id _self) { \ - XCUIApplication *app = [[XCUIApplication alloc] init]; \ - [app resetAuthorizationStatusForResource:XCUIProtectedResourceCamera]; \ - [app launch]; \ + [self resetPermissions]; \ + [[[XCUIApplication alloc] init] launch]; \ if (skip) { \ XCTSkip(@"Skip that test \"%@\"", dartTestName); \ } \ From 6b56eedab5d7e52c1db14eb4f411325ef9c16f37 Mon Sep 17 00:00:00 2001 From: karolinaoparczyk Date: Fri, 11 Oct 2024 14:04:22 +0200 Subject: [PATCH 05/16] Remove unnecessary variable --- packages/patrol/darwin/Classes/PatrolIntegrationTestIosRunner.h | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/patrol/darwin/Classes/PatrolIntegrationTestIosRunner.h b/packages/patrol/darwin/Classes/PatrolIntegrationTestIosRunner.h index 25ceab291..ce426d781 100644 --- a/packages/patrol/darwin/Classes/PatrolIntegrationTestIosRunner.h +++ b/packages/patrol/darwin/Classes/PatrolIntegrationTestIosRunner.h @@ -40,7 +40,6 @@ } \ \ +(void)resetPermissions { \ - XCUIApplication *app = [[XCUIApplication alloc] init]; \ if (@available(iOS 13.4, *)) { \ [app resetAuthorizationStatusForResource:XCUIProtectedResourceLocation]; \ [app resetAuthorizationStatusForResource:XCUIProtectedResourceContacts]; \ From c4ab3c44b170909a999247844e0471e8b78ddc19 Mon Sep 17 00:00:00 2001 From: karolinaoparczyk Date: Fri, 11 Oct 2024 14:10:32 +0200 Subject: [PATCH 06/16] Add other permissions --- .../darwin/Classes/PatrolIntegrationTestIosRunner.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/packages/patrol/darwin/Classes/PatrolIntegrationTestIosRunner.h b/packages/patrol/darwin/Classes/PatrolIntegrationTestIosRunner.h index ce426d781..24ee79ac4 100644 --- a/packages/patrol/darwin/Classes/PatrolIntegrationTestIosRunner.h +++ b/packages/patrol/darwin/Classes/PatrolIntegrationTestIosRunner.h @@ -53,6 +53,19 @@ [app resetAuthorizationStatusForResource:XCUIProtectedResourceMediaLibrary]; \ [app resetAuthorizationStatusForResource:XCUIProtectedResourceKeyboardNetwork]; \ } \ + if (@available(iOS 14.0, *)) { \ + [app resetAuthorizationStatusForResource:XCUIProtectedResourceHealth]; \ + } \ + if (@available(iOS 15.0, *)) { \ + [app resetAuthorizationStatusForResource:XCUIProtectedResourceUserTracking]; \ + [app resetAuthorizationStatusForResource:XCUIProtectedResourceFocus]; \ + [app resetAuthorizationStatusForResource:XCUIProtectedResourceRemovableVolumes]; \ + [app resetAuthorizationStatusForResource:XCUIProtectedResourceNetworkVolumes]; \ + [app resetAuthorizationStatusForResource:XCUIProtectedResourceAppleEvents]; \ + } \ + if (@available(iOS 15.4, *)) { \ + [app resetAuthorizationStatusForResource:XCUIProtectedResourceLocalNetwork]; \ + } \ } \ \ +(NSArray *)testInvocations { \ From 71866c2ca88f4cf61a99f1616bc049715fd14f65 Mon Sep 17 00:00:00 2001 From: karolinaoparczyk Date: Fri, 11 Oct 2024 14:15:50 +0200 Subject: [PATCH 07/16] Add other permissions --- packages/patrol/darwin/Classes/PatrolIntegrationTestIosRunner.h | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/patrol/darwin/Classes/PatrolIntegrationTestIosRunner.h b/packages/patrol/darwin/Classes/PatrolIntegrationTestIosRunner.h index 24ee79ac4..7e4ff898f 100644 --- a/packages/patrol/darwin/Classes/PatrolIntegrationTestIosRunner.h +++ b/packages/patrol/darwin/Classes/PatrolIntegrationTestIosRunner.h @@ -40,6 +40,7 @@ } \ \ +(void)resetPermissions { \ + XCUIApplication *app = [[XCUIApplication alloc] init]; \ if (@available(iOS 13.4, *)) { \ [app resetAuthorizationStatusForResource:XCUIProtectedResourceLocation]; \ [app resetAuthorizationStatusForResource:XCUIProtectedResourceContacts]; \ From 42a69f253014cbff134fcb7d26cfe7907221e35f Mon Sep 17 00:00:00 2001 From: karolinaoparczyk Date: Fri, 11 Oct 2024 18:01:55 +0200 Subject: [PATCH 08/16] Update test and permissions, revert ios target --- .../permissions/clear_permissions_test.dart | 13 ++++ .../ios/Runner.xcodeproj/project.pbxproj | 78 +++++++++---------- dev/e2e_app/lib/permissions_screen.dart | 25 ++++-- .../Classes/PatrolIntegrationTestIosRunner.h | 3 - 4 files changed, 69 insertions(+), 50 deletions(-) diff --git a/dev/e2e_app/integration_test/permissions/clear_permissions_test.dart b/dev/e2e_app/integration_test/permissions/clear_permissions_test.dart index e6fb7478b..6683d83b8 100644 --- a/dev/e2e_app/integration_test/permissions/clear_permissions_test.dart +++ b/dev/e2e_app/integration_test/permissions/clear_permissions_test.dart @@ -10,6 +10,7 @@ void main() { await _requestAndGrantCameraPermission($); await _requestAndGrantMicrophonePermission($); + await _requestAndGrantLocationPermission($); }); patrol('grants various permissions 2', ($) async { await createApp($); @@ -18,6 +19,7 @@ void main() { await _requestAndGrantCameraPermission($); await _requestAndGrantMicrophonePermission($); + await _requestAndGrantLocationPermission($); }); } @@ -40,3 +42,14 @@ Future _requestAndGrantMicrophonePermission( await $.pump(); } } + +Future _requestAndGrantLocationPermission( + PatrolIntegrationTester $, +) async { + expect($(#location).$(#statusText).text, 'Not granted'); + await $('Request location permission').tap(); + if (await $.native.isPermissionDialogVisible(timeout: _timeout)) { + await $.native.grantPermissionOnlyThisTime(); + await $.pump(); + } +} diff --git a/dev/e2e_app/ios/Runner.xcodeproj/project.pbxproj b/dev/e2e_app/ios/Runner.xcodeproj/project.pbxproj index 42101b06f..2d08ef296 100644 --- a/dev/e2e_app/ios/Runner.xcodeproj/project.pbxproj +++ b/dev/e2e_app/ios/Runner.xcodeproj/project.pbxproj @@ -8,15 +8,15 @@ /* Begin PBXBuildFile section */ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 162296CB6507E7D2B29D6854 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EDD038C99EEC86DB1BE3B28B /* Pods_Runner.framework */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 735C0DEADB7AD63E83BA5F87 /* Pods_Runner_RunnerUITests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 70AA43B9B4C80C1C97015E37 /* Pods_Runner_RunnerUITests.framework */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 983964DC2978A956007EB76F /* RunnerUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 983964DB2978A956007EB76F /* RunnerUITests.m */; }; 9862560529F9A72100B267FA /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9862560429F9A72100B267FA /* RunnerTests.swift */; }; - 9EB122AD19AB87EF9A455AE0 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6BC3560B4830BA000C071318 /* Pods_Runner.framework */; }; - B0857128DF1F6A49AC8F8B45 /* Pods_Runner_RunnerUITests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 54E01A95706666750AB61B42 /* Pods_Runner_RunnerUITests.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -52,16 +52,16 @@ /* Begin PBXFileReference section */ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; - 21A84891CCDF0395C677C1FA /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; + 17DC028A3CF64A70DB51B652 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; - 437B59E3AFD5588395844415 /* Pods-Runner-RunnerUITests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner-RunnerUITests.release.xcconfig"; path = "Target Support Files/Pods-Runner-RunnerUITests/Pods-Runner-RunnerUITests.release.xcconfig"; sourceTree = ""; }; - 54E01A95706666750AB61B42 /* Pods_Runner_RunnerUITests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner_RunnerUITests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 61EF0D45B2EFB3231A29904D /* Pods-Runner-RunnerUITests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner-RunnerUITests.profile.xcconfig"; path = "Target Support Files/Pods-Runner-RunnerUITests/Pods-Runner-RunnerUITests.profile.xcconfig"; sourceTree = ""; }; - 6BC3560B4830BA000C071318 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 578A1CD38833007246EDDCC8 /* Pods-Runner-RunnerUITests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner-RunnerUITests.release.xcconfig"; path = "Target Support Files/Pods-Runner-RunnerUITests/Pods-Runner-RunnerUITests.release.xcconfig"; sourceTree = ""; }; + 6C9F904E13C17E9E13E86FE0 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; + 70AA43B9B4C80C1C97015E37 /* Pods_Runner_RunnerUITests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner_RunnerUITests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; - 75273ABBA75A9DB827CA72CB /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; + 79FE376A55F9C7A8275AA39F /* Pods-Runner-RunnerUITests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner-RunnerUITests.debug.xcconfig"; path = "Target Support Files/Pods-Runner-RunnerUITests/Pods-Runner-RunnerUITests.debug.xcconfig"; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 8EC67D1D3AB2F72F65370373 /* Pods-Runner-RunnerUITests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner-RunnerUITests.profile.xcconfig"; path = "Target Support Files/Pods-Runner-RunnerUITests/Pods-Runner-RunnerUITests.profile.xcconfig"; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -74,8 +74,8 @@ 98575F2E29FA960A00AF8421 /* RunnerTests-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RunnerTests-Bridging-Header.h"; sourceTree = ""; }; 9862560229F9A72100B267FA /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 9862560429F9A72100B267FA /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; - C936D69C8587B6EF0FDCEC12 /* Pods-Runner-RunnerUITests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner-RunnerUITests.debug.xcconfig"; path = "Target Support Files/Pods-Runner-RunnerUITests/Pods-Runner-RunnerUITests.debug.xcconfig"; sourceTree = ""; }; - D4B72E459E8D5DA38685313A /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + EDD038C99EEC86DB1BE3B28B /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + F7164CC8571D465E673C3626 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -83,7 +83,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 9EB122AD19AB87EF9A455AE0 /* Pods_Runner.framework in Frameworks */, + 162296CB6507E7D2B29D6854 /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -91,7 +91,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - B0857128DF1F6A49AC8F8B45 /* Pods_Runner_RunnerUITests.framework in Frameworks */, + 735C0DEADB7AD63E83BA5F87 /* Pods_Runner_RunnerUITests.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -108,12 +108,12 @@ 71514460146D120DA8711EC5 /* Pods */ = { isa = PBXGroup; children = ( - 21A84891CCDF0395C677C1FA /* Pods-Runner.debug.xcconfig */, - D4B72E459E8D5DA38685313A /* Pods-Runner.release.xcconfig */, - 75273ABBA75A9DB827CA72CB /* Pods-Runner.profile.xcconfig */, - C936D69C8587B6EF0FDCEC12 /* Pods-Runner-RunnerUITests.debug.xcconfig */, - 437B59E3AFD5588395844415 /* Pods-Runner-RunnerUITests.release.xcconfig */, - 61EF0D45B2EFB3231A29904D /* Pods-Runner-RunnerUITests.profile.xcconfig */, + F7164CC8571D465E673C3626 /* Pods-Runner.debug.xcconfig */, + 17DC028A3CF64A70DB51B652 /* Pods-Runner.release.xcconfig */, + 6C9F904E13C17E9E13E86FE0 /* Pods-Runner.profile.xcconfig */, + 79FE376A55F9C7A8275AA39F /* Pods-Runner-RunnerUITests.debug.xcconfig */, + 578A1CD38833007246EDDCC8 /* Pods-Runner-RunnerUITests.release.xcconfig */, + 8EC67D1D3AB2F72F65370373 /* Pods-Runner-RunnerUITests.profile.xcconfig */, ); path = Pods; sourceTree = ""; @@ -138,7 +138,7 @@ 9862560329F9A72100B267FA /* RunnerTests */, 97C146EF1CF9000F007C117D /* Products */, 71514460146D120DA8711EC5 /* Pods */, - A9EDE3A914EB8EA7657CFA4E /* Frameworks */, + DC5B5B2AC4D12BB8678F076E /* Frameworks */, ); sourceTree = ""; }; @@ -184,11 +184,11 @@ path = RunnerTests; sourceTree = ""; }; - A9EDE3A914EB8EA7657CFA4E /* Frameworks */ = { + DC5B5B2AC4D12BB8678F076E /* Frameworks */ = { isa = PBXGroup; children = ( - 6BC3560B4830BA000C071318 /* Pods_Runner.framework */, - 54E01A95706666750AB61B42 /* Pods_Runner_RunnerUITests.framework */, + EDD038C99EEC86DB1BE3B28B /* Pods_Runner.framework */, + 70AA43B9B4C80C1C97015E37 /* Pods_Runner_RunnerUITests.framework */, ); name = Frameworks; sourceTree = ""; @@ -200,14 +200,14 @@ isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( - 5C9D315B699EF318EC999391 /* [CP] Check Pods Manifest.lock */, + 91316CBA1E46E86DE7A4FB9D /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* xcode_backend build */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* xcode_backend embed_and_thin */, - 99630BC56F6B45CF3ED3670B /* [CP] Embed Pods Frameworks */, + 4BAB6BE95CF298CED1206D94 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -222,13 +222,13 @@ isa = PBXNativeTarget; buildConfigurationList = 983964E12978A956007EB76F /* Build configuration list for PBXNativeTarget "RunnerUITests" */; buildPhases = ( - 48CC73F6B1992D6DD8140860 /* [CP] Check Pods Manifest.lock */, + 57A729EC2F3211B458286925 /* [CP] Check Pods Manifest.lock */, 983964E62978A9F4007EB76F /* xcode_backend build */, 983964D52978A956007EB76F /* Sources */, 983964D62978A956007EB76F /* Frameworks */, 983964D72978A956007EB76F /* Resources */, 983964E52978A9D4007EB76F /* xcode_backend embed_and_thin */, - 43FE5AEE72206FD010751A9E /* [CP] Embed Pods Frameworks */, + B778A6D350303A188769B23C /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -346,24 +346,24 @@ shellPath = /bin/sh; shellScript = "echo \"Runner xcode_backend embed_and_thin\"\n/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin\n"; }; - 43FE5AEE72206FD010751A9E /* [CP] Embed Pods Frameworks */ = { + 4BAB6BE95CF298CED1206D94 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner-RunnerUITests/Pods-Runner-RunnerUITests-frameworks-${CONFIGURATION}-input-files.xcfilelist", + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", ); name = "[CP] Embed Pods Frameworks"; outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner-RunnerUITests/Pods-Runner-RunnerUITests-frameworks-${CONFIGURATION}-output-files.xcfilelist", + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner-RunnerUITests/Pods-Runner-RunnerUITests-frameworks.sh\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - 48CC73F6B1992D6DD8140860 /* [CP] Check Pods Manifest.lock */ = { + 57A729EC2F3211B458286925 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -385,7 +385,7 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - 5C9D315B699EF318EC999391 /* [CP] Check Pods Manifest.lock */ = { + 91316CBA1E46E86DE7A4FB9D /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -457,21 +457,21 @@ shellPath = /bin/sh; shellScript = "echo \"RunnerUITests xcode_backend build\"\n/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build\n"; }; - 99630BC56F6B45CF3ED3670B /* [CP] Embed Pods Frameworks */ = { + B778A6D350303A188769B23C /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + "${PODS_ROOT}/Target Support Files/Pods-Runner-RunnerUITests/Pods-Runner-RunnerUITests-frameworks-${CONFIGURATION}-input-files.xcfilelist", ); name = "[CP] Embed Pods Frameworks"; outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + "${PODS_ROOT}/Target Support Files/Pods-Runner-RunnerUITests/Pods-Runner-RunnerUITests-frameworks-${CONFIGURATION}-output-files.xcfilelist", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner-RunnerUITests/Pods-Runner-RunnerUITests-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -578,7 +578,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 14.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -656,7 +656,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 14.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -705,7 +705,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 14.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; diff --git a/dev/e2e_app/lib/permissions_screen.dart b/dev/e2e_app/lib/permissions_screen.dart index 4c069e1b2..4a1ca5711 100644 --- a/dev/e2e_app/lib/permissions_screen.dart +++ b/dev/e2e_app/lib/permissions_screen.dart @@ -13,7 +13,7 @@ class PermissionsScreen extends StatefulWidget { class _PermissionsScreenState extends State { bool _cameraPermissionGranted = false; bool _microphonePermissionGranted = false; - bool _contactsPermissionGranted = false; + bool _locationPermissionGranted = false; Future _requestCameraPermission() async { await Future.delayed(Duration(seconds: 1)); @@ -31,10 +31,10 @@ class _PermissionsScreenState extends State { }); } - Future _requestContactsPermission() async { - final status = await Permission.contacts.request(); + Future _requestLocationPermission() async { + final status = await Permission.location.request(); setState(() { - _contactsPermissionGranted = status == PermissionStatus.granted; + _locationPermissionGranted = status == PermissionStatus.granted; }); } @@ -61,6 +61,15 @@ class _PermissionsScreenState extends State { }, ), ); + unawaited( + Permission.location.status.then( + (value) { + setState(() { + _locationPermissionGranted = value == PermissionStatus.granted; + }); + }, + ), + ); } @override @@ -85,10 +94,10 @@ class _PermissionsScreenState extends State { onTap: _requestMicrophonePermission, ), _PermissionTile( - name: 'Contacts', - icon: Icons.people, - granted: _contactsPermissionGranted, - onTap: _requestContactsPermission, + name: 'Location', + icon: Icons.pin_drop, + granted: _locationPermissionGranted, + onTap: _requestLocationPermission, ), ], ), diff --git a/packages/patrol/darwin/Classes/PatrolIntegrationTestIosRunner.h b/packages/patrol/darwin/Classes/PatrolIntegrationTestIosRunner.h index 7e4ff898f..64b92096f 100644 --- a/packages/patrol/darwin/Classes/PatrolIntegrationTestIosRunner.h +++ b/packages/patrol/darwin/Classes/PatrolIntegrationTestIosRunner.h @@ -60,9 +60,6 @@ if (@available(iOS 15.0, *)) { \ [app resetAuthorizationStatusForResource:XCUIProtectedResourceUserTracking]; \ [app resetAuthorizationStatusForResource:XCUIProtectedResourceFocus]; \ - [app resetAuthorizationStatusForResource:XCUIProtectedResourceRemovableVolumes]; \ - [app resetAuthorizationStatusForResource:XCUIProtectedResourceNetworkVolumes]; \ - [app resetAuthorizationStatusForResource:XCUIProtectedResourceAppleEvents]; \ } \ if (@available(iOS 15.4, *)) { \ [app resetAuthorizationStatusForResource:XCUIProtectedResourceLocalNetwork]; \ From 2d8ff596fd9016449e610377b209544768d821d9 Mon Sep 17 00:00:00 2001 From: piotruela Date: Tue, 29 Oct 2024 19:34:50 +0100 Subject: [PATCH 09/16] Add clear-permissions flag to ios commands --- .../Classes/PatrolIntegrationTestIosRunner.h | 149 +++++++++++++++++- .../lib/src/commands/build_ios.dart | 1 + .../patrol_cli/lib/src/commands/test.dart | 1 + .../lib/src/crossplatform/app_options.dart | 4 + .../lib/src/runner/patrol_command.dart | 17 +- 5 files changed, 166 insertions(+), 6 deletions(-) diff --git a/packages/patrol/darwin/Classes/PatrolIntegrationTestIosRunner.h b/packages/patrol/darwin/Classes/PatrolIntegrationTestIosRunner.h index 64b92096f..49c0fc23b 100644 --- a/packages/patrol/darwin/Classes/PatrolIntegrationTestIosRunner.h +++ b/packages/patrol/darwin/Classes/PatrolIntegrationTestIosRunner.h @@ -9,6 +9,7 @@ // For every Flutter dart test, dynamically generate an Objective-C method mirroring the test results // so it is reported as a native XCTest run result. +#ifdef CLEAR_PERMISSIONS #define PATROL_INTEGRATION_TEST_IOS_RUNNER(__test_class) \ @interface __test_class : XCTestCase \ @property(class, strong, nonatomic) NSDictionary *selectedTest; \ @@ -40,6 +41,7 @@ } \ \ +(void)resetPermissions { \ + NSLog(@"Clearing permissions"); \ XCUIApplication *app = [[XCUIApplication alloc] init]; \ if (@available(iOS 13.4, *)) { \ [app resetAuthorizationStatusForResource:XCUIProtectedResourceLocation]; \ @@ -67,6 +69,7 @@ } \ \ +(NSArray *)testInvocations { \ + NSLog(@"Running tests with clearing permissions"); \ /* Start native automation server */ \ PatrolServer *server = [[PatrolServer alloc] init]; \ \ @@ -176,4 +179,148 @@ return invocations; \ } \ \ - @end\ +@end +#else +#define PATROL_INTEGRATION_TEST_IOS_RUNNER(__test_class) \ + @interface __test_class : XCTestCase \ + @property(class, strong, nonatomic) NSDictionary *selectedTest; \ + @end \ + \ + @implementation __test_class \ + \ + static NSDictionary *_selectedTest = nil; \ + \ + +(NSDictionary *)selectedTest { \ + return _selectedTest; \ + } \ + \ + +(void)setSelectedTest : (NSDictionary *)newSelectedTest { \ + if (newSelectedTest != _selectedTest) { \ + _selectedTest = [newSelectedTest copy]; \ + } \ + } \ + \ + +(BOOL)instancesRespondToSelector : (SEL)aSelector { \ + NSString *name = NSStringFromSelector(aSelector); \ + BOOL skip = NO; \ + NSDictionary *testInfo = @{@"name" : name, @"skip" : @(skip)}; \ + [self setSelectedTest:testInfo]; \ + \ + [self defaultTestSuite]; /* calls testInvocations */ \ + BOOL result = [super instancesRespondToSelector:aSelector]; \ + return true; \ + } \ + \ + \ + +(NSArray *)testInvocations { \ + NSLog(@"Running tests without clearing permissions"); \ + /* Start native automation server */ \ + PatrolServer *server = [[PatrolServer alloc] init]; \ + \ + NSError *_Nullable __autoreleasing *_Nullable err = NULL; \ + [server startAndReturnError:err]; \ + if (err != NULL) { \ + NSLog(@"patrolServer.start(): failed, err: %@", err); \ + } \ + \ + /* Create a client for PatrolAppService, which lets us list and run Dart tests */ \ + __block ObjCPatrolAppServiceClient *appServiceClient = [[ObjCPatrolAppServiceClient alloc] init]; \ + \ + /* Allow the Local Network permission required by Dart Observatory */ \ + XCUIApplication *springboard = [[XCUIApplication alloc] initWithBundleIdentifier:@"com.apple.springboard"]; \ + XCUIElementQuery *systemAlerts = springboard.alerts; \ + if (systemAlerts.buttons[@"Allow"].exists) { \ + [systemAlerts.buttons[@"Allow"] tap]; \ + } \ + \ + __block NSArray *dartTests = NULL; \ + if ([self selectedTest] != nil) { \ + NSLog(@"selectedTest: %@", [self selectedTest]); \ + dartTests = [NSArray arrayWithObject:[self selectedTest]]; \ + } else { \ + /* Run the app for the first time to gather Dart tests */ \ + [[[XCUIApplication alloc] init] launch]; \ + /* Spin the runloop waiting until the app reports that it is ready to report Dart tests */ \ + while (!server.appReady) { \ + [NSRunLoop.currentRunLoop runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1.0]]; \ + } \ + [appServiceClient \ + listDartTestsWithCompletion:^(NSArray *_Nullable tests, NSError *_Nullable err) { \ + if (err != NULL) { \ + NSLog(@"listDartTests(): failed, err: %@", err); \ + } \ + \ + dartTests = tests; \ + }]; \ + \ + /* Spin the runloop waiting until the app reports the Dart tests it contains */ \ + while (!dartTests) { \ + [NSRunLoop.currentRunLoop runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1.0]]; \ + } \ + \ + NSLog(@"Got %lu Dart tests: %@", dartTests.count, dartTests); \ + } \ + \ + NSMutableArray *invocations = [[NSMutableArray alloc] init]; \ + \ + /** \ + * Once Dart tests are available, we: \ + * \ + * Step 1. Dynamically add test case methods that request execution of an individual Dart test file. \ + * \ + * Step 2. Create invocations to the generated methods and return them \ + */ \ + \ + for (NSDictionary * dartTest in dartTests) { \ + /* Step 1 - dynamically create test cases */ \ + NSString *dartTestName = dartTest[@"name"]; \ + BOOL skip = [dartTest[@"skip"] boolValue]; \ + \ + IMP implementation = imp_implementationWithBlock(^(id _self) { \ + [[[XCUIApplication alloc] init] launch]; \ + if (skip) { \ + XCTSkip(@"Skip that test \"%@\"", dartTestName); \ + } \ + \ + __block ObjCRunDartTestResponse *response = NULL; \ + __block NSError *error; \ + [appServiceClient \ + runDartTestWithName:dartTestName \ + completion:^(ObjCRunDartTestResponse *_Nullable r, NSError *_Nullable err) { \ + NSString *status; \ + if (err != NULL) { \ + error = err; \ + status = @"CRASHED"; \ + } else { \ + response = r; \ + status = response.passed ? @"PASSED" : @"FAILED"; \ + } \ + NSLog(@"runDartTest(\"%@\"): call finished, test result: %@", dartTestName, status); \ + }]; \ + \ + /* Wait until Dart test finishes (either fails or passes) or crashes */ \ + while (!response && !error) { \ + [NSRunLoop.currentRunLoop runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1.0]]; \ + } \ + BOOL passed = response ? response.passed : NO; \ + NSString *details = response ? response.details : @"(no details - app likely crashed)"; \ + XCTAssertTrue(passed, @"%@", details); \ + }); \ + SEL selector = NSSelectorFromString(dartTestName); \ + class_addMethod(self, selector, implementation, "v@:"); \ + \ + /* Step 2 – create invocations to the dynamically created methods */ \ + NSMethodSignature *signature = [self instanceMethodSignatureForSelector:selector]; \ + NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature]; \ + invocation.selector = selector; \ + \ + NSLog(@"RunnerUITests.testInvocations(): selectorName = %@, signature: %@", dartTestName, signature); \ + \ + [invocations addObject:invocation]; \ + } \ + \ + return invocations; \ + } \ + \ +@end +#endif diff --git a/packages/patrol_cli/lib/src/commands/build_ios.dart b/packages/patrol_cli/lib/src/commands/build_ios.dart index ce5f11715..2fa643fad 100644 --- a/packages/patrol_cli/lib/src/commands/build_ios.dart +++ b/packages/patrol_cli/lib/src/commands/build_ios.dart @@ -157,6 +157,7 @@ class BuildIOSCommand extends PatrolCommand { simulator: boolArg('simulator'), appServerPort: super.appServerPort, testServerPort: super.testServerPort, + clearPermissions: boolArg('clear-permissions'), ); try { diff --git a/packages/patrol_cli/lib/src/commands/test.dart b/packages/patrol_cli/lib/src/commands/test.dart index 506707223..acde73363 100644 --- a/packages/patrol_cli/lib/src/commands/test.dart +++ b/packages/patrol_cli/lib/src/commands/test.dart @@ -233,6 +233,7 @@ See https://github.com/leancodepl/patrol/issues/1316 to learn more. simulator: !device.real, appServerPort: super.appServerPort, testServerPort: super.testServerPort, + clearPermissions: boolArg('clear-permissions'), ); final macosOpts = MacOSAppOptions( diff --git a/packages/patrol_cli/lib/src/crossplatform/app_options.dart b/packages/patrol_cli/lib/src/crossplatform/app_options.dart index 83bfa9664..dfbc7e6ca 100644 --- a/packages/patrol_cli/lib/src/crossplatform/app_options.dart +++ b/packages/patrol_cli/lib/src/crossplatform/app_options.dart @@ -148,6 +148,7 @@ class IOSAppOptions { required this.simulator, required this.appServerPort, required this.testServerPort, + this.clearPermissions = false, }); final FlutterAppOptions flutter; @@ -157,6 +158,7 @@ class IOSAppOptions { final bool simulator; final int appServerPort; final int testServerPort; + final bool clearPermissions; String get description { final platform = simulator ? 'simulator' : 'device'; @@ -208,6 +210,8 @@ class IOSAppOptions { '-quiet', ...['-derivedDataPath', '../build/ios_integ'], r'OTHER_SWIFT_FLAGS=$(inherited) -D PATROL_ENABLED', + if (clearPermissions) + r'GCC_PREPROCESSOR_DEFINITIONS=$(inherited) CLEAR_PERMISSIONS=1', ]; return cmd; diff --git a/packages/patrol_cli/lib/src/runner/patrol_command.dart b/packages/patrol_cli/lib/src/runner/patrol_command.dart index 8b0b08396..1f717ecce 100644 --- a/packages/patrol_cli/lib/src/runner/patrol_command.dart +++ b/packages/patrol_cli/lib/src/runner/patrol_command.dart @@ -156,11 +156,18 @@ abstract class PatrolCommand extends Command { } void usesIOSOptions() { - argParser.addOption( - 'bundle-id', - help: 'Bundle identifier of the iOS app under test.', - valueHelp: 'pl.leancode.AwesomeApp', - ); + argParser + ..addOption( + 'bundle-id', + help: 'Bundle identifier of the iOS app under test.', + valueHelp: 'pl.leancode.AwesomeApp', + ) + ..addFlag( + 'clear-permissions', + help: + '*Experimental* Clear permissions available through XCUIProtectedResource API before running each test.', + negatable: false, + ); } void usesMacOSOptions() { From e4e7b5f73d4ba5025f1ab9f57c8fce23714180de Mon Sep 17 00:00:00 2001 From: piotruela Date: Tue, 29 Oct 2024 19:50:07 +0100 Subject: [PATCH 10/16] Format macro code --- .../darwin/Classes/PatrolIntegrationTestIosRunner.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/patrol/darwin/Classes/PatrolIntegrationTestIosRunner.h b/packages/patrol/darwin/Classes/PatrolIntegrationTestIosRunner.h index 49c0fc23b..2e84edd86 100644 --- a/packages/patrol/darwin/Classes/PatrolIntegrationTestIosRunner.h +++ b/packages/patrol/darwin/Classes/PatrolIntegrationTestIosRunner.h @@ -166,7 +166,7 @@ SEL selector = NSSelectorFromString(dartTestName); \ class_addMethod(self, selector, implementation, "v@:"); \ \ - /* Step 2 – create invocations to the dynamically created methods */ \ + /* Step 2 – create invocations to the dynamically created methods */ \ NSMethodSignature *signature = [self instanceMethodSignatureForSelector:selector]; \ NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature]; \ invocation.selector = selector; \ @@ -179,7 +179,7 @@ return invocations; \ } \ \ -@end + @end #else #define PATROL_INTEGRATION_TEST_IOS_RUNNER(__test_class) \ @interface __test_class : XCTestCase \ @@ -211,7 +211,6 @@ return true; \ } \ \ - \ +(NSArray *)testInvocations { \ NSLog(@"Running tests without clearing permissions"); \ /* Start native automation server */ \ @@ -309,7 +308,7 @@ SEL selector = NSSelectorFromString(dartTestName); \ class_addMethod(self, selector, implementation, "v@:"); \ \ - /* Step 2 – create invocations to the dynamically created methods */ \ + /* Step 2 – create invocations to the dynamically created methods */ \ NSMethodSignature *signature = [self instanceMethodSignatureForSelector:selector]; \ NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature]; \ invocation.selector = selector; \ @@ -322,5 +321,5 @@ return invocations; \ } \ \ -@end + @end #endif From 0800f4ec5f5c19e6f613a6a390e65ad3fb99bea4 Mon Sep 17 00:00:00 2001 From: piotruela Date: Tue, 29 Oct 2024 20:00:23 +0100 Subject: [PATCH 11/16] Add changelog entry --- packages/patrol/CHANGELOG.md | 4 ++++ .../patrol/darwin/Classes/PatrolIntegrationTestIosRunner.h | 4 ++-- packages/patrol_cli/CHANGELOG.md | 4 ++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/patrol/CHANGELOG.md b/packages/patrol/CHANGELOG.md index 890ad9cb4..c70ac7ef8 100644 --- a/packages/patrol/CHANGELOG.md +++ b/packages/patrol/CHANGELOG.md @@ -1,3 +1,7 @@ +## Unreleased + +- Add `clear-permissions` flag on ios commands. (#2367) + ## 3.11.2 - Bump min Flutter SDK to 3.24.0 and Dart SDK to 3.5.0 (#2371) diff --git a/packages/patrol/darwin/Classes/PatrolIntegrationTestIosRunner.h b/packages/patrol/darwin/Classes/PatrolIntegrationTestIosRunner.h index 2e84edd86..7b7cbd1ed 100644 --- a/packages/patrol/darwin/Classes/PatrolIntegrationTestIosRunner.h +++ b/packages/patrol/darwin/Classes/PatrolIntegrationTestIosRunner.h @@ -166,7 +166,7 @@ SEL selector = NSSelectorFromString(dartTestName); \ class_addMethod(self, selector, implementation, "v@:"); \ \ - /* Step 2 – create invocations to the dynamically created methods */ \ + /* Step 2 – create invocations to the dynamically created methods */ \ NSMethodSignature *signature = [self instanceMethodSignatureForSelector:selector]; \ NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature]; \ invocation.selector = selector; \ @@ -308,7 +308,7 @@ SEL selector = NSSelectorFromString(dartTestName); \ class_addMethod(self, selector, implementation, "v@:"); \ \ - /* Step 2 – create invocations to the dynamically created methods */ \ + /* Step 2 – create invocations to the dynamically created methods */ \ NSMethodSignature *signature = [self instanceMethodSignatureForSelector:selector]; \ NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature]; \ invocation.selector = selector; \ diff --git a/packages/patrol_cli/CHANGELOG.md b/packages/patrol_cli/CHANGELOG.md index 07595853d..5b50b3c3b 100644 --- a/packages/patrol_cli/CHANGELOG.md +++ b/packages/patrol_cli/CHANGELOG.md @@ -1,3 +1,7 @@ +## Unreleased + +- Add `clear-permissions` flag on ios commands. (#2367) + ## 3.2.1 - Allow running Patrol tests from any subfolder of the project (#2351) From b59aaa35d45b745cea2a810dc7dc304068f37d63 Mon Sep 17 00:00:00 2001 From: piotruela Date: Sun, 3 Nov 2024 15:59:04 +0100 Subject: [PATCH 12/16] Do not mark clear-permissions as experimental --- packages/patrol_cli/lib/src/runner/patrol_command.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/patrol_cli/lib/src/runner/patrol_command.dart b/packages/patrol_cli/lib/src/runner/patrol_command.dart index 1f717ecce..c3fcf28ee 100644 --- a/packages/patrol_cli/lib/src/runner/patrol_command.dart +++ b/packages/patrol_cli/lib/src/runner/patrol_command.dart @@ -165,7 +165,7 @@ abstract class PatrolCommand extends Command { ..addFlag( 'clear-permissions', help: - '*Experimental* Clear permissions available through XCUIProtectedResource API before running each test.', + 'Clear permissions available through XCUIProtectedResource API before running each test.', negatable: false, ); } From 66c101830a24b21be8569bb3a556c8f9568287f3 Mon Sep 17 00:00:00 2001 From: piotruela Date: Sun, 3 Nov 2024 16:05:38 +0100 Subject: [PATCH 13/16] Refactor permissions tests to test location permission --- .../permissions/deny_many_permissions_twice_test.dart | 10 +++++----- .../permissions/permissions_many_test.dart | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/dev/e2e_app/integration_test/permissions/deny_many_permissions_twice_test.dart b/dev/e2e_app/integration_test/permissions/deny_many_permissions_twice_test.dart index 43da27d22..a86d2f14b 100644 --- a/dev/e2e_app/integration_test/permissions/deny_many_permissions_twice_test.dart +++ b/dev/e2e_app/integration_test/permissions/deny_many_permissions_twice_test.dart @@ -16,8 +16,8 @@ void main() { await _requestAndDenyMicrophonePermission($); await _requestAndDenyMicrophonePermission($); - await _requestAndDenyContactsPermission($); - await _requestAndDenyContactsPermission($); + await _requestAndDenyLocationPermission($); + await _requestAndDenyLocationPermission($); }); } @@ -49,11 +49,11 @@ Future _requestAndDenyMicrophonePermission( expect($(#microphone).$(#statusText).text, 'Not granted'); } -Future _requestAndDenyContactsPermission( +Future _requestAndDenyLocationPermission( PatrolIntegrationTester $, ) async { if (!await Permission.contacts.isGranted) { - expect($(#contacts).$(#statusText).text, 'Not granted'); + expect($(#location).$(#statusText).text, 'Not granted'); await $('Request contacts permission').tap(); if (await $.native.isPermissionDialogVisible(timeout: _timeout)) { await $.native.denyPermission(); @@ -61,5 +61,5 @@ Future _requestAndDenyContactsPermission( } } - expect($(#contacts).$(#statusText).text, 'Not granted'); + expect($(#location).$(#statusText).text, 'Not granted'); } diff --git a/dev/e2e_app/integration_test/permissions/permissions_many_test.dart b/dev/e2e_app/integration_test/permissions/permissions_many_test.dart index f0a3a3b1d..6beff8906 100644 --- a/dev/e2e_app/integration_test/permissions/permissions_many_test.dart +++ b/dev/e2e_app/integration_test/permissions/permissions_many_test.dart @@ -12,7 +12,7 @@ void main() { await _requestAndGrantCameraPermission($); await _requestAndGrantMicrophonePermission($); - await _requestAndDenyContactsPermission($); + await _requestAndDenyLocationPermission($); }); } @@ -44,11 +44,11 @@ Future _requestAndGrantMicrophonePermission( expect($(#microphone).$(#statusText).text, 'Granted'); } -Future _requestAndDenyContactsPermission( +Future _requestAndDenyLocationPermission( PatrolIntegrationTester $, ) async { - if (!await Permission.contacts.isGranted) { - expect($(#contacts).$(#statusText).text, 'Not granted'); + if (!await Permission.location.isGranted) { + expect($(#location).$(#statusText).text, 'Not granted'); await $('Request contacts permission').tap(); if (await $.native.isPermissionDialogVisible(timeout: _timeout)) { await $.native.denyPermission(); @@ -56,5 +56,5 @@ Future _requestAndDenyContactsPermission( } } - expect($(#contacts).$(#statusText).text, 'Not granted'); + expect($(#location).$(#statusText).text, 'Not granted'); } From a88afacb6c965db341cde9f2fd214c909bf9a966 Mon Sep 17 00:00:00 2001 From: piotruela Date: Sun, 3 Nov 2024 18:54:39 +0100 Subject: [PATCH 14/16] Fix permission tests --- .github/workflows/test-ios-simulator.yaml | 2 +- .../permissions/deny_many_permissions_twice_test.dart | 4 ++-- .../integration_test/permissions/permissions_many_test.dart | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-ios-simulator.yaml b/.github/workflows/test-ios-simulator.yaml index 44e24984a..594b73631 100644 --- a/.github/workflows/test-ios-simulator.yaml +++ b/.github/workflows/test-ios-simulator.yaml @@ -104,7 +104,7 @@ jobs: sleep 10 # See https://github.com/leancodepl/patrol/issues/1282 TESTS_EXIT_CODE=0 - patrol test --exclude ${{ env.EXCLUDED_TESTS }} --verbose || TESTS_EXIT_CODE=$? + patrol test --exclude ${{ env.EXCLUDED_TESTS }} --verbose --clear-permissions || TESTS_EXIT_CODE=$? kill -SIGINT $recordingpid kill -SIGINT $logpid diff --git a/dev/e2e_app/integration_test/permissions/deny_many_permissions_twice_test.dart b/dev/e2e_app/integration_test/permissions/deny_many_permissions_twice_test.dart index a86d2f14b..66233a29d 100644 --- a/dev/e2e_app/integration_test/permissions/deny_many_permissions_twice_test.dart +++ b/dev/e2e_app/integration_test/permissions/deny_many_permissions_twice_test.dart @@ -52,9 +52,9 @@ Future _requestAndDenyMicrophonePermission( Future _requestAndDenyLocationPermission( PatrolIntegrationTester $, ) async { - if (!await Permission.contacts.isGranted) { + if (!await Permission.location.isGranted) { expect($(#location).$(#statusText).text, 'Not granted'); - await $('Request contacts permission').tap(); + await $('Request location permission').tap(); if (await $.native.isPermissionDialogVisible(timeout: _timeout)) { await $.native.denyPermission(); await $.pump(); diff --git a/dev/e2e_app/integration_test/permissions/permissions_many_test.dart b/dev/e2e_app/integration_test/permissions/permissions_many_test.dart index 6beff8906..f50d8de85 100644 --- a/dev/e2e_app/integration_test/permissions/permissions_many_test.dart +++ b/dev/e2e_app/integration_test/permissions/permissions_many_test.dart @@ -49,7 +49,7 @@ Future _requestAndDenyLocationPermission( ) async { if (!await Permission.location.isGranted) { expect($(#location).$(#statusText).text, 'Not granted'); - await $('Request contacts permission').tap(); + await $('Request location permission').tap(); if (await $.native.isPermissionDialogVisible(timeout: _timeout)) { await $.native.denyPermission(); await $.pump(); From c0edb8ff185768b027bddbeb5ae58d37006cb134 Mon Sep 17 00:00:00 2001 From: piotruela Date: Tue, 5 Nov 2024 15:58:26 +0100 Subject: [PATCH 15/16] Prepare patrol 3.12.0 and patrol_cli 3.3.0 for release --- docs/compatibility-table.mdx | 3 ++- packages/patrol/CHANGELOG.md | 2 +- packages/patrol/pubspec.yaml | 2 +- packages/patrol_cli/CHANGELOG.md | 2 +- packages/patrol_cli/lib/src/base/constants.dart | 2 +- .../src/compatibility_checker/compatibility_checker.dart | 8 ++++++++ packages/patrol_cli/pubspec.yaml | 2 +- 7 files changed, 15 insertions(+), 6 deletions(-) diff --git a/docs/compatibility-table.mdx b/docs/compatibility-table.mdx index 9030baefa..900869446 100644 --- a/docs/compatibility-table.mdx +++ b/docs/compatibility-table.mdx @@ -13,7 +13,8 @@ the table below to assess which version you should use. | patrol_cli | patrol | | -------------- | -------------- | -| 3.2.1 - | 3.11.2 - | +| 3.3.0+ | 3.12.0+ | +| 3.2.1 | 3.11.2 | | 3.2.0 | 3.11.0 - 3.11.1| | 3.1.0 - 3.1.1 | 3.10.0 | | 2.6.5 - 3.0.1 | 3.6.0 - 3.10.0 | diff --git a/packages/patrol/CHANGELOG.md b/packages/patrol/CHANGELOG.md index c70ac7ef8..27e0eba3a 100644 --- a/packages/patrol/CHANGELOG.md +++ b/packages/patrol/CHANGELOG.md @@ -1,4 +1,4 @@ -## Unreleased +## 3.12.0 - Add `clear-permissions` flag on ios commands. (#2367) diff --git a/packages/patrol/pubspec.yaml b/packages/patrol/pubspec.yaml index ccb6bd7d2..a36c2d895 100644 --- a/packages/patrol/pubspec.yaml +++ b/packages/patrol/pubspec.yaml @@ -2,7 +2,7 @@ name: patrol description: > Powerful Flutter-native UI testing framework overcoming limitations of existing Flutter testing tools. Ready for action! -version: 3.11.2 +version: 3.12.0 homepage: https://patrol.leancode.co repository: https://github.com/leancodepl/patrol/tree/master/packages/patrol issue_tracker: https://github.com/leancodepl/patrol/issues diff --git a/packages/patrol_cli/CHANGELOG.md b/packages/patrol_cli/CHANGELOG.md index 5b50b3c3b..01a9f3c92 100644 --- a/packages/patrol_cli/CHANGELOG.md +++ b/packages/patrol_cli/CHANGELOG.md @@ -1,4 +1,4 @@ -## Unreleased +## 3.3.0 - Add `clear-permissions` flag on ios commands. (#2367) diff --git a/packages/patrol_cli/lib/src/base/constants.dart b/packages/patrol_cli/lib/src/base/constants.dart index 54be515e4..34fa1e61e 100644 --- a/packages/patrol_cli/lib/src/base/constants.dart +++ b/packages/patrol_cli/lib/src/base/constants.dart @@ -1,3 +1,3 @@ /// Version of Patrol CLI. Must be kept in sync with pubspec.yaml. /// If you update this, make sure that compatibility-table.mdx is updated (if needed) -const version = '3.2.1'; +const version = '3.3.0'; diff --git a/packages/patrol_cli/lib/src/compatibility_checker/compatibility_checker.dart b/packages/patrol_cli/lib/src/compatibility_checker/compatibility_checker.dart index c8041f83c..212548e51 100644 --- a/packages/patrol_cli/lib/src/compatibility_checker/compatibility_checker.dart +++ b/packages/patrol_cli/lib/src/compatibility_checker/compatibility_checker.dart @@ -207,6 +207,10 @@ final _patrolVersionRange = [ ), VersionRange( min: Version.parse('3.11.2'), + max: Version.parse('3.11.2'), + ), + VersionRange( + min: Version.parse('3.12.0'), ), ]; @@ -249,5 +253,9 @@ final _patrolCliVersionRange = [ ), VersionRange( min: Version.parse('3.2.1'), + max: Version.parse('3.2.1'), + ), + VersionRange( + min: Version.parse('3.3.0'), ), ]; diff --git a/packages/patrol_cli/pubspec.yaml b/packages/patrol_cli/pubspec.yaml index 769d04a83..a2341aa77 100644 --- a/packages/patrol_cli/pubspec.yaml +++ b/packages/patrol_cli/pubspec.yaml @@ -1,7 +1,7 @@ name: patrol_cli description: > Command-line tool for Patrol, a powerful Flutter-native UI testing framework. -version: 3.2.1 # Must be kept in sync with constants.dart +version: 3.3.0 # Must be kept in sync with constants.dart homepage: https://patrol.leancode.co repository: https://github.com/leancodepl/patrol/tree/master/packages/patrol_cli issue_tracker: https://github.com/leancodepl/patrol/issues?q=is%3Aopen+is%3Aissue+label%3A%22package%3A+patrol_cli%22 From ea6b0cf7122f96bcd1ef0851cc6c716a8749a881 Mon Sep 17 00:00:00 2001 From: piotruela Date: Tue, 5 Nov 2024 16:01:52 +0100 Subject: [PATCH 16/16] Add version requirements to changelogs --- packages/patrol/CHANGELOG.md | 2 ++ packages/patrol_cli/CHANGELOG.md | 2 ++ 2 files changed, 4 insertions(+) diff --git a/packages/patrol/CHANGELOG.md b/packages/patrol/CHANGELOG.md index 27e0eba3a..558d216f1 100644 --- a/packages/patrol/CHANGELOG.md +++ b/packages/patrol/CHANGELOG.md @@ -2,6 +2,8 @@ - Add `clear-permissions` flag on ios commands. (#2367) +This version requires version 3.3.0 of `patrol_cli` package. + ## 3.11.2 - Bump min Flutter SDK to 3.24.0 and Dart SDK to 3.5.0 (#2371) diff --git a/packages/patrol_cli/CHANGELOG.md b/packages/patrol_cli/CHANGELOG.md index 01a9f3c92..b94636c57 100644 --- a/packages/patrol_cli/CHANGELOG.md +++ b/packages/patrol_cli/CHANGELOG.md @@ -2,6 +2,8 @@ - Add `clear-permissions` flag on ios commands. (#2367) +This version requires version 3.12.0 of `patrol` package. + ## 3.2.1 - Allow running Patrol tests from any subfolder of the project (#2351)