I have an app on iOS and I need to shake the simulator as part of UITests, how can this be implemented?
cmd+control+z do not offer, you need a solution within the code
Xcode 12.1, MacOS Catalina 10.15.6 I tried to use this type of code, but it didn't work out and I didn't find any other options either
func testChangingStand() {
var canBecomeFirstResponder: Bool {
get {
return true
}
}
func motionBegan(_ motion: UIEvent.EventSubtype, with event: UIEvent?) {
if motion == .motionShake {
sleep(5)
let tablesQuery = app.tables
let checkStand = tablesQuery.staticTexts[""]
if waitFor(checkStand, to: .appear) {
tablesQuery.staticTexts[""].tap()
} else {
tablesQuery/*@START_MENU_TOKEN@*/.staticTexts[""]/*[[".cells.staticTexts[\"\"]",".staticTexts[\"\"]"],[[[-1,1],[-1,0]]],[0]]@END_MENU_TOKEN@*/.tap()
}
tablesQuery.staticTexts["production"].tap()
tablesQuery.staticTexts["Legacy"].tap()
app.scrollViews.otherElements.staticTexts["API MODE"].tap()
app.switches.element(boundBy: 0).tap()
}
}
}