UITestingUITests.m 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 <WebDriverAgentLib/FBDebugLogDelegateDecorator.h>
  11. #import <WebDriverAgentLib/FBConfiguration.h>
  12. #import <WebDriverAgentLib/FBFailureProofTestCase.h>
  13. #import <WebDriverAgentLib/FBWebServer.h>
  14. #import <WebDriverAgentLib/XCTestCase.h>
  15. @interface UITestingUITests : FBFailureProofTestCase <FBWebServerDelegate>
  16. @end
  17. @implementation UITestingUITests
  18. + (void)setUp
  19. {
  20. [FBDebugLogDelegateDecorator decorateXCTestLogger];
  21. [FBConfiguration disableRemoteQueryEvaluation];
  22. [FBConfiguration configureDefaultKeyboardPreferences];
  23. [FBConfiguration disableApplicationUIInterruptionsHandling];
  24. if (NSProcessInfo.processInfo.environment[@"ENABLE_AUTOMATIC_SCREEN_RECORDINGS"]) {
  25. [FBConfiguration enableScreenRecordings];
  26. } else {
  27. [FBConfiguration disableScreenRecordings];
  28. }
  29. if (NSProcessInfo.processInfo.environment[@"ENABLE_AUTOMATIC_SCREENSHOTS"]) {
  30. [FBConfiguration enableScreenshots];
  31. } else {
  32. [FBConfiguration disableScreenshots];
  33. }
  34. [super setUp];
  35. }
  36. /**
  37. Never ending test used to start WebDriverAgent
  38. */
  39. - (void)testRunner
  40. {
  41. FBWebServer *webServer = [[FBWebServer alloc] init];
  42. webServer.delegate = self;
  43. [webServer startServing];
  44. }
  45. #pragma mark - FBWebServerDelegate
  46. - (void)webServerDidRequestShutdown:(FBWebServer *)webServer
  47. {
  48. [webServer stopServing];
  49. }
  50. @end