5

I'm working on developing tests using KIF for a project. I want to know if it's possible to have KIF simulate a tap on the home button? Is it also possible to simulate other actions at that point, such as bringing up the command center or the notification center?

Luke Solomon
  • 144
  • 6

2 Answers2

3

At least a partial answer for you, take a look at deactivateAppForDuration in 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;
nomad00
  • 401
  • 3
  • 10
2

For swift 3 and Xcode 8, this function of KIFSystemTestActor works:

    system().deactivateApp(forDuration: 3)


    extension XCTestCase {    
            func system(_ file : String = #file, _ line : Int = #line) -> KIFSystemTestActor {
            return KIFSystemTestActor(inFile: file, atLine: line, delegate: self)
        }
    }
Bill Chan
  • 3,199
  • 36
  • 32