FBAutoAlertsHandlerTests.m 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /**
  2. * Copyright (c) 2015-present, Facebook, Inc.
  3. * All rights reserved.
  4. *
  5. * This source code is licensed under the BSD-style license found in the
  6. * LICENSE file in the root directory of this source tree. An additional grant
  7. * of patent rights can be found in the PATENTS file in the same directory.
  8. */
  9. #import <XCTest/XCTest.h>
  10. #import "FBIntegrationTestCase.h"
  11. #import "FBMacros.h"
  12. #import "FBSession.h"
  13. #import "FBXCodeCompatibility.h"
  14. #import "FBTestMacros.h"
  15. #import "XCUIElement+FBUtilities.h"
  16. @interface FBAutoAlertsHandlerTests : FBIntegrationTestCase
  17. @property (nonatomic) FBSession *session;
  18. @end
  19. @implementation FBAutoAlertsHandlerTests
  20. - (void)setUp
  21. {
  22. [super setUp];
  23. [self launchApplication];
  24. [self goToAlertsPage];
  25. [self clearAlert];
  26. }
  27. - (void)tearDown
  28. {
  29. [self clearAlert];
  30. if (self.session) {
  31. [self.session kill];
  32. }
  33. [super tearDown];
  34. }
  35. // The test is flaky on slow Travis CI
  36. - (void)disabled_testAutoAcceptingOfAlerts
  37. {
  38. self.session = [FBSession
  39. initWithApplication:XCUIApplication.fb_activeApplication
  40. defaultAlertAction:@"accept"];
  41. for (int i = 0; i < 2; i++) {
  42. [self.testedApplication.buttons[FBShowAlertButtonName] tap];
  43. [self.testedApplication fb_waitUntilStable];
  44. FBAssertWaitTillBecomesTrue(self.testedApplication.alerts.count == 0);
  45. }
  46. }
  47. // The test is flaky on slow Travis CI
  48. - (void)disabled_testAutoDismissingOfAlerts
  49. {
  50. self.session = [FBSession
  51. initWithApplication:XCUIApplication.fb_activeApplication
  52. defaultAlertAction:@"dismiss"];
  53. for (int i = 0; i < 2; i++) {
  54. [self.testedApplication.buttons[FBShowAlertButtonName] tap];
  55. [self.testedApplication fb_waitUntilStable];
  56. FBAssertWaitTillBecomesTrue(self.testedApplication.alerts.count == 0);
  57. }
  58. }
  59. @end