Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Serchinastico/a6ff2b85ff48e208caf5b5b1fe424b86 to your computer and use it in GitHub Desktop.
Save Serchinastico/a6ff2b85ff48e208caf5b5b1fe424b86 to your computer and use it in GitHub Desktop.
Clase de test que muestra cómo usar KIF para interactuar con todo tipo de vistas
class SuperHeroesControlsViewControllerTests: AcceptanceTestCase {
func testShowsEmptyCaseIfThereAreNoSuperHeroes() {
openSuperHeroesViewController()
tester().tapView(withAccessibilityLabel: "Button")
tester().setValue(0, forSliderWithAccessibilityLabel: "Slider")
for _ in (0..<10) {
tester().tapStepper(withAccessibilityLabel: "Stepper", increment: .increment)
}
tester().selectDatePickerValue(["August", "18", "1988"])
tester().clearTextFromView(withAccessibilityLabel: "Text Field")
tester().enterText("Hello World!", intoViewWithAccessibilityLabel: "Text Field")
}
fileprivate func openSuperHeroesViewController() {
let superHeroesViewController = ServiceLocator().provideSuperHeroesControlsViewController()
let rootViewController = UINavigationController()
rootViewController.viewControllers = [superHeroesViewController]
present(viewController: rootViewController)
tester().waitForAnimationsToFinish()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment