-
Notifications
You must be signed in to change notification settings - Fork 919
/
Copy pathBackgroundTests.m
46 lines (36 loc) · 1.09 KB
/
BackgroundTests.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//
// BackgroundTests.m
// KIF
//
// Created by Jordan Zucker on 5/18/15.
//
//
#import <KIF/KIF.h>
@interface BackgroundTests : KIFTestCase
@end
@implementation BackgroundTests
+ (XCTestSuite *)defaultTestSuite
{
// 'deactivateAppForDuration' can't be used on iOS7
// The console shows a message "AX Lookup problem! 22 com.apple.iphone.axserver:-1"
if ([UIDevice.currentDevice.systemVersion compare:@"8.0" options:NSNumericSearch] < 0) {
return nil;
}
return [super defaultTestSuite];
}
- (void)beforeEach {
[tester tapViewWithAccessibilityLabel:@"Background"];
}
- (void)afterEach {
[tester tapViewWithAccessibilityLabel:@"Test Suite" traits:UIAccessibilityTraitButton];
[tester waitForViewWithAccessibilityLabel:@"Test Suite" traits:UIAccessibilityTraitHeader];
}
- (void)testBackgroundApp {
if (@available(iOS 14.0, *)) { // Xcode 12, UIAutomation framework not available
return;
}
[tester waitForViewWithAccessibilityLabel:@"Start"];
[system deactivateAppForDuration:5];
[tester waitForViewWithAccessibilityLabel:@"Back"];
}
@end