in SasquatchTV/SasquatchTVUITests/AppCenterUITests.swift [32:81]
func testEnableDisableSDK() {
guard let `app` = app else {
return
}
// Check App Center status.
let mcCell = app.cells.element(boundBy: 6)
let mcStatus = mcCell.staticTexts.element(boundBy: 1)
XCTAssertTrue(mcStatus.label == "Enabled")
// Disable App Center.
press(button: .down, times: 6)
XCUIRemote.shared().press(.select)
XCTAssertTrue(mcStatus.label == "Disabled")
// Check Analytics.
press(button: .up, times: 6)
XCUIRemote.shared().press(.select)
let disabledButton = app.segmentedControls.buttons["Disabled"]
XCTAssertTrue(disabledButton.isSelected)
// Without this delay the app doesn't have time to go back and the test fails.
sleep(1)
// Go back.
press(button: .menu, times: 1)
// Without this delay the app doesn't have time to go back and the test fails.
sleep(1)
// Enable App Center.
press(button: .down, times: 6)
XCUIRemote.shared().press(.select)
// Without this delay the app doesn't have time to go back and the test fails.
sleep(1)
XCTAssertTrue(mcStatus.label == "Enabled")
// Check Analytics.
press(button: .up, times: 6)
XCUIRemote.shared().press(.select)
// Without this delay the app doesn't have time to go back and the test fails.
sleep(1)
let enabledButton = app.segmentedControls.buttons["Enabled"]
XCTAssertTrue(enabledButton.isSelected)
}