我正在为应用程序编写单元测试,并想检查是否在特定场景中呈现了UIAlertController.
-(void)testBadLogin { // enter username and password in UITextFields self.viewController.usernameField.text = @"test@test.com"; self.viewController.passwordField.text = @"incorrect_pass"; [loginButton sendActionsForControlEvents: UIControlEventTouchUpInside]; // this isn't right XCTAssertNotNil([self.viewController alertController],@"alertController should appear"); }
如何检查UIAlertController是否已显示在当前视图之上?