1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 08:27:49 +08:00

Add test coverage of full account creation flow

This commit is contained in:
Bartłomiej Dach 2024-02-02 07:04:31 +01:00
parent a00cf87925
commit 091618db1a
No known key found for this signature in database

View File

@ -10,6 +10,7 @@ using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Testing;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Overlays;
@ -67,5 +68,34 @@ namespace osu.Game.Tests.Visual.Online
});
AddUntilStep("overlay is hidden", () => accountCreation.State.Value == Visibility.Hidden);
}
[Test]
public void TestFullFlow()
{
AddStep("log out", () => API.Logout());
AddStep("show manually", () => accountCreation.Show());
AddUntilStep("overlay is visible", () => accountCreation.State.Value == Visibility.Visible);
AddStep("click button", () => accountCreation.ChildrenOfType<SettingsButton>().Single().TriggerClick());
AddUntilStep("warning screen is present", () => accountCreation.ChildrenOfType<ScreenWarning>().SingleOrDefault()?.IsPresent == true);
AddStep("proceed", () => accountCreation.ChildrenOfType<DangerousSettingsButton>().Single().TriggerClick());
AddUntilStep("entry screen is present", () => accountCreation.ChildrenOfType<ScreenEntry>().SingleOrDefault()?.IsPresent == true);
AddStep("input details", () =>
{
var entryScreen = accountCreation.ChildrenOfType<ScreenEntry>().Single();
entryScreen.ChildrenOfType<OsuTextBox>().ElementAt(0).Text = "new_user";
entryScreen.ChildrenOfType<OsuTextBox>().ElementAt(1).Text = "new.user@fake.mail";
entryScreen.ChildrenOfType<OsuTextBox>().ElementAt(2).Text = "password";
});
AddStep("click button", () => accountCreation.ChildrenOfType<ScreenEntry>().Single()
.ChildrenOfType<SettingsButton>().Single().TriggerClick());
AddUntilStep("verification screen is present", () => accountCreation.ChildrenOfType<ScreenEmailVerification>().SingleOrDefault()?.IsPresent == true);
AddStep("verify", () => ((DummyAPIAccess)API).AuthenticateSecondFactor("abcdefgh"));
AddUntilStep("overlay is hidden", () => accountCreation.State.Value == Visibility.Hidden);
}
}
}