Add more UI helper methods for tests (#15463)

This commit is contained in:
Leon Friedrich
2023-04-17 11:46:28 +12:00
committed by GitHub
parent 9f6215a759
commit 33ed34b532
3 changed files with 178 additions and 17 deletions

View File

@@ -1,4 +1,5 @@
using System.Threading.Tasks;
using Content.Client.Chemistry.UI;
using Content.IntegrationTests.Tests.Interaction;
using Content.Shared.Chemistry;
using Content.Shared.Containers.ItemSlots;
@@ -22,7 +23,7 @@ public sealed class DispenserTest : InteractionTest
Assert.IsNull(Hands.ActiveHandEntity);
// Open BUI
await Interact("");
await Interact();
// Eject beaker via BUI.
var ev = new ItemSlotButtonPressedEvent(SharedChemMaster.InputSlotName);
@@ -31,5 +32,16 @@ public sealed class DispenserTest : InteractionTest
// Beaker is back in the player's hands
Assert.IsNotNull(Hands.ActiveHandEntity);
AssertPrototype("Beaker", Hands.ActiveHandEntity);
// Re-insert the beaker
await Interact();
Assert.IsNull(Hands.ActiveHandEntity);
// Re-eject using the button directly instead of sending a BUI event. This test is really just a test of the
// bui/window helper methods.
await ClickControl<ReagentDispenserWindow>(nameof(ReagentDispenserWindow.EjectButton));
await RunTicks(5);
Assert.IsNotNull(Hands.ActiveHandEntity);
AssertPrototype("Beaker", Hands.ActiveHandEntity);
}
}