Skip to content

Commit

Permalink
chore: Disable automatic screen recording by default (#726)
Browse files Browse the repository at this point in the history
  • Loading branch information
mykola-mokhnach authored Jun 8, 2023
1 parent 28b6e21 commit a070223
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
6 changes: 5 additions & 1 deletion WebDriverAgentLib/Utilities/FBConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 10 additions & 0 deletions WebDriverAgentLib/Utilities/FBConfiguration.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions WebDriverAgentRunner/UITestingUITests.m
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit a070223

Please sign in to comment.