Skip to content

Commit fbed62a

Browse files
author
Justin Martin
authored
Merge pull request #1306 from justinseanmartin/jmartin/xcode-16
Xcode 16 in CI
2 parents 2b1164c + 25645e8 commit fbed62a

11 files changed

+60
-29
lines changed

.github/workflows/build.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ jobs:
1414

1515
- name: Validate podspec
1616
run: pod lib lint
17-
1817
build_macos14:
1918
runs-on: macos-14
2019
strategy:
@@ -23,7 +22,9 @@ jobs:
2322
- { xcode_version: '14.3.1', simulator: 'name=iPad Air (5th generation),OS=16.4', run_extra_validations: 'false' }
2423
- { xcode_version: '14.3.1', simulator: 'name=iPhone 14,OS=16.4', run_extra_validations: 'false' }
2524
- { xcode_version: '15.4', simulator: 'name=iPad Air (5th generation),OS=17.5', run_extra_validations: 'false' }
26-
- { xcode_version: '15.4', simulator: 'name=iPhone 15,OS=17.5', run_extra_validations: 'true' }
25+
- { xcode_version: '15.4', simulator: 'name=iPhone 15,OS=17.5', run_extra_validations: 'false' }
26+
- { xcode_version: '16.0', simulator: 'name=iPad Air (5th generation),OS=18.0', run_extra_validations: 'false' }
27+
- { xcode_version: '16.0', simulator: 'name=iPhone 16,OS=18.0', run_extra_validations: 'true' }
2728
steps:
2829
- name: Checkout Project
2930
uses: actions/checkout@v1

Sources/KIF/Additions/CALayer-KIFAdditions.m

+23-3
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,32 @@ - (BOOL)hasAnimations
4141

4242
[layer.animationKeys enumerateObjectsUsingBlock:^(NSString *animationKey, NSUInteger idx, BOOL *innerStop) {
4343
CAAnimation *animation = [layer animationForKey:animationKey];
44-
double beginTime = [animation beginTime];
44+
4545
double completionTime = [animation KIF_completionTime];
4646

47-
// Ignore long running animations (> 1 minute duration)
48-
if (currentTime >= beginTime && completionTime < currentTime + 60 && currentTime < completionTime) {
47+
// Ignore long running animations (> 1 minute duration), as we don't want to wait on them
48+
if (completionTime > currentTime + 60) {
49+
return;
50+
}
51+
52+
// If an animation is set to be removed on completion, it must still be in progress if we enumerated it
53+
// This is the default behavior for animations, so we should often hit this codepath.
54+
if ([animation isRemovedOnCompletion]) {
4955
result = YES;
56+
} else if ([animation.delegate isKindOfClass:NSClassFromString(@"UIViewAnimationState")]) {
57+
// Use a private property on the private class to determine if the animation state has completed
58+
BOOL animationDidStopSent = [[(NSObject *)animation.delegate valueForKey:@"_animationDidStopSent"] boolValue];
59+
60+
if (!animationDidStopSent) {
61+
result = YES;
62+
}
63+
} else if (currentTime > completionTime) {
64+
// Otherwise, use the completion time to determine if the animation has been completed.
65+
// This doesn't seem to always be exactly right however.
66+
result = YES;
67+
}
68+
69+
if (result) {
5070
*innerStop = YES;
5171
*stop = YES;
5272
}

Sources/KIF/Additions/NSObject+KIFSwizzle.m

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ + (void)swizzleSEL:(SEL)originalSEL withSEL:(SEL)swizzledSEL
1717
Method originalMethod = class_getInstanceMethod(class, originalSEL);
1818
Method swizzledMethod = class_getInstanceMethod(class, swizzledSEL);
1919

20+
NSAssert(originalMethod != nil, @"The original method for selector '%@' couldn't be found", NSStringFromSelector(originalSEL));
21+
NSAssert(swizzledMethod != nil, @"The swizzled method for selector '%@' couldn't be found", NSStringFromSelector(swizzledSEL));
22+
2023
method_exchangeImplementations(originalMethod, swizzledMethod);
2124
}
2225

Sources/KIF/Additions/UIWindow+KIFSwizzle.m

+14-6
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,31 @@
99
#import "UIApplication-KIFAdditions.h"
1010
#import "NSObject+KIFSwizzle.h"
1111

12+
@interface UIWindow ()
13+
14+
- (instancetype)_initWithFrame:(CGRect)rect debugName:(NSString *)debugName windowScene:(UIWindowScene *)windowScene API_AVAILABLE(ios(13));
15+
16+
@end
17+
18+
1219
@implementation UIWindow (KIFSwizzle)
1320

1421
+ (void)load
1522
{
1623
static dispatch_once_t onceToken;
1724
dispatch_once(&onceToken, ^{
18-
[self swizzleSEL:@selector(init) withSEL:@selector(swizzle_init)];
19-
[self swizzleSEL:@selector(becomeKeyWindow) withSEL:@selector(swizzle_becomeKeyWindow)];
20-
if (@available(iOS 13.0, *)) {
21-
[self swizzleSEL:@selector(initWithWindowScene:) withSEL:@selector(swizzle_initWithWindowScene:)];
25+
if (@available(iOS 13, *)) {
26+
[self swizzleSEL:@selector(_initWithFrame:debugName:windowScene:) withSEL:@selector(swizzle__initWithFrame:debugName:windowScene:)];
27+
} else {
28+
[self swizzleSEL:@selector(init) withSEL:@selector(swizzle_init)];
2229
}
30+
[self swizzleSEL:@selector(becomeKeyWindow) withSEL:@selector(swizzle_becomeKeyWindow)];
2331
});
2432
}
2533

26-
- (instancetype)swizzle_initWithWindowScene:(UIWindowScene *)scene API_AVAILABLE(ios(13))
34+
- (instancetype)swizzle__initWithFrame:(CGRect)rect debugName:(NSString *)debugName windowScene:(UIWindowScene *)windowScene API_AVAILABLE(ios(13))
2735
{
28-
UIWindow *window = [self swizzle_initWithWindowScene:scene];
36+
UIWindow *window = [self swizzle__initWithFrame:rect debugName:debugName windowScene:windowScene];
2937
window.layer.speed = [UIApplication sharedApplication].animationSpeed;
3038

3139
return window;

Sources/KIF/Classes/KIFUITestActor.m

+1-2
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,8 @@ - (void)waitForAnimationsToFinishWithTimeout:(NSTimeInterval)timeout stabilizati
230230
[self waitForTimeInterval:maximumWaitingTimeInterval relativeToAnimationSpeed:YES];
231231
}
232232
} else {
233-
234233
// Wait for the view to stabilize and give them a chance to start animations before we wait for them.
235-
[self waitForTimeInterval:stabilizationTime relativeToAnimationSpeed:YES];
234+
[self waitForTimeInterval:MAX(stabilizationTime / [UIApplication sharedApplication].animationSpeed, 0.25) relativeToAnimationSpeed:NO];
236235
maximumWaitingTimeInterval -= stabilizationTime;
237236

238237
NSTimeInterval startTime = [NSDate timeIntervalSinceReferenceDate];

Tests/AccessibilityIdentifierTests.m

+3-3
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ - (void)testWaitingForAbscenceOfViewWithAccessibilityIdentifier
4949
- (void)testLongPressingViewWithAccessibilityIdentifier
5050
{
5151
[tester tapViewWithAccessibilityIdentifier:@"idGreeting"];
52-
[tester longPressViewWithAccessibilityIdentifier:@"idGreeting" duration:2];
52+
[tester longPressViewWithAccessibilityIdentifier:@"idGreeting" duration:1];
5353
[tester tapViewWithAccessibilityLabel:@"Select All"];
5454
}
5555

5656
- (void)testEnteringTextIntoViewWithAccessibilityIdentifier
5757
{
5858
[tester tapViewWithAccessibilityIdentifier:@"idGreeting"];
59-
[tester longPressViewWithAccessibilityIdentifier:@"idGreeting" duration:2];
59+
[tester longPressViewWithAccessibilityIdentifier:@"idGreeting" duration:1];
6060
[tester waitForAnimationsToFinish];
6161
[tester tapViewWithAccessibilityLabel:@"Select All"];
6262
[tester tapViewWithAccessibilityLabel:@"Cut"];
@@ -77,7 +77,7 @@ - (void)testClearingAndEnteringTextIntoViewWithAccessibilityLabel
7777
- (void)testSettingTextIntoViewWithAccessibilityIdentifier
7878
{
7979
UIView *greetingView = [tester waitForViewWithAccessibilityIdentifier:@"idGreeting"];
80-
[tester longPressViewWithAccessibilityIdentifier:@"idGreeting" duration:2];
80+
[tester longPressViewWithAccessibilityIdentifier:@"idGreeting" duration:1];
8181
[tester setText:@"Yo" intoViewWithAccessibilityIdentifier:@"idGreeting"];
8282
[tester expectView:greetingView toContainText:@"Yo"];
8383
[tester setText:@"Hello" intoViewWithAccessibilityIdentifier:@"idGreeting"];

Tests/AccessibilityIdentifierTests_ViewTestActor.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ - (void)testWaitingForAbscenceOfViewWithAccessibilityIdentifier
4949
- (void)testLongPressingViewWithAccessibilityIdentifier
5050
{
5151
[[viewTester usingIdentifier:@"idGreeting"] tap];
52-
[[viewTester usingIdentifier:@"idGreeting"] longPressWithDuration:2];
52+
[[viewTester usingIdentifier:@"idGreeting"] longPressWithDuration:1];
5353
[[viewTester usingLabel:@"Select All"] tap];
5454
}
5555

5656
- (void)testEnteringTextIntoViewWithAccessibilityIdentifier
5757
{
5858
[[viewTester usingIdentifier:@"idGreeting"] tap];
59-
[[viewTester usingIdentifier:@"idGreeting"] longPressWithDuration:2];
59+
[[viewTester usingIdentifier:@"idGreeting"] longPressWithDuration:1];
6060
[[viewTester usingLabel:@"Select All"] tap];
6161
[[viewTester usingLabel:@"Cut"] tap];
6262
[[viewTester usingIdentifier:@"idGreeting"] enterText:@"Yo"];

Tests/LongPressTests.m

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,21 @@ - (void)afterEach
2828
- (void)testLongPressingViewWithAccessibilityLabel
2929
{
3030
[tester tapViewWithAccessibilityLabel:@"Greeting"];
31-
[tester longPressViewWithAccessibilityLabel:@"Greeting" duration:2];
31+
[tester longPressViewWithAccessibilityLabel:@"Greeting" duration:1];
3232
[tester tapViewWithAccessibilityLabel:@"Select All"];
3333
}
3434

3535
- (void)testLongPressingViewViewWithTraits
3636
{
3737
[tester tapViewWithAccessibilityLabel:@"Greeting"];
38-
[tester longPressViewWithAccessibilityLabel:@"Greeting" value:@"Hello" duration:2];
38+
[tester longPressViewWithAccessibilityLabel:@"Greeting" value:@"Hello" duration:1];
3939
[tester tapViewWithAccessibilityLabel:@"Select All"];
4040
}
4141

4242
- (void)testLongPressingViewViewWithValue
4343
{
4444
[tester tapViewWithAccessibilityLabel:@"Greeting"];
45-
[tester longPressViewWithAccessibilityLabel:@"Greeting" value:@"Hello" traits:UIAccessibilityTraitUpdatesFrequently duration:2];
45+
[tester longPressViewWithAccessibilityLabel:@"Greeting" value:@"Hello" traits:UIAccessibilityTraitUpdatesFrequently duration:1];
4646
[tester tapViewWithAccessibilityLabel:@"Select All"];
4747
}
4848

Tests/LongPressTests_ViewTestActor.m

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,21 @@ - (void)afterEach
2828
- (void)testLongPressingViewWithAccessibilityLabel
2929
{
3030
[[viewTester usingLabel:@"Greeting"] tap];
31-
[[viewTester usingLabel:@"Greeting"] longPressWithDuration:2];
31+
[[viewTester usingLabel:@"Greeting"] longPressWithDuration:1];
3232
[[viewTester usingLabel:@"Select All"] tap];
3333
}
3434

3535
- (void)testLongPressingViewViewWithTraits
3636
{
3737
[[viewTester usingLabel:@"Greeting"] tap];
38-
[[[viewTester usingLabel:@"Greeting"] usingValue:@"Hello"] longPressWithDuration:2];
38+
[[[viewTester usingLabel:@"Greeting"] usingValue:@"Hello"] longPressWithDuration:1];
3939
[[viewTester usingLabel:@"Select All"] tap];
4040
}
4141

4242
- (void)testLongPressingViewViewWithValue
4343
{
4444
[[viewTester usingLabel:@"Greeting"] tap];
45-
[[[[viewTester usingLabel:@"Greeting"] usingValue:@"Hello"] usingTraits:UIAccessibilityTraitUpdatesFrequently] longPressWithDuration:2];
45+
[[[[viewTester usingLabel:@"Greeting"] usingValue:@"Hello"] usingTraits:UIAccessibilityTraitUpdatesFrequently] longPressWithDuration:1];
4646
[[viewTester usingLabel:@"Select All"] tap];
4747
}
4848

Tests/TypingTests.m

+3-3
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ - (void)testMissingFirstResponder
3939
- (void)testEnteringTextIntoFirstResponder
4040
{
4141
[tester tapViewWithAccessibilityLabel:@"Greeting"];
42-
[tester longPressViewWithAccessibilityLabel:@"Greeting" value:@"Hello" duration:2];
42+
[tester longPressViewWithAccessibilityLabel:@"Greeting" value:@"Hello" duration:1];
4343
[tester tapViewWithAccessibilityLabel:@"Select All"];
4444
[tester enterTextIntoCurrentFirstResponder:@"Yo"];
4545
[tester waitForViewWithAccessibilityLabel:@"Greeting" value:@"Yo" traits:UIAccessibilityTraitNone];
@@ -53,7 +53,7 @@ - (void)testFailingToEnterTextIntoFirstResponder
5353
- (void)testEnteringTextIntoViewWithAccessibilityLabel
5454
{
5555
[tester tapViewWithAccessibilityLabel:@"Greeting"];
56-
[tester longPressViewWithAccessibilityLabel:@"Greeting" value:@"Hello" duration:2];
56+
[tester longPressViewWithAccessibilityLabel:@"Greeting" value:@"Hello" duration:1];
5757
[tester tapViewWithAccessibilityLabel:@"Select All"];
5858
[tester tapViewWithAccessibilityLabel:@"Cut"];
5959
[tester enterText:@"Yo" intoViewWithAccessibilityLabel:@"Greeting"];
@@ -110,7 +110,7 @@ - (void)testClearingALongTextField
110110
- (void)testSettingTextIntoViewWithAccessibilityLabel
111111
{
112112
UIView *greetingView = [tester waitForViewWithAccessibilityLabel:@"Greeting"];
113-
[tester longPressViewWithAccessibilityLabel:@"Greeting" duration:2];
113+
[tester longPressViewWithAccessibilityLabel:@"Greeting" duration:1];
114114
[tester setText:@"Yo" intoViewWithAccessibilityLabel:@"Greeting"];
115115
[tester expectView:greetingView toContainText:@"Yo"];
116116
[tester setText:@"Hello" intoViewWithAccessibilityLabel:@"Greeting"];

Tests/TypingTests_ViewTestActor.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ - (void)testMissingFirstResponder
4040
- (void)testEnteringTextIntoFirstResponder
4141
{
4242
[tester tapViewWithAccessibilityLabel:@"Greeting"];
43-
[[[viewTester usingLabel:@"Greeting"] usingValue:@"Hello"] longPressWithDuration:2];
43+
[[[viewTester usingLabel:@"Greeting"] usingValue:@"Hello"] longPressWithDuration:1];
4444
[[viewTester usingLabel:@"Select All"] tap];
4545
[[viewTester usingFirstResponder] enterText:@"Yo"];
4646
[[[viewTester usingLabel:@"Greeting"] usingValue:@"Yo"] waitForView];
@@ -54,7 +54,7 @@ - (void)testFailingToEnterTextIntoFirstResponder
5454
- (void)testEnteringTextIntoViewWithAccessibilityLabel
5555
{
5656
[tester tapViewWithAccessibilityLabel:@"Greeting"];
57-
[[[viewTester usingLabel:@"Greeting"] usingValue:@"Hello"] longPressWithDuration:2];
57+
[[[viewTester usingLabel:@"Greeting"] usingValue:@"Hello"] longPressWithDuration:1];
5858
[[viewTester usingLabel:@"Select All"] tap];
5959
[[viewTester usingLabel:@"Cut"] tap];
6060
[[viewTester usingLabel:@"Greeting"] enterText:@"Yo"];

0 commit comments

Comments
 (0)