waitUntilError method

Future<TestInfoList<St>> waitUntilError({
  1. Object? error,
  2. Object? processedError,
  3. int? timeoutInSeconds,
})

If error is a Type, runs until after an action throws an error of this exact type. If error is NOT a Type, runs until after an action throws this error (using equals).

You can also, instead, define processedError, which is the error after wrapped by the action's wrapError() method. Note, if you define both error and processedError, both need to match.

Returns a list with all info until the error condition is met.

Implementation

Future<TestInfoList<St>> waitUntilError({
  Object? error,
  Object? processedError,
  int? timeoutInSeconds,
}) async {
  timeoutInSeconds ??= defaultTimeout;

  assert(error != null || processedError != null);

  var condition = (TestInfo<St> info) =>
      (error == null ||
          (error is Type && info.error.runtimeType == error) ||
          (error is! Type && info.error == error)) &&
      (processedError == null ||
          (processedError is Type && //
              info.processedError.runtimeType == processedError) ||
          (processedError is! Type && //
              info.processedError == processedError));

  var infoList = await waitCondition(
    condition,
    ignoreIni: true,
    timeoutInSeconds: timeoutInSeconds,
  );

  lastInfo = infoList.last;

  return infoList;
}