Skip to content

Commit

Permalink
Add cancellation token.
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahelsaig committed Feb 28, 2025
1 parent c243f26 commit 3c1efcc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,20 @@ Task FillAsync(string suffix, string value, bool isDropdown = false)
return context.ClickAndFillInWithRetriesAsync(by, value);
}

return ReliabilityHelper.DoWithRetriesOrFailAsync(async () =>
{
try
{
await context.SetDropdownByValueAsync(by, value);
return true;
}
catch (WebDriverException)
return ReliabilityHelper.DoWithRetriesOrFailAsync(
async () =>
{
return false;
}
});
try
{
await context.SetDropdownByValueAsync(by, value);
return true;
}
catch (WebDriverException)
{
return false;
}
},
cancellationToken: context.Configuration.TestCancellationToken);
}

await FillAsync(nameof(address.Name), address.Name);
Expand Down
2 changes: 1 addition & 1 deletion test/OrchardCore.Commerce.Tests.UI/UITestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protected async Task ExecuteTestAfterSetupAsync(
var timeoutValue = timeout ?? TimeSpan.FromMinutes(10);

var testTask = ExecuteTestAsync(testAsync, browser, SetupHelpers.RunSetupAsync, changeConfigurationAsync);
var timeoutTask = Task.Delay(timeoutValue);
var timeoutTask = Task.Delay(timeoutValue, CancellationToken.None);

await Task.WhenAny(testTask, timeoutTask);

Expand Down

0 comments on commit 3c1efcc

Please sign in to comment.