in Sasquatch/SasquatchUITests/AppCenterUITests.swift [83:126]
func testDisableSDKPersistence() {
guard let `app` = app else {
XCTFail()
return
}
var appCenterButton = app.tables["App Center"].switches["Set Enabled"]
XCTAssertTrue(appCenterButton.boolValue, "AppCenter doesn't enabled by default")
// Disable SDK.
appCenterButton.tap()
XCTAssertFalse(appCenterButton.boolValue)
// Several attempts for sure.
for i in 0..<3 {
// Restart application.
sleep(5)
XCUIDevice().press(.home)
sleep(5)
app.launch()
appCenterButton = app.tables["App Center"].switches["Set Enabled"]
XCTAssertFalse(appCenterButton.boolValue, "AppCenter doesn't disabled on next application run (\(i * 2 + 2) run)")
// Enable SDK.
appCenterButton.tap()
XCTAssertTrue(appCenterButton.boolValue)
// Restart application.
sleep(5)
XCUIDevice().press(XCUIDevice.Button.home)
sleep(5)
app.launch()
appCenterButton = app.tables["App Center"].switches["Set Enabled"]
XCTAssertTrue(appCenterButton.boolValue, "AppCenter doesn't enabled on next application run (\(i * 2 + 3) run)")
// Disable SDK.
appCenterButton.tap()
XCTAssertFalse(appCenterButton.boolValue)
}
}