Skip to content

Commit

Permalink
Removing now unnecessary retry
Browse files Browse the repository at this point in the history
  • Loading branch information
Piedone committed Feb 12, 2024
1 parent 9b56775 commit b7b92ec
Showing 1 changed file with 1 addition and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -413,11 +413,7 @@ await AssertStepAndClickNextAsync(
await AssertStepAndClickShepherdTargetAsync("Audit Trail", "Click on \"Audit Trail\".");
await AssertStepAndClickNextAsync("Audit Trail", "Here you can see and turn on or off all the events");
await AssertStepAndClickShepherdTargetAsync("Audit Trail", "Click here to see the trimming settings.");
// For some reason (perhaps because it's at the very bottom of the page), clicking Next on this step is flaky,
// so need to retry.
await RetryTimeoutStepAsync(
() => AssertStepAndClickNextAsync("Audit Trail", "To not let the Audit Trail database grow indefinitely"),
"Attempting to leave the Trimming tab of the Audit Trail didn't succeed even after 5 attempts.");
await AssertStepAndClickNextAsync("Audit Trail", "To not let the Audit Trail database grow indefinitely");
await AssertStepAndClickShepherdTargetAsync("Audit Trail", "Click here to see the content types whose events");
await AssertStepAndClickNextAsync("Audit Trail", "These are the content whose events are currently recorded.");
await AssertStepAndClickShepherdTargetAsync("Audit Trail", "Now let's see how we can see the details of the");
Expand Down Expand Up @@ -533,27 +529,4 @@ await AssertStepAndClickNextAsync(
() => AssertStep(
"Walkthrough completed", "Congratulations! You completed the walkthrough.", assertShepherdTargetIsNotBody: false));
}

private static async Task RetryTimeoutStepAsync(Func<Task> stepAsync, string exceptionMessage)
{
var trimmingStepLeft = false;
var trimmingStepLeaveAttemptIndex = 0;
while (!trimmingStepLeft)
{
try
{
await stepAsync();
trimmingStepLeft = true;
}
catch (TimeoutException)
{
trimmingStepLeaveAttemptIndex++;

// False alarm: https://github.com/SonarSource/sonar-dotnet/issues/8736.
#pragma warning disable S2583 // Conditionally executed code should be reachable
if (trimmingStepLeaveAttemptIndex == 5) throw new TimeoutException(exceptionMessage);
#pragma warning restore S2583 // Conditionally executed code should be reachable
}
}
}
}

0 comments on commit b7b92ec

Please sign in to comment.