Skip to content

Commit

Permalink
Make screenshot more stable
Browse files Browse the repository at this point in the history
  • Loading branch information
林名君 committed Nov 5, 2018
1 parent 85f450e commit 733712d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#import "XCUIDevice.h"
#import "XCUIScreen.h"
#import "FBConfiguration.h"

static const NSTimeInterval FBHomeButtonCoolOffTime = 1.;
static const NSTimeInterval FBScreenLockTimeout = 5.;
Expand Down Expand Up @@ -107,7 +108,7 @@ - (NSData *)fb_screenshotWithError:(NSError*__autoreleasing*)error
{
FBApplication *activeApplication = FBApplication.fb_activeApplication;
UIInterfaceOrientation orientation = activeApplication.interfaceOrientation;
CGSize screenSize = FBAdjustDimensionsForApplication(activeApplication.frame.size, orientation);
CGSize screenSize = [FBConfiguration screenSize];
CGRect screenRect = CGRectMake(0, 0, screenSize.width, screenSize.height);
// https://developer.apple.com/documentation/xctest/xctimagequality?language=objc
// Select lower quality, since XCTest crashes randomly if the maximum quality (zero value) is selected
Expand Down

0 comments on commit 733712d

Please sign in to comment.