Can I run a KIF test that puts my application in the background?

I am working on developing tests using KIF for a project. I want to know if KIF can simulate clicking on the home button? Is it also possible to simulate other actions at this point, for example, to bring up a command center or a notification center?

+4
source share
2 answers

At least a partial answer for you, look deactivateAppForDurationat KIFTestActor.h:

/*!
 @abstract Backgrounds app using UIAutomation command, simulating pressing the Home button
 @param duration Amount of time for a background event before the app becomes active again
 */
- (void)deactivateAppForDuration:(NSTimeInterval)duration;
+3
source

For fast 3 and Xcode 8, this KIFSystemTestActor function works:

    system().deactivateApp(forDuration: 3)


    extension XCTestCase {    
            func system(_ file : String = #file, _ line : Int = #line) -> KIFSystemTestActor {
            return KIFSystemTestActor(inFile: file, atLine: line, delegate: self)
        }
    }
+1
source

All Articles