From a070223e0ef43be8dd54d16ee3e3b96603ad5f3a Mon Sep 17 00:00:00 2001 From: Mykola Mokhnach Date: Thu, 8 Jun 2023 19:31:31 +0000 Subject: [PATCH] chore: Disable automatic screen recording by default (#726) --- WebDriverAgentLib/Utilities/FBConfiguration.h | 6 +++++- WebDriverAgentLib/Utilities/FBConfiguration.m | 10 ++++++++++ WebDriverAgentRunner/UITestingUITests.m | 5 +++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/WebDriverAgentLib/Utilities/FBConfiguration.h b/WebDriverAgentLib/Utilities/FBConfiguration.h index 7bfbccc43..bcb341a8d 100644 --- a/WebDriverAgentLib/Utilities/FBConfiguration.h +++ b/WebDriverAgentLib/Utilities/FBConfiguration.h @@ -49,10 +49,14 @@ extern NSString *const FBSnapshotMaxDepthKey; /*! Disables XCTest automated screenshots taking */ + (void)disableScreenshots; - /*! Enables XCTest automated screenshots taking */ + (void)enableScreenshots; +/*! Disables XCTest automated videos taking (iOS 17+) */ ++ (void)disableScreenRecordings; +/*! Enables XCTest automated videos taking (iOS 17+) */ ++ (void)enableScreenRecordings; + /* The maximum typing frequency for all typing activities */ + (void)setMaxTypingFrequency:(NSUInteger)value; + (NSUInteger)maxTypingFrequency; diff --git a/WebDriverAgentLib/Utilities/FBConfiguration.m b/WebDriverAgentLib/Utilities/FBConfiguration.m index 1c80e5498..f99c9d148 100644 --- a/WebDriverAgentLib/Utilities/FBConfiguration.m +++ b/WebDriverAgentLib/Utilities/FBConfiguration.m @@ -94,6 +94,16 @@ + (void)enableScreenshots [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"DisableScreenshots"]; } ++ (void)disableScreenRecordings +{ + [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"DisableDiagnosticScreenRecordings"]; +} + ++ (void)enableScreenRecordings +{ + [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"DisableDiagnosticScreenRecordings"]; +} + + (NSRange)bindingPortRange { // 'WebDriverAgent --port 8080' can be passed via the arguments to the process diff --git a/WebDriverAgentRunner/UITestingUITests.m b/WebDriverAgentRunner/UITestingUITests.m index c98fbd622..cc7c78073 100644 --- a/WebDriverAgentRunner/UITestingUITests.m +++ b/WebDriverAgentRunner/UITestingUITests.m @@ -26,6 +26,11 @@ + (void)setUp [FBConfiguration disableRemoteQueryEvaluation]; [FBConfiguration configureDefaultKeyboardPreferences]; [FBConfiguration disableApplicationUIInterruptionsHandling]; + if (NSProcessInfo.processInfo.environment[@"ENABLE_AUTOMATIC_SCREEN_RECORDINGS"]) { + [FBConfiguration enableScreenRecordings]; + } else { + [FBConfiguration disableScreenRecordings]; + } if (NSProcessInfo.processInfo.environment[@"ENABLE_AUTOMATIC_SCREENSHOTS"]) { [FBConfiguration enableScreenshots]; } else {