@@ -15,30 +15,43 @@ @interface PullToRefreshTests : KIFTestCase
15
15
16
16
@implementation PullToRefreshTests
17
17
18
- -(void ) testPullToRefreshByAccessibilityLabelWithDuration
18
+ - (void )afterEach
19
19
{
20
- UITableView *tableView;
21
- [tester waitForAccessibilityElement: NULL view: &tableView withIdentifier: @" Test Suite TableView" tappable: NO ];
22
-
23
- [tester pullToRefreshViewWithAccessibilityLabel: @" Table View" pullDownDuration: KIFPullToRefreshInAboutThreeSeconds];
24
- [tester waitForViewWithAccessibilityLabel: @" Bingo!" ];
25
- [tester waitForAbsenceOfViewWithAccessibilityLabel: @" Bingo!" ];
20
+ // For some reason, on iOS 16.4 w/ Xcode 14.3.1, the pull to refresh is ending before
21
+ // we call endRefreshing from `-[TestSuiteViewController pullToRefreshHandler].
22
+ //
23
+ // It seems like there is some difference in how we're synthesizing the touch events
24
+ // compared to what happens when a user sends the touch events. Set a symbolic breakpoint
25
+ // in "-[_UIRefreshControlModernContentView didTransitionFromState:toState:]" to see this
26
+ // in action. The register $x2 contains the `fromState` and $x3 contains the `toState`.
27
+ //
28
+ // KIF: 3 -> 1 (many times), 3 -> 2, 3 -> 3, 3 -> 0
29
+ // User: 0 -> 1, 1 -> 1 (many times), 1 -> 2, 2 -> 3, 3 -> 4, 4 -> 0
30
+ //
31
+ // So it seems like something is going wrong in translating the HID events in the
32
+ // `kif_IOHIDEventWithTouches` phases to appropriate UIResfrashControl states.
33
+ [tester waitForTimeInterval: 3.0 ];
34
+ }
26
35
27
- [tester waitForTimeInterval: 5 .0f ]; // make sure the PTR is finished.
36
+ - (void )testPullToRefreshByAccessibilityLabelWithDuration
37
+ {
38
+ [tester waitForViewWithAccessibilityIdentifier: @" Test Suite TableView" ];
39
+ [tester pullToRefreshViewWithAccessibilityLabel: @" Table View" pullDownDuration: KIFPullToRefreshInAboutAHalfSecond];
40
+ [tester waitForViewWithAccessibilityLabel: @" Bingo!" ];
41
+ [tester waitForAbsenceOfViewWithAccessibilityLabel: @" Bingo!" ];
28
42
}
29
43
30
- -(void ) testPullToRefreshWithBigContentSize
44
+ - (void )testPullToRefreshWithBigContentSize
31
45
{
32
46
UITableView *tableView;
33
47
[tester waitForAccessibilityElement: NULL view: &tableView withIdentifier: @" Test Suite TableView" tappable: NO ];
34
48
CGSize originalSize = tableView.contentSize ;
35
49
tableView.contentSize = CGSizeMake (1000 , 10000 );
36
50
37
- [tester pullToRefreshViewWithAccessibilityLabel: @" Table View" pullDownDuration: KIFPullToRefreshInAboutThreeSeconds ];
51
+ [tester pullToRefreshViewWithAccessibilityLabel: @" Table View" pullDownDuration: KIFPullToRefreshInAboutAHalfSecond ];
38
52
[tester waitForViewWithAccessibilityLabel: @" Bingo!" ];
39
53
[tester waitForAbsenceOfViewWithAccessibilityLabel: @" Bingo!" ];
40
54
41
- [tester waitForTimeInterval: 5 .0f ]; // make sure the PTR is finished.
42
55
tableView.contentSize = originalSize;
43
56
}
44
57
0 commit comments