PredicateBaseExtensionProtocol

public protocol PredicateBaseExtensionProtocol

Use generic protocols to better extend functionality in both engineering and testing projects

// for project
extension XCUIElement: PredicateBaseExtensionProtocol {
   public typealias T = XCUIElement
}

// for test
extension EasyPredicateTestItem: PredicateBaseExtensionProtocol {
   typealias T = EasyPredicateTestItem
}
  • T

    Declaration

    Swift

    associatedtype T
  • create a new preicate with EasyPredicates and LogicalType to judge is it satisfied on self

    Default Implementation

    Declaration

    Swift

    func waitUntil(predicates: [EasyPredicate], logic: NSCompoundPredicate.LogicalType, timeout: TimeInterval, handler: XCTNSPredicateExpectation.Handler?) -> (result: XCTWaiter.Result, element: T)

    Parameters

    predicates

    predicates rules

    logic

    rules relative

    timeout

    time limit

    handler

    expectation handler

    Return Value

    a tuple of waiting result and element

  • assertBreak(predicates:logic:) Default implementation

    assert by new preicate with EasyPredicates and LogicalType, if assert is passed then return self or return nil

    Default Implementation

    Declaration

    Swift

    func assertBreak(predicates: [EasyPredicate], logic: NSCompoundPredicate.LogicalType) -> T?

    Parameters

    predicates

    predicates rules

    logic

    rules relative

    Return Value

    self or nil