Fix flaky update beatmap set test

It is generally not possible to click a button that's not yet there,
and it turns out that when the test in question is ran headless, it may
not necessarily be there immediately.
This commit is contained in:
Bartłomiej Dach 2022-10-13 21:03:52 +02:00
parent 47d7d6fad9
commit df66a0c2e9
No known key found for this signature in database
1 changed files with 4 additions and 1 deletions

View File

@ -6,6 +6,7 @@
using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Graphics;
using osu.Framework.Testing;
using osu.Game.Beatmaps;
@ -150,6 +151,7 @@ public void TestDownloadFailed()
public void TestUpdateLocalBeatmap()
{
DialogOverlay dialogOverlay = null!;
UpdateBeatmapSetButton? updateButton = null;
AddStep("create carousel with dialog overlay", () =>
{
@ -176,7 +178,8 @@ public void TestUpdateLocalBeatmap()
carousel.UpdateBeatmapSet(testBeatmapSetInfo);
});
AddStep("click button", () => getUpdateButton()?.TriggerClick());
AddUntilStep("wait for update button", () => (updateButton = getUpdateButton()) != null);
AddStep("click button", () => updateButton.AsNonNull().TriggerClick());
AddAssert("dialog displayed", () => dialogOverlay.CurrentDialog is UpdateLocalConfirmationDialog);
AddStep("click confirmation", () =>