How to unlock a physical device via XCUITest or xcrun?

30 Views Asked by At

I'm attempting to write an UI test for lock/unlock device behavior for my app. Now I'm managing to lock the screen and go to enter password page, here's my code:

func testLockScreen() {
    XCUIDevice.shared.perform(NSSelectorFromString("pressLockButton"))
    sleep(1)
    XCUIDevice.shared.press(.home)
    sleep(1)
    XCUIDevice.shared.press(.home)
    sleep(1)
    //need to press pasword buttons to unlock the device
  }

Not sure how to implement this part, I've tried to use the Record UI Test feature, but it's a UIApplication object, not XCUIDevice.

Any suggestion would be great, thanks!

0

There are 0 best solutions below