failureKind function

TestFailureKind failureKind(
  1. Object? error, {
  2. TestApplicationHandle? handle,
})

Implementation

TestFailureKind failureKind(
  Object? error, {
  TestApplicationHandle? handle,
}) {
  if (error is UnsupportedApplicationCapability) {
    return TestFailureKind.unsupportedCapability;
  }
  if (error is ApplicationTestCrash) return TestFailureKind.crash;
  if (handle == null) return TestFailureKind.bootstrap;
  if (error is TestExecutionError) {
    switch (error.code) {
      case TestExecutionErrorCode.elementNotFound:
        return TestFailureKind.elementNotFound;
      case TestExecutionErrorCode.ambiguousTarget:
        return TestFailureKind.ambiguousTarget;
      case TestExecutionErrorCode.unsupportedAction:
      case TestExecutionErrorCode.executionUnavailable:
        return TestFailureKind.unsupportedCapability;
      default:
        return TestFailureKind.assertion;
    }
  }
  return TestFailureKind.assertion;
}