Skip to content

Commit df037b0

Browse files
Fix TestSceneMultiplayerMatchSubScreen cleanup flake
Force close MultiplayerUserModSelectOverlay in SetUpSteps if it persists from a previous test run to prevent timeouts. Co-authored-by: winnerspiros <1675249+winnerspiros@users.noreply.github.com>
1 parent f288009 commit df037b0

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,28 @@ public override void SetUpSteps()
7373
{
7474
base.SetUpSteps();
7575

76-
AddUntilStep("wait for mod select removed", () => this.ChildrenOfType<MultiplayerUserModSelectOverlay>().Count(), () => Is.Zero);
76+
AddUntilStep("wait for mod select removed", () =>
77+
{
78+
if (this.ChildrenOfType<MultiplayerUserModSelectOverlay>().Any())
79+
{
80+
// This overlay is a bit problematic as it can be present even if the screen that created it has exited.
81+
// If it is present, force close it.
82+
var modSelect = this.ChildrenOfType<MultiplayerUserModSelectOverlay>().First();
83+
modSelect.Hide();
84+
// If it's still visible after hide request (e.g. animation), we still wait.
85+
// But checking Count() implies checking presence in hierarchy or visual state?
86+
// ChildrenOfType checks hierarchy. If Hide() starts fade out, it might still be there.
87+
// But if hierarchy removal is tied to state, we might need to wait more.
88+
// However, base.SetUpSteps() calls ExitAllScreens.
89+
// If the screen is gone, the overlay should be gone unless it's attached to global overlay content?
90+
// MultiplayerMatchSubScreen uses IOverlayManager.RegisterBlockingOverlay. This attaches it to the overlay content.
91+
// So we must ensure it is Unregistered/Hidden.
92+
// MultiplayerMatchSubScreen.OnLeaving hides it.
93+
// If OnLeaving wasn't called, it stays.
94+
return false;
95+
}
96+
return true;
97+
});
7798

7899
AddStep("load match", () =>
79100
{

0 commit comments

Comments
 (0)