diff --git a/Lombiq.Tests.UI/Extensions/ReliabilityUITestContextExtensions.cs b/Lombiq.Tests.UI/Extensions/ReliabilityUITestContextExtensions.cs
index 682dac12f..8377568a3 100644
--- a/Lombiq.Tests.UI/Extensions/ReliabilityUITestContextExtensions.cs
+++ b/Lombiq.Tests.UI/Extensions/ReliabilityUITestContextExtensions.cs
@@ -74,13 +74,14 @@ public static Task DoWithRetriesOrFailAsync(
interval ?? context.Configuration.TimeoutConfiguration.RetryInterval);
///
- /// Executes the async process and retries if an element becomes stale ( ). If the operation didn't succeed then throws a .
///
/// In situations like a DataTable load it is possible that the page will change during execution of multiple long
- /// running operations such as GetAll, causing stale virtual DOM. Such change tends to be near instantaneous and
- /// only happens once at a time so this should pass by the 2nd try.
+ /// running operations such as ,
+ /// causing stale virtual DOM. Such change tends to be near instantaneous and only happens once at a time so this
+ /// should pass by the 2nd try.
///
///
/// The long running operation that may execute during DOM change and should be retried. Should return
- /// Executes the process and retries until no element is stale ( ).
+ /// Executes the process and retries until no element is stale (throws ).
///
/// If the operation didn't succeed then throws a .
///
diff --git a/Lombiq.Tests.UI/Helpers/ReliabilityHelper.cs b/Lombiq.Tests.UI/Helpers/ReliabilityHelper.cs
index bc4bc92a3..255d1f25d 100644
--- a/Lombiq.Tests.UI/Helpers/ReliabilityHelper.cs
+++ b/Lombiq.Tests.UI/Helpers/ReliabilityHelper.cs
@@ -7,29 +7,33 @@ namespace Lombiq.Tests.UI.Helpers;
public static class ReliabilityHelper
{
- private static readonly Func>, Func>> _retryIfStaleProcess = innerProcess => () =>
+ private static readonly Func>, Func>> _retryIfStaleProcess = innerProcess => async () =>
{
try
{
- return innerProcess();
+ // This needs to use await instead of returning the Task directly, because only this way can we catch the
+ // exception below.
+ return await innerProcess();
}
catch (StaleElementReferenceException)
{
// When navigating away this exception will be thrown for all old element references. Not nice to use
// exceptions but there doesn't seem to be a better way to do this.
- return Task.FromResult(false);
+ return false;
}
};
- private static readonly Func>, Func>> _retryIfNotStaleProcess = innerProcess => () =>
+ private static readonly Func>, Func>> _retryIfNotStaleProcess = innerProcess => async () =>
{
try
{
- return innerProcess();
+ // This needs to use await instead of returning the Task directly, because only this way can we catch the
+ // exception below.
+ return await innerProcess();
}
catch (StaleElementReferenceException)
{
- return Task.FromResult(true);
+ return true;
}
};