1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-19 10:52:55 +08:00

Fix tests potentially failing due to timing issues

This commit is contained in:
Dean Herbert 2020-02-14 15:26:55 +09:00
parent 76cfe1f42c
commit aa7efe6141

View File

@ -61,8 +61,8 @@ namespace osu.Game.Tests.Visual.Online
{ {
AddStep("set status to online", () => ((DummyAPIAccess)API).State = APIState.Online); AddStep("set status to online", () => ((DummyAPIAccess)API).State = APIState.Online);
AddAssert("children are visible", () => onlineView.ViewTarget.IsPresent); AddUntilStep("children are visible", () => onlineView.ViewTarget.IsPresent);
AddAssert("loading animation is not visible", () => !onlineView.LoadingAnimation.IsPresent); AddUntilStep("loading animation is not visible", () => !onlineView.LoadingAnimation.IsPresent);
} }
[Test] [Test]
@ -70,8 +70,8 @@ namespace osu.Game.Tests.Visual.Online
{ {
AddStep("set status to offline", () => ((DummyAPIAccess)API).State = APIState.Offline); AddStep("set status to offline", () => ((DummyAPIAccess)API).State = APIState.Offline);
AddAssert("children are hidden", () => !onlineView.ViewTarget.IsPresent); AddUntilStep("children are not visible", () => !onlineView.ViewTarget.IsPresent);
AddAssert("loading animation is not visible", () => !onlineView.LoadingAnimation.IsPresent); AddUntilStep("loading animation is not visible", () => !onlineView.LoadingAnimation.IsPresent);
} }
[Test] [Test]
@ -79,8 +79,8 @@ namespace osu.Game.Tests.Visual.Online
{ {
AddStep("set status to connecting", () => ((DummyAPIAccess)API).State = APIState.Connecting); AddStep("set status to connecting", () => ((DummyAPIAccess)API).State = APIState.Connecting);
AddAssert("children are hidden", () => !onlineView.ViewTarget.IsPresent); AddUntilStep("children are not visible", () => !onlineView.ViewTarget.IsPresent);
AddAssert("loading animation is visible", () => onlineView.LoadingAnimation.IsPresent); AddUntilStep("loading animation is visible", () => onlineView.LoadingAnimation.IsPresent);
} }
[Test] [Test]
@ -88,8 +88,8 @@ namespace osu.Game.Tests.Visual.Online
{ {
AddStep("set status to failing", () => ((DummyAPIAccess)API).State = APIState.Failing); AddStep("set status to failing", () => ((DummyAPIAccess)API).State = APIState.Failing);
AddAssert("children are hidden", () => !onlineView.ViewTarget.IsPresent); AddUntilStep("children are not visible", () => !onlineView.ViewTarget.IsPresent);
AddAssert("loading animation is visible", () => onlineView.LoadingAnimation.IsPresent); AddUntilStep("loading animation is visible", () => onlineView.LoadingAnimation.IsPresent);
} }
} }
} }