XCUIElement+FBFind.h 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. NS_ASSUME_NONNULL_BEGIN
  11. @interface XCUIElement (FBFind)
  12. /**
  13. Returns an array of descendants matching given class name
  14. @param className requested class name
  15. @param shouldReturnAfterFirstMatch set it to YES if you want only the first found element to be
  16. resolved and returned. This will speed up the search significantly if given class name matches multiple
  17. nodes in the UI tree
  18. @return an array of descendants matching given class name
  19. */
  20. - (NSArray<XCUIElement *> *)fb_descendantsMatchingClassName:(NSString *)className shouldReturnAfterFirstMatch:(BOOL)shouldReturnAfterFirstMatch;
  21. /**
  22. Returns an array of descendants matching given accessibility id
  23. @param accessibilityId requested accessibility id
  24. @param shouldReturnAfterFirstMatch set it to YES if you want only the first found element to be
  25. resolved and returned. This will speed up the search significantly if given id matches multiple
  26. nodes in the UI tree
  27. @return an array of descendants matching given accessibility id
  28. */
  29. - (NSArray<XCUIElement *> *)fb_descendantsMatchingIdentifier:(NSString *)accessibilityId shouldReturnAfterFirstMatch:(BOOL)shouldReturnAfterFirstMatch;
  30. /**
  31. Returns an array of descendants matching given xpath query
  32. @param xpathQuery requested xpath query
  33. @param shouldReturnAfterFirstMatch set it to YES if you want only the first found element to be
  34. resolved and returned. This will speed up the search significantly if given xpath matches multiple
  35. nodes in the UI tree
  36. @return an array of descendants matching given xpath query
  37. */
  38. - (NSArray<XCUIElement *> *)fb_descendantsMatchingXPathQuery:(NSString *)xpathQuery shouldReturnAfterFirstMatch:(BOOL)shouldReturnAfterFirstMatch;
  39. /**
  40. Returns an array of descendants matching given predicate.
  41. Allowed property names are only these declared in FBElement protocol (property names are received in runtime)
  42. and their shortcuts (without 'wd' prefix). All other property names are considered as unknown.
  43. @param predicate requested predicate
  44. @param shouldReturnAfterFirstMatch set it to YES if you want only the first found element to be
  45. resolved and returned. This will speed up the search significantly if given predicate matches multiple
  46. nodes in the UI tree
  47. @return an array of descendants matching given predicate
  48. @throw FBUnknownPredicateKeyException in case the given property name is not declared in FBElement protocol
  49. */
  50. - (NSArray<XCUIElement *> *)fb_descendantsMatchingPredicate:(NSPredicate *)predicate shouldReturnAfterFirstMatch:(BOOL)shouldReturnAfterFirstMatch;
  51. /**
  52. Returns an array of descendants with property matching given value
  53. @param property requested property name
  54. @param value requested value of the property
  55. @param partialSearch determines whether it should be exact or partial match
  56. @return an array of descendants with property matching given value
  57. */
  58. - (NSArray<XCUIElement *> *)fb_descendantsMatchingProperty:(NSString *)property value:(NSString *)value partialSearch:(BOOL)partialSearch;
  59. @end
  60. NS_ASSUME_NONNULL_END