Add reagent dispenser BUI test (#15443)

This commit is contained in:
Leon Friedrich
2023-04-17 04:34:36 +12:00
committed by GitHub
parent 6e0022d30f
commit a1f103d1e7
4 changed files with 181 additions and 20 deletions

View File

@@ -0,0 +1,35 @@
using System.Threading.Tasks;
using Content.IntegrationTests.Tests.Interaction;
using Content.Shared.Chemistry;
using Content.Shared.Containers.ItemSlots;
using NUnit.Framework;
namespace Content.IntegrationTests.Tests.Chemistry;
public sealed class DispenserTest : InteractionTest
{
/// <summary>
/// Basic test that checks that a beaker can be inserted and ejected from a dispenser.
/// </summary>
[Test]
public async Task InsertEjectBuiTest()
{
await SpawnTarget("chem_dispenser");
ToggleNeedPower();
// Insert beaker
await Interact("Beaker");
Assert.IsNull(Hands.ActiveHandEntity);
// Open BUI
await Interact("");
// Eject beaker via BUI.
var ev = new ItemSlotButtonPressedEvent(SharedChemMaster.InputSlotName);
await SendBui(ReagentDispenserUiKey.Key, ev);
// Beaker is back in the player's hands
Assert.IsNotNull(Hands.ActiveHandEntity);
AssertPrototype("Beaker", Hands.ActiveHandEntity);
}
}