XCUITest - How to disable Wi Fi while app is running?

Viewed 3373

I want to automate how ios App behave while running the XCUITest. When manually executing the test, I turn off the wi fi adapter. How do I do that using Xcode UI test?

thanks

p.s. I found that we can use below command to disable wi fi. But to do this I will need to send my app to background. I need to do this without sending current app to background.

let settingsApp = XCUIApplication(bundleIdentifier: "com.apple.Preferences")

settingsApp.launch()

settingsApp.tables.cells["Airplane Mode"].tap()
1 Answers
Related