Make tests faster (#8737)
* Test changes * Make finding the test tile a little smarter
This commit is contained in:
@@ -12,7 +12,7 @@ namespace Content.IntegrationTests.Tests.Gravity
|
||||
[TestFixture]
|
||||
[TestOf(typeof(WeightlessSystem))]
|
||||
[TestOf(typeof(GravityGeneratorComponent))]
|
||||
public sealed class WeightlessStatusTests : ContentIntegrationTest
|
||||
public sealed class WeightlessStatusTests
|
||||
{
|
||||
private const string Prototypes = @"
|
||||
- type: entity
|
||||
@@ -34,10 +34,8 @@ namespace Content.IntegrationTests.Tests.Gravity
|
||||
[Test]
|
||||
public async Task WeightlessStatusTest()
|
||||
{
|
||||
var options = new ServerContentIntegrationOption {ExtraPrototypes = Prototypes};
|
||||
var server = StartServer(options);
|
||||
|
||||
await server.WaitIdleAsync();
|
||||
await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true, ExtraPrototypes = Prototypes});
|
||||
var server = pairTracker.Pair.Server;
|
||||
|
||||
var mapManager = server.ResolveDependency<IMapManager>();
|
||||
var entityManager = server.ResolveDependency<IEntityManager>();
|
||||
@@ -47,45 +45,44 @@ namespace Content.IntegrationTests.Tests.Gravity
|
||||
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
var grid = GetMainGrid(mapManager);
|
||||
var coordinates = grid.ToCoordinates();
|
||||
var coordinates = PoolManager.GetMainEntityCoordinates(mapManager);
|
||||
human = entityManager.SpawnEntity("HumanDummy", coordinates);
|
||||
|
||||
Assert.True(entityManager.TryGetComponent(human, out AlertsComponent alerts));
|
||||
});
|
||||
|
||||
// Let WeightlessSystem and GravitySystem tick
|
||||
await server.WaitRunTicks(1);
|
||||
|
||||
await PoolManager.RunTicksSync(pairTracker.Pair, 10);
|
||||
var generatorUid = EntityUid.Invalid;
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
// No gravity without a gravity generator
|
||||
Assert.True(alertsSystem.IsShowingAlert(human, AlertType.Weightless));
|
||||
|
||||
entityManager.SpawnEntity("GravityGeneratorDummy", entityManager.GetComponent<TransformComponent>(human).Coordinates);
|
||||
generatorUid = entityManager.SpawnEntity("GravityGeneratorDummy", entityManager.GetComponent<TransformComponent>(human).Coordinates);
|
||||
});
|
||||
|
||||
// Let WeightlessSystem and GravitySystem tick
|
||||
await server.WaitRunTicks(1);
|
||||
await PoolManager.RunTicksSync(pairTracker.Pair, 10);
|
||||
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
Assert.False(alertsSystem.IsShowingAlert(human, AlertType.Weightless));
|
||||
|
||||
// TODO: Re-add gravity generator breaking when Vera is done with construction stuff.
|
||||
/*
|
||||
// Disable the gravity generator
|
||||
var args = new BreakageEventArgs {Owner = human};
|
||||
// gravityGenerator.OnBreak(args);
|
||||
*/
|
||||
// This should kill gravity
|
||||
entityManager.DeleteEntity(generatorUid);
|
||||
});
|
||||
|
||||
/*await server.WaitRunTicks(1);
|
||||
await PoolManager.RunTicksSync(pairTracker.Pair, 10);
|
||||
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
Assert.True(alerts.IsShowingAlert(AlertType.Weightless));
|
||||
});*/
|
||||
Assert.True(alertsSystem.IsShowingAlert(human, AlertType.Weightless));
|
||||
});
|
||||
|
||||
await PoolManager.RunTicksSync(pairTracker.Pair, 10);
|
||||
|
||||
await pairTracker.CleanReturnAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user