Skip to content

Commit

Permalink
chore: remove code for old os versions (#694)
Browse files Browse the repository at this point in the history
  • Loading branch information
KazuCocoa authored May 15, 2023
1 parent ff2f5b5 commit 4a9faa5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 24 deletions.
14 changes: 6 additions & 8 deletions WebDriverAgentLib/Commands/FBElementCommands.m
Original file line number Diff line number Diff line change
Expand Up @@ -696,14 +696,12 @@ + (XCUICoordinate *)gestureCoordinateWithCoordinate:(CGPoint)coordinate
See issue #732: https://github.com/facebook/WebDriverAgent/issues/732
*/
XCUIElement *element = application;
if (isSDKVersionGreaterThanOrEqualTo(@"11.0")) {
XCUIElement *window = application.windows.allElementsBoundByIndex.firstObject;
if (window) {
element = window;
id<FBXCElementSnapshot> snapshot = element.fb_cachedSnapshot ?: element.fb_takeSnapshot;
point.x -= snapshot.frame.origin.x;
point.y -= snapshot.frame.origin.y;
}
XCUIElement *window = application.windows.allElementsBoundByIndex.firstObject;
if (window) {
element = window;
id<FBXCElementSnapshot> snapshot = element.fb_cachedSnapshot ?: element.fb_takeSnapshot;
point.x -= snapshot.frame.origin.x;
point.y -= snapshot.frame.origin.y;
}
return [self gestureCoordinateWithCoordinate:point element:element];
}
Expand Down
4 changes: 1 addition & 3 deletions WebDriverAgentLib/Utilities/FBConfiguration.m
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,7 @@ + (void)configureDefaultKeyboardPreferences

// To dismiss keyboard tutorial on iOS 11+ (iPad)
if ([controller respondsToSelector:@selector(setValue:forPreferenceKey:)]) {
if (isSDKVersionGreaterThanOrEqualTo(@"11.0")) {
[controller setValue:@YES forPreferenceKey:@"DidShowGestureKeyboardIntroduction"];
}
[controller setValue:@YES forPreferenceKey:@"DidShowGestureKeyboardIntroduction"];
if (isSDKVersionGreaterThanOrEqualTo(@"13.0")) {
[controller setValue:@YES forPreferenceKey:@"DidShowContinuousPathIntroduction"];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ - (void)tearDown
// The test is flaky on slow Travis CI
- (void)disabled_testAutoAcceptingOfAlerts
{
if (SYSTEM_VERSION_LESS_THAN(@"11.0")) {
return;
}

self.session = [FBSession
initWithApplication:FBApplication.fb_activeApplication
defaultAlertAction:@"accept"];
Expand All @@ -66,10 +62,6 @@ - (void)disabled_testAutoAcceptingOfAlerts
// The test is flaky on slow Travis CI
- (void)disabled_testAutoDismissingOfAlerts
{
if (SYSTEM_VERSION_LESS_THAN(@"11.0")) {
return;
}

self.session = [FBSession
initWithApplication:FBApplication.fb_activeApplication
defaultAlertAction:@"dismiss"];
Expand Down
6 changes: 1 addition & 5 deletions WebDriverAgentTests/IntegrationTests/FBConfigurationTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,7 @@ - (void)testReduceMotion
XCTAssertTrue([FBConfiguration reduceMotionEnabled]);

[FBConfiguration setReduceMotionEnabled:defaultReduceMotionEnabled];
if (isSDKVersionLessThan(@"10.0")) {
XCTAssertFalse([FBConfiguration reduceMotionEnabled]);
} else {
XCTAssertEqual([FBConfiguration reduceMotionEnabled], defaultReduceMotionEnabled);
}
XCTAssertEqual([FBConfiguration reduceMotionEnabled], defaultReduceMotionEnabled);
}

@end

0 comments on commit 4a9faa5

Please sign in to comment.