Merge pull request #17169 from peppy/fix-song-select-test-failures-realm-callback

Refactor song select test methods to be resilient to slow realm callbacks
This commit is contained in:
Dan Balasescu 2022-03-09 11:14:26 +09:00 committed by GitHub
commit af4423959c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -284,14 +284,13 @@ namespace osu.Game.Tests.Visual.SongSelect
public void TestDummy()
{
createSongSelect();
AddAssert("dummy selected", () => songSelect.CurrentBeatmap == defaultBeatmap);
AddUntilStep("dummy selected", () => songSelect.CurrentBeatmap == defaultBeatmap);
AddUntilStep("dummy shown on wedge", () => songSelect.CurrentBeatmapDetailsBeatmap == defaultBeatmap);
addManyTestMaps();
AddWaitStep("wait for select", 3);
AddAssert("random map selected", () => songSelect.CurrentBeatmap != defaultBeatmap);
AddUntilStep("random map selected", () => songSelect.CurrentBeatmap != defaultBeatmap);
}
[Test]
@ -299,9 +298,8 @@ namespace osu.Game.Tests.Visual.SongSelect
{
createSongSelect();
addManyTestMaps();
AddWaitStep("wait for add", 3);
AddAssert("random map selected", () => songSelect.CurrentBeatmap != defaultBeatmap);
AddUntilStep("random map selected", () => songSelect.CurrentBeatmap != defaultBeatmap);
AddStep(@"Sort by Artist", () => config.SetValue(OsuSetting.SongSelectSortingMode, SortMode.Artist));
AddStep(@"Sort by Title", () => config.SetValue(OsuSetting.SongSelectSortingMode, SortMode.Title));
@ -571,6 +569,8 @@ namespace osu.Game.Tests.Visual.SongSelect
createSongSelect();
AddUntilStep("wait for selection", () => !Beatmap.IsDefault);
AddStep("press ctrl+enter", () =>
{
InputManager.PressKey(Key.ControlLeft);
@ -605,6 +605,8 @@ namespace osu.Game.Tests.Visual.SongSelect
addRulesetImportStep(0);
createSongSelect();
AddUntilStep("wait for selection", () => !Beatmap.IsDefault);
DrawableCarouselBeatmapSet set = null;
AddStep("Find the DrawableCarouselBeatmapSet", () =>
{
@ -844,6 +846,8 @@ namespace osu.Game.Tests.Visual.SongSelect
createSongSelect();
AddUntilStep("wait for selection", () => !Beatmap.IsDefault);
AddStep("present score", () =>
{
// this beatmap change should be overridden by the present.