FBElementUtilitiesTests.m 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  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 "FBElement.h"
  11. #import "XCUIElementDouble.h"
  12. #import "FBElementUtils.h"
  13. @interface FBElementUtilitiesTests : XCTestCase
  14. @end
  15. @implementation FBElementUtilitiesTests
  16. - (void)testTypesFiltering {
  17. NSMutableArray *elements = [NSMutableArray new];
  18. XCUIElementDouble *el1 = [XCUIElementDouble new];
  19. [elements addObject:el1];
  20. XCUIElementDouble *el2 = [XCUIElementDouble new];
  21. el2.elementType = XCUIElementTypeAlert;
  22. el2.wdType = @"XCUIElementTypeAlert";
  23. [elements addObject:el2];
  24. XCUIElementDouble *el3 = [XCUIElementDouble new];
  25. [elements addObject:el3];
  26. NSSet *result = [FBElementUtils uniqueElementTypesWithElements:elements];
  27. XCTAssertEqual([result count], 2);
  28. }
  29. @end