Last active
September 28, 2016 04:42
-
-
Save Calvin-Huang/1364c05d08af1191fa5376ba81a4c4ed to your computer and use it in GitHub Desktop.
Part of test selectable in UI test. https://github.com/Calvin-Huang/CHCarouselView/blob/master/CHCarouselViewUITests/CHCarouselViewUITests.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func test_changeContentView() { | |
let xctExpectation = expectation(description: "Wait for carousel auto slide.") | |
let carouselView = self.app.scrollViews.element | |
let alertView = self.app.alerts.element | |
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 4.5) { [unowned self] in | |
carouselView.tap() | |
XCTAssertTrue(alertView.staticTexts["You selected page: 1 in carousel."].exists, "CarouselView should auto slides to second .") | |
alertView.buttons["OK"].tap() | |
self.app.buttons["Change Content To Colored Views"].tap() | |
carouselView.tap() | |
XCTAssertTrue(alertView.staticTexts["You selected page: 0 in carousel."].exists, "CarouselView should reset to first view.") | |
alertView.buttons["OK"].tap() | |
} | |
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 12.5) { | |
carouselView.tap() | |
XCTAssertTrue(alertView.staticTexts["You selected page: 1 in carousel."].exists, "CarouselView should auto slides to secview after change content.") | |
xctExpectation.fulfill() | |
} | |
waitForExpectations(timeout: 20.0) { e in | |
XCTAssertTrue(e == nil, "Everything not completed in 10.0 sec.") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment